xref: /freebsd/sys/compat/linuxkpi/common/include/linux/pm.h (revision 0e981d79b19da8fc550ea0dbe46e8658be988db4)
14abbf816SBjoern A. Zeeb /*-
24abbf816SBjoern A. Zeeb  * SPDX-License-Identifier: BSD-2-Clause
34abbf816SBjoern A. Zeeb  *
44abbf816SBjoern A. Zeeb  * Copyright (c) 2020 The FreeBSD Foundation
54abbf816SBjoern A. Zeeb  *
64abbf816SBjoern A. Zeeb  * This software was developed by Björn Zeeb under sponsorship from
74abbf816SBjoern A. Zeeb  * the FreeBSD Foundation.
84abbf816SBjoern A. Zeeb  *
94abbf816SBjoern A. Zeeb  * Redistribution and use in source and binary forms, with or without
104abbf816SBjoern A. Zeeb  * modification, are permitted provided that the following conditions
114abbf816SBjoern A. Zeeb  * are met:
124abbf816SBjoern A. Zeeb  * 1. Redistributions of source code must retain the above copyright
134abbf816SBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer.
144abbf816SBjoern A. Zeeb  * 2. Redistributions in binary form must reproduce the above copyright
154abbf816SBjoern A. Zeeb  *    notice, this list of conditions and the following disclaimer in the
164abbf816SBjoern A. Zeeb  *    documentation and/or other materials provided with the distribution.
174abbf816SBjoern A. Zeeb  *
184abbf816SBjoern A. Zeeb  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
194abbf816SBjoern A. Zeeb  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
204abbf816SBjoern A. Zeeb  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
214abbf816SBjoern A. Zeeb  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
224abbf816SBjoern A. Zeeb  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
234abbf816SBjoern A. Zeeb  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
244abbf816SBjoern A. Zeeb  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
254abbf816SBjoern A. Zeeb  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
264abbf816SBjoern A. Zeeb  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
274abbf816SBjoern A. Zeeb  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
284abbf816SBjoern A. Zeeb  * SUCH DAMAGE.
294abbf816SBjoern A. Zeeb  *
304abbf816SBjoern A. Zeeb  * $FreeBSD$
314abbf816SBjoern A. Zeeb  */
324abbf816SBjoern A. Zeeb 
334abbf816SBjoern A. Zeeb #ifndef	_LINUXKPI_LINUX_PM_H
344abbf816SBjoern A. Zeeb #define	_LINUXKPI_LINUX_PM_H
354abbf816SBjoern A. Zeeb 
36*0e981d79SBjoern A. Zeeb typedef struct pm_message {
37*0e981d79SBjoern A. Zeeb 	int event;
38*0e981d79SBjoern A. Zeeb } pm_message_t;
39*0e981d79SBjoern A. Zeeb 
404abbf816SBjoern A. Zeeb #ifdef CONFIG_PM_SLEEP
414abbf816SBjoern A. Zeeb #define	SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc)	\
424abbf816SBjoern A. Zeeb const struct dev_pm_ops _name = {				\
434abbf816SBjoern A. Zeeb         .suspend	= _suspendfunc,				\
444abbf816SBjoern A. Zeeb         .resume		= _resumefunc,				\
454abbf816SBjoern A. Zeeb         .freeze		= _suspendfunc,				\
464abbf816SBjoern A. Zeeb         .thaw		= _resumefunc,				\
474abbf816SBjoern A. Zeeb         .poweroff	= _suspendfunc,				\
484abbf816SBjoern A. Zeeb         .restore	= _resumefunc,				\
494abbf816SBjoern A. Zeeb }
504abbf816SBjoern A. Zeeb #else
514abbf816SBjoern A. Zeeb #define	SIMPLE_DEV_PM_OPS(_name, _suspendfunc, _resumefunc)	\
524abbf816SBjoern A. Zeeb const struct dev_pm_ops _name = {				\
534abbf816SBjoern A. Zeeb }
544abbf816SBjoern A. Zeeb #endif
554abbf816SBjoern A. Zeeb 
564abbf816SBjoern A. Zeeb #endif	/* _LINUXKPI_LINUX_PM_H */
57