xref: /OK3568_Linux_fs/kernel/drivers/mfd/intel-lpss.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-only */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Intel LPSS core support.
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * Copyright (C) 2015, Intel Corporation
6*4882a593Smuzhiyun  *
7*4882a593Smuzhiyun  * Authors: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
8*4882a593Smuzhiyun  *          Mika Westerberg <mika.westerberg@linux.intel.com>
9*4882a593Smuzhiyun  */
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #ifndef __MFD_INTEL_LPSS_H
12*4882a593Smuzhiyun #define __MFD_INTEL_LPSS_H
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun #include <linux/pm.h>
15*4882a593Smuzhiyun 
16*4882a593Smuzhiyun struct device;
17*4882a593Smuzhiyun struct resource;
18*4882a593Smuzhiyun struct property_entry;
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun struct intel_lpss_platform_info {
21*4882a593Smuzhiyun 	struct resource *mem;
22*4882a593Smuzhiyun 	int irq;
23*4882a593Smuzhiyun 	unsigned long clk_rate;
24*4882a593Smuzhiyun 	const char *clk_con_id;
25*4882a593Smuzhiyun 	struct property_entry *properties;
26*4882a593Smuzhiyun };
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun int intel_lpss_probe(struct device *dev,
29*4882a593Smuzhiyun 		     const struct intel_lpss_platform_info *info);
30*4882a593Smuzhiyun void intel_lpss_remove(struct device *dev);
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun #ifdef CONFIG_PM
33*4882a593Smuzhiyun int intel_lpss_prepare(struct device *dev);
34*4882a593Smuzhiyun int intel_lpss_suspend(struct device *dev);
35*4882a593Smuzhiyun int intel_lpss_resume(struct device *dev);
36*4882a593Smuzhiyun 
37*4882a593Smuzhiyun #ifdef CONFIG_PM_SLEEP
38*4882a593Smuzhiyun #define INTEL_LPSS_SLEEP_PM_OPS			\
39*4882a593Smuzhiyun 	.prepare = intel_lpss_prepare,		\
40*4882a593Smuzhiyun 	SET_LATE_SYSTEM_SLEEP_PM_OPS(intel_lpss_suspend, intel_lpss_resume)
41*4882a593Smuzhiyun #else
42*4882a593Smuzhiyun #define INTEL_LPSS_SLEEP_PM_OPS
43*4882a593Smuzhiyun #endif
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun #define INTEL_LPSS_RUNTIME_PM_OPS		\
46*4882a593Smuzhiyun 	.runtime_suspend = intel_lpss_suspend,	\
47*4882a593Smuzhiyun 	.runtime_resume = intel_lpss_resume,
48*4882a593Smuzhiyun 
49*4882a593Smuzhiyun #else /* !CONFIG_PM */
50*4882a593Smuzhiyun #define INTEL_LPSS_SLEEP_PM_OPS
51*4882a593Smuzhiyun #define INTEL_LPSS_RUNTIME_PM_OPS
52*4882a593Smuzhiyun #endif /* CONFIG_PM */
53*4882a593Smuzhiyun 
54*4882a593Smuzhiyun #define INTEL_LPSS_PM_OPS(name)			\
55*4882a593Smuzhiyun const struct dev_pm_ops name = {		\
56*4882a593Smuzhiyun 	INTEL_LPSS_SLEEP_PM_OPS			\
57*4882a593Smuzhiyun 	INTEL_LPSS_RUNTIME_PM_OPS		\
58*4882a593Smuzhiyun }
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun #endif /* __MFD_INTEL_LPSS_H */
61