2 * Copyright (c) 2015, The Linux Foundation. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 and
6 * only version 2 as published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
14 #ifndef __QCOM_GDSC_H__
15 #define __QCOM_GDSC_H__
17 #include <linux/err.h>
18 #include <linux/pm_domain.h>
21 struct reset_controller_dev
;
23 /* Powerdomain allowable state bitfields */
24 #define PWRSTS_OFF BIT(0)
25 #define PWRSTS_RET BIT(1)
26 #define PWRSTS_ON BIT(2)
27 #define PWRSTS_OFF_ON (PWRSTS_OFF | PWRSTS_ON)
28 #define PWRSTS_RET_ON (PWRSTS_RET | PWRSTS_ON)
31 * struct gdsc - Globally Distributed Switch Controller
32 * @pd: generic power domain
33 * @regmap: regmap for MMIO accesses
34 * @gdscr: gsdc control register
35 * @cxcs: offsets of branch registers to toggle mem/periph bits in
36 * @cxc_count: number of @cxcs
37 * @pwrsts: Possible powerdomain power states
38 * @resets: ids of resets associated with this gdsc
39 * @reset_count: number of @resets
40 * @rcdev: reset controller
43 struct generic_pm_domain pd
;
44 struct regmap
*regmap
;
47 unsigned int cxc_count
;
49 struct reset_controller_dev
*rcdev
;
51 unsigned int reset_count
;
54 #ifdef CONFIG_QCOM_GDSC
55 int gdsc_register(struct device
*, struct gdsc
**, size_t n
,
56 struct reset_controller_dev
*, struct regmap
*);
57 void gdsc_unregister(struct device
*);
59 static inline int gdsc_register(struct device
*d
, struct gdsc
**g
, size_t n
,
60 struct reset_controller_dev
*rcdev
,
66 static inline void gdsc_unregister(struct device
*d
) {};
67 #endif /* CONFIG_QCOM_GDSC */
68 #endif /* __QCOM_GDSC_H__ */