diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-05 22:04:09 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-05 22:04:09 -0500 |
| commit | 8e128ce3318a147903c893de1891f6c2306f8a61 (patch) | |
| tree | 3b45e780570e9beb9ec8e83c677f2d9fd9b458ce /include | |
| parent | 0bbb2753584231db364b624bf8cf82551b94da7d (diff) | |
| parent | 3f874b6643e189d3d07618928ceed0013d71593e (diff) | |
Merge branch 'for-next' of git://git.o-hand.com/linux-mfd
* 'for-next' of git://git.o-hand.com/linux-mfd: (30 commits)
mfd: Fix section mismatch in da903x
mfd: move drivers/i2c/chips/menelaus.c to drivers/mfd
mfd: move drivers/i2c/chips/tps65010.c to drivers/mfd
mfd: dm355evm msp430 driver
mfd: Add missing break from wm3850-core
mfd: Add WM8351 support
mfd: Support configurable numbers of DCDCs and ISINKs on WM8350
mfd: Handle missing WM8350 platform data
mfd: Add WM8352 support
mfd: Use irq_to_desc in twl4030 code
power_supply: Add Dialog DA9030 battery charger driver
mfd: Dialog DA9030 battery charger MFD driver
mfd: Register WM8400 codec device
mfd: Pass driver_data onto child devices
mfd: Fix twl4030-core.c build error
mfd: twl4030 regulator bug fixes
mfd: twl4030: create some regulator devices
mfd: twl4030: cleanup symbols and OMAP dependency
mfd: twl4030: simplified child creation code
power_supply: Add battery health reporting for WM8350
...
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/i2c/dm355evm_msp.h | 79 | ||||
| -rw-r--r-- | include/linux/i2c/twl4030.h | 81 | ||||
| -rw-r--r-- | include/linux/mfd/da903x.h | 44 | ||||
| -rw-r--r-- | include/linux/mfd/wm8350/comparator.h | 8 | ||||
| -rw-r--r-- | include/linux/mfd/wm8350/core.h | 52 | ||||
| -rw-r--r-- | include/linux/mfd/wm8350/pmic.h | 4 | ||||
| -rw-r--r-- | include/linux/mfd/wm8350/supply.h | 25 | ||||
| -rw-r--r-- | include/linux/power_supply.h | 1 |
8 files changed, 256 insertions, 38 deletions
diff --git a/include/linux/i2c/dm355evm_msp.h b/include/linux/i2c/dm355evm_msp.h new file mode 100644 index 000000000000..372470350fab --- /dev/null +++ b/include/linux/i2c/dm355evm_msp.h | |||
| @@ -0,0 +1,79 @@ | |||
| 1 | /* | ||
| 2 | * dm355evm_msp.h - support MSP430 microcontroller on DM355EVM board | ||
| 3 | */ | ||
| 4 | #ifndef __LINUX_I2C_DM355EVM_MSP | ||
| 5 | #define __LINUX_I2C_DM355EVM_MSP | ||
| 6 | |||
| 7 | /* | ||
| 8 | * Written against Spectrum's writeup for the A4 firmware revision, | ||
| 9 | * and tweaked to match source and rev D2 schematics by removing CPLD | ||
| 10 | * and NOR flash hooks (which were last appropriate in rev B boards). | ||
| 11 | * | ||
| 12 | * Note that the firmware supports a flavor of write posting ... to be | ||
| 13 | * sure a write completes, issue another read or write. | ||
| 14 | */ | ||
| 15 | |||
| 16 | /* utilities to access "registers" emulated by msp430 firmware */ | ||
| 17 | extern int dm355evm_msp_write(u8 value, u8 reg); | ||
| 18 | extern int dm355evm_msp_read(u8 reg); | ||
| 19 | |||
| 20 | |||
| 21 | /* command/control registers */ | ||
| 22 | #define DM355EVM_MSP_COMMAND 0x00 | ||
| 23 | # define MSP_COMMAND_NULL 0 | ||
| 24 | # define MSP_COMMAND_RESET_COLD 1 | ||
| 25 | # define MSP_COMMAND_RESET_WARM 2 | ||
| 26 | # define MSP_COMMAND_RESET_WARM_I 3 | ||
| 27 | # define MSP_COMMAND_POWEROFF 4 | ||
| 28 | # define MSP_COMMAND_IR_REINIT 5 | ||
| 29 | #define DM355EVM_MSP_STATUS 0x01 | ||
| 30 | # define MSP_STATUS_BAD_OFFSET BIT(0) | ||
| 31 | # define MSP_STATUS_BAD_COMMAND BIT(1) | ||
| 32 | # define MSP_STATUS_POWER_ERROR BIT(2) | ||
| 33 | # define MSP_STATUS_RXBUF_OVERRUN BIT(3) | ||
| 34 | #define DM355EVM_MSP_RESET 0x02 /* 0 bits == in reset */ | ||
| 35 | # define MSP_RESET_DC5 BIT(0) | ||
| 36 | # define MSP_RESET_TVP5154 BIT(2) | ||
| 37 | # define MSP_RESET_IMAGER BIT(3) | ||
| 38 | # define MSP_RESET_ETHERNET BIT(4) | ||
| 39 | # define MSP_RESET_SYS BIT(5) | ||
| 40 | # define MSP_RESET_AIC33 BIT(7) | ||
| 41 | |||
| 42 | /* GPIO registers ... bit patterns mostly match the source MSP ports */ | ||
| 43 | #define DM355EVM_MSP_LED 0x03 /* active low (MSP P4) */ | ||
| 44 | #define DM355EVM_MSP_SWITCH1 0x04 /* (MSP P5, masked) */ | ||
| 45 | # define MSP_SWITCH1_SW6_1 BIT(0) | ||
| 46 | # define MSP_SWITCH1_SW6_2 BIT(1) | ||
| 47 | # define MSP_SWITCH1_SW6_3 BIT(2) | ||
| 48 | # define MSP_SWITCH1_SW6_4 BIT(3) | ||
| 49 | # define MSP_SWITCH1_J1 BIT(4) /* NTSC/PAL */ | ||
| 50 | # define MSP_SWITCH1_MSP_INT BIT(5) /* active low */ | ||
| 51 | #define DM355EVM_MSP_SWITCH2 0x05 /* (MSP P6, masked) */ | ||
| 52 | # define MSP_SWITCH2_SW10 BIT(3) | ||
| 53 | # define MSP_SWITCH2_SW11 BIT(4) | ||
| 54 | # define MSP_SWITCH2_SW12 BIT(5) | ||
| 55 | # define MSP_SWITCH2_SW13 BIT(6) | ||
| 56 | # define MSP_SWITCH2_SW14 BIT(7) | ||
| 57 | #define DM355EVM_MSP_SDMMC 0x06 /* (MSP P2, masked) */ | ||
| 58 | # define MSP_SDMMC_0_WP BIT(1) | ||
| 59 | # define MSP_SDMMC_0_CD BIT(2) /* active low */ | ||
| 60 | # define MSP_SDMMC_1_WP BIT(3) | ||
| 61 | # define MSP_SDMMC_1_CD BIT(4) /* active low */ | ||
| 62 | #define DM355EVM_MSP_FIRMREV 0x07 /* not a GPIO (out of order) */ | ||
| 63 | #define DM355EVM_MSP_VIDEO_IN 0x08 /* (MSP P3, masked) */ | ||
| 64 | # define MSP_VIDEO_IMAGER BIT(7) /* low == tvp5146 */ | ||
| 65 | |||
| 66 | /* power supply registers are currently omitted */ | ||
| 67 | |||
| 68 | /* RTC registers */ | ||
| 69 | #define DM355EVM_MSP_RTC_0 0x12 /* LSB */ | ||
| 70 | #define DM355EVM_MSP_RTC_1 0x13 | ||
| 71 | #define DM355EVM_MSP_RTC_2 0x14 | ||
| 72 | #define DM355EVM_MSP_RTC_3 0x15 /* MSB */ | ||
| 73 | |||
| 74 | /* input event queue registers; code == ((HIGH << 8) | LOW) */ | ||
| 75 | #define DM355EVM_MSP_INPUT_COUNT 0x16 /* decrement by reading LOW */ | ||
| 76 | #define DM355EVM_MSP_INPUT_HIGH 0x17 | ||
| 77 | #define DM355EVM_MSP_INPUT_LOW 0x18 | ||
| 78 | |||
| 79 | #endif /* __LINUX_I2C_DM355EVM_MSP */ | ||
diff --git a/include/linux/i2c/twl4030.h b/include/linux/i2c/twl4030.h index fb604dcd38f1..a8f84c01f82e 100644 --- a/include/linux/i2c/twl4030.h +++ b/include/linux/i2c/twl4030.h | |||
| @@ -78,8 +78,8 @@ int twl4030_i2c_read_u8(u8 mod_no, u8 *val, u8 reg); | |||
| 78 | * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 | 78 | * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 |
| 79 | * for the value, and populate your data starting at offset 1. | 79 | * for the value, and populate your data starting at offset 1. |
| 80 | */ | 80 | */ |
| 81 | int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); | 81 | int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); |
| 82 | int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes); | 82 | int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes); |
| 83 | 83 | ||
| 84 | /*----------------------------------------------------------------------*/ | 84 | /*----------------------------------------------------------------------*/ |
| 85 | 85 | ||
| @@ -278,6 +278,18 @@ struct twl4030_platform_data { | |||
| 278 | struct twl4030_keypad_data *keypad; | 278 | struct twl4030_keypad_data *keypad; |
| 279 | struct twl4030_usb_data *usb; | 279 | struct twl4030_usb_data *usb; |
| 280 | 280 | ||
| 281 | /* LDO regulators */ | ||
| 282 | struct regulator_init_data *vdac; | ||
| 283 | struct regulator_init_data *vpll1; | ||
| 284 | struct regulator_init_data *vpll2; | ||
| 285 | struct regulator_init_data *vmmc1; | ||
| 286 | struct regulator_init_data *vmmc2; | ||
| 287 | struct regulator_init_data *vsim; | ||
| 288 | struct regulator_init_data *vaux1; | ||
| 289 | struct regulator_init_data *vaux2; | ||
| 290 | struct regulator_init_data *vaux3; | ||
| 291 | struct regulator_init_data *vaux4; | ||
| 292 | |||
| 281 | /* REVISIT more to come ... _nothing_ should be hard-wired */ | 293 | /* REVISIT more to come ... _nothing_ should be hard-wired */ |
| 282 | }; | 294 | }; |
| 283 | 295 | ||
| @@ -285,33 +297,6 @@ struct twl4030_platform_data { | |||
| 285 | 297 | ||
| 286 | int twl4030_sih_setup(int module); | 298 | int twl4030_sih_setup(int module); |
| 287 | 299 | ||
| 288 | /* | ||
| 289 | * FIXME completely stop using TWL4030_IRQ_BASE ... instead, pass the | ||
| 290 | * IRQ data to subsidiary devices using platform device resources. | ||
| 291 | */ | ||
| 292 | |||
| 293 | /* IRQ information-need base */ | ||
| 294 | #include <mach/irqs.h> | ||
| 295 | /* TWL4030 interrupts */ | ||
| 296 | |||
| 297 | /* #define TWL4030_MODIRQ_GPIO (TWL4030_IRQ_BASE + 0) */ | ||
| 298 | #define TWL4030_MODIRQ_KEYPAD (TWL4030_IRQ_BASE + 1) | ||
| 299 | #define TWL4030_MODIRQ_BCI (TWL4030_IRQ_BASE + 2) | ||
| 300 | #define TWL4030_MODIRQ_MADC (TWL4030_IRQ_BASE + 3) | ||
| 301 | /* #define TWL4030_MODIRQ_USB (TWL4030_IRQ_BASE + 4) */ | ||
| 302 | /* #define TWL4030_MODIRQ_PWR (TWL4030_IRQ_BASE + 5) */ | ||
| 303 | |||
| 304 | #define TWL4030_PWRIRQ_PWRBTN (TWL4030_PWR_IRQ_BASE + 0) | ||
| 305 | /* #define TWL4030_PWRIRQ_CHG_PRES (TWL4030_PWR_IRQ_BASE + 1) */ | ||
| 306 | /* #define TWL4030_PWRIRQ_USB_PRES (TWL4030_PWR_IRQ_BASE + 2) */ | ||
| 307 | /* #define TWL4030_PWRIRQ_RTC (TWL4030_PWR_IRQ_BASE + 3) */ | ||
| 308 | /* #define TWL4030_PWRIRQ_HOT_DIE (TWL4030_PWR_IRQ_BASE + 4) */ | ||
| 309 | /* #define TWL4030_PWRIRQ_PWROK_TIMEOUT (TWL4030_PWR_IRQ_BASE + 5) */ | ||
| 310 | /* #define TWL4030_PWRIRQ_MBCHG (TWL4030_PWR_IRQ_BASE + 6) */ | ||
| 311 | /* #define TWL4030_PWRIRQ_SC_DETECT (TWL4030_PWR_IRQ_BASE + 7) */ | ||
| 312 | |||
| 313 | /* Rest are unsued currently*/ | ||
| 314 | |||
| 315 | /* Offsets to Power Registers */ | 300 | /* Offsets to Power Registers */ |
| 316 | #define TWL4030_VDAC_DEV_GRP 0x3B | 301 | #define TWL4030_VDAC_DEV_GRP 0x3B |
| 317 | #define TWL4030_VDAC_DEDICATED 0x3E | 302 | #define TWL4030_VDAC_DEDICATED 0x3E |
| @@ -322,10 +307,6 @@ int twl4030_sih_setup(int module); | |||
| 322 | #define TWL4030_VAUX3_DEV_GRP 0x1F | 307 | #define TWL4030_VAUX3_DEV_GRP 0x1F |
| 323 | #define TWL4030_VAUX3_DEDICATED 0x22 | 308 | #define TWL4030_VAUX3_DEDICATED 0x22 |
| 324 | 309 | ||
| 325 | /* TWL4030 GPIO interrupt definitions */ | ||
| 326 | |||
| 327 | #define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n)) | ||
| 328 | |||
| 329 | /* | 310 | /* |
| 330 | * Exported TWL4030 GPIO APIs | 311 | * Exported TWL4030 GPIO APIs |
| 331 | * | 312 | * |
| @@ -340,4 +321,38 @@ int twl4030_set_gpio_debounce(int gpio, int enable); | |||
| 340 | static inline int twl4030charger_usb_en(int enable) { return 0; } | 321 | static inline int twl4030charger_usb_en(int enable) { return 0; } |
| 341 | #endif | 322 | #endif |
| 342 | 323 | ||
| 324 | /*----------------------------------------------------------------------*/ | ||
| 325 | |||
| 326 | /* Linux-specific regulator identifiers ... for now, we only support | ||
| 327 | * the LDOs, and leave the three buck converters alone. VDD1 and VDD2 | ||
| 328 | * need to tie into hardware based voltage scaling (cpufreq etc), while | ||
| 329 | * VIO is generally fixed. | ||
| 330 | */ | ||
| 331 | |||
| 332 | /* EXTERNAL dc-to-dc buck converters */ | ||
| 333 | #define TWL4030_REG_VDD1 0 | ||
| 334 | #define TWL4030_REG_VDD2 1 | ||
| 335 | #define TWL4030_REG_VIO 2 | ||
| 336 | |||
| 337 | /* EXTERNAL LDOs */ | ||
| 338 | #define TWL4030_REG_VDAC 3 | ||
| 339 | #define TWL4030_REG_VPLL1 4 | ||
| 340 | #define TWL4030_REG_VPLL2 5 /* not on all chips */ | ||
| 341 | #define TWL4030_REG_VMMC1 6 | ||
| 342 | #define TWL4030_REG_VMMC2 7 /* not on all chips */ | ||
| 343 | #define TWL4030_REG_VSIM 8 /* not on all chips */ | ||
| 344 | #define TWL4030_REG_VAUX1 9 /* not on all chips */ | ||
| 345 | #define TWL4030_REG_VAUX2_4030 10 /* (twl4030-specific) */ | ||
| 346 | #define TWL4030_REG_VAUX2 11 /* (twl5030 and newer) */ | ||
| 347 | #define TWL4030_REG_VAUX3 12 /* not on all chips */ | ||
| 348 | #define TWL4030_REG_VAUX4 13 /* not on all chips */ | ||
| 349 | |||
| 350 | /* INTERNAL LDOs */ | ||
| 351 | #define TWL4030_REG_VINTANA1 14 | ||
| 352 | #define TWL4030_REG_VINTANA2 15 | ||
| 353 | #define TWL4030_REG_VINTDIG 16 | ||
| 354 | #define TWL4030_REG_VUSB1V5 17 | ||
| 355 | #define TWL4030_REG_VUSB1V8 18 | ||
| 356 | #define TWL4030_REG_VUSB3V1 19 | ||
| 357 | |||
| 343 | #endif /* End of __TWL4030_H */ | 358 | #endif /* End of __TWL4030_H */ |
diff --git a/include/linux/mfd/da903x.h b/include/linux/mfd/da903x.h index cad314c12439..115dbe965082 100644 --- a/include/linux/mfd/da903x.h +++ b/include/linux/mfd/da903x.h | |||
| @@ -32,6 +32,7 @@ enum { | |||
| 32 | DA9030_ID_LDO18, | 32 | DA9030_ID_LDO18, |
| 33 | DA9030_ID_LDO19, | 33 | DA9030_ID_LDO19, |
| 34 | DA9030_ID_LDO_INT, /* LDO Internal */ | 34 | DA9030_ID_LDO_INT, /* LDO Internal */ |
| 35 | DA9030_ID_BAT, /* battery charger */ | ||
| 35 | 36 | ||
| 36 | DA9034_ID_LED_1, | 37 | DA9034_ID_LED_1, |
| 37 | DA9034_ID_LED_2, | 38 | DA9034_ID_LED_2, |
| @@ -93,6 +94,43 @@ struct da9034_touch_pdata { | |||
| 93 | int y_inverted; | 94 | int y_inverted; |
| 94 | }; | 95 | }; |
| 95 | 96 | ||
| 97 | /* DA9030 battery charger data */ | ||
| 98 | struct power_supply_info; | ||
| 99 | |||
| 100 | struct da9030_battery_info { | ||
| 101 | /* battery parameters */ | ||
| 102 | struct power_supply_info *battery_info; | ||
| 103 | |||
| 104 | /* current and voltage to use for battery charging */ | ||
| 105 | unsigned int charge_milliamp; | ||
| 106 | unsigned int charge_millivolt; | ||
| 107 | |||
| 108 | /* voltage thresholds (in millivolts) */ | ||
| 109 | int vbat_low; | ||
| 110 | int vbat_crit; | ||
| 111 | int vbat_charge_start; | ||
| 112 | int vbat_charge_stop; | ||
| 113 | int vbat_charge_restart; | ||
| 114 | |||
| 115 | /* battery nominal minimal and maximal voltages in millivolts */ | ||
| 116 | int vcharge_min; | ||
| 117 | int vcharge_max; | ||
| 118 | |||
| 119 | /* Temperature thresholds. These are DA9030 register values | ||
| 120 | "as is" and should be measured for each battery type */ | ||
| 121 | int tbat_low; | ||
| 122 | int tbat_high; | ||
| 123 | int tbat_restart; | ||
| 124 | |||
| 125 | |||
| 126 | /* battery monitor interval (seconds) */ | ||
| 127 | unsigned int batmon_interval; | ||
| 128 | |||
| 129 | /* platform callbacks for battery low and critical events */ | ||
| 130 | void (*battery_low)(void); | ||
| 131 | void (*battery_critical)(void); | ||
| 132 | }; | ||
| 133 | |||
| 96 | struct da903x_subdev_info { | 134 | struct da903x_subdev_info { |
| 97 | int id; | 135 | int id; |
| 98 | const char *name; | 136 | const char *name; |
| @@ -190,11 +228,13 @@ extern int da903x_unregister_notifier(struct device *dev, | |||
| 190 | extern int da903x_query_status(struct device *dev, unsigned int status); | 228 | extern int da903x_query_status(struct device *dev, unsigned int status); |
| 191 | 229 | ||
| 192 | 230 | ||
| 193 | /* NOTE: the two functions below are not intended for use outside | 231 | /* NOTE: the functions below are not intended for use outside |
| 194 | * of the DA9034 sub-device drivers | 232 | * of the DA903x sub-device drivers |
| 195 | */ | 233 | */ |
| 196 | extern int da903x_write(struct device *dev, int reg, uint8_t val); | 234 | extern int da903x_write(struct device *dev, int reg, uint8_t val); |
| 235 | extern int da903x_writes(struct device *dev, int reg, int len, uint8_t *val); | ||
| 197 | extern int da903x_read(struct device *dev, int reg, uint8_t *val); | 236 | extern int da903x_read(struct device *dev, int reg, uint8_t *val); |
| 237 | extern int da903x_reads(struct device *dev, int reg, int len, uint8_t *val); | ||
| 198 | extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); | 238 | extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); |
| 199 | extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask); | 239 | extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask); |
| 200 | extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); | 240 | extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask); |
diff --git a/include/linux/mfd/wm8350/comparator.h b/include/linux/mfd/wm8350/comparator.h index 053788649452..54bc5d0fd502 100644 --- a/include/linux/mfd/wm8350/comparator.h +++ b/include/linux/mfd/wm8350/comparator.h | |||
| @@ -164,4 +164,12 @@ | |||
| 164 | #define WM8350_AUXADC_BATT 6 | 164 | #define WM8350_AUXADC_BATT 6 |
| 165 | #define WM8350_AUXADC_TEMP 7 | 165 | #define WM8350_AUXADC_TEMP 7 |
| 166 | 166 | ||
| 167 | struct wm8350; | ||
| 168 | |||
| 169 | /* | ||
| 170 | * AUX ADC Readback | ||
| 171 | */ | ||
| 172 | int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, | ||
| 173 | int vref); | ||
| 174 | |||
| 167 | #endif | 175 | #endif |
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h index 6ebf97f2a475..980669d50dca 100644 --- a/include/linux/mfd/wm8350/core.h +++ b/include/linux/mfd/wm8350/core.h | |||
| @@ -29,6 +29,7 @@ | |||
| 29 | */ | 29 | */ |
| 30 | #define WM8350_RESET_ID 0x00 | 30 | #define WM8350_RESET_ID 0x00 |
| 31 | #define WM8350_ID 0x01 | 31 | #define WM8350_ID 0x01 |
| 32 | #define WM8350_REVISION 0x02 | ||
| 32 | #define WM8350_SYSTEM_CONTROL_1 0x03 | 33 | #define WM8350_SYSTEM_CONTROL_1 0x03 |
| 33 | #define WM8350_SYSTEM_CONTROL_2 0x04 | 34 | #define WM8350_SYSTEM_CONTROL_2 0x04 |
| 34 | #define WM8350_SYSTEM_HIBERNATE 0x05 | 35 | #define WM8350_SYSTEM_HIBERNATE 0x05 |
| @@ -57,6 +58,10 @@ | |||
| 57 | #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 | 58 | #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 |
| 58 | #define WM8350_GPIO_INT_STATUS_MASK 0x26 | 59 | #define WM8350_GPIO_INT_STATUS_MASK 0x26 |
| 59 | #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 | 60 | #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 |
| 61 | #define WM8350_CHARGER_OVERRIDES 0xE2 | ||
| 62 | #define WM8350_MISC_OVERRIDES 0xE3 | ||
| 63 | #define WM8350_COMPARATOR_OVERRIDES 0xE7 | ||
| 64 | #define WM8350_STATE_MACHINE_STATUS 0xE9 | ||
| 60 | 65 | ||
| 61 | #define WM8350_MAX_REGISTER 0xFF | 66 | #define WM8350_MAX_REGISTER 0xFF |
| 62 | 67 | ||
| @@ -77,6 +82,11 @@ | |||
| 77 | #define WM8350_CUST_ID_MASK 0x00FF | 82 | #define WM8350_CUST_ID_MASK 0x00FF |
| 78 | 83 | ||
| 79 | /* | 84 | /* |
| 85 | * R2 (0x02) - Revision | ||
| 86 | */ | ||
| 87 | #define WM8350_MASK_REV_MASK 0x00FF | ||
| 88 | |||
| 89 | /* | ||
| 80 | * R3 (0x03) - System Control 1 | 90 | * R3 (0x03) - System Control 1 |
| 81 | */ | 91 | */ |
| 82 | #define WM8350_CHIP_ON 0x8000 | 92 | #define WM8350_CHIP_ON 0x8000 |
| @@ -523,6 +533,35 @@ | |||
| 523 | #define WM8350_DC2_STS 0x0002 | 533 | #define WM8350_DC2_STS 0x0002 |
| 524 | #define WM8350_DC1_STS 0x0001 | 534 | #define WM8350_DC1_STS 0x0001 |
| 525 | 535 | ||
| 536 | /* | ||
| 537 | * R226 (0xE2) - Charger status | ||
| 538 | */ | ||
| 539 | #define WM8350_CHG_BATT_HOT_OVRDE 0x8000 | ||
| 540 | #define WM8350_CHG_BATT_COLD_OVRDE 0x4000 | ||
| 541 | |||
| 542 | /* | ||
| 543 | * R227 (0xE3) - Misc Overrides | ||
| 544 | */ | ||
| 545 | #define WM8350_USB_LIMIT_OVRDE 0x0400 | ||
| 546 | |||
| 547 | /* | ||
| 548 | * R227 (0xE7) - Comparator Overrides | ||
| 549 | */ | ||
| 550 | #define WM8350_USB_FB_OVRDE 0x8000 | ||
| 551 | #define WM8350_WALL_FB_OVRDE 0x4000 | ||
| 552 | #define WM8350_BATT_FB_OVRDE 0x2000 | ||
| 553 | |||
| 554 | |||
| 555 | /* | ||
| 556 | * R233 (0xE9) - State Machinine Status | ||
| 557 | */ | ||
| 558 | #define WM8350_USB_SM_MASK 0x0700 | ||
| 559 | #define WM8350_USB_SM_SHIFT 8 | ||
| 560 | |||
| 561 | #define WM8350_USB_SM_100_SLV 1 | ||
| 562 | #define WM8350_USB_SM_500_SLV 5 | ||
| 563 | #define WM8350_USB_SM_STDBY_SLV 7 | ||
| 564 | |||
| 526 | /* WM8350 wake up conditions */ | 565 | /* WM8350 wake up conditions */ |
| 527 | #define WM8350_IRQ_WKUP_OFF_STATE 43 | 566 | #define WM8350_IRQ_WKUP_OFF_STATE 43 |
| 528 | #define WM8350_IRQ_WKUP_HIB_STATE 44 | 567 | #define WM8350_IRQ_WKUP_HIB_STATE 44 |
| @@ -536,6 +575,7 @@ | |||
| 536 | #define WM8350_REV_E 0x4 | 575 | #define WM8350_REV_E 0x4 |
| 537 | #define WM8350_REV_F 0x5 | 576 | #define WM8350_REV_F 0x5 |
| 538 | #define WM8350_REV_G 0x6 | 577 | #define WM8350_REV_G 0x6 |
| 578 | #define WM8350_REV_H 0x7 | ||
| 539 | 579 | ||
| 540 | #define WM8350_NUM_IRQ 63 | 580 | #define WM8350_NUM_IRQ 63 |
| 541 | 581 | ||
| @@ -549,6 +589,14 @@ extern const u16 wm8350_mode0_defaults[]; | |||
| 549 | extern const u16 wm8350_mode1_defaults[]; | 589 | extern const u16 wm8350_mode1_defaults[]; |
| 550 | extern const u16 wm8350_mode2_defaults[]; | 590 | extern const u16 wm8350_mode2_defaults[]; |
| 551 | extern const u16 wm8350_mode3_defaults[]; | 591 | extern const u16 wm8350_mode3_defaults[]; |
| 592 | extern const u16 wm8351_mode0_defaults[]; | ||
| 593 | extern const u16 wm8351_mode1_defaults[]; | ||
| 594 | extern const u16 wm8351_mode2_defaults[]; | ||
| 595 | extern const u16 wm8351_mode3_defaults[]; | ||
| 596 | extern const u16 wm8352_mode0_defaults[]; | ||
| 597 | extern const u16 wm8352_mode1_defaults[]; | ||
| 598 | extern const u16 wm8352_mode2_defaults[]; | ||
| 599 | extern const u16 wm8352_mode3_defaults[]; | ||
| 552 | 600 | ||
| 553 | struct wm8350; | 601 | struct wm8350; |
| 554 | 602 | ||
| @@ -558,8 +606,6 @@ struct wm8350_irq { | |||
| 558 | }; | 606 | }; |
| 559 | 607 | ||
| 560 | struct wm8350 { | 608 | struct wm8350 { |
| 561 | int rev; /* chip revision */ | ||
| 562 | |||
| 563 | struct device *dev; | 609 | struct device *dev; |
| 564 | 610 | ||
| 565 | /* device IO */ | 611 | /* device IO */ |
| @@ -572,6 +618,8 @@ struct wm8350 { | |||
| 572 | void *src); | 618 | void *src); |
| 573 | u16 *reg_cache; | 619 | u16 *reg_cache; |
| 574 | 620 | ||
| 621 | struct mutex auxadc_mutex; | ||
| 622 | |||
| 575 | /* Interrupt handling */ | 623 | /* Interrupt handling */ |
| 576 | struct work_struct irq_work; | 624 | struct work_struct irq_work; |
| 577 | struct mutex irq_mutex; /* IRQ table mutex */ | 625 | struct mutex irq_mutex; /* IRQ table mutex */ |
diff --git a/include/linux/mfd/wm8350/pmic.h b/include/linux/mfd/wm8350/pmic.h index 69b69e07f62f..96acbfc8aa12 100644 --- a/include/linux/mfd/wm8350/pmic.h +++ b/include/linux/mfd/wm8350/pmic.h | |||
| @@ -701,6 +701,10 @@ struct platform_device; | |||
| 701 | struct regulator_init_data; | 701 | struct regulator_init_data; |
| 702 | 702 | ||
| 703 | struct wm8350_pmic { | 703 | struct wm8350_pmic { |
| 704 | /* Number of regulators of each type on this device */ | ||
| 705 | int max_dcdc; | ||
| 706 | int max_isink; | ||
| 707 | |||
| 704 | /* ISINK to DCDC mapping */ | 708 | /* ISINK to DCDC mapping */ |
| 705 | int isink_A_dcdc; | 709 | int isink_A_dcdc; |
| 706 | int isink_B_dcdc; | 710 | int isink_B_dcdc; |
diff --git a/include/linux/mfd/wm8350/supply.h b/include/linux/mfd/wm8350/supply.h index 1c8f3cde79b0..2b9479310bbd 100644 --- a/include/linux/mfd/wm8350/supply.h +++ b/include/linux/mfd/wm8350/supply.h | |||
| @@ -13,7 +13,8 @@ | |||
| 13 | #ifndef __LINUX_MFD_WM8350_SUPPLY_H_ | 13 | #ifndef __LINUX_MFD_WM8350_SUPPLY_H_ |
| 14 | #define __LINUX_MFD_WM8350_SUPPLY_H_ | 14 | #define __LINUX_MFD_WM8350_SUPPLY_H_ |
| 15 | 15 | ||
| 16 | #include <linux/platform_device.h> | 16 | #include <linux/mutex.h> |
| 17 | #include <linux/power_supply.h> | ||
| 17 | 18 | ||
| 18 | /* | 19 | /* |
| 19 | * Charger registers | 20 | * Charger registers |
| @@ -104,8 +105,30 @@ | |||
| 104 | #define WM8350_IRQ_EXT_WALL_FB 37 | 105 | #define WM8350_IRQ_EXT_WALL_FB 37 |
| 105 | #define WM8350_IRQ_EXT_BAT_FB 38 | 106 | #define WM8350_IRQ_EXT_BAT_FB 38 |
| 106 | 107 | ||
| 108 | /* | ||
| 109 | * Policy to control charger state machine. | ||
| 110 | */ | ||
| 111 | struct wm8350_charger_policy { | ||
| 112 | |||
| 113 | /* charger state machine policy - set in machine driver */ | ||
| 114 | int eoc_mA; /* end of charge current (mA) */ | ||
| 115 | int charge_mV; /* charge voltage */ | ||
| 116 | int fast_limit_mA; /* fast charge current limit */ | ||
| 117 | int fast_limit_USB_mA; /* USB fast charge current limit */ | ||
| 118 | int charge_timeout; /* charge timeout (mins) */ | ||
| 119 | int trickle_start_mV; /* trickle charge starts at mV */ | ||
| 120 | int trickle_charge_mA; /* trickle charge current */ | ||
| 121 | int trickle_charge_USB_mA; /* USB trickle charge current */ | ||
| 122 | }; | ||
| 123 | |||
| 107 | struct wm8350_power { | 124 | struct wm8350_power { |
| 108 | struct platform_device *pdev; | 125 | struct platform_device *pdev; |
| 126 | struct power_supply battery; | ||
| 127 | struct power_supply usb; | ||
| 128 | struct power_supply ac; | ||
| 129 | struct wm8350_charger_policy *policy; | ||
| 130 | |||
| 131 | int rev_g_coeff; | ||
| 109 | }; | 132 | }; |
| 110 | 133 | ||
| 111 | #endif | 134 | #endif |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index f9348cba6dc1..8ff25e0e7f7a 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
| @@ -45,6 +45,7 @@ enum { | |||
| 45 | POWER_SUPPLY_HEALTH_DEAD, | 45 | POWER_SUPPLY_HEALTH_DEAD, |
| 46 | POWER_SUPPLY_HEALTH_OVERVOLTAGE, | 46 | POWER_SUPPLY_HEALTH_OVERVOLTAGE, |
| 47 | POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, | 47 | POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, |
| 48 | POWER_SUPPLY_HEALTH_COLD, | ||
| 48 | }; | 49 | }; |
| 49 | 50 | ||
| 50 | enum { | 51 | enum { |
