1 #ifndef __LINUX_PMIC_DA903X_H
2 #define __LINUX_PMIC_DA903X_H
4 /* Unified sub device IDs for DA9030/DA9034/DA9035 */
34 DA9030_ID_LDO_INT
, /* LDO Internal */
35 DA9030_ID_BAT
, /* battery charger */
65 * DA9030/DA9034 LEDs sub-devices uses generic "struct led_info"
66 * as the platform_data
69 /* DA9030 flags for "struct led_info"
71 #define DA9030_LED_RATE_ON (0 << 5)
72 #define DA9030_LED_RATE_052S (1 << 5)
73 #define DA9030_LED_DUTY_1_16 (0 << 3)
74 #define DA9030_LED_DUTY_1_8 (1 << 3)
75 #define DA9030_LED_DUTY_1_4 (2 << 3)
76 #define DA9030_LED_DUTY_1_2 (3 << 3)
78 #define DA9030_VIBRA_MODE_1P3V (0 << 1)
79 #define DA9030_VIBRA_MODE_2P7V (1 << 1)
80 #define DA9030_VIBRA_FREQ_1HZ (0 << 2)
81 #define DA9030_VIBRA_FREQ_2HZ (1 << 2)
82 #define DA9030_VIBRA_FREQ_4HZ (2 << 2)
83 #define DA9030_VIBRA_FREQ_8HZ (3 << 2)
84 #define DA9030_VIBRA_DUTY_ON (0 << 4)
85 #define DA9030_VIBRA_DUTY_75P (1 << 4)
86 #define DA9030_VIBRA_DUTY_50P (2 << 4)
87 #define DA9030_VIBRA_DUTY_25P (3 << 4)
89 /* DA9034 flags for "struct led_info" */
90 #define DA9034_LED_RAMP (1 << 7)
92 /* DA9034 touch screen platform data */
93 struct da9034_touch_pdata
{
94 int interval_ms
; /* sampling interval while pen down */
99 struct da9034_backlight_pdata
{
100 int output_current
; /* output current of WLED, from 0-31 (in mA) */
103 /* DA9030 battery charger data */
104 struct power_supply_info
;
106 struct da9030_battery_info
{
107 /* battery parameters */
108 struct power_supply_info
*battery_info
;
110 /* current and voltage to use for battery charging */
111 unsigned int charge_milliamp
;
112 unsigned int charge_millivolt
;
114 /* voltage thresholds (in millivolts) */
117 int vbat_charge_start
;
118 int vbat_charge_stop
;
119 int vbat_charge_restart
;
121 /* battery nominal minimal and maximal voltages in millivolts */
125 /* Temperature thresholds. These are DA9030 register values
126 "as is" and should be measured for each battery type */
132 /* battery monitor interval (seconds) */
133 unsigned int batmon_interval
;
135 /* platform callbacks for battery low and critical events */
136 void (*battery_low
)(void);
137 void (*battery_critical
)(void);
140 struct da903x_subdev_info
{
146 struct da903x_platform_data
{
148 struct da903x_subdev_info
*subdevs
;
151 /* bit definitions for DA9030 events */
152 #define DA9030_EVENT_ONKEY (1 << 0)
153 #define DA9030_EVENT_PWREN (1 << 1)
154 #define DA9030_EVENT_EXTON (1 << 2)
155 #define DA9030_EVENT_CHDET (1 << 3)
156 #define DA9030_EVENT_TBAT (1 << 4)
157 #define DA9030_EVENT_VBATMON (1 << 5)
158 #define DA9030_EVENT_VBATMON_TXON (1 << 6)
159 #define DA9030_EVENT_CHIOVER (1 << 7)
160 #define DA9030_EVENT_TCTO (1 << 8)
161 #define DA9030_EVENT_CCTO (1 << 9)
162 #define DA9030_EVENT_ADC_READY (1 << 10)
163 #define DA9030_EVENT_VBUS_4P4 (1 << 11)
164 #define DA9030_EVENT_VBUS_4P0 (1 << 12)
165 #define DA9030_EVENT_SESS_VALID (1 << 13)
166 #define DA9030_EVENT_SRP_DETECT (1 << 14)
167 #define DA9030_EVENT_WATCHDOG (1 << 15)
168 #define DA9030_EVENT_LDO15 (1 << 16)
169 #define DA9030_EVENT_LDO16 (1 << 17)
170 #define DA9030_EVENT_LDO17 (1 << 18)
171 #define DA9030_EVENT_LDO18 (1 << 19)
172 #define DA9030_EVENT_LDO19 (1 << 20)
173 #define DA9030_EVENT_BUCK2 (1 << 21)
175 /* bit definitions for DA9034 events */
176 #define DA9034_EVENT_ONKEY (1 << 0)
177 #define DA9034_EVENT_EXTON (1 << 2)
178 #define DA9034_EVENT_CHDET (1 << 3)
179 #define DA9034_EVENT_TBAT (1 << 4)
180 #define DA9034_EVENT_VBATMON (1 << 5)
181 #define DA9034_EVENT_REV_IOVER (1 << 6)
182 #define DA9034_EVENT_CH_IOVER (1 << 7)
183 #define DA9034_EVENT_CH_TCTO (1 << 8)
184 #define DA9034_EVENT_CH_CCTO (1 << 9)
185 #define DA9034_EVENT_USB_DEV (1 << 10)
186 #define DA9034_EVENT_OTGCP_IOVER (1 << 11)
187 #define DA9034_EVENT_VBUS_4P55 (1 << 12)
188 #define DA9034_EVENT_VBUS_3P8 (1 << 13)
189 #define DA9034_EVENT_SESS_1P8 (1 << 14)
190 #define DA9034_EVENT_SRP_READY (1 << 15)
191 #define DA9034_EVENT_ADC_MAN (1 << 16)
192 #define DA9034_EVENT_ADC_AUTO4 (1 << 17)
193 #define DA9034_EVENT_ADC_AUTO5 (1 << 18)
194 #define DA9034_EVENT_ADC_AUTO6 (1 << 19)
195 #define DA9034_EVENT_PEN_DOWN (1 << 20)
196 #define DA9034_EVENT_TSI_READY (1 << 21)
197 #define DA9034_EVENT_UART_TX (1 << 22)
198 #define DA9034_EVENT_UART_RX (1 << 23)
199 #define DA9034_EVENT_HEADSET (1 << 25)
200 #define DA9034_EVENT_HOOKSWITCH (1 << 26)
201 #define DA9034_EVENT_WATCHDOG (1 << 27)
203 extern int da903x_register_notifier(struct device
*dev
,
204 struct notifier_block
*nb
, unsigned int events
);
205 extern int da903x_unregister_notifier(struct device
*dev
,
206 struct notifier_block
*nb
, unsigned int events
);
208 /* Status Query Interface */
209 #define DA9030_STATUS_ONKEY (1 << 0)
210 #define DA9030_STATUS_PWREN1 (1 << 1)
211 #define DA9030_STATUS_EXTON (1 << 2)
212 #define DA9030_STATUS_CHDET (1 << 3)
213 #define DA9030_STATUS_TBAT (1 << 4)
214 #define DA9030_STATUS_VBATMON (1 << 5)
215 #define DA9030_STATUS_VBATMON_TXON (1 << 6)
216 #define DA9030_STATUS_MCLKDET (1 << 7)
218 #define DA9034_STATUS_ONKEY (1 << 0)
219 #define DA9034_STATUS_EXTON (1 << 2)
220 #define DA9034_STATUS_CHDET (1 << 3)
221 #define DA9034_STATUS_TBAT (1 << 4)
222 #define DA9034_STATUS_VBATMON (1 << 5)
223 #define DA9034_STATUS_PEN_DOWN (1 << 6)
224 #define DA9034_STATUS_MCLKDET (1 << 7)
225 #define DA9034_STATUS_USB_DEV (1 << 8)
226 #define DA9034_STATUS_HEADSET (1 << 9)
227 #define DA9034_STATUS_HOOKSWITCH (1 << 10)
228 #define DA9034_STATUS_REMCON (1 << 11)
229 #define DA9034_STATUS_VBUS_VALID_4P55 (1 << 12)
230 #define DA9034_STATUS_VBUS_VALID_3P8 (1 << 13)
231 #define DA9034_STATUS_SESS_VALID_1P8 (1 << 14)
232 #define DA9034_STATUS_SRP_READY (1 << 15)
234 extern int da903x_query_status(struct device
*dev
, unsigned int status
);
237 /* NOTE: the functions below are not intended for use outside
238 * of the DA903x sub-device drivers
240 extern int da903x_write(struct device
*dev
, int reg
, uint8_t val
);
241 extern int da903x_writes(struct device
*dev
, int reg
, int len
, uint8_t *val
);
242 extern int da903x_read(struct device
*dev
, int reg
, uint8_t *val
);
243 extern int da903x_reads(struct device
*dev
, int reg
, int len
, uint8_t *val
);
244 extern int da903x_update(struct device
*dev
, int reg
, uint8_t val
, uint8_t mask
);
245 extern int da903x_set_bits(struct device
*dev
, int reg
, uint8_t bit_mask
);
246 extern int da903x_clr_bits(struct device
*dev
, int reg
, uint8_t bit_mask
);
247 #endif /* __LINUX_PMIC_DA903X_H */
This page took 0.037867 seconds and 6 git commands to generate.