20 #ifndef __POWER_SMARTREFLEX_H
21 #define __POWER_SMARTREFLEX_H
23 #include <linux/types.h>
43 #define AVGWEIGHT 0x18
44 #define NVALUERECIPROCAL 0x1c
45 #define SENERROR_V1 0x20
46 #define ERRCONFIG_V1 0x24
48 #define IRQSTATUS_RAW 0x24
49 #define IRQSTATUS 0x28
50 #define IRQENABLE_SET 0x2C
51 #define IRQENABLE_CLR 0x30
52 #define SENERROR_V2 0x34
53 #define ERRCONFIG_V2 0x38
58 #define SRCONFIG_ACCUMDATA_SHIFT 22
59 #define SRCONFIG_SRCLKLENGTH_SHIFT 12
60 #define SRCONFIG_SENNENABLE_V1_SHIFT 5
61 #define SRCONFIG_SENPENABLE_V1_SHIFT 3
62 #define SRCONFIG_SENNENABLE_V2_SHIFT 1
63 #define SRCONFIG_SENPENABLE_V2_SHIFT 0
64 #define SRCONFIG_CLKCTRL_SHIFT 0
66 #define SRCONFIG_ACCUMDATA_MASK (0x3ff << 22)
68 #define SRCONFIG_SRENABLE BIT(11)
69 #define SRCONFIG_SENENABLE BIT(10)
70 #define SRCONFIG_ERRGEN_EN BIT(9)
71 #define SRCONFIG_MINMAXAVG_EN BIT(8)
72 #define SRCONFIG_DELAYCTRL BIT(2)
75 #define AVGWEIGHT_SENPAVGWEIGHT_SHIFT 2
76 #define AVGWEIGHT_SENNAVGWEIGHT_SHIFT 0
79 #define NVALUERECIPROCAL_SENPGAIN_SHIFT 20
80 #define NVALUERECIPROCAL_SENNGAIN_SHIFT 16
81 #define NVALUERECIPROCAL_RNSENP_SHIFT 8
82 #define NVALUERECIPROCAL_RNSENN_SHIFT 0
85 #define ERRCONFIG_ERRWEIGHT_SHIFT 16
86 #define ERRCONFIG_ERRMAXLIMIT_SHIFT 8
87 #define ERRCONFIG_ERRMINLIMIT_SHIFT 0
89 #define SR_ERRWEIGHT_MASK (0x07 << 16)
90 #define SR_ERRMAXLIMIT_MASK (0xff << 8)
91 #define SR_ERRMINLIMIT_MASK (0xff << 0)
93 #define ERRCONFIG_VPBOUNDINTEN_V1 BIT(31)
94 #define ERRCONFIG_VPBOUNDINTST_V1 BIT(30)
95 #define ERRCONFIG_MCUACCUMINTEN BIT(29)
96 #define ERRCONFIG_MCUACCUMINTST BIT(28)
97 #define ERRCONFIG_MCUVALIDINTEN BIT(27)
98 #define ERRCONFIG_MCUVALIDINTST BIT(26)
99 #define ERRCONFIG_MCUBOUNDINTEN BIT(25)
100 #define ERRCONFIG_MCUBOUNDINTST BIT(24)
101 #define ERRCONFIG_MCUDISACKINTEN BIT(23)
102 #define ERRCONFIG_VPBOUNDINTST_V2 BIT(23)
103 #define ERRCONFIG_MCUDISACKINTST BIT(22)
104 #define ERRCONFIG_VPBOUNDINTEN_V2 BIT(22)
106 #define ERRCONFIG_STATUS_V1_MASK (ERRCONFIG_VPBOUNDINTST_V1 | \
107 ERRCONFIG_MCUACCUMINTST | \
108 ERRCONFIG_MCUVALIDINTST | \
109 ERRCONFIG_MCUBOUNDINTST | \
110 ERRCONFIG_MCUDISACKINTST)
112 #define IRQSTATUS_MCUACCUMINT BIT(3)
113 #define IRQSTATUS_MCVALIDINT BIT(2)
114 #define IRQSTATUS_MCBOUNDSINT BIT(1)
115 #define IRQSTATUS_MCUDISABLEACKINT BIT(0)
118 #define IRQENABLE_MCUACCUMINT BIT(3)
119 #define IRQENABLE_MCUVALIDINT BIT(2)
120 #define IRQENABLE_MCUBOUNDSINT BIT(1)
121 #define IRQENABLE_MCUDISABLEACKINT BIT(0)
125 #define SRCLKLENGTH_12MHZ_SYSCLK 0x3c
126 #define SRCLKLENGTH_13MHZ_SYSCLK 0x41
127 #define SRCLKLENGTH_19MHZ_SYSCLK 0x60
128 #define SRCLKLENGTH_26MHZ_SYSCLK 0x82
129 #define SRCLKLENGTH_38MHZ_SYSCLK 0xC0
135 #define OMAP3430_SR_ACCUMDATA 0x1f4
137 #define OMAP3430_SR1_SENPAVGWEIGHT 0x03
138 #define OMAP3430_SR1_SENNAVGWEIGHT 0x03
140 #define OMAP3430_SR2_SENPAVGWEIGHT 0x01
141 #define OMAP3430_SR2_SENNAVGWEIGHT 0x01
143 #define OMAP3430_SR_ERRWEIGHT 0x04
144 #define OMAP3430_SR_ERRMAXLIMIT 0x02
182 #define sr_test_cond_timeout(cond, timeout, index) \
184 for (index = 0; index < timeout; index++) { \
197 struct omap_sr_pmic_data {
206 struct omap_smartreflex_dev_attr {
207 const char *sensor_voltdm_name;
210 #ifdef CONFIG_POWER_AVS_OMAP
217 #define SR_CLASS1 0x1
218 #define SR_CLASS2 0x2
219 #define SR_CLASS3 0x3
234 struct omap_sr_class_data {
251 struct omap_sr_nvalue_table {
255 unsigned long volt_nominal;
272 struct omap_sr_data {
279 struct omap_sr_nvalue_table *nvalue_table;
306 struct omap_sr_pmic_data *pmic_data) {}