diff options
Diffstat (limited to 'include/linux/i2c/twl.h')
-rw-r--r-- | include/linux/i2c/twl.h | 83 |
1 files changed, 76 insertions, 7 deletions
diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h index ba4f88624fc..bb92f0b1328 100644 --- a/include/linux/i2c/twl.h +++ b/include/linux/i2c/twl.h | |||
@@ -82,6 +82,10 @@ | |||
82 | #define TWL_MODULE_RTC TWL4030_MODULE_RTC | 82 | #define TWL_MODULE_RTC TWL4030_MODULE_RTC |
83 | #define TWL_MODULE_PWM TWL4030_MODULE_PWM0 | 83 | #define TWL_MODULE_PWM TWL4030_MODULE_PWM0 |
84 | 84 | ||
85 | #define TWL6030_MODULE_CHARGER TWL4030_MODULE_MAIN_CHARGE | ||
86 | #define TWL6025_MODULE_CHARGER 0x18 | ||
87 | |||
88 | #define TWL6030_MODULE_GASGAUGE 0x0B | ||
85 | #define TWL6030_MODULE_ID0 0x0D | 89 | #define TWL6030_MODULE_ID0 0x0D |
86 | #define TWL6030_MODULE_ID1 0x0E | 90 | #define TWL6030_MODULE_ID1 0x0E |
87 | #define TWL6030_MODULE_ID2 0x0F | 91 | #define TWL6030_MODULE_ID2 0x0F |
@@ -108,6 +112,7 @@ | |||
108 | #define GASGAUGE_INTR_OFFSET 17 | 112 | #define GASGAUGE_INTR_OFFSET 17 |
109 | #define USBOTG_INTR_OFFSET 4 | 113 | #define USBOTG_INTR_OFFSET 4 |
110 | #define CHARGER_INTR_OFFSET 2 | 114 | #define CHARGER_INTR_OFFSET 2 |
115 | #define GPADCSW_INTR_OFFSET 1 | ||
111 | #define RSV_INTR_OFFSET 0 | 116 | #define RSV_INTR_OFFSET 0 |
112 | 117 | ||
113 | /* INT register offsets */ | 118 | /* INT register offsets */ |
@@ -172,6 +177,14 @@ TWL_CLASS_IS(4030, TWL4030_CLASS_ID) | |||
172 | TWL_CLASS_IS(6030, TWL6030_CLASS_ID) | 177 | TWL_CLASS_IS(6030, TWL6030_CLASS_ID) |
173 | 178 | ||
174 | #define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */ | 179 | #define TWL6025_SUBCLASS BIT(4) /* TWL6025 has changed registers */ |
180 | #define MPU80031_SUBCLASS BIT(5) /* MPU80031 has changed registers */ | ||
181 | |||
182 | /* So we can recover the features in other parts of twl stack */ | ||
183 | unsigned int twl_features(void); | ||
184 | |||
185 | /* so we can get at the EPROM SMPS OFFSET/MULT stuff */ | ||
186 | u8 twl_get_smps_offset(void); | ||
187 | u8 twl_get_smps_mult(void); | ||
175 | 188 | ||
176 | /* | 189 | /* |
177 | * Read and write single 8-bit registers | 190 | * Read and write single 8-bit registers |
@@ -179,6 +192,8 @@ TWL_CLASS_IS(6030, TWL6030_CLASS_ID) | |||
179 | int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg); | 192 | int twl_i2c_write_u8(u8 mod_no, u8 val, u8 reg); |
180 | int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); | 193 | int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); |
181 | 194 | ||
195 | void twl_reg_dump(int module, int start, int end); | ||
196 | |||
182 | /* | 197 | /* |
183 | * Read and write several 8-bit registers at once. | 198 | * Read and write several 8-bit registers at once. |
184 | * | 199 | * |
@@ -215,6 +230,10 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot) | |||
215 | return -EIO; | 230 | return -EIO; |
216 | } | 231 | } |
217 | #endif | 232 | #endif |
233 | |||
234 | int twl6030_set_usb_charge_enable(int enable); | ||
235 | int twl6030_set_usb_in_current(int currentmA); | ||
236 | |||
218 | /*----------------------------------------------------------------------*/ | 237 | /*----------------------------------------------------------------------*/ |
219 | 238 | ||
220 | /* | 239 | /* |
@@ -552,11 +571,27 @@ static inline int twl6030_mmc_card_detect(struct device *dev, int slot) | |||
552 | 571 | ||
553 | struct twl4030_clock_init_data { | 572 | struct twl4030_clock_init_data { |
554 | bool ck32k_lowpwr_enable; | 573 | bool ck32k_lowpwr_enable; |
574 | bool clk32_active_state_on; | ||
555 | }; | 575 | }; |
556 | 576 | ||
557 | struct twl4030_bci_platform_data { | 577 | struct twl4030_bci_platform_data { |
558 | int *battery_tmp_tbl; | 578 | int *battery_tmp_tbl; |
559 | unsigned int tblsize; | 579 | unsigned int battery_tmp_tblsize; |
580 | int *battery_volt_tbl; | ||
581 | unsigned int battery_volt_tblsize; | ||
582 | unsigned int monitoring_interval; | ||
583 | |||
584 | unsigned int max_charger_currentmA; | ||
585 | unsigned int max_charger_voltagemV; | ||
586 | unsigned int termination_currentmA; | ||
587 | |||
588 | unsigned int max_bat_voltagemV; | ||
589 | unsigned int low_bat_voltagemV; | ||
590 | |||
591 | /* twl6025 */ | ||
592 | unsigned int use_hw_charger; | ||
593 | unsigned int use_eeprom_config; | ||
594 | unsigned int power_path; | ||
560 | }; | 595 | }; |
561 | 596 | ||
562 | /* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */ | 597 | /* TWL4030_GPIO_MAX (18) GPIOs, with interrupts */ |
@@ -621,6 +656,7 @@ struct twl4030_usb_data { | |||
621 | int (*phy_set_clock)(struct device *dev, int on); | 656 | int (*phy_set_clock)(struct device *dev, int on); |
622 | /* suspend/resume of phy */ | 657 | /* suspend/resume of phy */ |
623 | int (*phy_suspend)(struct device *dev, int suspend); | 658 | int (*phy_suspend)(struct device *dev, int suspend); |
659 | int (*board_control_power)(struct device *dev, int on); | ||
624 | }; | 660 | }; |
625 | 661 | ||
626 | struct twl4030_ins { | 662 | struct twl4030_ins { |
@@ -657,32 +693,49 @@ struct twl4030_power_data { | |||
657 | extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); | 693 | extern void twl4030_power_init(struct twl4030_power_data *triton2_scripts); |
658 | extern int twl4030_remove_script(u8 flags); | 694 | extern int twl4030_remove_script(u8 flags); |
659 | 695 | ||
660 | struct twl4030_codec_audio_data { | 696 | struct twl4030_codec_data { |
661 | unsigned int digimic_delay; /* in ms */ | 697 | unsigned int digimic_delay; /* in ms */ |
662 | unsigned int ramp_delay_value; | 698 | unsigned int ramp_delay_value; |
663 | unsigned int offset_cncl_path; | 699 | unsigned int offset_cncl_path; |
664 | unsigned int check_defaults:1; | 700 | unsigned int check_defaults:1; |
665 | unsigned int reset_registers:1; | 701 | unsigned int reset_registers:1; |
666 | unsigned int hs_extmute:1; | 702 | unsigned int hs_extmute:1; |
703 | u16 hs_left_step; | ||
704 | u16 hs_right_step; | ||
705 | u16 hf_left_step; | ||
706 | u16 hf_right_step; | ||
667 | void (*set_hs_extmute)(int mute); | 707 | void (*set_hs_extmute)(int mute); |
668 | }; | 708 | }; |
669 | 709 | ||
670 | struct twl4030_codec_vibra_data { | 710 | struct twl4030_vibra_data { |
671 | unsigned int coexist; | 711 | unsigned int coexist; |
712 | |||
713 | /* twl6040 */ | ||
714 | unsigned int vibldrv_res; /* left driver resistance */ | ||
715 | unsigned int vibrdrv_res; /* right driver resistance */ | ||
716 | unsigned int viblmotor_res; /* left motor resistance */ | ||
717 | unsigned int vibrmotor_res; /* right motor resistance */ | ||
718 | int vddvibl_uV; /* VDDVIBL volt, set 0 for fixed reg */ | ||
719 | int vddvibr_uV; /* VDDVIBR volt, set 0 for fixed reg */ | ||
672 | }; | 720 | }; |
673 | 721 | ||
674 | struct twl4030_codec_data { | 722 | struct twl4030_audio_data { |
675 | unsigned int audio_mclk; | 723 | unsigned int audio_mclk; |
676 | struct twl4030_codec_audio_data *audio; | 724 | struct twl4030_codec_data *codec; |
677 | struct twl4030_codec_vibra_data *vibra; | 725 | struct twl4030_vibra_data *vibra; |
678 | 726 | ||
679 | /* twl6040 */ | 727 | /* twl6040 */ |
680 | int audpwron_gpio; /* audio power-on gpio */ | 728 | int audpwron_gpio; /* audio power-on gpio */ |
681 | int naudint_irq; /* audio interrupt */ | 729 | int naudint_irq; /* audio interrupt */ |
730 | unsigned int irq_base; | ||
682 | }; | 731 | }; |
683 | 732 | ||
684 | struct twl4030_platform_data { | 733 | struct twl4030_platform_data { |
685 | unsigned irq_base, irq_end; | 734 | unsigned irq_base, irq_end; |
735 | |||
736 | /* Callback for boar regulator initialisation */ | ||
737 | int (*init)(void); | ||
738 | |||
686 | struct twl4030_clock_init_data *clock; | 739 | struct twl4030_clock_init_data *clock; |
687 | struct twl4030_bci_platform_data *bci; | 740 | struct twl4030_bci_platform_data *bci; |
688 | struct twl4030_gpio_platform_data *gpio; | 741 | struct twl4030_gpio_platform_data *gpio; |
@@ -690,7 +743,7 @@ struct twl4030_platform_data { | |||
690 | struct twl4030_keypad_data *keypad; | 743 | struct twl4030_keypad_data *keypad; |
691 | struct twl4030_usb_data *usb; | 744 | struct twl4030_usb_data *usb; |
692 | struct twl4030_power_data *power; | 745 | struct twl4030_power_data *power; |
693 | struct twl4030_codec_data *codec; | 746 | struct twl4030_audio_data *audio; |
694 | 747 | ||
695 | /* Common LDO regulators for TWL4030/TWL6030 */ | 748 | /* Common LDO regulators for TWL4030/TWL6030 */ |
696 | struct regulator_init_data *vdac; | 749 | struct regulator_init_data *vdac; |
@@ -809,6 +862,22 @@ static inline int twl4030charger_usb_en(int enable) { return 0; } | |||
809 | #define TWL6030_REG_VDAC 45 | 862 | #define TWL6030_REG_VDAC 45 |
810 | #define TWL6030_REG_VUSB 46 | 863 | #define TWL6030_REG_VUSB 46 |
811 | 864 | ||
865 | /* These are renamed in 6025 but same registers */ | ||
866 | #define TWL6025_REG_LDO2 48 | ||
867 | #define TWL6025_REG_LDO4 49 | ||
868 | #define TWL6025_REG_LDO3 50 | ||
869 | #define TWL6025_REG_LDO5 51 | ||
870 | #define TWL6025_REG_LDO1 52 | ||
871 | #define TWL6025_REG_LDO7 53 | ||
872 | #define TWL6025_REG_LDO6 54 | ||
873 | #define TWL6025_REG_LDOLN 55 | ||
874 | #define TWL6025_REG_LDOUSB 56 | ||
875 | |||
876 | /* 6025 DCDC supplies */ | ||
877 | #define TWL6025_REG_SMPS3 57 | ||
878 | #define TWL6025_REG_SMPS4 58 | ||
879 | #define TWL6025_REG_VIO 59 | ||
880 | |||
812 | /* INTERNAL LDOs */ | 881 | /* INTERNAL LDOs */ |
813 | #define TWL6030_REG_VRTC 47 | 882 | #define TWL6030_REG_VRTC 47 |
814 | #define TWL6030_REG_CLK32KG 48 | 883 | #define TWL6030_REG_CLK32KG 48 |