diff options
Diffstat (limited to 'include/linux/mfd/palmas.h')
-rw-r--r-- | include/linux/mfd/palmas.h | 102 |
1 files changed, 82 insertions, 20 deletions
diff --git a/include/linux/mfd/palmas.h b/include/linux/mfd/palmas.h index 1a8dd7afe084..9974e387e483 100644 --- a/include/linux/mfd/palmas.h +++ b/include/linux/mfd/palmas.h | |||
@@ -160,7 +160,8 @@ enum palmas_regulators { | |||
160 | PALMAS_REG_SMPS7, | 160 | PALMAS_REG_SMPS7, |
161 | PALMAS_REG_SMPS8, | 161 | PALMAS_REG_SMPS8, |
162 | PALMAS_REG_SMPS9, | 162 | PALMAS_REG_SMPS9, |
163 | PALMAS_REG_SMPS10, | 163 | PALMAS_REG_SMPS10_OUT2, |
164 | PALMAS_REG_SMPS10_OUT1, | ||
164 | /* LDO regulators */ | 165 | /* LDO regulators */ |
165 | PALMAS_REG_LDO1, | 166 | PALMAS_REG_LDO1, |
166 | PALMAS_REG_LDO2, | 167 | PALMAS_REG_LDO2, |
@@ -183,6 +184,50 @@ enum palmas_regulators { | |||
183 | PALMAS_NUM_REGS, | 184 | PALMAS_NUM_REGS, |
184 | }; | 185 | }; |
185 | 186 | ||
187 | /* External controll signal name */ | ||
188 | enum { | ||
189 | PALMAS_EXT_CONTROL_ENABLE1 = 0x1, | ||
190 | PALMAS_EXT_CONTROL_ENABLE2 = 0x2, | ||
191 | PALMAS_EXT_CONTROL_NSLEEP = 0x4, | ||
192 | }; | ||
193 | |||
194 | /* | ||
195 | * Palmas device resources can be controlled externally for | ||
196 | * enabling/disabling it rather than register write through i2c. | ||
197 | * Add the external controlled requestor ID for different resources. | ||
198 | */ | ||
199 | enum palmas_external_requestor_id { | ||
200 | PALMAS_EXTERNAL_REQSTR_ID_REGEN1, | ||
201 | PALMAS_EXTERNAL_REQSTR_ID_REGEN2, | ||
202 | PALMAS_EXTERNAL_REQSTR_ID_SYSEN1, | ||
203 | PALMAS_EXTERNAL_REQSTR_ID_SYSEN2, | ||
204 | PALMAS_EXTERNAL_REQSTR_ID_CLK32KG, | ||
205 | PALMAS_EXTERNAL_REQSTR_ID_CLK32KGAUDIO, | ||
206 | PALMAS_EXTERNAL_REQSTR_ID_REGEN3, | ||
207 | PALMAS_EXTERNAL_REQSTR_ID_SMPS12, | ||
208 | PALMAS_EXTERNAL_REQSTR_ID_SMPS3, | ||
209 | PALMAS_EXTERNAL_REQSTR_ID_SMPS45, | ||
210 | PALMAS_EXTERNAL_REQSTR_ID_SMPS6, | ||
211 | PALMAS_EXTERNAL_REQSTR_ID_SMPS7, | ||
212 | PALMAS_EXTERNAL_REQSTR_ID_SMPS8, | ||
213 | PALMAS_EXTERNAL_REQSTR_ID_SMPS9, | ||
214 | PALMAS_EXTERNAL_REQSTR_ID_SMPS10, | ||
215 | PALMAS_EXTERNAL_REQSTR_ID_LDO1, | ||
216 | PALMAS_EXTERNAL_REQSTR_ID_LDO2, | ||
217 | PALMAS_EXTERNAL_REQSTR_ID_LDO3, | ||
218 | PALMAS_EXTERNAL_REQSTR_ID_LDO4, | ||
219 | PALMAS_EXTERNAL_REQSTR_ID_LDO5, | ||
220 | PALMAS_EXTERNAL_REQSTR_ID_LDO6, | ||
221 | PALMAS_EXTERNAL_REQSTR_ID_LDO7, | ||
222 | PALMAS_EXTERNAL_REQSTR_ID_LDO8, | ||
223 | PALMAS_EXTERNAL_REQSTR_ID_LDO9, | ||
224 | PALMAS_EXTERNAL_REQSTR_ID_LDOLN, | ||
225 | PALMAS_EXTERNAL_REQSTR_ID_LDOUSB, | ||
226 | |||
227 | /* Last entry */ | ||
228 | PALMAS_EXTERNAL_REQSTR_ID_MAX, | ||
229 | }; | ||
230 | |||
186 | struct palmas_pmic_platform_data { | 231 | struct palmas_pmic_platform_data { |
187 | /* An array of pointers to regulator init data indexed by regulator | 232 | /* An array of pointers to regulator init data indexed by regulator |
188 | * ID | 233 | * ID |
@@ -258,6 +303,7 @@ struct palmas_platform_data { | |||
258 | */ | 303 | */ |
259 | int mux_from_pdata; | 304 | int mux_from_pdata; |
260 | u8 pad1, pad2; | 305 | u8 pad1, pad2; |
306 | bool pm_off; | ||
261 | 307 | ||
262 | struct palmas_pmic_platform_data *pmic_pdata; | 308 | struct palmas_pmic_platform_data *pmic_pdata; |
263 | struct palmas_gpadc_platform_data *gpadc_pdata; | 309 | struct palmas_gpadc_platform_data *gpadc_pdata; |
@@ -355,9 +401,9 @@ struct palmas_pmic { | |||
355 | int smps123; | 401 | int smps123; |
356 | int smps457; | 402 | int smps457; |
357 | 403 | ||
358 | int range[PALMAS_REG_SMPS10]; | 404 | int range[PALMAS_REG_SMPS10_OUT1]; |
359 | unsigned int ramp_delay[PALMAS_REG_SMPS10]; | 405 | unsigned int ramp_delay[PALMAS_REG_SMPS10_OUT1]; |
360 | unsigned int current_reg_mode[PALMAS_REG_SMPS10]; | 406 | unsigned int current_reg_mode[PALMAS_REG_SMPS10_OUT1]; |
361 | }; | 407 | }; |
362 | 408 | ||
363 | struct palmas_resource { | 409 | struct palmas_resource { |
@@ -371,17 +417,15 @@ struct palmas_usb { | |||
371 | 417 | ||
372 | struct extcon_dev edev; | 418 | struct extcon_dev edev; |
373 | 419 | ||
374 | /* used to set vbus, in atomic path */ | ||
375 | struct work_struct set_vbus_work; | ||
376 | |||
377 | int id_otg_irq; | 420 | int id_otg_irq; |
378 | int id_irq; | 421 | int id_irq; |
379 | int vbus_otg_irq; | 422 | int vbus_otg_irq; |
380 | int vbus_irq; | 423 | int vbus_irq; |
381 | 424 | ||
382 | int vbus_enable; | ||
383 | |||
384 | enum palmas_usb_state linkstat; | 425 | enum palmas_usb_state linkstat; |
426 | int wakeup; | ||
427 | bool enable_vbus_detection; | ||
428 | bool enable_id_detection; | ||
385 | }; | 429 | }; |
386 | 430 | ||
387 | #define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator) | 431 | #define comparator_to_palmas(x) container_of((x), struct palmas_usb, comparator) |
@@ -449,7 +493,7 @@ enum usb_irq_events { | |||
449 | #define PALMAS_DVFS_BASE 0x180 | 493 | #define PALMAS_DVFS_BASE 0x180 |
450 | #define PALMAS_PMU_CONTROL_BASE 0x1A0 | 494 | #define PALMAS_PMU_CONTROL_BASE 0x1A0 |
451 | #define PALMAS_RESOURCE_BASE 0x1D4 | 495 | #define PALMAS_RESOURCE_BASE 0x1D4 |
452 | #define PALMAS_PU_PD_OD_BASE 0x1F4 | 496 | #define PALMAS_PU_PD_OD_BASE 0x1F0 |
453 | #define PALMAS_LED_BASE 0x200 | 497 | #define PALMAS_LED_BASE 0x200 |
454 | #define PALMAS_INTERRUPT_BASE 0x210 | 498 | #define PALMAS_INTERRUPT_BASE 0x210 |
455 | #define PALMAS_USB_OTG_BASE 0x250 | 499 | #define PALMAS_USB_OTG_BASE 0x250 |
@@ -1734,16 +1778,20 @@ enum usb_irq_events { | |||
1734 | #define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0 | 1778 | #define PALMAS_REGEN3_CTRL_MODE_ACTIVE_SHIFT 0 |
1735 | 1779 | ||
1736 | /* Registers for function PAD_CONTROL */ | 1780 | /* Registers for function PAD_CONTROL */ |
1737 | #define PALMAS_PU_PD_INPUT_CTRL1 0x0 | 1781 | #define PALMAS_OD_OUTPUT_CTRL2 0x2 |
1738 | #define PALMAS_PU_PD_INPUT_CTRL2 0x1 | 1782 | #define PALMAS_POLARITY_CTRL2 0x3 |
1739 | #define PALMAS_PU_PD_INPUT_CTRL3 0x2 | 1783 | #define PALMAS_PU_PD_INPUT_CTRL1 0x4 |
1740 | #define PALMAS_OD_OUTPUT_CTRL 0x4 | 1784 | #define PALMAS_PU_PD_INPUT_CTRL2 0x5 |
1741 | #define PALMAS_POLARITY_CTRL 0x5 | 1785 | #define PALMAS_PU_PD_INPUT_CTRL3 0x6 |
1742 | #define PALMAS_PRIMARY_SECONDARY_PAD1 0x6 | 1786 | #define PALMAS_PU_PD_INPUT_CTRL5 0x7 |
1743 | #define PALMAS_PRIMARY_SECONDARY_PAD2 0x7 | 1787 | #define PALMAS_OD_OUTPUT_CTRL 0x8 |
1744 | #define PALMAS_I2C_SPI 0x8 | 1788 | #define PALMAS_POLARITY_CTRL 0x9 |
1745 | #define PALMAS_PU_PD_INPUT_CTRL4 0x9 | 1789 | #define PALMAS_PRIMARY_SECONDARY_PAD1 0xA |
1746 | #define PALMAS_PRIMARY_SECONDARY_PAD3 0xA | 1790 | #define PALMAS_PRIMARY_SECONDARY_PAD2 0xB |
1791 | #define PALMAS_I2C_SPI 0xC | ||
1792 | #define PALMAS_PU_PD_INPUT_CTRL4 0xD | ||
1793 | #define PALMAS_PRIMARY_SECONDARY_PAD3 0xE | ||
1794 | #define PALMAS_PRIMARY_SECONDARY_PAD4 0xF | ||
1747 | 1795 | ||
1748 | /* Bit definitions for PU_PD_INPUT_CTRL1 */ | 1796 | /* Bit definitions for PU_PD_INPUT_CTRL1 */ |
1749 | #define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40 | 1797 | #define PALMAS_PU_PD_INPUT_CTRL1_RESET_IN_PD 0x40 |
@@ -2501,6 +2549,15 @@ enum usb_irq_events { | |||
2501 | #define PALMAS_PU_PD_GPIO_CTRL1 0x6 | 2549 | #define PALMAS_PU_PD_GPIO_CTRL1 0x6 |
2502 | #define PALMAS_PU_PD_GPIO_CTRL2 0x7 | 2550 | #define PALMAS_PU_PD_GPIO_CTRL2 0x7 |
2503 | #define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8 | 2551 | #define PALMAS_OD_OUTPUT_GPIO_CTRL 0x8 |
2552 | #define PALMAS_GPIO_DATA_IN2 0x9 | ||
2553 | #define PALMAS_GPIO_DATA_DIR2 0x0A | ||
2554 | #define PALMAS_GPIO_DATA_OUT2 0x0B | ||
2555 | #define PALMAS_GPIO_DEBOUNCE_EN2 0x0C | ||
2556 | #define PALMAS_GPIO_CLEAR_DATA_OUT2 0x0D | ||
2557 | #define PALMAS_GPIO_SET_DATA_OUT2 0x0E | ||
2558 | #define PALMAS_PU_PD_GPIO_CTRL3 0x0F | ||
2559 | #define PALMAS_PU_PD_GPIO_CTRL4 0x10 | ||
2560 | #define PALMAS_OD_OUTPUT_GPIO_CTRL2 0x11 | ||
2504 | 2561 | ||
2505 | /* Bit definitions for GPIO_DATA_IN */ | 2562 | /* Bit definitions for GPIO_DATA_IN */ |
2506 | #define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80 | 2563 | #define PALMAS_GPIO_DATA_IN_GPIO_7_IN 0x80 |
@@ -2866,4 +2923,9 @@ static inline int palmas_irq_get_virq(struct palmas *palmas, int irq) | |||
2866 | return regmap_irq_get_virq(palmas->irq_data, irq); | 2923 | return regmap_irq_get_virq(palmas->irq_data, irq); |
2867 | } | 2924 | } |
2868 | 2925 | ||
2926 | |||
2927 | int palmas_ext_control_req_config(struct palmas *palmas, | ||
2928 | enum palmas_external_requestor_id ext_control_req_id, | ||
2929 | int ext_ctrl, bool enable); | ||
2930 | |||
2869 | #endif /* __LINUX_MFD_PALMAS_H */ | 2931 | #endif /* __LINUX_MFD_PALMAS_H */ |