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
...

+4564 -361
-23
drivers/i2c/chips/Kconfig
··· 126 126 This driver can also be built as a module. If so, the module 127 127 will be called isp1301_omap. 128 128 129 - config TPS65010 130 - tristate "TPS6501x Power Management chips" 131 - depends on GPIOLIB 132 - default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK 133 - help 134 - If you say yes here you get support for the TPS6501x series of 135 - Power Management chips. These include voltage regulators, 136 - lithium ion/polymer battery charging, and other features that 137 - are often used in portable devices like cell phones and cameras. 138 - 139 - This driver can also be built as a module. If so, the module 140 - will be called tps65010. 141 - 142 129 config SENSORS_MAX6875 143 130 tristate "Maxim MAX6875 Power supply supervisor" 144 131 depends on EXPERIMENTAL ··· 150 163 151 164 This driver can also be built as a module. If so, the module 152 165 will be called tsl2550. 153 - 154 - config MENELAUS 155 - bool "TWL92330/Menelaus PM chip" 156 - depends on I2C=y && ARCH_OMAP24XX 157 - help 158 - If you say yes here you get support for the Texas Instruments 159 - TWL92330/Menelaus Power Management chip. This include voltage 160 - regulators, Dual slot memory card tranceivers, real-time clock 161 - and other features that are often used in portable devices like 162 - cell phones and PDAs. 163 166 164 167 config MCU_MPC8349EMITX 165 168 tristate "MPC8349E-mITX MCU driver"
-2
drivers/i2c/chips/Makefile
··· 19 19 obj-$(CONFIG_PCF8575) += pcf8575.o 20 20 obj-$(CONFIG_SENSORS_PCF8591) += pcf8591.o 21 21 obj-$(CONFIG_ISP1301_OMAP) += isp1301_omap.o 22 - obj-$(CONFIG_TPS65010) += tps65010.o 23 - obj-$(CONFIG_MENELAUS) += menelaus.o 24 22 obj-$(CONFIG_SENSORS_TSL2550) += tsl2550.o 25 23 obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o 26 24
drivers/i2c/chips/menelaus.c drivers/mfd/menelaus.c
drivers/i2c/chips/tps65010.c drivers/mfd/tps65010.c
+65 -1
drivers/mfd/Kconfig
··· 34 34 This driver supports the ASIC3 multifunction chip found on many 35 35 PDAs (mainly iPAQ and HTC based ones) 36 36 37 + config MFD_DM355EVM_MSP 38 + bool "DaVinci DM355 EVM microcontroller" 39 + depends on I2C && MACH_DAVINCI_DM355_EVM 40 + help 41 + This driver supports the MSP430 microcontroller used on these 42 + boards. MSP430 firmware manages resets and power sequencing, 43 + inputs from buttons and the IR remote, LEDs, an RTC, and more. 44 + 37 45 config HTC_EGPIO 38 46 bool "HTC EGPIO support" 39 47 depends on GENERIC_HARDIRQS && GPIOLIB && ARM ··· 69 61 To compile this driver as a module, choose M here: the 70 62 module will be called ucb1400_core. 71 63 64 + config TPS65010 65 + tristate "TPS6501x Power Management chips" 66 + depends on I2C && GPIOLIB 67 + default y if MACH_OMAP_H2 || MACH_OMAP_H3 || MACH_OMAP_OSK 68 + help 69 + If you say yes here you get support for the TPS6501x series of 70 + Power Management chips. These include voltage regulators, 71 + lithium ion/polymer battery charging, and other features that 72 + are often used in portable devices like cell phones and cameras. 73 + 74 + This driver can also be built as a module. If so, the module 75 + will be called tps65010. 76 + 77 + config MENELAUS 78 + bool "Texas Instruments TWL92330/Menelaus PM chip" 79 + depends on I2C=y && ARCH_OMAP24XX 80 + help 81 + If you say yes here you get support for the Texas Instruments 82 + TWL92330/Menelaus Power Management chip. This include voltage 83 + regulators, Dual slot memory card tranceivers, real-time clock 84 + and other features that are often used in portable devices like 85 + cell phones and PDAs. 86 + 72 87 config TWL4030_CORE 73 88 bool "Texas Instruments TWL4030/TPS659x0 Support" 74 - depends on I2C=y && GENERIC_HARDIRQS && (ARCH_OMAP2 || ARCH_OMAP3) 89 + depends on I2C=y && GENERIC_HARDIRQS 75 90 help 76 91 Say yes here if you have TWL4030 family chip on your board. 77 92 This core driver provides register access and IRQ handling ··· 147 116 148 117 config MFD_WM8400 149 118 tristate "Support Wolfson Microelectronics WM8400" 119 + select MFD_CORE 150 120 depends on I2C 151 121 help 152 122 Support for the Wolfson Microelecronics WM8400 PMIC and audio ··· 171 139 depends on MFD_WM8350 172 140 173 141 config MFD_WM8350_CONFIG_MODE_3 142 + bool 143 + depends on MFD_WM8350 144 + 145 + config MFD_WM8351_CONFIG_MODE_0 146 + bool 147 + depends on MFD_WM8350 148 + 149 + config MFD_WM8351_CONFIG_MODE_1 150 + bool 151 + depends on MFD_WM8350 152 + 153 + config MFD_WM8351_CONFIG_MODE_2 154 + bool 155 + depends on MFD_WM8350 156 + 157 + config MFD_WM8351_CONFIG_MODE_3 158 + bool 159 + depends on MFD_WM8350 160 + 161 + config MFD_WM8352_CONFIG_MODE_0 162 + bool 163 + depends on MFD_WM8350 164 + 165 + config MFD_WM8352_CONFIG_MODE_1 166 + bool 167 + depends on MFD_WM8350 168 + 169 + config MFD_WM8352_CONFIG_MODE_2 170 + bool 171 + depends on MFD_WM8350 172 + 173 + config MFD_WM8352_CONFIG_MODE_3 174 174 bool 175 175 depends on MFD_WM8350 176 176
+5
drivers/mfd/Makefile
··· 8 8 obj-$(CONFIG_HTC_EGPIO) += htc-egpio.o 9 9 obj-$(CONFIG_HTC_PASIC3) += htc-pasic3.o 10 10 11 + obj-$(CONFIG_MFD_DM355EVM_MSP) += dm355evm_msp.o 12 + 11 13 obj-$(CONFIG_MFD_T7L66XB) += t7l66xb.o 12 14 obj-$(CONFIG_MFD_TC6387XB) += tc6387xb.o 13 15 obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o ··· 18 16 wm8350-objs := wm8350-core.o wm8350-regmap.o wm8350-gpio.o 19 17 obj-$(CONFIG_MFD_WM8350) += wm8350.o 20 18 obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o 19 + 20 + obj-$(CONFIG_TPS65010) += tps65010.o 21 + obj-$(CONFIG_MENELAUS) += menelaus.o 21 22 22 23 obj-$(CONFIG_TWL4030_CORE) += twl4030-core.o twl4030-irq.o 23 24
+14 -2
drivers/mfd/da903x.c
··· 151 151 } 152 152 EXPORT_SYMBOL_GPL(da903x_write); 153 153 154 + int da903x_writes(struct device *dev, int reg, int len, uint8_t *val) 155 + { 156 + return __da903x_writes(to_i2c_client(dev), reg, len, val); 157 + } 158 + EXPORT_SYMBOL_GPL(da903x_writes); 159 + 154 160 int da903x_read(struct device *dev, int reg, uint8_t *val) 155 161 { 156 162 return __da903x_read(to_i2c_client(dev), reg, val); 157 163 } 158 164 EXPORT_SYMBOL_GPL(da903x_read); 165 + 166 + int da903x_reads(struct device *dev, int reg, int len, uint8_t *val) 167 + { 168 + return __da903x_reads(to_i2c_client(dev), reg, len, val); 169 + } 170 + EXPORT_SYMBOL_GPL(da903x_reads); 159 171 160 172 int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask) 161 173 { ··· 447 435 }; 448 436 MODULE_DEVICE_TABLE(i2c, da903x_id_table); 449 437 450 - static int __devexit __remove_subdev(struct device *dev, void *unused) 438 + static int __remove_subdev(struct device *dev, void *unused) 451 439 { 452 440 platform_device_unregister(to_platform_device(dev)); 453 441 return 0; 454 442 } 455 443 456 - static int __devexit da903x_remove_subdevs(struct da903x_chip *chip) 444 + static int da903x_remove_subdevs(struct da903x_chip *chip) 457 445 { 458 446 return device_for_each_child(chip->dev, NULL, __remove_subdev); 459 447 }
+420
drivers/mfd/dm355evm_msp.c
··· 1 + /* 2 + * dm355evm_msp.c - driver for MSP430 firmware on DM355EVM board 3 + * 4 + * Copyright (C) 2008 David Brownell 5 + * 6 + * This program is free software; you can redistribute it and/or modify 7 + * it under the terms of the GNU General Public License as published by 8 + * the Free Software Foundation; either version 2 of the License, or 9 + * (at your option) any later version. 10 + */ 11 + 12 + #include <linux/init.h> 13 + #include <linux/mutex.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/clk.h> 16 + #include <linux/err.h> 17 + #include <linux/gpio.h> 18 + #include <linux/leds.h> 19 + #include <linux/i2c.h> 20 + #include <linux/i2c/dm355evm_msp.h> 21 + 22 + 23 + /* 24 + * The DM355 is a DaVinci chip with video support but no C64+ DSP. Its 25 + * EVM board has an MSP430 programmed with firmware for various board 26 + * support functions. This driver exposes some of them directly, and 27 + * supports other drivers (e.g. RTC, input) for more complex access. 28 + * 29 + * Because this firmware is entirely board-specific, this file embeds 30 + * knowledge that would be passed as platform_data in a generic driver. 31 + * 32 + * This driver was tested with firmware revision A4. 33 + */ 34 + 35 + #if defined(CONFIG_KEYBOARD_DM355EVM) \ 36 + || defined(CONFIG_KEYBOARD_DM355EVM_MODULE) 37 + #define msp_has_keyboard() true 38 + #else 39 + #define msp_has_keyboard() false 40 + #endif 41 + 42 + #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) 43 + #define msp_has_leds() true 44 + #else 45 + #define msp_has_leds() false 46 + #endif 47 + 48 + #if defined(CONFIG_RTC_DRV_DM355EVM) || defined(CONFIG_RTC_DRV_DM355EVM_MODULE) 49 + #define msp_has_rtc() true 50 + #else 51 + #define msp_has_rtc() false 52 + #endif 53 + 54 + #if defined(CONFIG_VIDEO_TVP514X) || defined(CONFIG_VIDEO_TVP514X_MODULE) 55 + #define msp_has_tvp() true 56 + #else 57 + #define msp_has_tvp() false 58 + #endif 59 + 60 + 61 + /*----------------------------------------------------------------------*/ 62 + 63 + /* REVISIT for paranoia's sake, retry reads/writes on error */ 64 + 65 + static struct i2c_client *msp430; 66 + 67 + /** 68 + * dm355evm_msp_write - Writes a register in dm355evm_msp 69 + * @value: the value to be written 70 + * @reg: register address 71 + * 72 + * Returns result of operation - 0 is success, else negative errno 73 + */ 74 + int dm355evm_msp_write(u8 value, u8 reg) 75 + { 76 + return i2c_smbus_write_byte_data(msp430, reg, value); 77 + } 78 + EXPORT_SYMBOL(dm355evm_msp_write); 79 + 80 + /** 81 + * dm355evm_msp_read - Reads a register from dm355evm_msp 82 + * @reg: register address 83 + * 84 + * Returns result of operation - value, or negative errno 85 + */ 86 + int dm355evm_msp_read(u8 reg) 87 + { 88 + return i2c_smbus_read_byte_data(msp430, reg); 89 + } 90 + EXPORT_SYMBOL(dm355evm_msp_read); 91 + 92 + /*----------------------------------------------------------------------*/ 93 + 94 + /* 95 + * Many of the msp430 pins are just used as fixed-direction GPIOs. 96 + * We could export a few more of them this way, if we wanted. 97 + */ 98 + #define MSP_GPIO(bit,reg) ((DM355EVM_MSP_ ## reg) << 3 | (bit)) 99 + 100 + static const u8 msp_gpios[] = { 101 + /* eight leds */ 102 + MSP_GPIO(0, LED), MSP_GPIO(1, LED), 103 + MSP_GPIO(2, LED), MSP_GPIO(3, LED), 104 + MSP_GPIO(4, LED), MSP_GPIO(5, LED), 105 + MSP_GPIO(6, LED), MSP_GPIO(7, LED), 106 + /* SW6 and the NTSC/nPAL jumper */ 107 + MSP_GPIO(0, SWITCH1), MSP_GPIO(1, SWITCH1), 108 + MSP_GPIO(2, SWITCH1), MSP_GPIO(3, SWITCH1), 109 + MSP_GPIO(4, SWITCH1), 110 + }; 111 + 112 + #define MSP_GPIO_REG(offset) (msp_gpios[(offset)] >> 3) 113 + #define MSP_GPIO_MASK(offset) BIT(msp_gpios[(offset)] & 0x07) 114 + 115 + static int msp_gpio_in(struct gpio_chip *chip, unsigned offset) 116 + { 117 + switch (MSP_GPIO_REG(offset)) { 118 + case DM355EVM_MSP_SWITCH1: 119 + case DM355EVM_MSP_SWITCH2: 120 + case DM355EVM_MSP_SDMMC: 121 + return 0; 122 + default: 123 + return -EINVAL; 124 + } 125 + } 126 + 127 + static u8 msp_led_cache; 128 + 129 + static int msp_gpio_get(struct gpio_chip *chip, unsigned offset) 130 + { 131 + int reg, status; 132 + 133 + reg = MSP_GPIO_REG(offset); 134 + status = dm355evm_msp_read(reg); 135 + if (status < 0) 136 + return status; 137 + if (reg == DM355EVM_MSP_LED) 138 + msp_led_cache = status; 139 + return status & MSP_GPIO_MASK(offset); 140 + } 141 + 142 + static int msp_gpio_out(struct gpio_chip *chip, unsigned offset, int value) 143 + { 144 + int mask, bits; 145 + 146 + /* NOTE: there are some other signals that could be 147 + * packaged as output GPIOs, but they aren't as useful 148 + * as the LEDs ... so for now we don't. 149 + */ 150 + if (MSP_GPIO_REG(offset) != DM355EVM_MSP_LED) 151 + return -EINVAL; 152 + 153 + mask = MSP_GPIO_MASK(offset); 154 + bits = msp_led_cache; 155 + 156 + bits &= ~mask; 157 + if (value) 158 + bits |= mask; 159 + msp_led_cache = bits; 160 + 161 + return dm355evm_msp_write(bits, DM355EVM_MSP_LED); 162 + } 163 + 164 + static void msp_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 165 + { 166 + msp_gpio_out(chip, offset, value); 167 + } 168 + 169 + static struct gpio_chip dm355evm_msp_gpio = { 170 + .label = "dm355evm_msp", 171 + .owner = THIS_MODULE, 172 + .direction_input = msp_gpio_in, 173 + .get = msp_gpio_get, 174 + .direction_output = msp_gpio_out, 175 + .set = msp_gpio_set, 176 + .base = -EINVAL, /* dynamic assignment */ 177 + .ngpio = ARRAY_SIZE(msp_gpios), 178 + .can_sleep = true, 179 + }; 180 + 181 + /*----------------------------------------------------------------------*/ 182 + 183 + static struct device *add_child(struct i2c_client *client, const char *name, 184 + void *pdata, unsigned pdata_len, 185 + bool can_wakeup, int irq) 186 + { 187 + struct platform_device *pdev; 188 + int status; 189 + 190 + pdev = platform_device_alloc(name, -1); 191 + if (!pdev) { 192 + dev_dbg(&client->dev, "can't alloc dev\n"); 193 + status = -ENOMEM; 194 + goto err; 195 + } 196 + 197 + device_init_wakeup(&pdev->dev, can_wakeup); 198 + pdev->dev.parent = &client->dev; 199 + 200 + if (pdata) { 201 + status = platform_device_add_data(pdev, pdata, pdata_len); 202 + if (status < 0) { 203 + dev_dbg(&pdev->dev, "can't add platform_data\n"); 204 + goto err; 205 + } 206 + } 207 + 208 + if (irq) { 209 + struct resource r = { 210 + .start = irq, 211 + .flags = IORESOURCE_IRQ, 212 + }; 213 + 214 + status = platform_device_add_resources(pdev, &r, 1); 215 + if (status < 0) { 216 + dev_dbg(&pdev->dev, "can't add irq\n"); 217 + goto err; 218 + } 219 + } 220 + 221 + status = platform_device_add(pdev); 222 + 223 + err: 224 + if (status < 0) { 225 + platform_device_put(pdev); 226 + dev_err(&client->dev, "can't add %s dev\n", name); 227 + return ERR_PTR(status); 228 + } 229 + return &pdev->dev; 230 + } 231 + 232 + static int add_children(struct i2c_client *client) 233 + { 234 + static const struct { 235 + int offset; 236 + char *label; 237 + } config_inputs[] = { 238 + /* 8 == right after the LEDs */ 239 + { 8 + 0, "sw6_1", }, 240 + { 8 + 1, "sw6_2", }, 241 + { 8 + 2, "sw6_3", }, 242 + { 8 + 3, "sw6_4", }, 243 + { 8 + 4, "NTSC/nPAL", }, 244 + }; 245 + 246 + struct device *child; 247 + int status; 248 + int i; 249 + 250 + /* GPIO-ish stuff */ 251 + dm355evm_msp_gpio.dev = &client->dev; 252 + status = gpiochip_add(&dm355evm_msp_gpio); 253 + if (status < 0) 254 + return status; 255 + 256 + /* LED output */ 257 + if (msp_has_leds()) { 258 + #define GPIO_LED(l) .name = l, .active_low = true 259 + static struct gpio_led evm_leds[] = { 260 + { GPIO_LED("dm355evm::ds14"), 261 + .default_trigger = "heartbeat", }, 262 + { GPIO_LED("dm355evm::ds15"), 263 + .default_trigger = "mmc0", }, 264 + { GPIO_LED("dm355evm::ds16"), 265 + /* could also be a CE-ATA drive */ 266 + .default_trigger = "mmc1", }, 267 + { GPIO_LED("dm355evm::ds17"), 268 + .default_trigger = "nand-disk", }, 269 + { GPIO_LED("dm355evm::ds18"), }, 270 + { GPIO_LED("dm355evm::ds19"), }, 271 + { GPIO_LED("dm355evm::ds20"), }, 272 + { GPIO_LED("dm355evm::ds21"), }, 273 + }; 274 + #undef GPIO_LED 275 + 276 + struct gpio_led_platform_data evm_led_data = { 277 + .num_leds = ARRAY_SIZE(evm_leds), 278 + .leds = evm_leds, 279 + }; 280 + 281 + for (i = 0; i < ARRAY_SIZE(evm_leds); i++) 282 + evm_leds[i].gpio = i + dm355evm_msp_gpio.base; 283 + 284 + /* NOTE: these are the only fully programmable LEDs 285 + * on the board, since GPIO-61/ds22 (and many signals 286 + * going to DC7) must be used for AEMIF address lines 287 + * unless the top 1 GB of NAND is unused... 288 + */ 289 + child = add_child(client, "leds-gpio", 290 + &evm_led_data, sizeof(evm_led_data), 291 + false, 0); 292 + if (IS_ERR(child)) 293 + return PTR_ERR(child); 294 + } 295 + 296 + /* configuration inputs */ 297 + for (i = 0; i < ARRAY_SIZE(config_inputs); i++) { 298 + int gpio = dm355evm_msp_gpio.base + config_inputs[i].offset; 299 + 300 + gpio_request(gpio, config_inputs[i].label); 301 + gpio_direction_input(gpio); 302 + 303 + /* make it easy for userspace to see these */ 304 + gpio_export(gpio, false); 305 + } 306 + 307 + /* RTC is a 32 bit counter, no alarm */ 308 + if (msp_has_rtc()) { 309 + child = add_child(client, "rtc-dm355evm", 310 + NULL, 0, false, 0); 311 + if (IS_ERR(child)) 312 + return PTR_ERR(child); 313 + } 314 + 315 + /* input from buttons and IR remote (uses the IRQ) */ 316 + if (msp_has_keyboard()) { 317 + child = add_child(client, "dm355evm_keys", 318 + NULL, 0, true, client->irq); 319 + if (IS_ERR(child)) 320 + return PTR_ERR(child); 321 + } 322 + 323 + return 0; 324 + } 325 + 326 + /*----------------------------------------------------------------------*/ 327 + 328 + static void dm355evm_command(unsigned command) 329 + { 330 + int status; 331 + 332 + status = dm355evm_msp_write(command, DM355EVM_MSP_COMMAND); 333 + if (status < 0) 334 + dev_err(&msp430->dev, "command %d failure %d\n", 335 + command, status); 336 + } 337 + 338 + static void dm355evm_power_off(void) 339 + { 340 + dm355evm_command(MSP_COMMAND_POWEROFF); 341 + } 342 + 343 + static int dm355evm_msp_remove(struct i2c_client *client) 344 + { 345 + pm_power_off = NULL; 346 + msp430 = NULL; 347 + return 0; 348 + } 349 + 350 + static int 351 + dm355evm_msp_probe(struct i2c_client *client, const struct i2c_device_id *id) 352 + { 353 + int status; 354 + const char *video = msp_has_tvp() ? "TVP5146" : "imager"; 355 + 356 + if (msp430) 357 + return -EBUSY; 358 + msp430 = client; 359 + 360 + /* display revision status; doubles as sanity check */ 361 + status = dm355evm_msp_read(DM355EVM_MSP_FIRMREV); 362 + if (status < 0) 363 + goto fail; 364 + dev_info(&client->dev, "firmware v.%02X, %s as video-in\n", 365 + status, video); 366 + 367 + /* mux video input: either tvp5146 or some external imager */ 368 + status = dm355evm_msp_write(msp_has_tvp() ? 0 : MSP_VIDEO_IMAGER, 369 + DM355EVM_MSP_VIDEO_IN); 370 + if (status < 0) 371 + dev_warn(&client->dev, "error %d muxing %s as video-in\n", 372 + status, video); 373 + 374 + /* init LED cache, and turn off the LEDs */ 375 + msp_led_cache = 0xff; 376 + dm355evm_msp_write(msp_led_cache, DM355EVM_MSP_LED); 377 + 378 + /* export capabilities we support */ 379 + status = add_children(client); 380 + if (status < 0) 381 + goto fail; 382 + 383 + /* PM hookup */ 384 + pm_power_off = dm355evm_power_off; 385 + 386 + return 0; 387 + 388 + fail: 389 + /* FIXME remove children ... */ 390 + dm355evm_msp_remove(client); 391 + return status; 392 + } 393 + 394 + static const struct i2c_device_id dm355evm_msp_ids[] = { 395 + { "dm355evm_msp", 0 }, 396 + { /* end of list */ }, 397 + }; 398 + MODULE_DEVICE_TABLE(i2c, dm355evm_msp_ids); 399 + 400 + static struct i2c_driver dm355evm_msp_driver = { 401 + .driver.name = "dm355evm_msp", 402 + .id_table = dm355evm_msp_ids, 403 + .probe = dm355evm_msp_probe, 404 + .remove = dm355evm_msp_remove, 405 + }; 406 + 407 + static int __init dm355evm_msp_init(void) 408 + { 409 + return i2c_add_driver(&dm355evm_msp_driver); 410 + } 411 + subsys_initcall(dm355evm_msp_init); 412 + 413 + static void __exit dm355evm_msp_exit(void) 414 + { 415 + i2c_del_driver(&dm355evm_msp_driver); 416 + } 417 + module_exit(dm355evm_msp_exit); 418 + 419 + MODULE_DESCRIPTION("Interface to MSP430 firmware on DM355EVM"); 420 + MODULE_LICENSE("GPL");
+1
drivers/mfd/mfd-core.c
··· 34 34 goto fail_device; 35 35 36 36 pdev->dev.parent = parent; 37 + platform_set_drvdata(pdev, cell->driver_data); 37 38 38 39 ret = platform_device_add_data(pdev, 39 40 cell->platform_data, cell->data_size);
+255 -235
drivers/mfd/twl4030-core.c
··· 33 33 #include <linux/clk.h> 34 34 #include <linux/err.h> 35 35 36 + #include <linux/regulator/machine.h> 37 + 36 38 #include <linux/i2c.h> 37 39 #include <linux/i2c/twl4030.h> 38 40 ··· 71 69 #define twl_has_gpio() true 72 70 #else 73 71 #define twl_has_gpio() false 72 + #endif 73 + 74 + #if defined(CONFIG_REGULATOR_TWL4030) \ 75 + || defined(CONFIG_REGULATOR_TWL4030_MODULE) 76 + #define twl_has_regulator() true 77 + #else 78 + #define twl_has_regulator() false 74 79 #endif 75 80 76 81 #if defined(CONFIG_TWL4030_MADC) || defined(CONFIG_TWL4030_MADC_MODULE) ··· 158 149 #define HIGH_PERF_SQ (1 << 3) 159 150 160 151 152 + /* chip-specific feature flags, for i2c_device_id.driver_data */ 153 + #define TWL4030_VAUX2 BIT(0) /* pre-5030 voltage ranges */ 154 + #define TPS_SUBSET BIT(1) /* tps659[23]0 have fewer LDOs */ 155 + 161 156 /*----------------------------------------------------------------------*/ 162 157 163 158 /* is driver active, bound to a chip? */ ··· 238 225 * 239 226 * Returns the result of operation - 0 is success 240 227 */ 241 - int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, u8 num_bytes) 228 + int twl4030_i2c_write(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) 242 229 { 243 230 int ret; 244 231 int sid; ··· 287 274 * 288 275 * Returns result of operation - num_bytes is success else failure. 289 276 */ 290 - int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, u8 num_bytes) 277 + int twl4030_i2c_read(u8 mod_no, u8 *value, u8 reg, unsigned num_bytes) 291 278 { 292 279 int ret; 293 280 u8 val; ··· 365 352 366 353 /*----------------------------------------------------------------------*/ 367 354 355 + static struct device * 356 + add_numbered_child(unsigned chip, const char *name, int num, 357 + void *pdata, unsigned pdata_len, 358 + bool can_wakeup, int irq0, int irq1) 359 + { 360 + struct platform_device *pdev; 361 + struct twl4030_client *twl = &twl4030_modules[chip]; 362 + int status; 363 + 364 + pdev = platform_device_alloc(name, num); 365 + if (!pdev) { 366 + dev_dbg(&twl->client->dev, "can't alloc dev\n"); 367 + status = -ENOMEM; 368 + goto err; 369 + } 370 + 371 + device_init_wakeup(&pdev->dev, can_wakeup); 372 + pdev->dev.parent = &twl->client->dev; 373 + 374 + if (pdata) { 375 + status = platform_device_add_data(pdev, pdata, pdata_len); 376 + if (status < 0) { 377 + dev_dbg(&pdev->dev, "can't add platform_data\n"); 378 + goto err; 379 + } 380 + } 381 + 382 + if (irq0) { 383 + struct resource r[2] = { 384 + { .start = irq0, .flags = IORESOURCE_IRQ, }, 385 + { .start = irq1, .flags = IORESOURCE_IRQ, }, 386 + }; 387 + 388 + status = platform_device_add_resources(pdev, r, irq1 ? 2 : 1); 389 + if (status < 0) { 390 + dev_dbg(&pdev->dev, "can't add irqs\n"); 391 + goto err; 392 + } 393 + } 394 + 395 + status = platform_device_add(pdev); 396 + 397 + err: 398 + if (status < 0) { 399 + platform_device_put(pdev); 400 + dev_err(&twl->client->dev, "can't add %s dev\n", name); 401 + return ERR_PTR(status); 402 + } 403 + return &pdev->dev; 404 + } 405 + 406 + static inline struct device *add_child(unsigned chip, const char *name, 407 + void *pdata, unsigned pdata_len, 408 + bool can_wakeup, int irq0, int irq1) 409 + { 410 + return add_numbered_child(chip, name, -1, pdata, pdata_len, 411 + can_wakeup, irq0, irq1); 412 + } 413 + 414 + static struct device * 415 + add_regulator_linked(int num, struct regulator_init_data *pdata, 416 + struct regulator_consumer_supply *consumers, 417 + unsigned num_consumers) 418 + { 419 + /* regulator framework demands init_data ... */ 420 + if (!pdata) 421 + return NULL; 422 + 423 + if (consumers) { 424 + pdata->consumer_supplies = consumers; 425 + pdata->num_consumer_supplies = num_consumers; 426 + } 427 + 428 + /* NOTE: we currently ignore regulator IRQs, e.g. for short circuits */ 429 + return add_numbered_child(3, "twl4030_reg", num, 430 + pdata, sizeof(*pdata), false, 0, 0); 431 + } 432 + 433 + static struct device * 434 + add_regulator(int num, struct regulator_init_data *pdata) 435 + { 436 + return add_regulator_linked(num, pdata, NULL, 0); 437 + } 438 + 368 439 /* 369 440 * NOTE: We know the first 8 IRQs after pdata->base_irq are 370 441 * for the PIH, and the next are for the PWR_INT SIH, since 371 442 * that's how twl_init_irq() sets things up. 372 443 */ 373 444 374 - static int add_children(struct twl4030_platform_data *pdata) 445 + static int 446 + add_children(struct twl4030_platform_data *pdata, unsigned long features) 375 447 { 376 - struct platform_device *pdev = NULL; 377 - struct twl4030_client *twl = NULL; 378 - int status = 0; 448 + struct device *child; 449 + struct device *usb_transceiver = NULL; 379 450 380 - if (twl_has_bci() && pdata->bci) { 381 - twl = &twl4030_modules[3]; 382 - 383 - pdev = platform_device_alloc("twl4030_bci", -1); 384 - if (!pdev) { 385 - pr_debug("%s: can't alloc bci dev\n", DRIVER_NAME); 386 - status = -ENOMEM; 387 - goto err; 388 - } 389 - 390 - if (status == 0) { 391 - pdev->dev.parent = &twl->client->dev; 392 - status = platform_device_add_data(pdev, pdata->bci, 393 - sizeof(*pdata->bci)); 394 - if (status < 0) { 395 - dev_dbg(&twl->client->dev, 396 - "can't add bci data, %d\n", 397 - status); 398 - goto err; 399 - } 400 - } 401 - 402 - if (status == 0) { 403 - struct resource r = { 404 - .start = pdata->irq_base + 8 + 1, 405 - .flags = IORESOURCE_IRQ, 406 - }; 407 - 408 - status = platform_device_add_resources(pdev, &r, 1); 409 - } 410 - 411 - if (status == 0) 412 - status = platform_device_add(pdev); 413 - 414 - if (status < 0) { 415 - platform_device_put(pdev); 416 - dev_dbg(&twl->client->dev, 417 - "can't create bci dev, %d\n", 418 - status); 419 - goto err; 420 - } 451 + if (twl_has_bci() && pdata->bci && !(features & TPS_SUBSET)) { 452 + child = add_child(3, "twl4030_bci", 453 + pdata->bci, sizeof(*pdata->bci), 454 + false, 455 + /* irq0 = CHG_PRES, irq1 = BCI */ 456 + pdata->irq_base + 8 + 1, pdata->irq_base + 2); 457 + if (IS_ERR(child)) 458 + return PTR_ERR(child); 421 459 } 422 460 423 461 if (twl_has_gpio() && pdata->gpio) { 424 - twl = &twl4030_modules[1]; 425 - 426 - pdev = platform_device_alloc("twl4030_gpio", -1); 427 - if (!pdev) { 428 - pr_debug("%s: can't alloc gpio dev\n", DRIVER_NAME); 429 - status = -ENOMEM; 430 - goto err; 431 - } 432 - 433 - /* more driver model init */ 434 - if (status == 0) { 435 - pdev->dev.parent = &twl->client->dev; 436 - /* device_init_wakeup(&pdev->dev, 1); */ 437 - 438 - status = platform_device_add_data(pdev, pdata->gpio, 439 - sizeof(*pdata->gpio)); 440 - if (status < 0) { 441 - dev_dbg(&twl->client->dev, 442 - "can't add gpio data, %d\n", 443 - status); 444 - goto err; 445 - } 446 - } 447 - 448 - /* GPIO module IRQ */ 449 - if (status == 0) { 450 - struct resource r = { 451 - .start = pdata->irq_base + 0, 452 - .flags = IORESOURCE_IRQ, 453 - }; 454 - 455 - status = platform_device_add_resources(pdev, &r, 1); 456 - } 457 - 458 - if (status == 0) 459 - status = platform_device_add(pdev); 460 - 461 - if (status < 0) { 462 - platform_device_put(pdev); 463 - dev_dbg(&twl->client->dev, 464 - "can't create gpio dev, %d\n", 465 - status); 466 - goto err; 467 - } 462 + child = add_child(1, "twl4030_gpio", 463 + pdata->gpio, sizeof(*pdata->gpio), 464 + false, pdata->irq_base + 0, 0); 465 + if (IS_ERR(child)) 466 + return PTR_ERR(child); 468 467 } 469 468 470 469 if (twl_has_keypad() && pdata->keypad) { 471 - pdev = platform_device_alloc("twl4030_keypad", -1); 472 - if (pdev) { 473 - twl = &twl4030_modules[2]; 474 - pdev->dev.parent = &twl->client->dev; 475 - device_init_wakeup(&pdev->dev, 1); 476 - status = platform_device_add_data(pdev, pdata->keypad, 477 - sizeof(*pdata->keypad)); 478 - if (status < 0) { 479 - dev_dbg(&twl->client->dev, 480 - "can't add keypad data, %d\n", 481 - status); 482 - platform_device_put(pdev); 483 - goto err; 484 - } 485 - status = platform_device_add(pdev); 486 - if (status < 0) { 487 - platform_device_put(pdev); 488 - dev_dbg(&twl->client->dev, 489 - "can't create keypad dev, %d\n", 490 - status); 491 - goto err; 492 - } 493 - } else { 494 - pr_debug("%s: can't alloc keypad dev\n", DRIVER_NAME); 495 - status = -ENOMEM; 496 - goto err; 497 - } 470 + child = add_child(2, "twl4030_keypad", 471 + pdata->keypad, sizeof(*pdata->keypad), 472 + true, pdata->irq_base + 1, 0); 473 + if (IS_ERR(child)) 474 + return PTR_ERR(child); 498 475 } 499 476 500 477 if (twl_has_madc() && pdata->madc) { 501 - pdev = platform_device_alloc("twl4030_madc", -1); 502 - if (pdev) { 503 - twl = &twl4030_modules[2]; 504 - pdev->dev.parent = &twl->client->dev; 505 - device_init_wakeup(&pdev->dev, 1); 506 - status = platform_device_add_data(pdev, pdata->madc, 507 - sizeof(*pdata->madc)); 508 - if (status < 0) { 509 - platform_device_put(pdev); 510 - dev_dbg(&twl->client->dev, 511 - "can't add madc data, %d\n", 512 - status); 513 - goto err; 514 - } 515 - status = platform_device_add(pdev); 516 - if (status < 0) { 517 - platform_device_put(pdev); 518 - dev_dbg(&twl->client->dev, 519 - "can't create madc dev, %d\n", 520 - status); 521 - goto err; 522 - } 523 - } else { 524 - pr_debug("%s: can't alloc madc dev\n", DRIVER_NAME); 525 - status = -ENOMEM; 526 - goto err; 527 - } 478 + child = add_child(2, "twl4030_madc", 479 + pdata->madc, sizeof(*pdata->madc), 480 + true, pdata->irq_base + 3, 0); 481 + if (IS_ERR(child)) 482 + return PTR_ERR(child); 528 483 } 529 484 530 485 if (twl_has_rtc()) { 531 - twl = &twl4030_modules[3]; 532 - 533 - pdev = platform_device_alloc("twl4030_rtc", -1); 534 - if (!pdev) { 535 - pr_debug("%s: can't alloc rtc dev\n", DRIVER_NAME); 536 - status = -ENOMEM; 537 - } else { 538 - pdev->dev.parent = &twl->client->dev; 539 - device_init_wakeup(&pdev->dev, 1); 540 - } 541 - 542 486 /* 543 - * REVISIT platform_data here currently might use of 487 + * REVISIT platform_data here currently might expose the 544 488 * "msecure" line ... but for now we just expect board 545 - * setup to tell the chip "we are secure" at all times. 489 + * setup to tell the chip "it's always ok to SET_TIME". 546 490 * Eventually, Linux might become more aware of such 547 491 * HW security concerns, and "least privilege". 548 492 */ 549 - 550 - /* RTC module IRQ */ 551 - if (status == 0) { 552 - struct resource r = { 553 - .start = pdata->irq_base + 8 + 3, 554 - .flags = IORESOURCE_IRQ, 555 - }; 556 - 557 - status = platform_device_add_resources(pdev, &r, 1); 558 - } 559 - 560 - if (status == 0) 561 - status = platform_device_add(pdev); 562 - 563 - if (status < 0) { 564 - platform_device_put(pdev); 565 - dev_dbg(&twl->client->dev, 566 - "can't create rtc dev, %d\n", 567 - status); 568 - goto err; 569 - } 493 + child = add_child(3, "twl4030_rtc", 494 + NULL, 0, 495 + true, pdata->irq_base + 8 + 3, 0); 496 + if (IS_ERR(child)) 497 + return PTR_ERR(child); 570 498 } 571 499 572 500 if (twl_has_usb() && pdata->usb) { 573 - twl = &twl4030_modules[0]; 501 + child = add_child(0, "twl4030_usb", 502 + pdata->usb, sizeof(*pdata->usb), 503 + true, 504 + /* irq0 = USB_PRES, irq1 = USB */ 505 + pdata->irq_base + 8 + 2, pdata->irq_base + 4); 506 + if (IS_ERR(child)) 507 + return PTR_ERR(child); 574 508 575 - pdev = platform_device_alloc("twl4030_usb", -1); 576 - if (!pdev) { 577 - pr_debug("%s: can't alloc usb dev\n", DRIVER_NAME); 578 - status = -ENOMEM; 579 - goto err; 580 - } 581 - 582 - if (status == 0) { 583 - pdev->dev.parent = &twl->client->dev; 584 - device_init_wakeup(&pdev->dev, 1); 585 - status = platform_device_add_data(pdev, pdata->usb, 586 - sizeof(*pdata->usb)); 587 - if (status < 0) { 588 - platform_device_put(pdev); 589 - dev_dbg(&twl->client->dev, 590 - "can't add usb data, %d\n", 591 - status); 592 - goto err; 593 - } 594 - } 595 - 596 - if (status == 0) { 597 - struct resource r = { 598 - .start = pdata->irq_base + 8 + 2, 599 - .flags = IORESOURCE_IRQ, 600 - }; 601 - 602 - status = platform_device_add_resources(pdev, &r, 1); 603 - } 604 - 605 - if (status == 0) 606 - status = platform_device_add(pdev); 607 - 608 - if (status < 0) { 609 - platform_device_put(pdev); 610 - dev_dbg(&twl->client->dev, 611 - "can't create usb dev, %d\n", 612 - status); 613 - } 509 + /* we need to connect regulators to this transceiver */ 510 + usb_transceiver = child; 614 511 } 615 512 616 - err: 617 - if (status) 618 - pr_err("failed to add twl4030's children (status %d)\n", status); 619 - return status; 513 + if (twl_has_regulator()) { 514 + /* 515 + child = add_regulator(TWL4030_REG_VPLL1, pdata->vpll1); 516 + if (IS_ERR(child)) 517 + return PTR_ERR(child); 518 + */ 519 + 520 + child = add_regulator(TWL4030_REG_VMMC1, pdata->vmmc1); 521 + if (IS_ERR(child)) 522 + return PTR_ERR(child); 523 + 524 + child = add_regulator(TWL4030_REG_VDAC, pdata->vdac); 525 + if (IS_ERR(child)) 526 + return PTR_ERR(child); 527 + 528 + child = add_regulator((features & TWL4030_VAUX2) 529 + ? TWL4030_REG_VAUX2_4030 530 + : TWL4030_REG_VAUX2, 531 + pdata->vaux2); 532 + if (IS_ERR(child)) 533 + return PTR_ERR(child); 534 + } 535 + 536 + if (twl_has_regulator() && usb_transceiver) { 537 + static struct regulator_consumer_supply usb1v5 = { 538 + .supply = "usb1v5", 539 + }; 540 + static struct regulator_consumer_supply usb1v8 = { 541 + .supply = "usb1v8", 542 + }; 543 + static struct regulator_consumer_supply usb3v1 = { 544 + .supply = "usb3v1", 545 + }; 546 + 547 + /* this is a template that gets copied */ 548 + struct regulator_init_data usb_fixed = { 549 + .constraints.valid_modes_mask = 550 + REGULATOR_MODE_NORMAL 551 + | REGULATOR_MODE_STANDBY, 552 + .constraints.valid_ops_mask = 553 + REGULATOR_CHANGE_MODE 554 + | REGULATOR_CHANGE_STATUS, 555 + }; 556 + 557 + usb1v5.dev = usb_transceiver; 558 + usb1v8.dev = usb_transceiver; 559 + usb3v1.dev = usb_transceiver; 560 + 561 + child = add_regulator_linked(TWL4030_REG_VUSB1V5, &usb_fixed, 562 + &usb1v5, 1); 563 + if (IS_ERR(child)) 564 + return PTR_ERR(child); 565 + 566 + child = add_regulator_linked(TWL4030_REG_VUSB1V8, &usb_fixed, 567 + &usb1v8, 1); 568 + if (IS_ERR(child)) 569 + return PTR_ERR(child); 570 + 571 + child = add_regulator_linked(TWL4030_REG_VUSB3V1, &usb_fixed, 572 + &usb3v1, 1); 573 + if (IS_ERR(child)) 574 + return PTR_ERR(child); 575 + } 576 + 577 + /* maybe add LDOs that are omitted on cost-reduced parts */ 578 + if (twl_has_regulator() && !(features & TPS_SUBSET)) { 579 + /* 580 + child = add_regulator(TWL4030_REG_VPLL2, pdata->vpll2); 581 + if (IS_ERR(child)) 582 + return PTR_ERR(child); 583 + */ 584 + 585 + child = add_regulator(TWL4030_REG_VMMC2, pdata->vmmc2); 586 + if (IS_ERR(child)) 587 + return PTR_ERR(child); 588 + 589 + child = add_regulator(TWL4030_REG_VSIM, pdata->vsim); 590 + if (IS_ERR(child)) 591 + return PTR_ERR(child); 592 + 593 + child = add_regulator(TWL4030_REG_VAUX1, pdata->vaux1); 594 + if (IS_ERR(child)) 595 + return PTR_ERR(child); 596 + 597 + child = add_regulator(TWL4030_REG_VAUX3, pdata->vaux3); 598 + if (IS_ERR(child)) 599 + return PTR_ERR(child); 600 + 601 + child = add_regulator(TWL4030_REG_VAUX4, pdata->vaux4); 602 + if (IS_ERR(child)) 603 + return PTR_ERR(child); 604 + } 605 + 606 + return 0; 620 607 } 621 608 622 609 /*----------------------------------------------------------------------*/ ··· 658 645 osc = clk_get(NULL, "osc_ck"); 659 646 else 660 647 osc = clk_get(NULL, "osc_sys_ck"); 661 - #else 662 - /* REVISIT for non-OMAP systems, pass the clock rate from 663 - * board init code, using platform_data. 664 - */ 665 - osc = ERR_PTR(-EIO); 666 - #endif 648 + 667 649 if (IS_ERR(osc)) { 668 650 printk(KERN_WARNING "Skipping twl4030 internal clock init and " 669 651 "using bootloader value (unknown osc rate)\n"); ··· 667 659 668 660 rate = clk_get_rate(osc); 669 661 clk_put(osc); 662 + 663 + #else 664 + /* REVISIT for non-OMAP systems, pass the clock rate from 665 + * board init code, using platform_data. 666 + */ 667 + osc = ERR_PTR(-EIO); 668 + 669 + printk(KERN_WARNING "Skipping twl4030 internal clock init and " 670 + "using bootloader value (unknown osc rate)\n"); 671 + 672 + return; 673 + #endif 670 674 671 675 switch (rate) { 672 676 case 19200000: ··· 784 764 goto fail; 785 765 } 786 766 787 - status = add_children(pdata); 767 + status = add_children(pdata, id->driver_data); 788 768 fail: 789 769 if (status < 0) 790 770 twl4030_remove(client); ··· 792 772 } 793 773 794 774 static const struct i2c_device_id twl4030_ids[] = { 795 - { "twl4030", 0 }, /* "Triton 2" */ 796 - { "tps65950", 0 }, /* catalog version of twl4030 */ 797 - { "tps65930", 0 }, /* fewer LDOs and DACs; no charger */ 798 - { "tps65920", 0 }, /* fewer LDOs; no codec or charger */ 799 - { "twl5030", 0 }, /* T2 updated */ 775 + { "twl4030", TWL4030_VAUX2 }, /* "Triton 2" */ 776 + { "twl5030", 0 }, /* T2 updated */ 777 + { "tps65950", 0 }, /* catalog version of twl5030 */ 778 + { "tps65930", TPS_SUBSET }, /* fewer LDOs and DACs; no charger */ 779 + { "tps65920", TPS_SUBSET }, /* fewer LDOs; no codec or charger */ 800 780 { /* end of list */ }, 801 781 }; 802 782 MODULE_DEVICE_TABLE(i2c, twl4030_ids);
+26 -4
drivers/mfd/twl4030-irq.c
··· 180 180 static int twl4030_irq_thread(void *data) 181 181 { 182 182 long irq = (long)data; 183 - irq_desc_t *desc = irq_desc + irq; 183 + struct irq_desc *desc = irq_to_desc(irq); 184 184 static unsigned i2c_errors; 185 185 const static unsigned max_i2c_errors = 100; 186 + 187 + if (!desc) { 188 + pr_err("twl4030: Invalid IRQ: %ld\n", irq); 189 + return -EINVAL; 190 + } 186 191 187 192 current->flags |= PF_NOFREEZE; 188 193 ··· 220 215 pih_isr; 221 216 pih_isr >>= 1, module_irq++) { 222 217 if (pih_isr & 0x1) { 223 - irq_desc_t *d = irq_desc + module_irq; 218 + struct irq_desc *d = irq_to_desc(module_irq); 219 + 220 + if (!d) { 221 + pr_err("twl4030: Invalid SIH IRQ: %d\n", 222 + module_irq); 223 + return -EINVAL; 224 + } 224 225 225 226 /* These can't be masked ... always warn 226 227 * if we get any surprises. ··· 463 452 /* Modify only the bits we know must change */ 464 453 while (edge_change) { 465 454 int i = fls(edge_change) - 1; 466 - struct irq_desc *d = irq_desc + i + agent->irq_base; 455 + struct irq_desc *d = irq_to_desc(i + agent->irq_base); 467 456 int byte = 1 + (i >> 2); 468 457 int off = (i & 0x3) * 2; 458 + 459 + if (!d) { 460 + pr_err("twl4030: Invalid IRQ: %d\n", 461 + i + agent->irq_base); 462 + return; 463 + } 469 464 470 465 bytes[byte] &= ~(0x03 << off); 471 466 ··· 529 512 static int twl4030_sih_set_type(unsigned irq, unsigned trigger) 530 513 { 531 514 struct sih_agent *sih = get_irq_chip_data(irq); 532 - struct irq_desc *desc = irq_desc + irq; 515 + struct irq_desc *desc = irq_to_desc(irq); 533 516 unsigned long flags; 517 + 518 + if (!desc) { 519 + pr_err("twl4030: Invalid IRQ: %d\n", irq); 520 + return -EINVAL; 521 + } 534 522 535 523 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 536 524 return -EINVAL;
+241 -45
drivers/mfd/wm8350-core.c
··· 63 63 */ 64 64 static DEFINE_MUTEX(io_mutex); 65 65 static DEFINE_MUTEX(reg_lock_mutex); 66 - static DEFINE_MUTEX(auxadc_mutex); 67 66 68 67 /* Perform a physical read from the device. 69 68 */ ··· 298 299 } 299 300 EXPORT_SYMBOL_GPL(wm8350_block_write); 300 301 302 + /** 303 + * wm8350_reg_lock() 304 + * 305 + * The WM8350 has a hardware lock which can be used to prevent writes to 306 + * some registers (generally those which can cause particularly serious 307 + * problems if misused). This function enables that lock. 308 + */ 301 309 int wm8350_reg_lock(struct wm8350 *wm8350) 302 310 { 303 311 u16 key = WM8350_LOCK_KEY; ··· 320 314 } 321 315 EXPORT_SYMBOL_GPL(wm8350_reg_lock); 322 316 317 + /** 318 + * wm8350_reg_unlock() 319 + * 320 + * The WM8350 has a hardware lock which can be used to prevent writes to 321 + * some registers (generally those which can cause particularly serious 322 + * problems if misused). This function disables that lock so updates 323 + * can be performed. For maximum safety this should be done only when 324 + * required. 325 + */ 323 326 int wm8350_reg_unlock(struct wm8350 *wm8350) 324 327 { 325 328 u16 key = WM8350_UNLOCK_KEY; ··· 1081 1066 } 1082 1067 EXPORT_SYMBOL_GPL(wm8350_unmask_irq); 1083 1068 1069 + int wm8350_read_auxadc(struct wm8350 *wm8350, int channel, int scale, int vref) 1070 + { 1071 + u16 reg, result = 0; 1072 + int tries = 5; 1073 + 1074 + if (channel < WM8350_AUXADC_AUX1 || channel > WM8350_AUXADC_TEMP) 1075 + return -EINVAL; 1076 + if (channel >= WM8350_AUXADC_USB && channel <= WM8350_AUXADC_TEMP 1077 + && (scale != 0 || vref != 0)) 1078 + return -EINVAL; 1079 + 1080 + mutex_lock(&wm8350->auxadc_mutex); 1081 + 1082 + /* Turn on the ADC */ 1083 + reg = wm8350_reg_read(wm8350, WM8350_POWER_MGMT_5); 1084 + wm8350_reg_write(wm8350, WM8350_POWER_MGMT_5, reg | WM8350_AUXADC_ENA); 1085 + 1086 + if (scale || vref) { 1087 + reg = scale << 13; 1088 + reg |= vref << 12; 1089 + wm8350_reg_write(wm8350, WM8350_AUX1_READBACK + channel, reg); 1090 + } 1091 + 1092 + reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); 1093 + reg |= 1 << channel | WM8350_AUXADC_POLL; 1094 + wm8350_reg_write(wm8350, WM8350_DIGITISER_CONTROL_1, reg); 1095 + 1096 + do { 1097 + schedule_timeout_interruptible(1); 1098 + reg = wm8350_reg_read(wm8350, WM8350_DIGITISER_CONTROL_1); 1099 + } while (tries-- && (reg & WM8350_AUXADC_POLL)); 1100 + 1101 + if (!tries) 1102 + dev_err(wm8350->dev, "adc chn %d read timeout\n", channel); 1103 + else 1104 + result = wm8350_reg_read(wm8350, 1105 + WM8350_AUX1_READBACK + channel); 1106 + 1107 + /* Turn off the ADC */ 1108 + reg = wm8350_reg_read(wm8350, WM8350_POWER_MGMT_5); 1109 + wm8350_reg_write(wm8350, WM8350_POWER_MGMT_5, 1110 + reg & ~WM8350_AUXADC_ENA); 1111 + 1112 + mutex_unlock(&wm8350->auxadc_mutex); 1113 + 1114 + return result & WM8350_AUXADC_DATA1_MASK; 1115 + } 1116 + EXPORT_SYMBOL_GPL(wm8350_read_auxadc); 1117 + 1084 1118 /* 1085 1119 * Cache is always host endian. 1086 1120 */ 1087 - static int wm8350_create_cache(struct wm8350 *wm8350, int mode) 1121 + static int wm8350_create_cache(struct wm8350 *wm8350, int type, int mode) 1088 1122 { 1089 1123 int i, ret = 0; 1090 1124 u16 value; 1091 1125 const u16 *reg_map; 1092 1126 1093 - switch (mode) { 1094 - #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_0 1127 + switch (type) { 1095 1128 case 0: 1096 - reg_map = wm8350_mode0_defaults; 1097 - break; 1129 + switch (mode) { 1130 + #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_0 1131 + case 0: 1132 + reg_map = wm8350_mode0_defaults; 1133 + break; 1098 1134 #endif 1099 1135 #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_1 1100 - case 1: 1101 - reg_map = wm8350_mode1_defaults; 1102 - break; 1136 + case 1: 1137 + reg_map = wm8350_mode1_defaults; 1138 + break; 1103 1139 #endif 1104 1140 #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_2 1105 - case 2: 1106 - reg_map = wm8350_mode2_defaults; 1107 - break; 1141 + case 2: 1142 + reg_map = wm8350_mode2_defaults; 1143 + break; 1108 1144 #endif 1109 1145 #ifdef CONFIG_MFD_WM8350_CONFIG_MODE_3 1110 - case 3: 1111 - reg_map = wm8350_mode3_defaults; 1112 - break; 1146 + case 3: 1147 + reg_map = wm8350_mode3_defaults; 1148 + break; 1113 1149 #endif 1150 + default: 1151 + dev_err(wm8350->dev, 1152 + "WM8350 configuration mode %d not supported\n", 1153 + mode); 1154 + return -EINVAL; 1155 + } 1156 + break; 1157 + 1158 + case 1: 1159 + switch (mode) { 1160 + #ifdef CONFIG_MFD_WM8351_CONFIG_MODE_0 1161 + case 0: 1162 + reg_map = wm8351_mode0_defaults; 1163 + break; 1164 + #endif 1165 + #ifdef CONFIG_MFD_WM8351_CONFIG_MODE_1 1166 + case 1: 1167 + reg_map = wm8351_mode1_defaults; 1168 + break; 1169 + #endif 1170 + #ifdef CONFIG_MFD_WM8351_CONFIG_MODE_2 1171 + case 2: 1172 + reg_map = wm8351_mode2_defaults; 1173 + break; 1174 + #endif 1175 + #ifdef CONFIG_MFD_WM8351_CONFIG_MODE_3 1176 + case 3: 1177 + reg_map = wm8351_mode3_defaults; 1178 + break; 1179 + #endif 1180 + default: 1181 + dev_err(wm8350->dev, 1182 + "WM8351 configuration mode %d not supported\n", 1183 + mode); 1184 + return -EINVAL; 1185 + } 1186 + break; 1187 + 1188 + case 2: 1189 + switch (mode) { 1190 + #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_0 1191 + case 0: 1192 + reg_map = wm8352_mode0_defaults; 1193 + break; 1194 + #endif 1195 + #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_1 1196 + case 1: 1197 + reg_map = wm8352_mode1_defaults; 1198 + break; 1199 + #endif 1200 + #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_2 1201 + case 2: 1202 + reg_map = wm8352_mode2_defaults; 1203 + break; 1204 + #endif 1205 + #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_3 1206 + case 3: 1207 + reg_map = wm8352_mode3_defaults; 1208 + break; 1209 + #endif 1210 + default: 1211 + dev_err(wm8350->dev, 1212 + "WM8352 configuration mode %d not supported\n", 1213 + mode); 1214 + return -EINVAL; 1215 + } 1216 + break; 1217 + 1114 1218 default: 1115 - dev_err(wm8350->dev, "Configuration mode %d not supported\n", 1219 + dev_err(wm8350->dev, 1220 + "WM835x configuration mode %d not supported\n", 1116 1221 mode); 1117 1222 return -EINVAL; 1118 1223 } ··· 1298 1163 struct wm8350_platform_data *pdata) 1299 1164 { 1300 1165 int ret = -EINVAL; 1301 - u16 id1, id2, mask, mode; 1166 + u16 id1, id2, mask_rev; 1167 + u16 cust_id, mode, chip_rev; 1302 1168 1303 1169 /* get WM8350 revision and config mode */ 1304 1170 wm8350->read_dev(wm8350, WM8350_RESET_ID, sizeof(id1), &id1); 1305 1171 wm8350->read_dev(wm8350, WM8350_ID, sizeof(id2), &id2); 1172 + wm8350->read_dev(wm8350, WM8350_REVISION, sizeof(mask_rev), &mask_rev); 1306 1173 1307 1174 id1 = be16_to_cpu(id1); 1308 1175 id2 = be16_to_cpu(id2); 1176 + mask_rev = be16_to_cpu(mask_rev); 1309 1177 1310 - if (id1 == 0x6143) { 1311 - switch ((id2 & WM8350_CHIP_REV_MASK) >> 12) { 1312 - case WM8350_REV_E: 1313 - dev_info(wm8350->dev, "Found Rev E device\n"); 1314 - wm8350->rev = WM8350_REV_E; 1315 - break; 1316 - case WM8350_REV_F: 1317 - dev_info(wm8350->dev, "Found Rev F device\n"); 1318 - wm8350->rev = WM8350_REV_F; 1319 - break; 1320 - case WM8350_REV_G: 1321 - dev_info(wm8350->dev, "Found Rev G device\n"); 1322 - wm8350->rev = WM8350_REV_G; 1323 - break; 1324 - default: 1325 - /* For safety we refuse to run on unknown hardware */ 1326 - dev_info(wm8350->dev, "Found unknown rev\n"); 1327 - ret = -ENODEV; 1328 - goto err; 1329 - } 1330 - } else { 1331 - dev_info(wm8350->dev, "Device with ID %x is not a WM8350\n", 1332 - id1); 1178 + if (id1 != 0x6143) { 1179 + dev_err(wm8350->dev, 1180 + "Device with ID %x is not a WM8350\n", id1); 1333 1181 ret = -ENODEV; 1334 1182 goto err; 1335 1183 } 1336 1184 1337 1185 mode = id2 & WM8350_CONF_STS_MASK >> 10; 1338 - mask = id2 & WM8350_CUST_ID_MASK; 1339 - dev_info(wm8350->dev, "Config mode %d, ROM mask %d\n", mode, mask); 1186 + cust_id = id2 & WM8350_CUST_ID_MASK; 1187 + chip_rev = (id2 & WM8350_CHIP_REV_MASK) >> 12; 1188 + dev_info(wm8350->dev, 1189 + "CONF_STS %d, CUST_ID %d, MASK_REV %d, CHIP_REV %d\n", 1190 + mode, cust_id, mask_rev, chip_rev); 1340 1191 1341 - ret = wm8350_create_cache(wm8350, mode); 1192 + if (cust_id != 0) { 1193 + dev_err(wm8350->dev, "Unsupported CUST_ID\n"); 1194 + ret = -ENODEV; 1195 + goto err; 1196 + } 1197 + 1198 + switch (mask_rev) { 1199 + case 0: 1200 + wm8350->pmic.max_dcdc = WM8350_DCDC_6; 1201 + wm8350->pmic.max_isink = WM8350_ISINK_B; 1202 + 1203 + switch (chip_rev) { 1204 + case WM8350_REV_E: 1205 + dev_info(wm8350->dev, "WM8350 Rev E\n"); 1206 + break; 1207 + case WM8350_REV_F: 1208 + dev_info(wm8350->dev, "WM8350 Rev F\n"); 1209 + break; 1210 + case WM8350_REV_G: 1211 + dev_info(wm8350->dev, "WM8350 Rev G\n"); 1212 + wm8350->power.rev_g_coeff = 1; 1213 + break; 1214 + case WM8350_REV_H: 1215 + dev_info(wm8350->dev, "WM8350 Rev H\n"); 1216 + wm8350->power.rev_g_coeff = 1; 1217 + break; 1218 + default: 1219 + /* For safety we refuse to run on unknown hardware */ 1220 + dev_err(wm8350->dev, "Unknown WM8350 CHIP_REV\n"); 1221 + ret = -ENODEV; 1222 + goto err; 1223 + } 1224 + break; 1225 + 1226 + case 1: 1227 + wm8350->pmic.max_dcdc = WM8350_DCDC_4; 1228 + wm8350->pmic.max_isink = WM8350_ISINK_A; 1229 + 1230 + switch (chip_rev) { 1231 + case 0: 1232 + dev_info(wm8350->dev, "WM8351 Rev A\n"); 1233 + wm8350->power.rev_g_coeff = 1; 1234 + break; 1235 + 1236 + default: 1237 + dev_err(wm8350->dev, "Unknown WM8351 CHIP_REV\n"); 1238 + ret = -ENODEV; 1239 + goto err; 1240 + } 1241 + break; 1242 + 1243 + case 2: 1244 + wm8350->pmic.max_dcdc = WM8350_DCDC_6; 1245 + wm8350->pmic.max_isink = WM8350_ISINK_B; 1246 + 1247 + switch (chip_rev) { 1248 + case 0: 1249 + dev_info(wm8350->dev, "WM8352 Rev A\n"); 1250 + wm8350->power.rev_g_coeff = 1; 1251 + break; 1252 + 1253 + default: 1254 + dev_err(wm8350->dev, "Unknown WM8352 CHIP_REV\n"); 1255 + ret = -ENODEV; 1256 + goto err; 1257 + } 1258 + break; 1259 + 1260 + default: 1261 + dev_err(wm8350->dev, "Unknown MASK_REV\n"); 1262 + ret = -ENODEV; 1263 + goto err; 1264 + } 1265 + 1266 + ret = wm8350_create_cache(wm8350, mask_rev, mode); 1342 1267 if (ret < 0) { 1343 - printk(KERN_ERR "wm8350: failed to create register cache\n"); 1268 + dev_err(wm8350->dev, "Failed to create register cache\n"); 1344 1269 return ret; 1345 1270 } 1346 1271 1347 - if (pdata->init) { 1272 + if (pdata && pdata->init) { 1348 1273 ret = pdata->init(wm8350); 1349 1274 if (ret != 0) { 1350 1275 dev_err(wm8350->dev, "Platform init() failed: %d\n", ··· 1413 1218 } 1414 1219 } 1415 1220 1221 + mutex_init(&wm8350->auxadc_mutex); 1416 1222 mutex_init(&wm8350->irq_mutex); 1417 1223 INIT_WORK(&wm8350->irq_work, wm8350_irq_worker); 1418 1224 if (irq) {
+2 -2
drivers/mfd/wm8350-i2c.c
··· 1 1 /* 2 2 * wm8350-i2c.c -- Generic I2C driver for Wolfson WM8350 PMIC 3 3 * 4 - * This driver defines and configures the WM8350 for the Freescale i.MX32ADS. 5 - * 6 4 * Copyright 2007, 2008 Wolfson Microelectronics PLC. 7 5 * 8 6 * Author: Liam Girdwood ··· 97 99 98 100 static const struct i2c_device_id wm8350_i2c_id[] = { 99 101 { "wm8350", 0 }, 102 + { "wm8351", 0 }, 103 + { "wm8352", 0 }, 100 104 { } 101 105 }; 102 106 MODULE_DEVICE_TABLE(i2c, wm8350_i2c_id);
+2098 -2
drivers/mfd/wm8350-regmap.c
··· 1074 1074 }; 1075 1075 #endif 1076 1076 1077 + #ifdef CONFIG_MFD_WM8351_CONFIG_MODE_0 1078 + 1079 + #undef WM8350_HAVE_CONFIG_MODE 1080 + #define WM8350_HAVE_CONFIG_MODE 1081 + 1082 + const u16 wm8351_mode0_defaults[] = { 1083 + 0x6143, /* R0 - Reset/ID */ 1084 + 0x0000, /* R1 - ID */ 1085 + 0x0001, /* R2 - Revision */ 1086 + 0x1C02, /* R3 - System Control 1 */ 1087 + 0x0004, /* R4 - System Control 2 */ 1088 + 0x0000, /* R5 - System Hibernate */ 1089 + 0x8A00, /* R6 - Interface Control */ 1090 + 0x0000, /* R7 */ 1091 + 0x8000, /* R8 - Power mgmt (1) */ 1092 + 0x0000, /* R9 - Power mgmt (2) */ 1093 + 0x0000, /* R10 - Power mgmt (3) */ 1094 + 0x2000, /* R11 - Power mgmt (4) */ 1095 + 0x0E00, /* R12 - Power mgmt (5) */ 1096 + 0x0000, /* R13 - Power mgmt (6) */ 1097 + 0x0000, /* R14 - Power mgmt (7) */ 1098 + 0x0000, /* R15 */ 1099 + 0x0000, /* R16 - RTC Seconds/Minutes */ 1100 + 0x0100, /* R17 - RTC Hours/Day */ 1101 + 0x0101, /* R18 - RTC Date/Month */ 1102 + 0x1400, /* R19 - RTC Year */ 1103 + 0x0000, /* R20 - Alarm Seconds/Minutes */ 1104 + 0x0000, /* R21 - Alarm Hours/Day */ 1105 + 0x0000, /* R22 - Alarm Date/Month */ 1106 + 0x0320, /* R23 - RTC Time Control */ 1107 + 0x0000, /* R24 - System Interrupts */ 1108 + 0x0000, /* R25 - Interrupt Status 1 */ 1109 + 0x0000, /* R26 - Interrupt Status 2 */ 1110 + 0x0000, /* R27 */ 1111 + 0x0000, /* R28 - Under Voltage Interrupt status */ 1112 + 0x0000, /* R29 - Over Current Interrupt status */ 1113 + 0x0000, /* R30 - GPIO Interrupt Status */ 1114 + 0x0000, /* R31 - Comparator Interrupt Status */ 1115 + 0x3FFF, /* R32 - System Interrupts Mask */ 1116 + 0x0000, /* R33 - Interrupt Status 1 Mask */ 1117 + 0x0000, /* R34 - Interrupt Status 2 Mask */ 1118 + 0x0000, /* R35 */ 1119 + 0x0000, /* R36 - Under Voltage Interrupt status Mask */ 1120 + 0x0000, /* R37 - Over Current Interrupt status Mask */ 1121 + 0x0000, /* R38 - GPIO Interrupt Status Mask */ 1122 + 0x0000, /* R39 - Comparator Interrupt Status Mask */ 1123 + 0x0040, /* R40 - Clock Control 1 */ 1124 + 0x0000, /* R41 - Clock Control 2 */ 1125 + 0x3A00, /* R42 - FLL Control 1 */ 1126 + 0x7086, /* R43 - FLL Control 2 */ 1127 + 0xC226, /* R44 - FLL Control 3 */ 1128 + 0x0000, /* R45 - FLL Control 4 */ 1129 + 0x0000, /* R46 */ 1130 + 0x0000, /* R47 */ 1131 + 0x0000, /* R48 - DAC Control */ 1132 + 0x0000, /* R49 */ 1133 + 0x00C0, /* R50 - DAC Digital Volume L */ 1134 + 0x00C0, /* R51 - DAC Digital Volume R */ 1135 + 0x0000, /* R52 */ 1136 + 0x0040, /* R53 - DAC LR Rate */ 1137 + 0x0000, /* R54 - DAC Clock Control */ 1138 + 0x0000, /* R55 */ 1139 + 0x0000, /* R56 */ 1140 + 0x0000, /* R57 */ 1141 + 0x4000, /* R58 - DAC Mute */ 1142 + 0x0000, /* R59 - DAC Mute Volume */ 1143 + 0x0000, /* R60 - DAC Side */ 1144 + 0x0000, /* R61 */ 1145 + 0x0000, /* R62 */ 1146 + 0x0000, /* R63 */ 1147 + 0x8000, /* R64 - ADC Control */ 1148 + 0x0000, /* R65 */ 1149 + 0x00C0, /* R66 - ADC Digital Volume L */ 1150 + 0x00C0, /* R67 - ADC Digital Volume R */ 1151 + 0x0000, /* R68 - ADC Divider */ 1152 + 0x0000, /* R69 */ 1153 + 0x0040, /* R70 - ADC LR Rate */ 1154 + 0x0000, /* R71 */ 1155 + 0x0303, /* R72 - Input Control */ 1156 + 0x0000, /* R73 - IN3 Input Control */ 1157 + 0x0000, /* R74 - Mic Bias Control */ 1158 + 0x0000, /* R75 */ 1159 + 0x0000, /* R76 - Output Control */ 1160 + 0x0000, /* R77 - Jack Detect */ 1161 + 0x0000, /* R78 - Anti Pop Control */ 1162 + 0x0000, /* R79 */ 1163 + 0x0040, /* R80 - Left Input Volume */ 1164 + 0x0040, /* R81 - Right Input Volume */ 1165 + 0x0000, /* R82 */ 1166 + 0x0000, /* R83 */ 1167 + 0x0000, /* R84 */ 1168 + 0x0000, /* R85 */ 1169 + 0x0000, /* R86 */ 1170 + 0x0000, /* R87 */ 1171 + 0x0800, /* R88 - Left Mixer Control */ 1172 + 0x1000, /* R89 - Right Mixer Control */ 1173 + 0x0000, /* R90 */ 1174 + 0x0000, /* R91 */ 1175 + 0x0000, /* R92 - OUT3 Mixer Control */ 1176 + 0x0000, /* R93 - OUT4 Mixer Control */ 1177 + 0x0000, /* R94 */ 1178 + 0x0000, /* R95 */ 1179 + 0x0000, /* R96 - Output Left Mixer Volume */ 1180 + 0x0000, /* R97 - Output Right Mixer Volume */ 1181 + 0x0000, /* R98 - Input Mixer Volume L */ 1182 + 0x0000, /* R99 - Input Mixer Volume R */ 1183 + 0x0000, /* R100 - Input Mixer Volume */ 1184 + 0x0000, /* R101 */ 1185 + 0x0000, /* R102 */ 1186 + 0x0000, /* R103 */ 1187 + 0x00E4, /* R104 - OUT1L Volume */ 1188 + 0x00E4, /* R105 - OUT1R Volume */ 1189 + 0x00E4, /* R106 - OUT2L Volume */ 1190 + 0x02E4, /* R107 - OUT2R Volume */ 1191 + 0x0000, /* R108 */ 1192 + 0x0000, /* R109 */ 1193 + 0x0000, /* R110 */ 1194 + 0x0000, /* R111 - BEEP Volume */ 1195 + 0x0A00, /* R112 - AI Formating */ 1196 + 0x0000, /* R113 - ADC DAC COMP */ 1197 + 0x0020, /* R114 - AI ADC Control */ 1198 + 0x0020, /* R115 - AI DAC Control */ 1199 + 0x0000, /* R116 */ 1200 + 0x0000, /* R117 */ 1201 + 0x0000, /* R118 */ 1202 + 0x0000, /* R119 */ 1203 + 0x0000, /* R120 */ 1204 + 0x0000, /* R121 */ 1205 + 0x0000, /* R122 */ 1206 + 0x0000, /* R123 */ 1207 + 0x0000, /* R124 */ 1208 + 0x0000, /* R125 */ 1209 + 0x0000, /* R126 */ 1210 + 0x0000, /* R127 */ 1211 + 0x1FFF, /* R128 - GPIO Debounce */ 1212 + 0x0000, /* R129 - GPIO Pin pull up Control */ 1213 + 0x0000, /* R130 - GPIO Pull down Control */ 1214 + 0x0000, /* R131 - GPIO Interrupt Mode */ 1215 + 0x0000, /* R132 */ 1216 + 0x0000, /* R133 - GPIO Control */ 1217 + 0x0FFC, /* R134 - GPIO Configuration (i/o) */ 1218 + 0x0FFC, /* R135 - GPIO Pin Polarity / Type */ 1219 + 0x0000, /* R136 */ 1220 + 0x0000, /* R137 */ 1221 + 0x0000, /* R138 */ 1222 + 0x0000, /* R139 */ 1223 + 0x0013, /* R140 - GPIO Function Select 1 */ 1224 + 0x0000, /* R141 - GPIO Function Select 2 */ 1225 + 0x0000, /* R142 - GPIO Function Select 3 */ 1226 + 0x0003, /* R143 - GPIO Function Select 4 */ 1227 + 0x0000, /* R144 - Digitiser Control (1) */ 1228 + 0x0002, /* R145 - Digitiser Control (2) */ 1229 + 0x0000, /* R146 */ 1230 + 0x0000, /* R147 */ 1231 + 0x0000, /* R148 */ 1232 + 0x0000, /* R149 */ 1233 + 0x0000, /* R150 */ 1234 + 0x0000, /* R151 */ 1235 + 0x7000, /* R152 - AUX1 Readback */ 1236 + 0x7000, /* R153 - AUX2 Readback */ 1237 + 0x7000, /* R154 - AUX3 Readback */ 1238 + 0x7000, /* R155 - AUX4 Readback */ 1239 + 0x0000, /* R156 - USB Voltage Readback */ 1240 + 0x0000, /* R157 - LINE Voltage Readback */ 1241 + 0x0000, /* R158 - BATT Voltage Readback */ 1242 + 0x0000, /* R159 - Chip Temp Readback */ 1243 + 0x0000, /* R160 */ 1244 + 0x0000, /* R161 */ 1245 + 0x0000, /* R162 */ 1246 + 0x0000, /* R163 - Generic Comparator Control */ 1247 + 0x0000, /* R164 - Generic comparator 1 */ 1248 + 0x0000, /* R165 - Generic comparator 2 */ 1249 + 0x0000, /* R166 - Generic comparator 3 */ 1250 + 0x0000, /* R167 - Generic comparator 4 */ 1251 + 0xA00F, /* R168 - Battery Charger Control 1 */ 1252 + 0x0B06, /* R169 - Battery Charger Control 2 */ 1253 + 0x0000, /* R170 - Battery Charger Control 3 */ 1254 + 0x0000, /* R171 */ 1255 + 0x0000, /* R172 - Current Sink Driver A */ 1256 + 0x0000, /* R173 - CSA Flash control */ 1257 + 0x0000, /* R174 */ 1258 + 0x0000, /* R175 */ 1259 + 0x0000, /* R176 - DCDC/LDO requested */ 1260 + 0x032D, /* R177 - DCDC Active options */ 1261 + 0x0000, /* R178 - DCDC Sleep options */ 1262 + 0x0025, /* R179 - Power-check comparator */ 1263 + 0x000E, /* R180 - DCDC1 Control */ 1264 + 0x0000, /* R181 - DCDC1 Timeouts */ 1265 + 0x1006, /* R182 - DCDC1 Low Power */ 1266 + 0x0018, /* R183 - DCDC2 Control */ 1267 + 0x0000, /* R184 - DCDC2 Timeouts */ 1268 + 0x0000, /* R185 */ 1269 + 0x0000, /* R186 - DCDC3 Control */ 1270 + 0x0000, /* R187 - DCDC3 Timeouts */ 1271 + 0x0006, /* R188 - DCDC3 Low Power */ 1272 + 0x0000, /* R189 - DCDC4 Control */ 1273 + 0x0000, /* R190 - DCDC4 Timeouts */ 1274 + 0x0006, /* R191 - DCDC4 Low Power */ 1275 + 0x0008, /* R192 */ 1276 + 0x0000, /* R193 */ 1277 + 0x0000, /* R194 */ 1278 + 0x0000, /* R195 */ 1279 + 0x0000, /* R196 */ 1280 + 0x0006, /* R197 */ 1281 + 0x0000, /* R198 */ 1282 + 0x0003, /* R199 - Limit Switch Control */ 1283 + 0x001C, /* R200 - LDO1 Control */ 1284 + 0x0000, /* R201 - LDO1 Timeouts */ 1285 + 0x001C, /* R202 - LDO1 Low Power */ 1286 + 0x001B, /* R203 - LDO2 Control */ 1287 + 0x0000, /* R204 - LDO2 Timeouts */ 1288 + 0x001C, /* R205 - LDO2 Low Power */ 1289 + 0x001B, /* R206 - LDO3 Control */ 1290 + 0x0000, /* R207 - LDO3 Timeouts */ 1291 + 0x001C, /* R208 - LDO3 Low Power */ 1292 + 0x001B, /* R209 - LDO4 Control */ 1293 + 0x0000, /* R210 - LDO4 Timeouts */ 1294 + 0x001C, /* R211 - LDO4 Low Power */ 1295 + 0x0000, /* R212 */ 1296 + 0x0000, /* R213 */ 1297 + 0x0000, /* R214 */ 1298 + 0x0000, /* R215 - VCC_FAULT Masks */ 1299 + 0x001F, /* R216 - Main Bandgap Control */ 1300 + 0x0000, /* R217 - OSC Control */ 1301 + 0x9000, /* R218 - RTC Tick Control */ 1302 + 0x0000, /* R219 - Security1 */ 1303 + 0x4000, /* R220 */ 1304 + 0x0000, /* R221 */ 1305 + 0x0000, /* R222 */ 1306 + 0x0000, /* R223 */ 1307 + 0x0000, /* R224 - Signal overrides */ 1308 + 0x0000, /* R225 - DCDC/LDO status */ 1309 + 0x0000, /* R226 - Charger Overides/status */ 1310 + 0x0000, /* R227 - misc overrides */ 1311 + 0x0000, /* R228 - Supply overrides/status 1 */ 1312 + 0x0000, /* R229 - Supply overrides/status 2 */ 1313 + 0xE000, /* R230 - GPIO Pin Status */ 1314 + 0x0000, /* R231 - comparotor overrides */ 1315 + 0x0000, /* R232 */ 1316 + 0x0000, /* R233 - State Machine status */ 1317 + 0x1200, /* R234 - FLL Test 1 */ 1318 + 0x0000, /* R235 */ 1319 + 0x8000, /* R236 */ 1320 + 0x0000, /* R237 */ 1321 + 0x0000, /* R238 */ 1322 + 0x0000, /* R239 */ 1323 + 0x0003, /* R240 */ 1324 + 0x0000, /* R241 */ 1325 + 0x0000, /* R242 */ 1326 + 0x0004, /* R243 */ 1327 + 0x0300, /* R244 */ 1328 + 0x0000, /* R245 */ 1329 + 0x0200, /* R246 */ 1330 + 0x0000, /* R247 */ 1331 + 0x1000, /* R248 - DCDC1 Test Controls */ 1332 + 0x1000, /* R249 */ 1333 + 0x1000, /* R250 - DCDC3 Test Controls */ 1334 + 0x1000, /* R251 - DCDC4 Test Controls */ 1335 + }; 1336 + #endif 1337 + 1338 + #ifdef CONFIG_MFD_WM8351_CONFIG_MODE_1 1339 + 1340 + #undef WM8350_HAVE_CONFIG_MODE 1341 + #define WM8350_HAVE_CONFIG_MODE 1342 + 1343 + const u16 wm8351_mode1_defaults[] = { 1344 + 0x6143, /* R0 - Reset/ID */ 1345 + 0x0000, /* R1 - ID */ 1346 + 0x0001, /* R2 - Revision */ 1347 + 0x1C02, /* R3 - System Control 1 */ 1348 + 0x0204, /* R4 - System Control 2 */ 1349 + 0x0000, /* R5 - System Hibernate */ 1350 + 0x8A00, /* R6 - Interface Control */ 1351 + 0x0000, /* R7 */ 1352 + 0x8000, /* R8 - Power mgmt (1) */ 1353 + 0x0000, /* R9 - Power mgmt (2) */ 1354 + 0x0000, /* R10 - Power mgmt (3) */ 1355 + 0x2000, /* R11 - Power mgmt (4) */ 1356 + 0x0E00, /* R12 - Power mgmt (5) */ 1357 + 0x0000, /* R13 - Power mgmt (6) */ 1358 + 0x0000, /* R14 - Power mgmt (7) */ 1359 + 0x0000, /* R15 */ 1360 + 0x0000, /* R16 - RTC Seconds/Minutes */ 1361 + 0x0100, /* R17 - RTC Hours/Day */ 1362 + 0x0101, /* R18 - RTC Date/Month */ 1363 + 0x1400, /* R19 - RTC Year */ 1364 + 0x0000, /* R20 - Alarm Seconds/Minutes */ 1365 + 0x0000, /* R21 - Alarm Hours/Day */ 1366 + 0x0000, /* R22 - Alarm Date/Month */ 1367 + 0x0320, /* R23 - RTC Time Control */ 1368 + 0x0000, /* R24 - System Interrupts */ 1369 + 0x0000, /* R25 - Interrupt Status 1 */ 1370 + 0x0000, /* R26 - Interrupt Status 2 */ 1371 + 0x0000, /* R27 */ 1372 + 0x0000, /* R28 - Under Voltage Interrupt status */ 1373 + 0x0000, /* R29 - Over Current Interrupt status */ 1374 + 0x0000, /* R30 - GPIO Interrupt Status */ 1375 + 0x0000, /* R31 - Comparator Interrupt Status */ 1376 + 0x3FFF, /* R32 - System Interrupts Mask */ 1377 + 0x0000, /* R33 - Interrupt Status 1 Mask */ 1378 + 0x0000, /* R34 - Interrupt Status 2 Mask */ 1379 + 0x0000, /* R35 */ 1380 + 0x0000, /* R36 - Under Voltage Interrupt status Mask */ 1381 + 0x0000, /* R37 - Over Current Interrupt status Mask */ 1382 + 0x0000, /* R38 - GPIO Interrupt Status Mask */ 1383 + 0x0000, /* R39 - Comparator Interrupt Status Mask */ 1384 + 0x0040, /* R40 - Clock Control 1 */ 1385 + 0x0000, /* R41 - Clock Control 2 */ 1386 + 0x3A00, /* R42 - FLL Control 1 */ 1387 + 0x7086, /* R43 - FLL Control 2 */ 1388 + 0xC226, /* R44 - FLL Control 3 */ 1389 + 0x0000, /* R45 - FLL Control 4 */ 1390 + 0x0000, /* R46 */ 1391 + 0x0000, /* R47 */ 1392 + 0x0000, /* R48 - DAC Control */ 1393 + 0x0000, /* R49 */ 1394 + 0x00C0, /* R50 - DAC Digital Volume L */ 1395 + 0x00C0, /* R51 - DAC Digital Volume R */ 1396 + 0x0000, /* R52 */ 1397 + 0x0040, /* R53 - DAC LR Rate */ 1398 + 0x0000, /* R54 - DAC Clock Control */ 1399 + 0x0000, /* R55 */ 1400 + 0x0000, /* R56 */ 1401 + 0x0000, /* R57 */ 1402 + 0x4000, /* R58 - DAC Mute */ 1403 + 0x0000, /* R59 - DAC Mute Volume */ 1404 + 0x0000, /* R60 - DAC Side */ 1405 + 0x0000, /* R61 */ 1406 + 0x0000, /* R62 */ 1407 + 0x0000, /* R63 */ 1408 + 0x8000, /* R64 - ADC Control */ 1409 + 0x0000, /* R65 */ 1410 + 0x00C0, /* R66 - ADC Digital Volume L */ 1411 + 0x00C0, /* R67 - ADC Digital Volume R */ 1412 + 0x0000, /* R68 - ADC Divider */ 1413 + 0x0000, /* R69 */ 1414 + 0x0040, /* R70 - ADC LR Rate */ 1415 + 0x0000, /* R71 */ 1416 + 0x0303, /* R72 - Input Control */ 1417 + 0x0000, /* R73 - IN3 Input Control */ 1418 + 0x0000, /* R74 - Mic Bias Control */ 1419 + 0x0000, /* R75 */ 1420 + 0x0000, /* R76 - Output Control */ 1421 + 0x0000, /* R77 - Jack Detect */ 1422 + 0x0000, /* R78 - Anti Pop Control */ 1423 + 0x0000, /* R79 */ 1424 + 0x0040, /* R80 - Left Input Volume */ 1425 + 0x0040, /* R81 - Right Input Volume */ 1426 + 0x0000, /* R82 */ 1427 + 0x0000, /* R83 */ 1428 + 0x0000, /* R84 */ 1429 + 0x0000, /* R85 */ 1430 + 0x0000, /* R86 */ 1431 + 0x0000, /* R87 */ 1432 + 0x0800, /* R88 - Left Mixer Control */ 1433 + 0x1000, /* R89 - Right Mixer Control */ 1434 + 0x0000, /* R90 */ 1435 + 0x0000, /* R91 */ 1436 + 0x0000, /* R92 - OUT3 Mixer Control */ 1437 + 0x0000, /* R93 - OUT4 Mixer Control */ 1438 + 0x0000, /* R94 */ 1439 + 0x0000, /* R95 */ 1440 + 0x0000, /* R96 - Output Left Mixer Volume */ 1441 + 0x0000, /* R97 - Output Right Mixer Volume */ 1442 + 0x0000, /* R98 - Input Mixer Volume L */ 1443 + 0x0000, /* R99 - Input Mixer Volume R */ 1444 + 0x0000, /* R100 - Input Mixer Volume */ 1445 + 0x0000, /* R101 */ 1446 + 0x0000, /* R102 */ 1447 + 0x0000, /* R103 */ 1448 + 0x00E4, /* R104 - OUT1L Volume */ 1449 + 0x00E4, /* R105 - OUT1R Volume */ 1450 + 0x00E4, /* R106 - OUT2L Volume */ 1451 + 0x02E4, /* R107 - OUT2R Volume */ 1452 + 0x0000, /* R108 */ 1453 + 0x0000, /* R109 */ 1454 + 0x0000, /* R110 */ 1455 + 0x0000, /* R111 - BEEP Volume */ 1456 + 0x0A00, /* R112 - AI Formating */ 1457 + 0x0000, /* R113 - ADC DAC COMP */ 1458 + 0x0020, /* R114 - AI ADC Control */ 1459 + 0x0020, /* R115 - AI DAC Control */ 1460 + 0x0000, /* R116 */ 1461 + 0x0000, /* R117 */ 1462 + 0x0000, /* R118 */ 1463 + 0x0000, /* R119 */ 1464 + 0x0000, /* R120 */ 1465 + 0x0000, /* R121 */ 1466 + 0x0000, /* R122 */ 1467 + 0x0000, /* R123 */ 1468 + 0x0000, /* R124 */ 1469 + 0x0000, /* R125 */ 1470 + 0x0000, /* R126 */ 1471 + 0x0000, /* R127 */ 1472 + 0x1FFF, /* R128 - GPIO Debounce */ 1473 + 0x0000, /* R129 - GPIO Pin pull up Control */ 1474 + 0x0000, /* R130 - GPIO Pull down Control */ 1475 + 0x0000, /* R131 - GPIO Interrupt Mode */ 1476 + 0x0000, /* R132 */ 1477 + 0x0000, /* R133 - GPIO Control */ 1478 + 0x0CFB, /* R134 - GPIO Configuration (i/o) */ 1479 + 0x0C1F, /* R135 - GPIO Pin Polarity / Type */ 1480 + 0x0000, /* R136 */ 1481 + 0x0000, /* R137 */ 1482 + 0x0000, /* R138 */ 1483 + 0x0000, /* R139 */ 1484 + 0x0300, /* R140 - GPIO Function Select 1 */ 1485 + 0x1110, /* R141 - GPIO Function Select 2 */ 1486 + 0x0013, /* R142 - GPIO Function Select 3 */ 1487 + 0x0003, /* R143 - GPIO Function Select 4 */ 1488 + 0x0000, /* R144 - Digitiser Control (1) */ 1489 + 0x0002, /* R145 - Digitiser Control (2) */ 1490 + 0x0000, /* R146 */ 1491 + 0x0000, /* R147 */ 1492 + 0x0000, /* R148 */ 1493 + 0x0000, /* R149 */ 1494 + 0x0000, /* R150 */ 1495 + 0x0000, /* R151 */ 1496 + 0x7000, /* R152 - AUX1 Readback */ 1497 + 0x7000, /* R153 - AUX2 Readback */ 1498 + 0x7000, /* R154 - AUX3 Readback */ 1499 + 0x7000, /* R155 - AUX4 Readback */ 1500 + 0x0000, /* R156 - USB Voltage Readback */ 1501 + 0x0000, /* R157 - LINE Voltage Readback */ 1502 + 0x0000, /* R158 - BATT Voltage Readback */ 1503 + 0x0000, /* R159 - Chip Temp Readback */ 1504 + 0x0000, /* R160 */ 1505 + 0x0000, /* R161 */ 1506 + 0x0000, /* R162 */ 1507 + 0x0000, /* R163 - Generic Comparator Control */ 1508 + 0x0000, /* R164 - Generic comparator 1 */ 1509 + 0x0000, /* R165 - Generic comparator 2 */ 1510 + 0x0000, /* R166 - Generic comparator 3 */ 1511 + 0x0000, /* R167 - Generic comparator 4 */ 1512 + 0xA00F, /* R168 - Battery Charger Control 1 */ 1513 + 0x0B06, /* R169 - Battery Charger Control 2 */ 1514 + 0x0000, /* R170 - Battery Charger Control 3 */ 1515 + 0x0000, /* R171 */ 1516 + 0x0000, /* R172 - Current Sink Driver A */ 1517 + 0x0000, /* R173 - CSA Flash control */ 1518 + 0x0000, /* R174 */ 1519 + 0x0000, /* R175 */ 1520 + 0x0000, /* R176 - DCDC/LDO requested */ 1521 + 0x032D, /* R177 - DCDC Active options */ 1522 + 0x0000, /* R178 - DCDC Sleep options */ 1523 + 0x0025, /* R179 - Power-check comparator */ 1524 + 0x000E, /* R180 - DCDC1 Control */ 1525 + 0x0C00, /* R181 - DCDC1 Timeouts */ 1526 + 0x1006, /* R182 - DCDC1 Low Power */ 1527 + 0x0018, /* R183 - DCDC2 Control */ 1528 + 0x0000, /* R184 - DCDC2 Timeouts */ 1529 + 0x0000, /* R185 */ 1530 + 0x0026, /* R186 - DCDC3 Control */ 1531 + 0x0400, /* R187 - DCDC3 Timeouts */ 1532 + 0x0006, /* R188 - DCDC3 Low Power */ 1533 + 0x0062, /* R189 - DCDC4 Control */ 1534 + 0x0800, /* R190 - DCDC4 Timeouts */ 1535 + 0x0006, /* R191 - DCDC4 Low Power */ 1536 + 0x0008, /* R192 */ 1537 + 0x0000, /* R193 */ 1538 + 0x0000, /* R194 */ 1539 + 0x000A, /* R195 */ 1540 + 0x1000, /* R196 */ 1541 + 0x0006, /* R197 */ 1542 + 0x0000, /* R198 */ 1543 + 0x0003, /* R199 - Limit Switch Control */ 1544 + 0x0006, /* R200 - LDO1 Control */ 1545 + 0x0000, /* R201 - LDO1 Timeouts */ 1546 + 0x001C, /* R202 - LDO1 Low Power */ 1547 + 0x0010, /* R203 - LDO2 Control */ 1548 + 0x0C00, /* R204 - LDO2 Timeouts */ 1549 + 0x001C, /* R205 - LDO2 Low Power */ 1550 + 0x001F, /* R206 - LDO3 Control */ 1551 + 0x0800, /* R207 - LDO3 Timeouts */ 1552 + 0x001C, /* R208 - LDO3 Low Power */ 1553 + 0x000A, /* R209 - LDO4 Control */ 1554 + 0x0800, /* R210 - LDO4 Timeouts */ 1555 + 0x001C, /* R211 - LDO4 Low Power */ 1556 + 0x0000, /* R212 */ 1557 + 0x0000, /* R213 */ 1558 + 0x0000, /* R214 */ 1559 + 0x0000, /* R215 - VCC_FAULT Masks */ 1560 + 0x001F, /* R216 - Main Bandgap Control */ 1561 + 0x0000, /* R217 - OSC Control */ 1562 + 0x9000, /* R218 - RTC Tick Control */ 1563 + 0x0000, /* R219 - Security1 */ 1564 + 0x4000, /* R220 */ 1565 + 0x0000, /* R221 */ 1566 + 0x0000, /* R222 */ 1567 + 0x0000, /* R223 */ 1568 + 0x0000, /* R224 - Signal overrides */ 1569 + 0x0000, /* R225 - DCDC/LDO status */ 1570 + 0x0000, /* R226 - Charger Overides/status */ 1571 + 0x0000, /* R227 - misc overrides */ 1572 + 0x0000, /* R228 - Supply overrides/status 1 */ 1573 + 0x0000, /* R229 - Supply overrides/status 2 */ 1574 + 0xE000, /* R230 - GPIO Pin Status */ 1575 + 0x0000, /* R231 - comparotor overrides */ 1576 + 0x0000, /* R232 */ 1577 + 0x0000, /* R233 - State Machine status */ 1578 + 0x1200, /* R234 - FLL Test 1 */ 1579 + 0x0000, /* R235 */ 1580 + 0x8000, /* R236 */ 1581 + 0x0000, /* R237 */ 1582 + 0x0000, /* R238 */ 1583 + 0x0000, /* R239 */ 1584 + 0x0003, /* R240 */ 1585 + 0x0000, /* R241 */ 1586 + 0x0000, /* R242 */ 1587 + 0x0004, /* R243 */ 1588 + 0x0300, /* R244 */ 1589 + 0x0000, /* R245 */ 1590 + 0x0200, /* R246 */ 1591 + 0x1000, /* R247 */ 1592 + 0x1000, /* R248 - DCDC1 Test Controls */ 1593 + 0x1000, /* R249 */ 1594 + 0x1000, /* R250 - DCDC3 Test Controls */ 1595 + 0x1000, /* R251 - DCDC4 Test Controls */ 1596 + }; 1597 + #endif 1598 + 1599 + #ifdef CONFIG_MFD_WM8351_CONFIG_MODE_2 1600 + 1601 + #undef WM8350_HAVE_CONFIG_MODE 1602 + #define WM8350_HAVE_CONFIG_MODE 1603 + 1604 + const u16 wm8351_mode2_defaults[] = { 1605 + 0x6143, /* R0 - Reset/ID */ 1606 + 0x0000, /* R1 - ID */ 1607 + 0x0001, /* R2 - Revision */ 1608 + 0x1C02, /* R3 - System Control 1 */ 1609 + 0x0214, /* R4 - System Control 2 */ 1610 + 0x0000, /* R5 - System Hibernate */ 1611 + 0x8A00, /* R6 - Interface Control */ 1612 + 0x0000, /* R7 */ 1613 + 0x8000, /* R8 - Power mgmt (1) */ 1614 + 0x0000, /* R9 - Power mgmt (2) */ 1615 + 0x0000, /* R10 - Power mgmt (3) */ 1616 + 0x2000, /* R11 - Power mgmt (4) */ 1617 + 0x0E00, /* R12 - Power mgmt (5) */ 1618 + 0x0000, /* R13 - Power mgmt (6) */ 1619 + 0x0000, /* R14 - Power mgmt (7) */ 1620 + 0x0000, /* R15 */ 1621 + 0x0000, /* R16 - RTC Seconds/Minutes */ 1622 + 0x0100, /* R17 - RTC Hours/Day */ 1623 + 0x0101, /* R18 - RTC Date/Month */ 1624 + 0x1400, /* R19 - RTC Year */ 1625 + 0x0000, /* R20 - Alarm Seconds/Minutes */ 1626 + 0x0000, /* R21 - Alarm Hours/Day */ 1627 + 0x0000, /* R22 - Alarm Date/Month */ 1628 + 0x0320, /* R23 - RTC Time Control */ 1629 + 0x0000, /* R24 - System Interrupts */ 1630 + 0x0000, /* R25 - Interrupt Status 1 */ 1631 + 0x0000, /* R26 - Interrupt Status 2 */ 1632 + 0x0000, /* R27 */ 1633 + 0x0000, /* R28 - Under Voltage Interrupt status */ 1634 + 0x0000, /* R29 - Over Current Interrupt status */ 1635 + 0x0000, /* R30 - GPIO Interrupt Status */ 1636 + 0x0000, /* R31 - Comparator Interrupt Status */ 1637 + 0x3FFF, /* R32 - System Interrupts Mask */ 1638 + 0x0000, /* R33 - Interrupt Status 1 Mask */ 1639 + 0x0000, /* R34 - Interrupt Status 2 Mask */ 1640 + 0x0000, /* R35 */ 1641 + 0x0000, /* R36 - Under Voltage Interrupt status Mask */ 1642 + 0x0000, /* R37 - Over Current Interrupt status Mask */ 1643 + 0x0000, /* R38 - GPIO Interrupt Status Mask */ 1644 + 0x0000, /* R39 - Comparator Interrupt Status Mask */ 1645 + 0x0040, /* R40 - Clock Control 1 */ 1646 + 0x0000, /* R41 - Clock Control 2 */ 1647 + 0x3A00, /* R42 - FLL Control 1 */ 1648 + 0x7086, /* R43 - FLL Control 2 */ 1649 + 0xC226, /* R44 - FLL Control 3 */ 1650 + 0x0000, /* R45 - FLL Control 4 */ 1651 + 0x0000, /* R46 */ 1652 + 0x0000, /* R47 */ 1653 + 0x0000, /* R48 - DAC Control */ 1654 + 0x0000, /* R49 */ 1655 + 0x00C0, /* R50 - DAC Digital Volume L */ 1656 + 0x00C0, /* R51 - DAC Digital Volume R */ 1657 + 0x0000, /* R52 */ 1658 + 0x0040, /* R53 - DAC LR Rate */ 1659 + 0x0000, /* R54 - DAC Clock Control */ 1660 + 0x0000, /* R55 */ 1661 + 0x0000, /* R56 */ 1662 + 0x0000, /* R57 */ 1663 + 0x4000, /* R58 - DAC Mute */ 1664 + 0x0000, /* R59 - DAC Mute Volume */ 1665 + 0x0000, /* R60 - DAC Side */ 1666 + 0x0000, /* R61 */ 1667 + 0x0000, /* R62 */ 1668 + 0x0000, /* R63 */ 1669 + 0x8000, /* R64 - ADC Control */ 1670 + 0x0000, /* R65 */ 1671 + 0x00C0, /* R66 - ADC Digital Volume L */ 1672 + 0x00C0, /* R67 - ADC Digital Volume R */ 1673 + 0x0000, /* R68 - ADC Divider */ 1674 + 0x0000, /* R69 */ 1675 + 0x0040, /* R70 - ADC LR Rate */ 1676 + 0x0000, /* R71 */ 1677 + 0x0303, /* R72 - Input Control */ 1678 + 0x0000, /* R73 - IN3 Input Control */ 1679 + 0x0000, /* R74 - Mic Bias Control */ 1680 + 0x0000, /* R75 */ 1681 + 0x0000, /* R76 - Output Control */ 1682 + 0x0000, /* R77 - Jack Detect */ 1683 + 0x0000, /* R78 - Anti Pop Control */ 1684 + 0x0000, /* R79 */ 1685 + 0x0040, /* R80 - Left Input Volume */ 1686 + 0x0040, /* R81 - Right Input Volume */ 1687 + 0x0000, /* R82 */ 1688 + 0x0000, /* R83 */ 1689 + 0x0000, /* R84 */ 1690 + 0x0000, /* R85 */ 1691 + 0x0000, /* R86 */ 1692 + 0x0000, /* R87 */ 1693 + 0x0800, /* R88 - Left Mixer Control */ 1694 + 0x1000, /* R89 - Right Mixer Control */ 1695 + 0x0000, /* R90 */ 1696 + 0x0000, /* R91 */ 1697 + 0x0000, /* R92 - OUT3 Mixer Control */ 1698 + 0x0000, /* R93 - OUT4 Mixer Control */ 1699 + 0x0000, /* R94 */ 1700 + 0x0000, /* R95 */ 1701 + 0x0000, /* R96 - Output Left Mixer Volume */ 1702 + 0x0000, /* R97 - Output Right Mixer Volume */ 1703 + 0x0000, /* R98 - Input Mixer Volume L */ 1704 + 0x0000, /* R99 - Input Mixer Volume R */ 1705 + 0x0000, /* R100 - Input Mixer Volume */ 1706 + 0x0000, /* R101 */ 1707 + 0x0000, /* R102 */ 1708 + 0x0000, /* R103 */ 1709 + 0x00E4, /* R104 - OUT1L Volume */ 1710 + 0x00E4, /* R105 - OUT1R Volume */ 1711 + 0x00E4, /* R106 - OUT2L Volume */ 1712 + 0x02E4, /* R107 - OUT2R Volume */ 1713 + 0x0000, /* R108 */ 1714 + 0x0000, /* R109 */ 1715 + 0x0000, /* R110 */ 1716 + 0x0000, /* R111 - BEEP Volume */ 1717 + 0x0A00, /* R112 - AI Formating */ 1718 + 0x0000, /* R113 - ADC DAC COMP */ 1719 + 0x0020, /* R114 - AI ADC Control */ 1720 + 0x0020, /* R115 - AI DAC Control */ 1721 + 0x0000, /* R116 */ 1722 + 0x0000, /* R117 */ 1723 + 0x0000, /* R118 */ 1724 + 0x0000, /* R119 */ 1725 + 0x0000, /* R120 */ 1726 + 0x0000, /* R121 */ 1727 + 0x0000, /* R122 */ 1728 + 0x0000, /* R123 */ 1729 + 0x0000, /* R124 */ 1730 + 0x0000, /* R125 */ 1731 + 0x0000, /* R126 */ 1732 + 0x0000, /* R127 */ 1733 + 0x1FFF, /* R128 - GPIO Debounce */ 1734 + 0x0000, /* R129 - GPIO Pin pull up Control */ 1735 + 0x0110, /* R130 - GPIO Pull down Control */ 1736 + 0x0000, /* R131 - GPIO Interrupt Mode */ 1737 + 0x0000, /* R132 */ 1738 + 0x0000, /* R133 - GPIO Control */ 1739 + 0x09FA, /* R134 - GPIO Configuration (i/o) */ 1740 + 0x0DF6, /* R135 - GPIO Pin Polarity / Type */ 1741 + 0x0000, /* R136 */ 1742 + 0x0000, /* R137 */ 1743 + 0x0000, /* R138 */ 1744 + 0x0000, /* R139 */ 1745 + 0x1310, /* R140 - GPIO Function Select 1 */ 1746 + 0x0003, /* R141 - GPIO Function Select 2 */ 1747 + 0x2000, /* R142 - GPIO Function Select 3 */ 1748 + 0x0000, /* R143 - GPIO Function Select 4 */ 1749 + 0x0000, /* R144 - Digitiser Control (1) */ 1750 + 0x0002, /* R145 - Digitiser Control (2) */ 1751 + 0x0000, /* R146 */ 1752 + 0x0000, /* R147 */ 1753 + 0x0000, /* R148 */ 1754 + 0x0000, /* R149 */ 1755 + 0x0000, /* R150 */ 1756 + 0x0000, /* R151 */ 1757 + 0x7000, /* R152 - AUX1 Readback */ 1758 + 0x7000, /* R153 - AUX2 Readback */ 1759 + 0x7000, /* R154 - AUX3 Readback */ 1760 + 0x7000, /* R155 - AUX4 Readback */ 1761 + 0x0000, /* R156 - USB Voltage Readback */ 1762 + 0x0000, /* R157 - LINE Voltage Readback */ 1763 + 0x0000, /* R158 - BATT Voltage Readback */ 1764 + 0x0000, /* R159 - Chip Temp Readback */ 1765 + 0x0000, /* R160 */ 1766 + 0x0000, /* R161 */ 1767 + 0x0000, /* R162 */ 1768 + 0x0000, /* R163 - Generic Comparator Control */ 1769 + 0x0000, /* R164 - Generic comparator 1 */ 1770 + 0x0000, /* R165 - Generic comparator 2 */ 1771 + 0x0000, /* R166 - Generic comparator 3 */ 1772 + 0x0000, /* R167 - Generic comparator 4 */ 1773 + 0xA00F, /* R168 - Battery Charger Control 1 */ 1774 + 0x0B06, /* R169 - Battery Charger Control 2 */ 1775 + 0x0000, /* R170 - Battery Charger Control 3 */ 1776 + 0x0000, /* R171 */ 1777 + 0x0000, /* R172 - Current Sink Driver A */ 1778 + 0x0000, /* R173 - CSA Flash control */ 1779 + 0x0000, /* R174 */ 1780 + 0x0000, /* R175 */ 1781 + 0x0000, /* R176 - DCDC/LDO requested */ 1782 + 0x032D, /* R177 - DCDC Active options */ 1783 + 0x0000, /* R178 - DCDC Sleep options */ 1784 + 0x0025, /* R179 - Power-check comparator */ 1785 + 0x001A, /* R180 - DCDC1 Control */ 1786 + 0x0800, /* R181 - DCDC1 Timeouts */ 1787 + 0x1006, /* R182 - DCDC1 Low Power */ 1788 + 0x0018, /* R183 - DCDC2 Control */ 1789 + 0x0000, /* R184 - DCDC2 Timeouts */ 1790 + 0x0000, /* R185 */ 1791 + 0x0056, /* R186 - DCDC3 Control */ 1792 + 0x0400, /* R187 - DCDC3 Timeouts */ 1793 + 0x0006, /* R188 - DCDC3 Low Power */ 1794 + 0x0026, /* R189 - DCDC4 Control */ 1795 + 0x0C00, /* R190 - DCDC4 Timeouts */ 1796 + 0x0006, /* R191 - DCDC4 Low Power */ 1797 + 0x0008, /* R192 */ 1798 + 0x0000, /* R193 */ 1799 + 0x0000, /* R194 */ 1800 + 0x0026, /* R195 */ 1801 + 0x0C00, /* R196 */ 1802 + 0x0006, /* R197 */ 1803 + 0x0000, /* R198 */ 1804 + 0x0003, /* R199 - Limit Switch Control */ 1805 + 0x001C, /* R200 - LDO1 Control */ 1806 + 0x0400, /* R201 - LDO1 Timeouts */ 1807 + 0x001C, /* R202 - LDO1 Low Power */ 1808 + 0x0010, /* R203 - LDO2 Control */ 1809 + 0x0C00, /* R204 - LDO2 Timeouts */ 1810 + 0x001C, /* R205 - LDO2 Low Power */ 1811 + 0x0015, /* R206 - LDO3 Control */ 1812 + 0x0000, /* R207 - LDO3 Timeouts */ 1813 + 0x001C, /* R208 - LDO3 Low Power */ 1814 + 0x001A, /* R209 - LDO4 Control */ 1815 + 0x0000, /* R210 - LDO4 Timeouts */ 1816 + 0x001C, /* R211 - LDO4 Low Power */ 1817 + 0x0000, /* R212 */ 1818 + 0x0000, /* R213 */ 1819 + 0x0000, /* R214 */ 1820 + 0x0000, /* R215 - VCC_FAULT Masks */ 1821 + 0x001F, /* R216 - Main Bandgap Control */ 1822 + 0x0000, /* R217 - OSC Control */ 1823 + 0x9000, /* R218 - RTC Tick Control */ 1824 + 0x0000, /* R219 - Security1 */ 1825 + 0x4000, /* R220 */ 1826 + 0x0000, /* R221 */ 1827 + 0x0000, /* R222 */ 1828 + 0x0000, /* R223 */ 1829 + 0x0000, /* R224 - Signal overrides */ 1830 + 0x0000, /* R225 - DCDC/LDO status */ 1831 + 0x0000, /* R226 - Charger Overides/status */ 1832 + 0x0000, /* R227 - misc overrides */ 1833 + 0x0000, /* R228 - Supply overrides/status 1 */ 1834 + 0x0000, /* R229 - Supply overrides/status 2 */ 1835 + 0xE000, /* R230 - GPIO Pin Status */ 1836 + 0x0000, /* R231 - comparotor overrides */ 1837 + 0x0000, /* R232 */ 1838 + 0x0000, /* R233 - State Machine status */ 1839 + 0x1200, /* R234 - FLL Test 1 */ 1840 + 0x0000, /* R235 */ 1841 + 0x8000, /* R236 */ 1842 + 0x0000, /* R237 */ 1843 + 0x0000, /* R238 */ 1844 + 0x0000, /* R239 */ 1845 + 0x0003, /* R240 */ 1846 + 0x0000, /* R241 */ 1847 + 0x0000, /* R242 */ 1848 + 0x0004, /* R243 */ 1849 + 0x0300, /* R244 */ 1850 + 0x0000, /* R245 */ 1851 + 0x0200, /* R246 */ 1852 + 0x0000, /* R247 */ 1853 + 0x1000, /* R248 - DCDC1 Test Controls */ 1854 + 0x1000, /* R249 */ 1855 + 0x1000, /* R250 - DCDC3 Test Controls */ 1856 + 0x1000, /* R251 - DCDC4 Test Controls */ 1857 + }; 1858 + #endif 1859 + 1860 + #ifdef CONFIG_MFD_WM8351_CONFIG_MODE_3 1861 + 1862 + #undef WM8350_HAVE_CONFIG_MODE 1863 + #define WM8350_HAVE_CONFIG_MODE 1864 + 1865 + const u16 wm8351_mode3_defaults[] = { 1866 + 0x6143, /* R0 - Reset/ID */ 1867 + 0x0000, /* R1 - ID */ 1868 + 0x0001, /* R2 - Revision */ 1869 + 0x1C02, /* R3 - System Control 1 */ 1870 + 0x0204, /* R4 - System Control 2 */ 1871 + 0x0000, /* R5 - System Hibernate */ 1872 + 0x8A00, /* R6 - Interface Control */ 1873 + 0x0000, /* R7 */ 1874 + 0x8000, /* R8 - Power mgmt (1) */ 1875 + 0x0000, /* R9 - Power mgmt (2) */ 1876 + 0x0000, /* R10 - Power mgmt (3) */ 1877 + 0x2000, /* R11 - Power mgmt (4) */ 1878 + 0x0E00, /* R12 - Power mgmt (5) */ 1879 + 0x0000, /* R13 - Power mgmt (6) */ 1880 + 0x0000, /* R14 - Power mgmt (7) */ 1881 + 0x0000, /* R15 */ 1882 + 0x0000, /* R16 - RTC Seconds/Minutes */ 1883 + 0x0100, /* R17 - RTC Hours/Day */ 1884 + 0x0101, /* R18 - RTC Date/Month */ 1885 + 0x1400, /* R19 - RTC Year */ 1886 + 0x0000, /* R20 - Alarm Seconds/Minutes */ 1887 + 0x0000, /* R21 - Alarm Hours/Day */ 1888 + 0x0000, /* R22 - Alarm Date/Month */ 1889 + 0x0320, /* R23 - RTC Time Control */ 1890 + 0x0000, /* R24 - System Interrupts */ 1891 + 0x0000, /* R25 - Interrupt Status 1 */ 1892 + 0x0000, /* R26 - Interrupt Status 2 */ 1893 + 0x0000, /* R27 */ 1894 + 0x0000, /* R28 - Under Voltage Interrupt status */ 1895 + 0x0000, /* R29 - Over Current Interrupt status */ 1896 + 0x0000, /* R30 - GPIO Interrupt Status */ 1897 + 0x0000, /* R31 - Comparator Interrupt Status */ 1898 + 0x3FFF, /* R32 - System Interrupts Mask */ 1899 + 0x0000, /* R33 - Interrupt Status 1 Mask */ 1900 + 0x0000, /* R34 - Interrupt Status 2 Mask */ 1901 + 0x0000, /* R35 */ 1902 + 0x0000, /* R36 - Under Voltage Interrupt status Mask */ 1903 + 0x0000, /* R37 - Over Current Interrupt status Mask */ 1904 + 0x0000, /* R38 - GPIO Interrupt Status Mask */ 1905 + 0x0000, /* R39 - Comparator Interrupt Status Mask */ 1906 + 0x0040, /* R40 - Clock Control 1 */ 1907 + 0x0000, /* R41 - Clock Control 2 */ 1908 + 0x3A00, /* R42 - FLL Control 1 */ 1909 + 0x7086, /* R43 - FLL Control 2 */ 1910 + 0xC226, /* R44 - FLL Control 3 */ 1911 + 0x0000, /* R45 - FLL Control 4 */ 1912 + 0x0000, /* R46 */ 1913 + 0x0000, /* R47 */ 1914 + 0x0000, /* R48 - DAC Control */ 1915 + 0x0000, /* R49 */ 1916 + 0x00C0, /* R50 - DAC Digital Volume L */ 1917 + 0x00C0, /* R51 - DAC Digital Volume R */ 1918 + 0x0000, /* R52 */ 1919 + 0x0040, /* R53 - DAC LR Rate */ 1920 + 0x0000, /* R54 - DAC Clock Control */ 1921 + 0x0000, /* R55 */ 1922 + 0x0000, /* R56 */ 1923 + 0x0000, /* R57 */ 1924 + 0x4000, /* R58 - DAC Mute */ 1925 + 0x0000, /* R59 - DAC Mute Volume */ 1926 + 0x0000, /* R60 - DAC Side */ 1927 + 0x0000, /* R61 */ 1928 + 0x0000, /* R62 */ 1929 + 0x0000, /* R63 */ 1930 + 0x8000, /* R64 - ADC Control */ 1931 + 0x0000, /* R65 */ 1932 + 0x00C0, /* R66 - ADC Digital Volume L */ 1933 + 0x00C0, /* R67 - ADC Digital Volume R */ 1934 + 0x0000, /* R68 - ADC Divider */ 1935 + 0x0000, /* R69 */ 1936 + 0x0040, /* R70 - ADC LR Rate */ 1937 + 0x0000, /* R71 */ 1938 + 0x0303, /* R72 - Input Control */ 1939 + 0x0000, /* R73 - IN3 Input Control */ 1940 + 0x0000, /* R74 - Mic Bias Control */ 1941 + 0x0000, /* R75 */ 1942 + 0x0000, /* R76 - Output Control */ 1943 + 0x0000, /* R77 - Jack Detect */ 1944 + 0x0000, /* R78 - Anti Pop Control */ 1945 + 0x0000, /* R79 */ 1946 + 0x0040, /* R80 - Left Input Volume */ 1947 + 0x0040, /* R81 - Right Input Volume */ 1948 + 0x0000, /* R82 */ 1949 + 0x0000, /* R83 */ 1950 + 0x0000, /* R84 */ 1951 + 0x0000, /* R85 */ 1952 + 0x0000, /* R86 */ 1953 + 0x0000, /* R87 */ 1954 + 0x0800, /* R88 - Left Mixer Control */ 1955 + 0x1000, /* R89 - Right Mixer Control */ 1956 + 0x0000, /* R90 */ 1957 + 0x0000, /* R91 */ 1958 + 0x0000, /* R92 - OUT3 Mixer Control */ 1959 + 0x0000, /* R93 - OUT4 Mixer Control */ 1960 + 0x0000, /* R94 */ 1961 + 0x0000, /* R95 */ 1962 + 0x0000, /* R96 - Output Left Mixer Volume */ 1963 + 0x0000, /* R97 - Output Right Mixer Volume */ 1964 + 0x0000, /* R98 - Input Mixer Volume L */ 1965 + 0x0000, /* R99 - Input Mixer Volume R */ 1966 + 0x0000, /* R100 - Input Mixer Volume */ 1967 + 0x0000, /* R101 */ 1968 + 0x0000, /* R102 */ 1969 + 0x0000, /* R103 */ 1970 + 0x00E4, /* R104 - OUT1L Volume */ 1971 + 0x00E4, /* R105 - OUT1R Volume */ 1972 + 0x00E4, /* R106 - OUT2L Volume */ 1973 + 0x02E4, /* R107 - OUT2R Volume */ 1974 + 0x0000, /* R108 */ 1975 + 0x0000, /* R109 */ 1976 + 0x0000, /* R110 */ 1977 + 0x0000, /* R111 - BEEP Volume */ 1978 + 0x0A00, /* R112 - AI Formating */ 1979 + 0x0000, /* R113 - ADC DAC COMP */ 1980 + 0x0020, /* R114 - AI ADC Control */ 1981 + 0x0020, /* R115 - AI DAC Control */ 1982 + 0x0000, /* R116 */ 1983 + 0x0000, /* R117 */ 1984 + 0x0000, /* R118 */ 1985 + 0x0000, /* R119 */ 1986 + 0x0000, /* R120 */ 1987 + 0x0000, /* R121 */ 1988 + 0x0000, /* R122 */ 1989 + 0x0000, /* R123 */ 1990 + 0x0000, /* R124 */ 1991 + 0x0000, /* R125 */ 1992 + 0x0000, /* R126 */ 1993 + 0x0000, /* R127 */ 1994 + 0x1FFF, /* R128 - GPIO Debounce */ 1995 + 0x0010, /* R129 - GPIO Pin pull up Control */ 1996 + 0x0000, /* R130 - GPIO Pull down Control */ 1997 + 0x0000, /* R131 - GPIO Interrupt Mode */ 1998 + 0x0000, /* R132 */ 1999 + 0x0000, /* R133 - GPIO Control */ 2000 + 0x0BFB, /* R134 - GPIO Configuration (i/o) */ 2001 + 0x0FFD, /* R135 - GPIO Pin Polarity / Type */ 2002 + 0x0000, /* R136 */ 2003 + 0x0000, /* R137 */ 2004 + 0x0000, /* R138 */ 2005 + 0x0000, /* R139 */ 2006 + 0x0310, /* R140 - GPIO Function Select 1 */ 2007 + 0x0001, /* R141 - GPIO Function Select 2 */ 2008 + 0x2300, /* R142 - GPIO Function Select 3 */ 2009 + 0x0003, /* R143 - GPIO Function Select 4 */ 2010 + 0x0000, /* R144 - Digitiser Control (1) */ 2011 + 0x0002, /* R145 - Digitiser Control (2) */ 2012 + 0x0000, /* R146 */ 2013 + 0x0000, /* R147 */ 2014 + 0x0000, /* R148 */ 2015 + 0x0000, /* R149 */ 2016 + 0x0000, /* R150 */ 2017 + 0x0000, /* R151 */ 2018 + 0x7000, /* R152 - AUX1 Readback */ 2019 + 0x7000, /* R153 - AUX2 Readback */ 2020 + 0x7000, /* R154 - AUX3 Readback */ 2021 + 0x7000, /* R155 - AUX4 Readback */ 2022 + 0x0000, /* R156 - USB Voltage Readback */ 2023 + 0x0000, /* R157 - LINE Voltage Readback */ 2024 + 0x0000, /* R158 - BATT Voltage Readback */ 2025 + 0x0000, /* R159 - Chip Temp Readback */ 2026 + 0x0000, /* R160 */ 2027 + 0x0000, /* R161 */ 2028 + 0x0000, /* R162 */ 2029 + 0x0000, /* R163 - Generic Comparator Control */ 2030 + 0x0000, /* R164 - Generic comparator 1 */ 2031 + 0x0000, /* R165 - Generic comparator 2 */ 2032 + 0x0000, /* R166 - Generic comparator 3 */ 2033 + 0x0000, /* R167 - Generic comparator 4 */ 2034 + 0xA00F, /* R168 - Battery Charger Control 1 */ 2035 + 0x0B06, /* R169 - Battery Charger Control 2 */ 2036 + 0x0000, /* R170 - Battery Charger Control 3 */ 2037 + 0x0000, /* R171 */ 2038 + 0x0000, /* R172 - Current Sink Driver A */ 2039 + 0x0000, /* R173 - CSA Flash control */ 2040 + 0x0000, /* R174 */ 2041 + 0x0000, /* R175 */ 2042 + 0x0000, /* R176 - DCDC/LDO requested */ 2043 + 0x032D, /* R177 - DCDC Active options */ 2044 + 0x0000, /* R178 - DCDC Sleep options */ 2045 + 0x0025, /* R179 - Power-check comparator */ 2046 + 0x000E, /* R180 - DCDC1 Control */ 2047 + 0x0400, /* R181 - DCDC1 Timeouts */ 2048 + 0x1006, /* R182 - DCDC1 Low Power */ 2049 + 0x0018, /* R183 - DCDC2 Control */ 2050 + 0x0000, /* R184 - DCDC2 Timeouts */ 2051 + 0x0000, /* R185 */ 2052 + 0x0026, /* R186 - DCDC3 Control */ 2053 + 0x0800, /* R187 - DCDC3 Timeouts */ 2054 + 0x0006, /* R188 - DCDC3 Low Power */ 2055 + 0x0062, /* R189 - DCDC4 Control */ 2056 + 0x1400, /* R190 - DCDC4 Timeouts */ 2057 + 0x0006, /* R191 - DCDC4 Low Power */ 2058 + 0x0008, /* R192 */ 2059 + 0x0000, /* R193 */ 2060 + 0x0000, /* R194 */ 2061 + 0x0026, /* R195 */ 2062 + 0x0400, /* R196 */ 2063 + 0x0006, /* R197 */ 2064 + 0x0000, /* R198 */ 2065 + 0x0003, /* R199 - Limit Switch Control */ 2066 + 0x0006, /* R200 - LDO1 Control */ 2067 + 0x0C00, /* R201 - LDO1 Timeouts */ 2068 + 0x001C, /* R202 - LDO1 Low Power */ 2069 + 0x0016, /* R203 - LDO2 Control */ 2070 + 0x0000, /* R204 - LDO2 Timeouts */ 2071 + 0x001C, /* R205 - LDO2 Low Power */ 2072 + 0x0019, /* R206 - LDO3 Control */ 2073 + 0x0000, /* R207 - LDO3 Timeouts */ 2074 + 0x001C, /* R208 - LDO3 Low Power */ 2075 + 0x001A, /* R209 - LDO4 Control */ 2076 + 0x1000, /* R210 - LDO4 Timeouts */ 2077 + 0x001C, /* R211 - LDO4 Low Power */ 2078 + 0x0000, /* R212 */ 2079 + 0x0000, /* R213 */ 2080 + 0x0000, /* R214 */ 2081 + 0x0000, /* R215 - VCC_FAULT Masks */ 2082 + 0x001F, /* R216 - Main Bandgap Control */ 2083 + 0x0000, /* R217 - OSC Control */ 2084 + 0x9000, /* R218 - RTC Tick Control */ 2085 + 0x0000, /* R219 - Security1 */ 2086 + 0x4000, /* R220 */ 2087 + 0x0000, /* R221 */ 2088 + 0x0000, /* R222 */ 2089 + 0x0000, /* R223 */ 2090 + 0x0000, /* R224 - Signal overrides */ 2091 + 0x0000, /* R225 - DCDC/LDO status */ 2092 + 0x0000, /* R226 - Charger Overides/status */ 2093 + 0x0000, /* R227 - misc overrides */ 2094 + 0x0000, /* R228 - Supply overrides/status 1 */ 2095 + 0x0000, /* R229 - Supply overrides/status 2 */ 2096 + 0xE000, /* R230 - GPIO Pin Status */ 2097 + 0x0000, /* R231 - comparotor overrides */ 2098 + 0x0000, /* R232 */ 2099 + 0x0000, /* R233 - State Machine status */ 2100 + 0x1200, /* R234 - FLL Test 1 */ 2101 + 0x0000, /* R235 */ 2102 + 0x8000, /* R236 */ 2103 + 0x0000, /* R237 */ 2104 + 0x0000, /* R238 */ 2105 + 0x0000, /* R239 */ 2106 + 0x0003, /* R240 */ 2107 + 0x0000, /* R241 */ 2108 + 0x0000, /* R242 */ 2109 + 0x0004, /* R243 */ 2110 + 0x0300, /* R244 */ 2111 + 0x0000, /* R245 */ 2112 + 0x0200, /* R246 */ 2113 + 0x0000, /* R247 */ 2114 + 0x1000, /* R248 - DCDC1 Test Controls */ 2115 + 0x1000, /* R249 */ 2116 + 0x1000, /* R250 - DCDC3 Test Controls */ 2117 + 0x1000, /* R251 - DCDC4 Test Controls */ 2118 + }; 2119 + #endif 2120 + 2121 + #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_0 2122 + 2123 + #undef WM8350_HAVE_CONFIG_MODE 2124 + #define WM8350_HAVE_CONFIG_MODE 2125 + 2126 + const u16 wm8352_mode0_defaults[] = { 2127 + 0x6143, /* R0 - Reset/ID */ 2128 + 0x0000, /* R1 - ID */ 2129 + 0x0002, /* R2 - Revision */ 2130 + 0x1C02, /* R3 - System Control 1 */ 2131 + 0x0004, /* R4 - System Control 2 */ 2132 + 0x0000, /* R5 - System Hibernate */ 2133 + 0x8A00, /* R6 - Interface Control */ 2134 + 0x0000, /* R7 */ 2135 + 0x8000, /* R8 - Power mgmt (1) */ 2136 + 0x0000, /* R9 - Power mgmt (2) */ 2137 + 0x0000, /* R10 - Power mgmt (3) */ 2138 + 0x2000, /* R11 - Power mgmt (4) */ 2139 + 0x0E00, /* R12 - Power mgmt (5) */ 2140 + 0x0000, /* R13 - Power mgmt (6) */ 2141 + 0x0000, /* R14 - Power mgmt (7) */ 2142 + 0x0000, /* R15 */ 2143 + 0x0000, /* R16 - RTC Seconds/Minutes */ 2144 + 0x0100, /* R17 - RTC Hours/Day */ 2145 + 0x0101, /* R18 - RTC Date/Month */ 2146 + 0x1400, /* R19 - RTC Year */ 2147 + 0x0000, /* R20 - Alarm Seconds/Minutes */ 2148 + 0x0000, /* R21 - Alarm Hours/Day */ 2149 + 0x0000, /* R22 - Alarm Date/Month */ 2150 + 0x0320, /* R23 - RTC Time Control */ 2151 + 0x0000, /* R24 - System Interrupts */ 2152 + 0x0000, /* R25 - Interrupt Status 1 */ 2153 + 0x0000, /* R26 - Interrupt Status 2 */ 2154 + 0x0000, /* R27 */ 2155 + 0x0000, /* R28 - Under Voltage Interrupt status */ 2156 + 0x0000, /* R29 - Over Current Interrupt status */ 2157 + 0x0000, /* R30 - GPIO Interrupt Status */ 2158 + 0x0000, /* R31 - Comparator Interrupt Status */ 2159 + 0x3FFF, /* R32 - System Interrupts Mask */ 2160 + 0x0000, /* R33 - Interrupt Status 1 Mask */ 2161 + 0x0000, /* R34 - Interrupt Status 2 Mask */ 2162 + 0x0000, /* R35 */ 2163 + 0x0000, /* R36 - Under Voltage Interrupt status Mask */ 2164 + 0x0000, /* R37 - Over Current Interrupt status Mask */ 2165 + 0x0000, /* R38 - GPIO Interrupt Status Mask */ 2166 + 0x0000, /* R39 - Comparator Interrupt Status Mask */ 2167 + 0x0040, /* R40 - Clock Control 1 */ 2168 + 0x0000, /* R41 - Clock Control 2 */ 2169 + 0x3A00, /* R42 - FLL Control 1 */ 2170 + 0x7086, /* R43 - FLL Control 2 */ 2171 + 0xC226, /* R44 - FLL Control 3 */ 2172 + 0x0000, /* R45 - FLL Control 4 */ 2173 + 0x0000, /* R46 */ 2174 + 0x0000, /* R47 */ 2175 + 0x0000, /* R48 - DAC Control */ 2176 + 0x0000, /* R49 */ 2177 + 0x00C0, /* R50 - DAC Digital Volume L */ 2178 + 0x00C0, /* R51 - DAC Digital Volume R */ 2179 + 0x0000, /* R52 */ 2180 + 0x0040, /* R53 - DAC LR Rate */ 2181 + 0x0000, /* R54 - DAC Clock Control */ 2182 + 0x0000, /* R55 */ 2183 + 0x0000, /* R56 */ 2184 + 0x0000, /* R57 */ 2185 + 0x4000, /* R58 - DAC Mute */ 2186 + 0x0000, /* R59 - DAC Mute Volume */ 2187 + 0x0000, /* R60 - DAC Side */ 2188 + 0x0000, /* R61 */ 2189 + 0x0000, /* R62 */ 2190 + 0x0000, /* R63 */ 2191 + 0x8000, /* R64 - ADC Control */ 2192 + 0x0000, /* R65 */ 2193 + 0x00C0, /* R66 - ADC Digital Volume L */ 2194 + 0x00C0, /* R67 - ADC Digital Volume R */ 2195 + 0x0000, /* R68 - ADC Divider */ 2196 + 0x0000, /* R69 */ 2197 + 0x0040, /* R70 - ADC LR Rate */ 2198 + 0x0000, /* R71 */ 2199 + 0x0303, /* R72 - Input Control */ 2200 + 0x0000, /* R73 - IN3 Input Control */ 2201 + 0x0000, /* R74 - Mic Bias Control */ 2202 + 0x0000, /* R75 */ 2203 + 0x0000, /* R76 - Output Control */ 2204 + 0x0000, /* R77 - Jack Detect */ 2205 + 0x0000, /* R78 - Anti Pop Control */ 2206 + 0x0000, /* R79 */ 2207 + 0x0040, /* R80 - Left Input Volume */ 2208 + 0x0040, /* R81 - Right Input Volume */ 2209 + 0x0000, /* R82 */ 2210 + 0x0000, /* R83 */ 2211 + 0x0000, /* R84 */ 2212 + 0x0000, /* R85 */ 2213 + 0x0000, /* R86 */ 2214 + 0x0000, /* R87 */ 2215 + 0x0800, /* R88 - Left Mixer Control */ 2216 + 0x1000, /* R89 - Right Mixer Control */ 2217 + 0x0000, /* R90 */ 2218 + 0x0000, /* R91 */ 2219 + 0x0000, /* R92 - OUT3 Mixer Control */ 2220 + 0x0000, /* R93 - OUT4 Mixer Control */ 2221 + 0x0000, /* R94 */ 2222 + 0x0000, /* R95 */ 2223 + 0x0000, /* R96 - Output Left Mixer Volume */ 2224 + 0x0000, /* R97 - Output Right Mixer Volume */ 2225 + 0x0000, /* R98 - Input Mixer Volume L */ 2226 + 0x0000, /* R99 - Input Mixer Volume R */ 2227 + 0x0000, /* R100 - Input Mixer Volume */ 2228 + 0x0000, /* R101 */ 2229 + 0x0000, /* R102 */ 2230 + 0x0000, /* R103 */ 2231 + 0x00E4, /* R104 - OUT1L Volume */ 2232 + 0x00E4, /* R105 - OUT1R Volume */ 2233 + 0x00E4, /* R106 - OUT2L Volume */ 2234 + 0x02E4, /* R107 - OUT2R Volume */ 2235 + 0x0000, /* R108 */ 2236 + 0x0000, /* R109 */ 2237 + 0x0000, /* R110 */ 2238 + 0x0000, /* R111 - BEEP Volume */ 2239 + 0x0A00, /* R112 - AI Formating */ 2240 + 0x0000, /* R113 - ADC DAC COMP */ 2241 + 0x0020, /* R114 - AI ADC Control */ 2242 + 0x0020, /* R115 - AI DAC Control */ 2243 + 0x0000, /* R116 */ 2244 + 0x0000, /* R117 */ 2245 + 0x0000, /* R118 */ 2246 + 0x0000, /* R119 */ 2247 + 0x0000, /* R120 */ 2248 + 0x0000, /* R121 */ 2249 + 0x0000, /* R122 */ 2250 + 0x0000, /* R123 */ 2251 + 0x0000, /* R124 */ 2252 + 0x0000, /* R125 */ 2253 + 0x0000, /* R126 */ 2254 + 0x0000, /* R127 */ 2255 + 0x1FFF, /* R128 - GPIO Debounce */ 2256 + 0x0000, /* R129 - GPIO Pin pull up Control */ 2257 + 0x0000, /* R130 - GPIO Pull down Control */ 2258 + 0x0000, /* R131 - GPIO Interrupt Mode */ 2259 + 0x0000, /* R132 */ 2260 + 0x0000, /* R133 - GPIO Control */ 2261 + 0x0FFC, /* R134 - GPIO Configuration (i/o) */ 2262 + 0x0FFC, /* R135 - GPIO Pin Polarity / Type */ 2263 + 0x0000, /* R136 */ 2264 + 0x0000, /* R137 */ 2265 + 0x0000, /* R138 */ 2266 + 0x0000, /* R139 */ 2267 + 0x0013, /* R140 - GPIO Function Select 1 */ 2268 + 0x0000, /* R141 - GPIO Function Select 2 */ 2269 + 0x0000, /* R142 - GPIO Function Select 3 */ 2270 + 0x0003, /* R143 - GPIO Function Select 4 */ 2271 + 0x0000, /* R144 - Digitiser Control (1) */ 2272 + 0x0002, /* R145 - Digitiser Control (2) */ 2273 + 0x0000, /* R146 */ 2274 + 0x0000, /* R147 */ 2275 + 0x0000, /* R148 */ 2276 + 0x0000, /* R149 */ 2277 + 0x0000, /* R150 */ 2278 + 0x0000, /* R151 */ 2279 + 0x7000, /* R152 - AUX1 Readback */ 2280 + 0x7000, /* R153 - AUX2 Readback */ 2281 + 0x7000, /* R154 - AUX3 Readback */ 2282 + 0x7000, /* R155 - AUX4 Readback */ 2283 + 0x0000, /* R156 - USB Voltage Readback */ 2284 + 0x0000, /* R157 - LINE Voltage Readback */ 2285 + 0x0000, /* R158 - BATT Voltage Readback */ 2286 + 0x0000, /* R159 - Chip Temp Readback */ 2287 + 0x0000, /* R160 */ 2288 + 0x0000, /* R161 */ 2289 + 0x0000, /* R162 */ 2290 + 0x0000, /* R163 - Generic Comparator Control */ 2291 + 0x0000, /* R164 - Generic comparator 1 */ 2292 + 0x0000, /* R165 - Generic comparator 2 */ 2293 + 0x0000, /* R166 - Generic comparator 3 */ 2294 + 0x0000, /* R167 - Generic comparator 4 */ 2295 + 0xA00F, /* R168 - Battery Charger Control 1 */ 2296 + 0x0B06, /* R169 - Battery Charger Control 2 */ 2297 + 0x0000, /* R170 - Battery Charger Control 3 */ 2298 + 0x0000, /* R171 */ 2299 + 0x0000, /* R172 - Current Sink Driver A */ 2300 + 0x0000, /* R173 - CSA Flash control */ 2301 + 0x0000, /* R174 - Current Sink Driver B */ 2302 + 0x0000, /* R175 - CSB Flash control */ 2303 + 0x0000, /* R176 - DCDC/LDO requested */ 2304 + 0x032D, /* R177 - DCDC Active options */ 2305 + 0x0000, /* R178 - DCDC Sleep options */ 2306 + 0x0025, /* R179 - Power-check comparator */ 2307 + 0x000E, /* R180 - DCDC1 Control */ 2308 + 0x0000, /* R181 - DCDC1 Timeouts */ 2309 + 0x1006, /* R182 - DCDC1 Low Power */ 2310 + 0x0018, /* R183 - DCDC2 Control */ 2311 + 0x0000, /* R184 - DCDC2 Timeouts */ 2312 + 0x0000, /* R185 */ 2313 + 0x0000, /* R186 - DCDC3 Control */ 2314 + 0x0000, /* R187 - DCDC3 Timeouts */ 2315 + 0x0006, /* R188 - DCDC3 Low Power */ 2316 + 0x0000, /* R189 - DCDC4 Control */ 2317 + 0x0000, /* R190 - DCDC4 Timeouts */ 2318 + 0x0006, /* R191 - DCDC4 Low Power */ 2319 + 0x0008, /* R192 - DCDC5 Control */ 2320 + 0x0000, /* R193 - DCDC5 Timeouts */ 2321 + 0x0000, /* R194 */ 2322 + 0x0000, /* R195 - DCDC6 Control */ 2323 + 0x0000, /* R196 - DCDC6 Timeouts */ 2324 + 0x0006, /* R197 - DCDC6 Low Power */ 2325 + 0x0000, /* R198 */ 2326 + 0x0003, /* R199 - Limit Switch Control */ 2327 + 0x001C, /* R200 - LDO1 Control */ 2328 + 0x0000, /* R201 - LDO1 Timeouts */ 2329 + 0x001C, /* R202 - LDO1 Low Power */ 2330 + 0x001B, /* R203 - LDO2 Control */ 2331 + 0x0000, /* R204 - LDO2 Timeouts */ 2332 + 0x001C, /* R205 - LDO2 Low Power */ 2333 + 0x001B, /* R206 - LDO3 Control */ 2334 + 0x0000, /* R207 - LDO3 Timeouts */ 2335 + 0x001C, /* R208 - LDO3 Low Power */ 2336 + 0x001B, /* R209 - LDO4 Control */ 2337 + 0x0000, /* R210 - LDO4 Timeouts */ 2338 + 0x001C, /* R211 - LDO4 Low Power */ 2339 + 0x0000, /* R212 */ 2340 + 0x0000, /* R213 */ 2341 + 0x0000, /* R214 */ 2342 + 0x0000, /* R215 - VCC_FAULT Masks */ 2343 + 0x001F, /* R216 - Main Bandgap Control */ 2344 + 0x0000, /* R217 - OSC Control */ 2345 + 0x9000, /* R218 - RTC Tick Control */ 2346 + 0x0000, /* R219 - Security1 */ 2347 + 0x4000, /* R220 */ 2348 + 0x0000, /* R221 */ 2349 + 0x0000, /* R222 */ 2350 + 0x0000, /* R223 */ 2351 + 0x0000, /* R224 - Signal overrides */ 2352 + 0x0000, /* R225 - DCDC/LDO status */ 2353 + 0x0000, /* R226 - Charger Overides/status */ 2354 + 0x0000, /* R227 - misc overrides */ 2355 + 0x0000, /* R228 - Supply overrides/status 1 */ 2356 + 0x0000, /* R229 - Supply overrides/status 2 */ 2357 + 0xE000, /* R230 - GPIO Pin Status */ 2358 + 0x0000, /* R231 - comparotor overrides */ 2359 + 0x0000, /* R232 */ 2360 + 0x0000, /* R233 - State Machine status */ 2361 + 0x1200, /* R234 */ 2362 + 0x0000, /* R235 */ 2363 + 0x8000, /* R236 */ 2364 + 0x0000, /* R237 */ 2365 + 0x0000, /* R238 */ 2366 + 0x0000, /* R239 */ 2367 + 0x0003, /* R240 */ 2368 + 0x0000, /* R241 */ 2369 + 0x0000, /* R242 */ 2370 + 0x0004, /* R243 */ 2371 + 0x0300, /* R244 */ 2372 + 0x0000, /* R245 */ 2373 + 0x0200, /* R246 */ 2374 + 0x0000, /* R247 */ 2375 + 0x1000, /* R248 - DCDC1 Test Controls */ 2376 + 0x5000, /* R249 */ 2377 + 0x1000, /* R250 - DCDC3 Test Controls */ 2378 + 0x1000, /* R251 - DCDC4 Test Controls */ 2379 + 0x5100, /* R252 */ 2380 + 0x1000, /* R253 - DCDC6 Test Controls */ 2381 + }; 2382 + #endif 2383 + 2384 + #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_1 2385 + 2386 + #undef WM8350_HAVE_CONFIG_MODE 2387 + #define WM8350_HAVE_CONFIG_MODE 2388 + 2389 + const u16 wm8352_mode1_defaults[] = { 2390 + 0x6143, /* R0 - Reset/ID */ 2391 + 0x0000, /* R1 - ID */ 2392 + 0x0002, /* R2 - Revision */ 2393 + 0x1C02, /* R3 - System Control 1 */ 2394 + 0x0204, /* R4 - System Control 2 */ 2395 + 0x0000, /* R5 - System Hibernate */ 2396 + 0x8A00, /* R6 - Interface Control */ 2397 + 0x0000, /* R7 */ 2398 + 0x8000, /* R8 - Power mgmt (1) */ 2399 + 0x0000, /* R9 - Power mgmt (2) */ 2400 + 0x0000, /* R10 - Power mgmt (3) */ 2401 + 0x2000, /* R11 - Power mgmt (4) */ 2402 + 0x0E00, /* R12 - Power mgmt (5) */ 2403 + 0x0000, /* R13 - Power mgmt (6) */ 2404 + 0x0000, /* R14 - Power mgmt (7) */ 2405 + 0x0000, /* R15 */ 2406 + 0x0000, /* R16 - RTC Seconds/Minutes */ 2407 + 0x0100, /* R17 - RTC Hours/Day */ 2408 + 0x0101, /* R18 - RTC Date/Month */ 2409 + 0x1400, /* R19 - RTC Year */ 2410 + 0x0000, /* R20 - Alarm Seconds/Minutes */ 2411 + 0x0000, /* R21 - Alarm Hours/Day */ 2412 + 0x0000, /* R22 - Alarm Date/Month */ 2413 + 0x0320, /* R23 - RTC Time Control */ 2414 + 0x0000, /* R24 - System Interrupts */ 2415 + 0x0000, /* R25 - Interrupt Status 1 */ 2416 + 0x0000, /* R26 - Interrupt Status 2 */ 2417 + 0x0000, /* R27 */ 2418 + 0x0000, /* R28 - Under Voltage Interrupt status */ 2419 + 0x0000, /* R29 - Over Current Interrupt status */ 2420 + 0x0000, /* R30 - GPIO Interrupt Status */ 2421 + 0x0000, /* R31 - Comparator Interrupt Status */ 2422 + 0x3FFF, /* R32 - System Interrupts Mask */ 2423 + 0x0000, /* R33 - Interrupt Status 1 Mask */ 2424 + 0x0000, /* R34 - Interrupt Status 2 Mask */ 2425 + 0x0000, /* R35 */ 2426 + 0x0000, /* R36 - Under Voltage Interrupt status Mask */ 2427 + 0x0000, /* R37 - Over Current Interrupt status Mask */ 2428 + 0x0000, /* R38 - GPIO Interrupt Status Mask */ 2429 + 0x0000, /* R39 - Comparator Interrupt Status Mask */ 2430 + 0x0040, /* R40 - Clock Control 1 */ 2431 + 0x0000, /* R41 - Clock Control 2 */ 2432 + 0x3A00, /* R42 - FLL Control 1 */ 2433 + 0x7086, /* R43 - FLL Control 2 */ 2434 + 0xC226, /* R44 - FLL Control 3 */ 2435 + 0x0000, /* R45 - FLL Control 4 */ 2436 + 0x0000, /* R46 */ 2437 + 0x0000, /* R47 */ 2438 + 0x0000, /* R48 - DAC Control */ 2439 + 0x0000, /* R49 */ 2440 + 0x00C0, /* R50 - DAC Digital Volume L */ 2441 + 0x00C0, /* R51 - DAC Digital Volume R */ 2442 + 0x0000, /* R52 */ 2443 + 0x0040, /* R53 - DAC LR Rate */ 2444 + 0x0000, /* R54 - DAC Clock Control */ 2445 + 0x0000, /* R55 */ 2446 + 0x0000, /* R56 */ 2447 + 0x0000, /* R57 */ 2448 + 0x4000, /* R58 - DAC Mute */ 2449 + 0x0000, /* R59 - DAC Mute Volume */ 2450 + 0x0000, /* R60 - DAC Side */ 2451 + 0x0000, /* R61 */ 2452 + 0x0000, /* R62 */ 2453 + 0x0000, /* R63 */ 2454 + 0x8000, /* R64 - ADC Control */ 2455 + 0x0000, /* R65 */ 2456 + 0x00C0, /* R66 - ADC Digital Volume L */ 2457 + 0x00C0, /* R67 - ADC Digital Volume R */ 2458 + 0x0000, /* R68 - ADC Divider */ 2459 + 0x0000, /* R69 */ 2460 + 0x0040, /* R70 - ADC LR Rate */ 2461 + 0x0000, /* R71 */ 2462 + 0x0303, /* R72 - Input Control */ 2463 + 0x0000, /* R73 - IN3 Input Control */ 2464 + 0x0000, /* R74 - Mic Bias Control */ 2465 + 0x0000, /* R75 */ 2466 + 0x0000, /* R76 - Output Control */ 2467 + 0x0000, /* R77 - Jack Detect */ 2468 + 0x0000, /* R78 - Anti Pop Control */ 2469 + 0x0000, /* R79 */ 2470 + 0x0040, /* R80 - Left Input Volume */ 2471 + 0x0040, /* R81 - Right Input Volume */ 2472 + 0x0000, /* R82 */ 2473 + 0x0000, /* R83 */ 2474 + 0x0000, /* R84 */ 2475 + 0x0000, /* R85 */ 2476 + 0x0000, /* R86 */ 2477 + 0x0000, /* R87 */ 2478 + 0x0800, /* R88 - Left Mixer Control */ 2479 + 0x1000, /* R89 - Right Mixer Control */ 2480 + 0x0000, /* R90 */ 2481 + 0x0000, /* R91 */ 2482 + 0x0000, /* R92 - OUT3 Mixer Control */ 2483 + 0x0000, /* R93 - OUT4 Mixer Control */ 2484 + 0x0000, /* R94 */ 2485 + 0x0000, /* R95 */ 2486 + 0x0000, /* R96 - Output Left Mixer Volume */ 2487 + 0x0000, /* R97 - Output Right Mixer Volume */ 2488 + 0x0000, /* R98 - Input Mixer Volume L */ 2489 + 0x0000, /* R99 - Input Mixer Volume R */ 2490 + 0x0000, /* R100 - Input Mixer Volume */ 2491 + 0x0000, /* R101 */ 2492 + 0x0000, /* R102 */ 2493 + 0x0000, /* R103 */ 2494 + 0x00E4, /* R104 - OUT1L Volume */ 2495 + 0x00E4, /* R105 - OUT1R Volume */ 2496 + 0x00E4, /* R106 - OUT2L Volume */ 2497 + 0x02E4, /* R107 - OUT2R Volume */ 2498 + 0x0000, /* R108 */ 2499 + 0x0000, /* R109 */ 2500 + 0x0000, /* R110 */ 2501 + 0x0000, /* R111 - BEEP Volume */ 2502 + 0x0A00, /* R112 - AI Formating */ 2503 + 0x0000, /* R113 - ADC DAC COMP */ 2504 + 0x0020, /* R114 - AI ADC Control */ 2505 + 0x0020, /* R115 - AI DAC Control */ 2506 + 0x0000, /* R116 */ 2507 + 0x0000, /* R117 */ 2508 + 0x0000, /* R118 */ 2509 + 0x0000, /* R119 */ 2510 + 0x0000, /* R120 */ 2511 + 0x0000, /* R121 */ 2512 + 0x0000, /* R122 */ 2513 + 0x0000, /* R123 */ 2514 + 0x0000, /* R124 */ 2515 + 0x0000, /* R125 */ 2516 + 0x0000, /* R126 */ 2517 + 0x0000, /* R127 */ 2518 + 0x1FFF, /* R128 - GPIO Debounce */ 2519 + 0x0000, /* R129 - GPIO Pin pull up Control */ 2520 + 0x0000, /* R130 - GPIO Pull down Control */ 2521 + 0x0000, /* R131 - GPIO Interrupt Mode */ 2522 + 0x0000, /* R132 */ 2523 + 0x0000, /* R133 - GPIO Control */ 2524 + 0x0BFB, /* R134 - GPIO Configuration (i/o) */ 2525 + 0x0FFF, /* R135 - GPIO Pin Polarity / Type */ 2526 + 0x0000, /* R136 */ 2527 + 0x0000, /* R137 */ 2528 + 0x0000, /* R138 */ 2529 + 0x0000, /* R139 */ 2530 + 0x0300, /* R140 - GPIO Function Select 1 */ 2531 + 0x0000, /* R141 - GPIO Function Select 2 */ 2532 + 0x2300, /* R142 - GPIO Function Select 3 */ 2533 + 0x0003, /* R143 - GPIO Function Select 4 */ 2534 + 0x0000, /* R144 - Digitiser Control (1) */ 2535 + 0x0002, /* R145 - Digitiser Control (2) */ 2536 + 0x0000, /* R146 */ 2537 + 0x0000, /* R147 */ 2538 + 0x0000, /* R148 */ 2539 + 0x0000, /* R149 */ 2540 + 0x0000, /* R150 */ 2541 + 0x0000, /* R151 */ 2542 + 0x7000, /* R152 - AUX1 Readback */ 2543 + 0x7000, /* R153 - AUX2 Readback */ 2544 + 0x7000, /* R154 - AUX3 Readback */ 2545 + 0x7000, /* R155 - AUX4 Readback */ 2546 + 0x0000, /* R156 - USB Voltage Readback */ 2547 + 0x0000, /* R157 - LINE Voltage Readback */ 2548 + 0x0000, /* R158 - BATT Voltage Readback */ 2549 + 0x0000, /* R159 - Chip Temp Readback */ 2550 + 0x0000, /* R160 */ 2551 + 0x0000, /* R161 */ 2552 + 0x0000, /* R162 */ 2553 + 0x0000, /* R163 - Generic Comparator Control */ 2554 + 0x0000, /* R164 - Generic comparator 1 */ 2555 + 0x0000, /* R165 - Generic comparator 2 */ 2556 + 0x0000, /* R166 - Generic comparator 3 */ 2557 + 0x0000, /* R167 - Generic comparator 4 */ 2558 + 0xA00F, /* R168 - Battery Charger Control 1 */ 2559 + 0x0B06, /* R169 - Battery Charger Control 2 */ 2560 + 0x0000, /* R170 - Battery Charger Control 3 */ 2561 + 0x0000, /* R171 */ 2562 + 0x0000, /* R172 - Current Sink Driver A */ 2563 + 0x0000, /* R173 - CSA Flash control */ 2564 + 0x0000, /* R174 - Current Sink Driver B */ 2565 + 0x0000, /* R175 - CSB Flash control */ 2566 + 0x0000, /* R176 - DCDC/LDO requested */ 2567 + 0x032D, /* R177 - DCDC Active options */ 2568 + 0x0000, /* R178 - DCDC Sleep options */ 2569 + 0x0025, /* R179 - Power-check comparator */ 2570 + 0x0062, /* R180 - DCDC1 Control */ 2571 + 0x0400, /* R181 - DCDC1 Timeouts */ 2572 + 0x1006, /* R182 - DCDC1 Low Power */ 2573 + 0x0018, /* R183 - DCDC2 Control */ 2574 + 0x0000, /* R184 - DCDC2 Timeouts */ 2575 + 0x0000, /* R185 */ 2576 + 0x0006, /* R186 - DCDC3 Control */ 2577 + 0x0800, /* R187 - DCDC3 Timeouts */ 2578 + 0x0006, /* R188 - DCDC3 Low Power */ 2579 + 0x0006, /* R189 - DCDC4 Control */ 2580 + 0x0C00, /* R190 - DCDC4 Timeouts */ 2581 + 0x0006, /* R191 - DCDC4 Low Power */ 2582 + 0x0008, /* R192 - DCDC5 Control */ 2583 + 0x0000, /* R193 - DCDC5 Timeouts */ 2584 + 0x0000, /* R194 */ 2585 + 0x0026, /* R195 - DCDC6 Control */ 2586 + 0x1000, /* R196 - DCDC6 Timeouts */ 2587 + 0x0006, /* R197 - DCDC6 Low Power */ 2588 + 0x0000, /* R198 */ 2589 + 0x0003, /* R199 - Limit Switch Control */ 2590 + 0x0002, /* R200 - LDO1 Control */ 2591 + 0x0000, /* R201 - LDO1 Timeouts */ 2592 + 0x001C, /* R202 - LDO1 Low Power */ 2593 + 0x001A, /* R203 - LDO2 Control */ 2594 + 0x0000, /* R204 - LDO2 Timeouts */ 2595 + 0x001C, /* R205 - LDO2 Low Power */ 2596 + 0x001F, /* R206 - LDO3 Control */ 2597 + 0x0000, /* R207 - LDO3 Timeouts */ 2598 + 0x001C, /* R208 - LDO3 Low Power */ 2599 + 0x001F, /* R209 - LDO4 Control */ 2600 + 0x0000, /* R210 - LDO4 Timeouts */ 2601 + 0x001C, /* R211 - LDO4 Low Power */ 2602 + 0x0000, /* R212 */ 2603 + 0x0000, /* R213 */ 2604 + 0x0000, /* R214 */ 2605 + 0x0000, /* R215 - VCC_FAULT Masks */ 2606 + 0x001F, /* R216 - Main Bandgap Control */ 2607 + 0x0000, /* R217 - OSC Control */ 2608 + 0x9000, /* R218 - RTC Tick Control */ 2609 + 0x0000, /* R219 - Security1 */ 2610 + 0x4000, /* R220 */ 2611 + 0x0000, /* R221 */ 2612 + 0x0000, /* R222 */ 2613 + 0x0000, /* R223 */ 2614 + 0x0000, /* R224 - Signal overrides */ 2615 + 0x0000, /* R225 - DCDC/LDO status */ 2616 + 0x0000, /* R226 - Charger Overides/status */ 2617 + 0x0000, /* R227 - misc overrides */ 2618 + 0x0000, /* R228 - Supply overrides/status 1 */ 2619 + 0x0000, /* R229 - Supply overrides/status 2 */ 2620 + 0xE000, /* R230 - GPIO Pin Status */ 2621 + 0x0000, /* R231 - comparotor overrides */ 2622 + 0x0000, /* R232 */ 2623 + 0x0000, /* R233 - State Machine status */ 2624 + 0x1200, /* R234 */ 2625 + 0x0000, /* R235 */ 2626 + 0x8000, /* R236 */ 2627 + 0x0000, /* R237 */ 2628 + 0x0000, /* R238 */ 2629 + 0x0000, /* R239 */ 2630 + 0x0003, /* R240 */ 2631 + 0x0000, /* R241 */ 2632 + 0x0000, /* R242 */ 2633 + 0x0004, /* R243 */ 2634 + 0x0300, /* R244 */ 2635 + 0x0000, /* R245 */ 2636 + 0x0200, /* R246 */ 2637 + 0x0000, /* R247 */ 2638 + 0x1000, /* R248 - DCDC1 Test Controls */ 2639 + 0x5000, /* R249 */ 2640 + 0x1000, /* R250 - DCDC3 Test Controls */ 2641 + 0x1000, /* R251 - DCDC4 Test Controls */ 2642 + 0x5100, /* R252 */ 2643 + 0x1000, /* R253 - DCDC6 Test Controls */ 2644 + }; 2645 + #endif 2646 + 2647 + #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_2 2648 + 2649 + #undef WM8350_HAVE_CONFIG_MODE 2650 + #define WM8350_HAVE_CONFIG_MODE 2651 + 2652 + const u16 wm8352_mode2_defaults[] = { 2653 + 0x6143, /* R0 - Reset/ID */ 2654 + 0x0000, /* R1 - ID */ 2655 + 0x0002, /* R2 - Revision */ 2656 + 0x1C02, /* R3 - System Control 1 */ 2657 + 0x0204, /* R4 - System Control 2 */ 2658 + 0x0000, /* R5 - System Hibernate */ 2659 + 0x8A00, /* R6 - Interface Control */ 2660 + 0x0000, /* R7 */ 2661 + 0x8000, /* R8 - Power mgmt (1) */ 2662 + 0x0000, /* R9 - Power mgmt (2) */ 2663 + 0x0000, /* R10 - Power mgmt (3) */ 2664 + 0x2000, /* R11 - Power mgmt (4) */ 2665 + 0x0E00, /* R12 - Power mgmt (5) */ 2666 + 0x0000, /* R13 - Power mgmt (6) */ 2667 + 0x0000, /* R14 - Power mgmt (7) */ 2668 + 0x0000, /* R15 */ 2669 + 0x0000, /* R16 - RTC Seconds/Minutes */ 2670 + 0x0100, /* R17 - RTC Hours/Day */ 2671 + 0x0101, /* R18 - RTC Date/Month */ 2672 + 0x1400, /* R19 - RTC Year */ 2673 + 0x0000, /* R20 - Alarm Seconds/Minutes */ 2674 + 0x0000, /* R21 - Alarm Hours/Day */ 2675 + 0x0000, /* R22 - Alarm Date/Month */ 2676 + 0x0320, /* R23 - RTC Time Control */ 2677 + 0x0000, /* R24 - System Interrupts */ 2678 + 0x0000, /* R25 - Interrupt Status 1 */ 2679 + 0x0000, /* R26 - Interrupt Status 2 */ 2680 + 0x0000, /* R27 */ 2681 + 0x0000, /* R28 - Under Voltage Interrupt status */ 2682 + 0x0000, /* R29 - Over Current Interrupt status */ 2683 + 0x0000, /* R30 - GPIO Interrupt Status */ 2684 + 0x0000, /* R31 - Comparator Interrupt Status */ 2685 + 0x3FFF, /* R32 - System Interrupts Mask */ 2686 + 0x0000, /* R33 - Interrupt Status 1 Mask */ 2687 + 0x0000, /* R34 - Interrupt Status 2 Mask */ 2688 + 0x0000, /* R35 */ 2689 + 0x0000, /* R36 - Under Voltage Interrupt status Mask */ 2690 + 0x0000, /* R37 - Over Current Interrupt status Mask */ 2691 + 0x0000, /* R38 - GPIO Interrupt Status Mask */ 2692 + 0x0000, /* R39 - Comparator Interrupt Status Mask */ 2693 + 0x0040, /* R40 - Clock Control 1 */ 2694 + 0x0000, /* R41 - Clock Control 2 */ 2695 + 0x3A00, /* R42 - FLL Control 1 */ 2696 + 0x7086, /* R43 - FLL Control 2 */ 2697 + 0xC226, /* R44 - FLL Control 3 */ 2698 + 0x0000, /* R45 - FLL Control 4 */ 2699 + 0x0000, /* R46 */ 2700 + 0x0000, /* R47 */ 2701 + 0x0000, /* R48 - DAC Control */ 2702 + 0x0000, /* R49 */ 2703 + 0x00C0, /* R50 - DAC Digital Volume L */ 2704 + 0x00C0, /* R51 - DAC Digital Volume R */ 2705 + 0x0000, /* R52 */ 2706 + 0x0040, /* R53 - DAC LR Rate */ 2707 + 0x0000, /* R54 - DAC Clock Control */ 2708 + 0x0000, /* R55 */ 2709 + 0x0000, /* R56 */ 2710 + 0x0000, /* R57 */ 2711 + 0x4000, /* R58 - DAC Mute */ 2712 + 0x0000, /* R59 - DAC Mute Volume */ 2713 + 0x0000, /* R60 - DAC Side */ 2714 + 0x0000, /* R61 */ 2715 + 0x0000, /* R62 */ 2716 + 0x0000, /* R63 */ 2717 + 0x8000, /* R64 - ADC Control */ 2718 + 0x0000, /* R65 */ 2719 + 0x00C0, /* R66 - ADC Digital Volume L */ 2720 + 0x00C0, /* R67 - ADC Digital Volume R */ 2721 + 0x0000, /* R68 - ADC Divider */ 2722 + 0x0000, /* R69 */ 2723 + 0x0040, /* R70 - ADC LR Rate */ 2724 + 0x0000, /* R71 */ 2725 + 0x0303, /* R72 - Input Control */ 2726 + 0x0000, /* R73 - IN3 Input Control */ 2727 + 0x0000, /* R74 - Mic Bias Control */ 2728 + 0x0000, /* R75 */ 2729 + 0x0000, /* R76 - Output Control */ 2730 + 0x0000, /* R77 - Jack Detect */ 2731 + 0x0000, /* R78 - Anti Pop Control */ 2732 + 0x0000, /* R79 */ 2733 + 0x0040, /* R80 - Left Input Volume */ 2734 + 0x0040, /* R81 - Right Input Volume */ 2735 + 0x0000, /* R82 */ 2736 + 0x0000, /* R83 */ 2737 + 0x0000, /* R84 */ 2738 + 0x0000, /* R85 */ 2739 + 0x0000, /* R86 */ 2740 + 0x0000, /* R87 */ 2741 + 0x0800, /* R88 - Left Mixer Control */ 2742 + 0x1000, /* R89 - Right Mixer Control */ 2743 + 0x0000, /* R90 */ 2744 + 0x0000, /* R91 */ 2745 + 0x0000, /* R92 - OUT3 Mixer Control */ 2746 + 0x0000, /* R93 - OUT4 Mixer Control */ 2747 + 0x0000, /* R94 */ 2748 + 0x0000, /* R95 */ 2749 + 0x0000, /* R96 - Output Left Mixer Volume */ 2750 + 0x0000, /* R97 - Output Right Mixer Volume */ 2751 + 0x0000, /* R98 - Input Mixer Volume L */ 2752 + 0x0000, /* R99 - Input Mixer Volume R */ 2753 + 0x0000, /* R100 - Input Mixer Volume */ 2754 + 0x0000, /* R101 */ 2755 + 0x0000, /* R102 */ 2756 + 0x0000, /* R103 */ 2757 + 0x00E4, /* R104 - OUT1L Volume */ 2758 + 0x00E4, /* R105 - OUT1R Volume */ 2759 + 0x00E4, /* R106 - OUT2L Volume */ 2760 + 0x02E4, /* R107 - OUT2R Volume */ 2761 + 0x0000, /* R108 */ 2762 + 0x0000, /* R109 */ 2763 + 0x0000, /* R110 */ 2764 + 0x0000, /* R111 - BEEP Volume */ 2765 + 0x0A00, /* R112 - AI Formating */ 2766 + 0x0000, /* R113 - ADC DAC COMP */ 2767 + 0x0020, /* R114 - AI ADC Control */ 2768 + 0x0020, /* R115 - AI DAC Control */ 2769 + 0x0000, /* R116 */ 2770 + 0x0000, /* R117 */ 2771 + 0x0000, /* R118 */ 2772 + 0x0000, /* R119 */ 2773 + 0x0000, /* R120 */ 2774 + 0x0000, /* R121 */ 2775 + 0x0000, /* R122 */ 2776 + 0x0000, /* R123 */ 2777 + 0x0000, /* R124 */ 2778 + 0x0000, /* R125 */ 2779 + 0x0000, /* R126 */ 2780 + 0x0000, /* R127 */ 2781 + 0x1FFF, /* R128 - GPIO Debounce */ 2782 + 0x0000, /* R129 - GPIO Pin pull up Control */ 2783 + 0x0110, /* R130 - GPIO Pull down Control */ 2784 + 0x0000, /* R131 - GPIO Interrupt Mode */ 2785 + 0x0000, /* R132 */ 2786 + 0x0000, /* R133 - GPIO Control */ 2787 + 0x09DA, /* R134 - GPIO Configuration (i/o) */ 2788 + 0x0DD6, /* R135 - GPIO Pin Polarity / Type */ 2789 + 0x0000, /* R136 */ 2790 + 0x0000, /* R137 */ 2791 + 0x0000, /* R138 */ 2792 + 0x0000, /* R139 */ 2793 + 0x1310, /* R140 - GPIO Function Select 1 */ 2794 + 0x0033, /* R141 - GPIO Function Select 2 */ 2795 + 0x2000, /* R142 - GPIO Function Select 3 */ 2796 + 0x0000, /* R143 - GPIO Function Select 4 */ 2797 + 0x0000, /* R144 - Digitiser Control (1) */ 2798 + 0x0002, /* R145 - Digitiser Control (2) */ 2799 + 0x0000, /* R146 */ 2800 + 0x0000, /* R147 */ 2801 + 0x0000, /* R148 */ 2802 + 0x0000, /* R149 */ 2803 + 0x0000, /* R150 */ 2804 + 0x0000, /* R151 */ 2805 + 0x7000, /* R152 - AUX1 Readback */ 2806 + 0x7000, /* R153 - AUX2 Readback */ 2807 + 0x7000, /* R154 - AUX3 Readback */ 2808 + 0x7000, /* R155 - AUX4 Readback */ 2809 + 0x0000, /* R156 - USB Voltage Readback */ 2810 + 0x0000, /* R157 - LINE Voltage Readback */ 2811 + 0x0000, /* R158 - BATT Voltage Readback */ 2812 + 0x0000, /* R159 - Chip Temp Readback */ 2813 + 0x0000, /* R160 */ 2814 + 0x0000, /* R161 */ 2815 + 0x0000, /* R162 */ 2816 + 0x0000, /* R163 - Generic Comparator Control */ 2817 + 0x0000, /* R164 - Generic comparator 1 */ 2818 + 0x0000, /* R165 - Generic comparator 2 */ 2819 + 0x0000, /* R166 - Generic comparator 3 */ 2820 + 0x0000, /* R167 - Generic comparator 4 */ 2821 + 0xA00F, /* R168 - Battery Charger Control 1 */ 2822 + 0x0B06, /* R169 - Battery Charger Control 2 */ 2823 + 0x0000, /* R170 - Battery Charger Control 3 */ 2824 + 0x0000, /* R171 */ 2825 + 0x0000, /* R172 - Current Sink Driver A */ 2826 + 0x0000, /* R173 - CSA Flash control */ 2827 + 0x0000, /* R174 - Current Sink Driver B */ 2828 + 0x0000, /* R175 - CSB Flash control */ 2829 + 0x0000, /* R176 - DCDC/LDO requested */ 2830 + 0x032D, /* R177 - DCDC Active options */ 2831 + 0x0000, /* R178 - DCDC Sleep options */ 2832 + 0x0025, /* R179 - Power-check comparator */ 2833 + 0x000E, /* R180 - DCDC1 Control */ 2834 + 0x0800, /* R181 - DCDC1 Timeouts */ 2835 + 0x1006, /* R182 - DCDC1 Low Power */ 2836 + 0x0018, /* R183 - DCDC2 Control */ 2837 + 0x0000, /* R184 - DCDC2 Timeouts */ 2838 + 0x0000, /* R185 */ 2839 + 0x0056, /* R186 - DCDC3 Control */ 2840 + 0x1800, /* R187 - DCDC3 Timeouts */ 2841 + 0x0006, /* R188 - DCDC3 Low Power */ 2842 + 0x000E, /* R189 - DCDC4 Control */ 2843 + 0x1000, /* R190 - DCDC4 Timeouts */ 2844 + 0x0006, /* R191 - DCDC4 Low Power */ 2845 + 0x0008, /* R192 - DCDC5 Control */ 2846 + 0x0000, /* R193 - DCDC5 Timeouts */ 2847 + 0x0000, /* R194 */ 2848 + 0x0026, /* R195 - DCDC6 Control */ 2849 + 0x0C00, /* R196 - DCDC6 Timeouts */ 2850 + 0x0006, /* R197 - DCDC6 Low Power */ 2851 + 0x0000, /* R198 */ 2852 + 0x0003, /* R199 - Limit Switch Control */ 2853 + 0x001C, /* R200 - LDO1 Control */ 2854 + 0x0000, /* R201 - LDO1 Timeouts */ 2855 + 0x001C, /* R202 - LDO1 Low Power */ 2856 + 0x0006, /* R203 - LDO2 Control */ 2857 + 0x0400, /* R204 - LDO2 Timeouts */ 2858 + 0x001C, /* R205 - LDO2 Low Power */ 2859 + 0x001C, /* R206 - LDO3 Control */ 2860 + 0x1400, /* R207 - LDO3 Timeouts */ 2861 + 0x001C, /* R208 - LDO3 Low Power */ 2862 + 0x001A, /* R209 - LDO4 Control */ 2863 + 0x0000, /* R210 - LDO4 Timeouts */ 2864 + 0x001C, /* R211 - LDO4 Low Power */ 2865 + 0x0000, /* R212 */ 2866 + 0x0000, /* R213 */ 2867 + 0x0000, /* R214 */ 2868 + 0x0000, /* R215 - VCC_FAULT Masks */ 2869 + 0x001F, /* R216 - Main Bandgap Control */ 2870 + 0x0000, /* R217 - OSC Control */ 2871 + 0x9000, /* R218 - RTC Tick Control */ 2872 + 0x0000, /* R219 - Security1 */ 2873 + 0x4000, /* R220 */ 2874 + 0x0000, /* R221 */ 2875 + 0x0000, /* R222 */ 2876 + 0x0000, /* R223 */ 2877 + 0x0000, /* R224 - Signal overrides */ 2878 + 0x0000, /* R225 - DCDC/LDO status */ 2879 + 0x0000, /* R226 - Charger Overides/status */ 2880 + 0x0000, /* R227 - misc overrides */ 2881 + 0x0000, /* R228 - Supply overrides/status 1 */ 2882 + 0x0000, /* R229 - Supply overrides/status 2 */ 2883 + 0xE000, /* R230 - GPIO Pin Status */ 2884 + 0x0000, /* R231 - comparotor overrides */ 2885 + 0x0000, /* R232 */ 2886 + 0x0000, /* R233 - State Machine status */ 2887 + 0x1200, /* R234 */ 2888 + 0x0000, /* R235 */ 2889 + 0x8000, /* R236 */ 2890 + 0x0000, /* R237 */ 2891 + 0x0000, /* R238 */ 2892 + 0x0000, /* R239 */ 2893 + 0x0003, /* R240 */ 2894 + 0x0000, /* R241 */ 2895 + 0x0000, /* R242 */ 2896 + 0x0004, /* R243 */ 2897 + 0x0300, /* R244 */ 2898 + 0x0000, /* R245 */ 2899 + 0x0200, /* R246 */ 2900 + 0x0000, /* R247 */ 2901 + 0x1000, /* R248 - DCDC1 Test Controls */ 2902 + 0x5000, /* R249 */ 2903 + 0x1000, /* R250 - DCDC3 Test Controls */ 2904 + 0x1000, /* R251 - DCDC4 Test Controls */ 2905 + 0x5100, /* R252 */ 2906 + 0x1000, /* R253 - DCDC6 Test Controls */ 2907 + }; 2908 + #endif 2909 + 2910 + #ifdef CONFIG_MFD_WM8352_CONFIG_MODE_3 2911 + 2912 + #undef WM8350_HAVE_CONFIG_MODE 2913 + #define WM8350_HAVE_CONFIG_MODE 2914 + 2915 + const u16 wm8352_mode3_defaults[] = { 2916 + 0x6143, /* R0 - Reset/ID */ 2917 + 0x0000, /* R1 - ID */ 2918 + 0x0002, /* R2 - Revision */ 2919 + 0x1C02, /* R3 - System Control 1 */ 2920 + 0x0204, /* R4 - System Control 2 */ 2921 + 0x0000, /* R5 - System Hibernate */ 2922 + 0x8A00, /* R6 - Interface Control */ 2923 + 0x0000, /* R7 */ 2924 + 0x8000, /* R8 - Power mgmt (1) */ 2925 + 0x0000, /* R9 - Power mgmt (2) */ 2926 + 0x0000, /* R10 - Power mgmt (3) */ 2927 + 0x2000, /* R11 - Power mgmt (4) */ 2928 + 0x0E00, /* R12 - Power mgmt (5) */ 2929 + 0x0000, /* R13 - Power mgmt (6) */ 2930 + 0x0000, /* R14 - Power mgmt (7) */ 2931 + 0x0000, /* R15 */ 2932 + 0x0000, /* R16 - RTC Seconds/Minutes */ 2933 + 0x0100, /* R17 - RTC Hours/Day */ 2934 + 0x0101, /* R18 - RTC Date/Month */ 2935 + 0x1400, /* R19 - RTC Year */ 2936 + 0x0000, /* R20 - Alarm Seconds/Minutes */ 2937 + 0x0000, /* R21 - Alarm Hours/Day */ 2938 + 0x0000, /* R22 - Alarm Date/Month */ 2939 + 0x0320, /* R23 - RTC Time Control */ 2940 + 0x0000, /* R24 - System Interrupts */ 2941 + 0x0000, /* R25 - Interrupt Status 1 */ 2942 + 0x0000, /* R26 - Interrupt Status 2 */ 2943 + 0x0000, /* R27 */ 2944 + 0x0000, /* R28 - Under Voltage Interrupt status */ 2945 + 0x0000, /* R29 - Over Current Interrupt status */ 2946 + 0x0000, /* R30 - GPIO Interrupt Status */ 2947 + 0x0000, /* R31 - Comparator Interrupt Status */ 2948 + 0x3FFF, /* R32 - System Interrupts Mask */ 2949 + 0x0000, /* R33 - Interrupt Status 1 Mask */ 2950 + 0x0000, /* R34 - Interrupt Status 2 Mask */ 2951 + 0x0000, /* R35 */ 2952 + 0x0000, /* R36 - Under Voltage Interrupt status Mask */ 2953 + 0x0000, /* R37 - Over Current Interrupt status Mask */ 2954 + 0x0000, /* R38 - GPIO Interrupt Status Mask */ 2955 + 0x0000, /* R39 - Comparator Interrupt Status Mask */ 2956 + 0x0040, /* R40 - Clock Control 1 */ 2957 + 0x0000, /* R41 - Clock Control 2 */ 2958 + 0x3A00, /* R42 - FLL Control 1 */ 2959 + 0x7086, /* R43 - FLL Control 2 */ 2960 + 0xC226, /* R44 - FLL Control 3 */ 2961 + 0x0000, /* R45 - FLL Control 4 */ 2962 + 0x0000, /* R46 */ 2963 + 0x0000, /* R47 */ 2964 + 0x0000, /* R48 - DAC Control */ 2965 + 0x0000, /* R49 */ 2966 + 0x00C0, /* R50 - DAC Digital Volume L */ 2967 + 0x00C0, /* R51 - DAC Digital Volume R */ 2968 + 0x0000, /* R52 */ 2969 + 0x0040, /* R53 - DAC LR Rate */ 2970 + 0x0000, /* R54 - DAC Clock Control */ 2971 + 0x0000, /* R55 */ 2972 + 0x0000, /* R56 */ 2973 + 0x0000, /* R57 */ 2974 + 0x4000, /* R58 - DAC Mute */ 2975 + 0x0000, /* R59 - DAC Mute Volume */ 2976 + 0x0000, /* R60 - DAC Side */ 2977 + 0x0000, /* R61 */ 2978 + 0x0000, /* R62 */ 2979 + 0x0000, /* R63 */ 2980 + 0x8000, /* R64 - ADC Control */ 2981 + 0x0000, /* R65 */ 2982 + 0x00C0, /* R66 - ADC Digital Volume L */ 2983 + 0x00C0, /* R67 - ADC Digital Volume R */ 2984 + 0x0000, /* R68 - ADC Divider */ 2985 + 0x0000, /* R69 */ 2986 + 0x0040, /* R70 - ADC LR Rate */ 2987 + 0x0000, /* R71 */ 2988 + 0x0303, /* R72 - Input Control */ 2989 + 0x0000, /* R73 - IN3 Input Control */ 2990 + 0x0000, /* R74 - Mic Bias Control */ 2991 + 0x0000, /* R75 */ 2992 + 0x0000, /* R76 - Output Control */ 2993 + 0x0000, /* R77 - Jack Detect */ 2994 + 0x0000, /* R78 - Anti Pop Control */ 2995 + 0x0000, /* R79 */ 2996 + 0x0040, /* R80 - Left Input Volume */ 2997 + 0x0040, /* R81 - Right Input Volume */ 2998 + 0x0000, /* R82 */ 2999 + 0x0000, /* R83 */ 3000 + 0x0000, /* R84 */ 3001 + 0x0000, /* R85 */ 3002 + 0x0000, /* R86 */ 3003 + 0x0000, /* R87 */ 3004 + 0x0800, /* R88 - Left Mixer Control */ 3005 + 0x1000, /* R89 - Right Mixer Control */ 3006 + 0x0000, /* R90 */ 3007 + 0x0000, /* R91 */ 3008 + 0x0000, /* R92 - OUT3 Mixer Control */ 3009 + 0x0000, /* R93 - OUT4 Mixer Control */ 3010 + 0x0000, /* R94 */ 3011 + 0x0000, /* R95 */ 3012 + 0x0000, /* R96 - Output Left Mixer Volume */ 3013 + 0x0000, /* R97 - Output Right Mixer Volume */ 3014 + 0x0000, /* R98 - Input Mixer Volume L */ 3015 + 0x0000, /* R99 - Input Mixer Volume R */ 3016 + 0x0000, /* R100 - Input Mixer Volume */ 3017 + 0x0000, /* R101 */ 3018 + 0x0000, /* R102 */ 3019 + 0x0000, /* R103 */ 3020 + 0x00E4, /* R104 - OUT1L Volume */ 3021 + 0x00E4, /* R105 - OUT1R Volume */ 3022 + 0x00E4, /* R106 - OUT2L Volume */ 3023 + 0x02E4, /* R107 - OUT2R Volume */ 3024 + 0x0000, /* R108 */ 3025 + 0x0000, /* R109 */ 3026 + 0x0000, /* R110 */ 3027 + 0x0000, /* R111 - BEEP Volume */ 3028 + 0x0A00, /* R112 - AI Formating */ 3029 + 0x0000, /* R113 - ADC DAC COMP */ 3030 + 0x0020, /* R114 - AI ADC Control */ 3031 + 0x0020, /* R115 - AI DAC Control */ 3032 + 0x0000, /* R116 */ 3033 + 0x0000, /* R117 */ 3034 + 0x0000, /* R118 */ 3035 + 0x0000, /* R119 */ 3036 + 0x0000, /* R120 */ 3037 + 0x0000, /* R121 */ 3038 + 0x0000, /* R122 */ 3039 + 0x0000, /* R123 */ 3040 + 0x0000, /* R124 */ 3041 + 0x0000, /* R125 */ 3042 + 0x0000, /* R126 */ 3043 + 0x0000, /* R127 */ 3044 + 0x1FFF, /* R128 - GPIO Debounce */ 3045 + 0x0010, /* R129 - GPIO Pin pull up Control */ 3046 + 0x0000, /* R130 - GPIO Pull down Control */ 3047 + 0x0000, /* R131 - GPIO Interrupt Mode */ 3048 + 0x0000, /* R132 */ 3049 + 0x0000, /* R133 - GPIO Control */ 3050 + 0x0BFB, /* R134 - GPIO Configuration (i/o) */ 3051 + 0x0FFD, /* R135 - GPIO Pin Polarity / Type */ 3052 + 0x0000, /* R136 */ 3053 + 0x0000, /* R137 */ 3054 + 0x0000, /* R138 */ 3055 + 0x0000, /* R139 */ 3056 + 0x0310, /* R140 - GPIO Function Select 1 */ 3057 + 0x0001, /* R141 - GPIO Function Select 2 */ 3058 + 0x2300, /* R142 - GPIO Function Select 3 */ 3059 + 0x0003, /* R143 - GPIO Function Select 4 */ 3060 + 0x0000, /* R144 - Digitiser Control (1) */ 3061 + 0x0002, /* R145 - Digitiser Control (2) */ 3062 + 0x0000, /* R146 */ 3063 + 0x0000, /* R147 */ 3064 + 0x0000, /* R148 */ 3065 + 0x0000, /* R149 */ 3066 + 0x0000, /* R150 */ 3067 + 0x0000, /* R151 */ 3068 + 0x7000, /* R152 - AUX1 Readback */ 3069 + 0x7000, /* R153 - AUX2 Readback */ 3070 + 0x7000, /* R154 - AUX3 Readback */ 3071 + 0x7000, /* R155 - AUX4 Readback */ 3072 + 0x0000, /* R156 - USB Voltage Readback */ 3073 + 0x0000, /* R157 - LINE Voltage Readback */ 3074 + 0x0000, /* R158 - BATT Voltage Readback */ 3075 + 0x0000, /* R159 - Chip Temp Readback */ 3076 + 0x0000, /* R160 */ 3077 + 0x0000, /* R161 */ 3078 + 0x0000, /* R162 */ 3079 + 0x0000, /* R163 - Generic Comparator Control */ 3080 + 0x0000, /* R164 - Generic comparator 1 */ 3081 + 0x0000, /* R165 - Generic comparator 2 */ 3082 + 0x0000, /* R166 - Generic comparator 3 */ 3083 + 0x0000, /* R167 - Generic comparator 4 */ 3084 + 0xA00F, /* R168 - Battery Charger Control 1 */ 3085 + 0x0B06, /* R169 - Battery Charger Control 2 */ 3086 + 0x0000, /* R170 - Battery Charger Control 3 */ 3087 + 0x0000, /* R171 */ 3088 + 0x0000, /* R172 - Current Sink Driver A */ 3089 + 0x0000, /* R173 - CSA Flash control */ 3090 + 0x0000, /* R174 - Current Sink Driver B */ 3091 + 0x0000, /* R175 - CSB Flash control */ 3092 + 0x0000, /* R176 - DCDC/LDO requested */ 3093 + 0x032D, /* R177 - DCDC Active options */ 3094 + 0x0000, /* R178 - DCDC Sleep options */ 3095 + 0x0025, /* R179 - Power-check comparator */ 3096 + 0x0006, /* R180 - DCDC1 Control */ 3097 + 0x0400, /* R181 - DCDC1 Timeouts */ 3098 + 0x1006, /* R182 - DCDC1 Low Power */ 3099 + 0x0018, /* R183 - DCDC2 Control */ 3100 + 0x0000, /* R184 - DCDC2 Timeouts */ 3101 + 0x0000, /* R185 */ 3102 + 0x0050, /* R186 - DCDC3 Control */ 3103 + 0x0C00, /* R187 - DCDC3 Timeouts */ 3104 + 0x0006, /* R188 - DCDC3 Low Power */ 3105 + 0x000E, /* R189 - DCDC4 Control */ 3106 + 0x0400, /* R190 - DCDC4 Timeouts */ 3107 + 0x0006, /* R191 - DCDC4 Low Power */ 3108 + 0x0008, /* R192 - DCDC5 Control */ 3109 + 0x0000, /* R193 - DCDC5 Timeouts */ 3110 + 0x0000, /* R194 */ 3111 + 0x0029, /* R195 - DCDC6 Control */ 3112 + 0x0800, /* R196 - DCDC6 Timeouts */ 3113 + 0x0006, /* R197 - DCDC6 Low Power */ 3114 + 0x0000, /* R198 */ 3115 + 0x0003, /* R199 - Limit Switch Control */ 3116 + 0x001D, /* R200 - LDO1 Control */ 3117 + 0x1000, /* R201 - LDO1 Timeouts */ 3118 + 0x001C, /* R202 - LDO1 Low Power */ 3119 + 0x0017, /* R203 - LDO2 Control */ 3120 + 0x1000, /* R204 - LDO2 Timeouts */ 3121 + 0x001C, /* R205 - LDO2 Low Power */ 3122 + 0x0006, /* R206 - LDO3 Control */ 3123 + 0x1000, /* R207 - LDO3 Timeouts */ 3124 + 0x001C, /* R208 - LDO3 Low Power */ 3125 + 0x0010, /* R209 - LDO4 Control */ 3126 + 0x1000, /* R210 - LDO4 Timeouts */ 3127 + 0x001C, /* R211 - LDO4 Low Power */ 3128 + 0x0000, /* R212 */ 3129 + 0x0000, /* R213 */ 3130 + 0x0000, /* R214 */ 3131 + 0x0000, /* R215 - VCC_FAULT Masks */ 3132 + 0x001F, /* R216 - Main Bandgap Control */ 3133 + 0x0000, /* R217 - OSC Control */ 3134 + 0x9000, /* R218 - RTC Tick Control */ 3135 + 0x0000, /* R219 - Security1 */ 3136 + 0x4000, /* R220 */ 3137 + 0x0000, /* R221 */ 3138 + 0x0000, /* R222 */ 3139 + 0x0000, /* R223 */ 3140 + 0x0000, /* R224 - Signal overrides */ 3141 + 0x0000, /* R225 - DCDC/LDO status */ 3142 + 0x0000, /* R226 - Charger Overides/status */ 3143 + 0x0000, /* R227 - misc overrides */ 3144 + 0x0000, /* R228 - Supply overrides/status 1 */ 3145 + 0x0000, /* R229 - Supply overrides/status 2 */ 3146 + 0xE000, /* R230 - GPIO Pin Status */ 3147 + 0x0000, /* R231 - comparotor overrides */ 3148 + 0x0000, /* R232 */ 3149 + 0x0000, /* R233 - State Machine status */ 3150 + 0x1200, /* R234 */ 3151 + 0x0000, /* R235 */ 3152 + 0x8000, /* R236 */ 3153 + 0x0000, /* R237 */ 3154 + 0x0000, /* R238 */ 3155 + 0x0000, /* R239 */ 3156 + 0x0003, /* R240 */ 3157 + 0x0000, /* R241 */ 3158 + 0x0000, /* R242 */ 3159 + 0x0004, /* R243 */ 3160 + 0x0300, /* R244 */ 3161 + 0x0000, /* R245 */ 3162 + 0x0200, /* R246 */ 3163 + 0x0000, /* R247 */ 3164 + 0x1000, /* R248 - DCDC1 Test Controls */ 3165 + 0x5000, /* R249 */ 3166 + 0x1000, /* R250 - DCDC3 Test Controls */ 3167 + 0x1000, /* R251 - DCDC4 Test Controls */ 3168 + 0x5100, /* R252 */ 3169 + 0x1000, /* R253 - DCDC6 Test Controls */ 3170 + }; 3171 + #endif 3172 + 1077 3173 /* The register defaults for the config mode used must be compiled in but 1078 3174 * due to the impact on kernel size it is possible to disable 1079 3175 */ ··· 3403 1307 { 0xFF3F, 0xE03F, 0x0000 }, /* R216 - Main Bandgap Control */ 3404 1308 { 0xEF2F, 0xE02F, 0x0000 }, /* R217 - OSC Control */ 3405 1309 { 0xF3FF, 0xB3FF, 0xc000 }, /* R218 - RTC Tick Control */ 3406 - { 0xFFFF, 0xFFFF, 0xFFFF }, /* R219 */ 1310 + { 0xFFFF, 0xFFFF, 0x0000 }, /* R219 - Security */ 3407 1311 { 0x09FF, 0x01FF, 0x0000 }, /* R220 - RAM BIST 1 */ 3408 1312 { 0x0000, 0x0000, 0x0000 }, /* R221 */ 3409 1313 { 0xFFFF, 0xFFFF, 0xFFFF }, /* R222 */ 3410 1314 { 0xFFFF, 0xFFFF, 0xFFFF }, /* R223 */ 3411 1315 { 0x0000, 0x0000, 0x0000 }, /* R224 */ 3412 1316 { 0x8F3F, 0x0000, 0xFFFF }, /* R225 - DCDC/LDO status */ 3413 - { 0x0000, 0x0000, 0x0000 }, /* R226 */ 1317 + { 0x0000, 0x0000, 0xFFFF }, /* R226 - Charger status */ 3414 1318 { 0x0000, 0x0000, 0xFFFF }, /* R227 */ 3415 1319 { 0x0000, 0x0000, 0x0000 }, /* R228 */ 3416 1320 { 0x0000, 0x0000, 0x0000 }, /* R229 */
+25 -6
drivers/mfd/wm8400-core.c
··· 15 15 #include <linux/bug.h> 16 16 #include <linux/i2c.h> 17 17 #include <linux/kernel.h> 18 + #include <linux/mfd/core.h> 18 19 #include <linux/mfd/wm8400-private.h> 19 20 #include <linux/mfd/wm8400-audio.h> 20 21 ··· 240 239 } 241 240 EXPORT_SYMBOL_GPL(wm8400_reset_codec_reg_cache); 242 241 242 + static int wm8400_register_codec(struct wm8400 *wm8400) 243 + { 244 + struct mfd_cell cell = { 245 + .name = "wm8400-codec", 246 + .driver_data = wm8400, 247 + }; 248 + 249 + return mfd_add_devices(wm8400->dev, -1, &cell, 1, NULL, 0); 250 + } 251 + 243 252 /* 244 253 * wm8400_init - Generic initialisation 245 254 * ··· 307 296 reg = (reg & WM8400_CHIP_REV_MASK) >> WM8400_CHIP_REV_SHIFT; 308 297 dev_info(wm8400->dev, "WM8400 revision %x\n", reg); 309 298 299 + ret = wm8400_register_codec(wm8400); 300 + if (ret != 0) { 301 + dev_err(wm8400->dev, "Failed to register codec\n"); 302 + goto err_children; 303 + } 304 + 310 305 if (pdata && pdata->platform_init) { 311 306 ret = pdata->platform_init(wm8400->dev); 312 - if (ret != 0) 307 + if (ret != 0) { 313 308 dev_err(wm8400->dev, "Platform init failed: %d\n", 314 309 ret); 310 + goto err_children; 311 + } 315 312 } else 316 313 dev_warn(wm8400->dev, "No platform initialisation supplied\n"); 317 314 315 + return 0; 316 + 317 + err_children: 318 + mfd_remove_devices(wm8400->dev); 318 319 return ret; 319 320 } 320 321 321 322 static void wm8400_release(struct wm8400 *wm8400) 322 323 { 323 - int i; 324 - 325 - for (i = 0; i < ARRAY_SIZE(wm8400->regulators); i++) 326 - if (wm8400->regulators[i].name) 327 - platform_device_unregister(&wm8400->regulators[i]); 324 + mfd_remove_devices(wm8400->dev); 328 325 } 329 326 330 327 #if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
+14
drivers/power/Kconfig
··· 29 29 Say Y here to enable support APM status emulation using 30 30 battery class devices. 31 31 32 + config WM8350_POWER 33 + tristate "WM8350 PMU support" 34 + depends on MFD_WM8350 35 + help 36 + Say Y here to enable support for the power management unit 37 + provided by the Wolfson Microelectronics WM8350 PMIC. 38 + 32 39 config BATTERY_DS2760 33 40 tristate "DS2760 battery driver (HP iPAQ & others)" 34 41 select W1 ··· 74 67 depends on I2C 75 68 help 76 69 Say Y here to enable support for batteries with BQ27200(I2C) chip. 70 + 71 + config BATTERY_DA9030 72 + tristate "DA9030 battery driver" 73 + depends on PMIC_DA903X 74 + help 75 + Say Y here to enable support for batteries charger integrated into 76 + DA9030 PMIC. 77 77 78 78 endif # POWER_SUPPLY
+2
drivers/power/Makefile
··· 16 16 17 17 obj-$(CONFIG_PDA_POWER) += pda_power.o 18 18 obj-$(CONFIG_APM_POWER) += apm_power.o 19 + obj-$(CONFIG_WM8350_POWER) += wm8350_power.o 19 20 20 21 obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o 21 22 obj-$(CONFIG_BATTERY_PMU) += pmu_battery.o ··· 24 23 obj-$(CONFIG_BATTERY_TOSA) += tosa_battery.o 25 24 obj-$(CONFIG_BATTERY_WM97XX) += wm97xx_battery.o 26 25 obj-$(CONFIG_BATTERY_BQ27x00) += bq27x00_battery.o 26 + obj-$(CONFIG_BATTERY_DA9030) += da9030_battery.o
+600
drivers/power/da9030_battery.c
··· 1 + /* 2 + * Battery charger driver for Dialog Semiconductor DA9030 3 + * 4 + * Copyright (C) 2008 Compulab, Ltd. 5 + * Mike Rapoport <mike@compulab.co.il> 6 + * 7 + * This program is free software; you can redistribute it and/or modify 8 + * it under the terms of the GNU General Public License version 2 as 9 + * published by the Free Software Foundation. 10 + */ 11 + 12 + #include <linux/kernel.h> 13 + #include <linux/init.h> 14 + #include <linux/types.h> 15 + #include <linux/device.h> 16 + #include <linux/workqueue.h> 17 + #include <linux/module.h> 18 + #include <linux/platform_device.h> 19 + #include <linux/power_supply.h> 20 + #include <linux/mfd/da903x.h> 21 + 22 + #include <linux/debugfs.h> 23 + #include <linux/seq_file.h> 24 + 25 + #define DA9030_STATUS_CHDET (1 << 3) 26 + 27 + #define DA9030_FAULT_LOG 0x0a 28 + #define DA9030_FAULT_LOG_OVER_TEMP (1 << 7) 29 + #define DA9030_FAULT_LOG_VBAT_OVER (1 << 4) 30 + 31 + #define DA9030_CHARGE_CONTROL 0x28 32 + #define DA9030_CHRG_CHARGER_ENABLE (1 << 7) 33 + 34 + #define DA9030_ADC_MAN_CONTROL 0x30 35 + #define DA9030_ADC_TBATREF_ENABLE (1 << 5) 36 + #define DA9030_ADC_LDO_INT_ENABLE (1 << 4) 37 + 38 + #define DA9030_ADC_AUTO_CONTROL 0x31 39 + #define DA9030_ADC_TBAT_ENABLE (1 << 5) 40 + #define DA9030_ADC_VBAT_IN_TXON (1 << 4) 41 + #define DA9030_ADC_VCH_ENABLE (1 << 3) 42 + #define DA9030_ADC_ICH_ENABLE (1 << 2) 43 + #define DA9030_ADC_VBAT_ENABLE (1 << 1) 44 + #define DA9030_ADC_AUTO_SLEEP_ENABLE (1 << 0) 45 + 46 + #define DA9030_VBATMON 0x32 47 + #define DA9030_VBATMONTXON 0x33 48 + #define DA9030_TBATHIGHP 0x34 49 + #define DA9030_TBATHIGHN 0x35 50 + #define DA9030_TBATLOW 0x36 51 + 52 + #define DA9030_VBAT_RES 0x41 53 + #define DA9030_VBATMIN_RES 0x42 54 + #define DA9030_VBATMINTXON_RES 0x43 55 + #define DA9030_ICHMAX_RES 0x44 56 + #define DA9030_ICHMIN_RES 0x45 57 + #define DA9030_ICHAVERAGE_RES 0x46 58 + #define DA9030_VCHMAX_RES 0x47 59 + #define DA9030_VCHMIN_RES 0x48 60 + #define DA9030_TBAT_RES 0x49 61 + 62 + struct da9030_adc_res { 63 + uint8_t vbat_res; 64 + uint8_t vbatmin_res; 65 + uint8_t vbatmintxon; 66 + uint8_t ichmax_res; 67 + uint8_t ichmin_res; 68 + uint8_t ichaverage_res; 69 + uint8_t vchmax_res; 70 + uint8_t vchmin_res; 71 + uint8_t tbat_res; 72 + uint8_t adc_in4_res; 73 + uint8_t adc_in5_res; 74 + }; 75 + 76 + struct da9030_battery_thresholds { 77 + int tbat_low; 78 + int tbat_high; 79 + int tbat_restart; 80 + 81 + int vbat_low; 82 + int vbat_crit; 83 + int vbat_charge_start; 84 + int vbat_charge_stop; 85 + int vbat_charge_restart; 86 + 87 + int vcharge_min; 88 + int vcharge_max; 89 + }; 90 + 91 + struct da9030_charger { 92 + struct power_supply psy; 93 + 94 + struct device *master; 95 + 96 + struct da9030_adc_res adc; 97 + struct delayed_work work; 98 + unsigned int interval; 99 + 100 + struct power_supply_info *battery_info; 101 + 102 + struct da9030_battery_thresholds thresholds; 103 + 104 + unsigned int charge_milliamp; 105 + unsigned int charge_millivolt; 106 + 107 + /* charger status */ 108 + bool chdet; 109 + uint8_t fault; 110 + int mA; 111 + int mV; 112 + bool is_on; 113 + 114 + struct notifier_block nb; 115 + 116 + /* platform callbacks for battery low and critical events */ 117 + void (*battery_low)(void); 118 + void (*battery_critical)(void); 119 + 120 + struct dentry *debug_file; 121 + }; 122 + 123 + static inline int da9030_reg_to_mV(int reg) 124 + { 125 + return ((reg * 2650) >> 8) + 2650; 126 + } 127 + 128 + static inline int da9030_millivolt_to_reg(int mV) 129 + { 130 + return ((mV - 2650) << 8) / 2650; 131 + } 132 + 133 + static inline int da9030_reg_to_mA(int reg) 134 + { 135 + return ((reg * 24000) >> 8) / 15; 136 + } 137 + 138 + #ifdef CONFIG_DEBUG_FS 139 + static int bat_debug_show(struct seq_file *s, void *data) 140 + { 141 + struct da9030_charger *charger = s->private; 142 + 143 + seq_printf(s, "charger is %s\n", charger->is_on ? "on" : "off"); 144 + if (charger->chdet) { 145 + seq_printf(s, "iset = %dmA, vset = %dmV\n", 146 + charger->mA, charger->mV); 147 + } 148 + 149 + seq_printf(s, "vbat_res = %d (%dmV)\n", 150 + charger->adc.vbat_res, 151 + da9030_reg_to_mV(charger->adc.vbat_res)); 152 + seq_printf(s, "vbatmin_res = %d (%dmV)\n", 153 + charger->adc.vbatmin_res, 154 + da9030_reg_to_mV(charger->adc.vbatmin_res)); 155 + seq_printf(s, "vbatmintxon = %d (%dmV)\n", 156 + charger->adc.vbatmintxon, 157 + da9030_reg_to_mV(charger->adc.vbatmintxon)); 158 + seq_printf(s, "ichmax_res = %d (%dmA)\n", 159 + charger->adc.ichmax_res, 160 + da9030_reg_to_mV(charger->adc.ichmax_res)); 161 + seq_printf(s, "ichmin_res = %d (%dmA)\n", 162 + charger->adc.ichmin_res, 163 + da9030_reg_to_mA(charger->adc.ichmin_res)); 164 + seq_printf(s, "ichaverage_res = %d (%dmA)\n", 165 + charger->adc.ichaverage_res, 166 + da9030_reg_to_mA(charger->adc.ichaverage_res)); 167 + seq_printf(s, "vchmax_res = %d (%dmV)\n", 168 + charger->adc.vchmax_res, 169 + da9030_reg_to_mA(charger->adc.vchmax_res)); 170 + seq_printf(s, "vchmin_res = %d (%dmV)\n", 171 + charger->adc.vchmin_res, 172 + da9030_reg_to_mV(charger->adc.vchmin_res)); 173 + 174 + return 0; 175 + } 176 + 177 + static int debug_open(struct inode *inode, struct file *file) 178 + { 179 + return single_open(file, bat_debug_show, inode->i_private); 180 + } 181 + 182 + static const struct file_operations bat_debug_fops = { 183 + .open = debug_open, 184 + .read = seq_read, 185 + .llseek = seq_lseek, 186 + .release = single_release, 187 + }; 188 + 189 + static struct dentry *da9030_bat_create_debugfs(struct da9030_charger *charger) 190 + { 191 + charger->debug_file = debugfs_create_file("charger", 0666, 0, charger, 192 + &bat_debug_fops); 193 + return charger->debug_file; 194 + } 195 + 196 + static void da9030_bat_remove_debugfs(struct da9030_charger *charger) 197 + { 198 + debugfs_remove(charger->debug_file); 199 + } 200 + #else 201 + static inline struct dentry *da9030_bat_create_debugfs(struct da9030_charger *charger) 202 + { 203 + return NULL; 204 + } 205 + static inline void da9030_bat_remove_debugfs(struct da9030_charger *charger) 206 + { 207 + } 208 + #endif 209 + 210 + static inline void da9030_read_adc(struct da9030_charger *charger, 211 + struct da9030_adc_res *adc) 212 + { 213 + da903x_reads(charger->master, DA9030_VBAT_RES, 214 + sizeof(*adc), (uint8_t *)adc); 215 + } 216 + 217 + static void da9030_charger_update_state(struct da9030_charger *charger) 218 + { 219 + uint8_t val; 220 + 221 + da903x_read(charger->master, DA9030_CHARGE_CONTROL, &val); 222 + charger->is_on = (val & DA9030_CHRG_CHARGER_ENABLE) ? 1 : 0; 223 + charger->mA = ((val >> 3) & 0xf) * 100; 224 + charger->mV = (val & 0x7) * 50 + 4000; 225 + 226 + da9030_read_adc(charger, &charger->adc); 227 + da903x_read(charger->master, DA9030_FAULT_LOG, &charger->fault); 228 + charger->chdet = da903x_query_status(charger->master, 229 + DA9030_STATUS_CHDET); 230 + } 231 + 232 + static void da9030_set_charge(struct da9030_charger *charger, int on) 233 + { 234 + uint8_t val; 235 + 236 + if (on) { 237 + val = DA9030_CHRG_CHARGER_ENABLE; 238 + val |= (charger->charge_milliamp / 100) << 3; 239 + val |= (charger->charge_millivolt - 4000) / 50; 240 + charger->is_on = 1; 241 + } else { 242 + val = 0; 243 + charger->is_on = 0; 244 + } 245 + 246 + da903x_write(charger->master, DA9030_CHARGE_CONTROL, val); 247 + } 248 + 249 + static void da9030_charger_check_state(struct da9030_charger *charger) 250 + { 251 + da9030_charger_update_state(charger); 252 + 253 + /* we wake or boot with external power on */ 254 + if (!charger->is_on) { 255 + if ((charger->chdet) && 256 + (charger->adc.vbat_res < 257 + charger->thresholds.vbat_charge_start)) { 258 + da9030_set_charge(charger, 1); 259 + } 260 + } else { 261 + if (charger->adc.vbat_res >= 262 + charger->thresholds.vbat_charge_stop) { 263 + da9030_set_charge(charger, 0); 264 + da903x_write(charger->master, DA9030_VBATMON, 265 + charger->thresholds.vbat_charge_restart); 266 + } else if (charger->adc.vbat_res > 267 + charger->thresholds.vbat_low) { 268 + /* we are charging and passed LOW_THRESH, 269 + so upate DA9030 VBAT threshold 270 + */ 271 + da903x_write(charger->master, DA9030_VBATMON, 272 + charger->thresholds.vbat_low); 273 + } 274 + if (charger->adc.vchmax_res > charger->thresholds.vcharge_max || 275 + charger->adc.vchmin_res < charger->thresholds.vcharge_min || 276 + /* Tempreture readings are negative */ 277 + charger->adc.tbat_res < charger->thresholds.tbat_high || 278 + charger->adc.tbat_res > charger->thresholds.tbat_low) { 279 + /* disable charger */ 280 + da9030_set_charge(charger, 0); 281 + } 282 + } 283 + } 284 + 285 + static void da9030_charging_monitor(struct work_struct *work) 286 + { 287 + struct da9030_charger *charger; 288 + 289 + charger = container_of(work, struct da9030_charger, work.work); 290 + 291 + da9030_charger_check_state(charger); 292 + 293 + /* reschedule for the next time */ 294 + schedule_delayed_work(&charger->work, charger->interval); 295 + } 296 + 297 + static enum power_supply_property da9030_battery_props[] = { 298 + POWER_SUPPLY_PROP_MODEL_NAME, 299 + POWER_SUPPLY_PROP_STATUS, 300 + POWER_SUPPLY_PROP_HEALTH, 301 + POWER_SUPPLY_PROP_TECHNOLOGY, 302 + POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN, 303 + POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN, 304 + POWER_SUPPLY_PROP_VOLTAGE_NOW, 305 + POWER_SUPPLY_PROP_CURRENT_AVG, 306 + }; 307 + 308 + static void da9030_battery_check_status(struct da9030_charger *charger, 309 + union power_supply_propval *val) 310 + { 311 + if (charger->chdet) { 312 + if (charger->is_on) 313 + val->intval = POWER_SUPPLY_STATUS_CHARGING; 314 + else 315 + val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING; 316 + } else { 317 + val->intval = POWER_SUPPLY_STATUS_DISCHARGING; 318 + } 319 + } 320 + 321 + static void da9030_battery_check_health(struct da9030_charger *charger, 322 + union power_supply_propval *val) 323 + { 324 + if (charger->fault & DA9030_FAULT_LOG_OVER_TEMP) 325 + val->intval = POWER_SUPPLY_HEALTH_OVERHEAT; 326 + else if (charger->fault & DA9030_FAULT_LOG_VBAT_OVER) 327 + val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE; 328 + else 329 + val->intval = POWER_SUPPLY_HEALTH_GOOD; 330 + } 331 + 332 + static int da9030_battery_get_property(struct power_supply *psy, 333 + enum power_supply_property psp, 334 + union power_supply_propval *val) 335 + { 336 + struct da9030_charger *charger; 337 + charger = container_of(psy, struct da9030_charger, psy); 338 + 339 + switch (psp) { 340 + case POWER_SUPPLY_PROP_STATUS: 341 + da9030_battery_check_status(charger, val); 342 + break; 343 + case POWER_SUPPLY_PROP_HEALTH: 344 + da9030_battery_check_health(charger, val); 345 + break; 346 + case POWER_SUPPLY_PROP_TECHNOLOGY: 347 + val->intval = charger->battery_info->technology; 348 + break; 349 + case POWER_SUPPLY_PROP_VOLTAGE_MAX_DESIGN: 350 + val->intval = charger->battery_info->voltage_max_design; 351 + break; 352 + case POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN: 353 + val->intval = charger->battery_info->voltage_min_design; 354 + break; 355 + case POWER_SUPPLY_PROP_VOLTAGE_NOW: 356 + val->intval = da9030_reg_to_mV(charger->adc.vbat_res) * 1000; 357 + break; 358 + case POWER_SUPPLY_PROP_CURRENT_AVG: 359 + val->intval = 360 + da9030_reg_to_mA(charger->adc.ichaverage_res) * 1000; 361 + break; 362 + case POWER_SUPPLY_PROP_MODEL_NAME: 363 + val->strval = charger->battery_info->name; 364 + break; 365 + default: 366 + break; 367 + } 368 + 369 + return 0; 370 + } 371 + 372 + static void da9030_battery_vbat_event(struct da9030_charger *charger) 373 + { 374 + da9030_read_adc(charger, &charger->adc); 375 + 376 + if (charger->is_on) 377 + return; 378 + 379 + if (charger->adc.vbat_res < charger->thresholds.vbat_low) { 380 + /* set VBAT threshold for critical */ 381 + da903x_write(charger->master, DA9030_VBATMON, 382 + charger->thresholds.vbat_crit); 383 + if (charger->battery_low) 384 + charger->battery_low(); 385 + } else if (charger->adc.vbat_res < 386 + charger->thresholds.vbat_crit) { 387 + /* notify the system of battery critical */ 388 + if (charger->battery_critical) 389 + charger->battery_critical(); 390 + } 391 + } 392 + 393 + static int da9030_battery_event(struct notifier_block *nb, unsigned long event, 394 + void *data) 395 + { 396 + struct da9030_charger *charger = 397 + container_of(nb, struct da9030_charger, nb); 398 + int status; 399 + 400 + switch (event) { 401 + case DA9030_EVENT_CHDET: 402 + status = da903x_query_status(charger->master, 403 + DA9030_STATUS_CHDET); 404 + da9030_set_charge(charger, status); 405 + break; 406 + case DA9030_EVENT_VBATMON: 407 + da9030_battery_vbat_event(charger); 408 + break; 409 + case DA9030_EVENT_CHIOVER: 410 + case DA9030_EVENT_TBAT: 411 + da9030_set_charge(charger, 0); 412 + break; 413 + } 414 + 415 + return 0; 416 + } 417 + 418 + static void da9030_battery_convert_thresholds(struct da9030_charger *charger, 419 + struct da9030_battery_info *pdata) 420 + { 421 + charger->thresholds.tbat_low = pdata->tbat_low; 422 + charger->thresholds.tbat_high = pdata->tbat_high; 423 + charger->thresholds.tbat_restart = pdata->tbat_restart; 424 + 425 + charger->thresholds.vbat_low = 426 + da9030_millivolt_to_reg(pdata->vbat_low); 427 + charger->thresholds.vbat_crit = 428 + da9030_millivolt_to_reg(pdata->vbat_crit); 429 + charger->thresholds.vbat_charge_start = 430 + da9030_millivolt_to_reg(pdata->vbat_charge_start); 431 + charger->thresholds.vbat_charge_stop = 432 + da9030_millivolt_to_reg(pdata->vbat_charge_stop); 433 + charger->thresholds.vbat_charge_restart = 434 + da9030_millivolt_to_reg(pdata->vbat_charge_restart); 435 + 436 + charger->thresholds.vcharge_min = 437 + da9030_millivolt_to_reg(pdata->vcharge_min); 438 + charger->thresholds.vcharge_max = 439 + da9030_millivolt_to_reg(pdata->vcharge_max); 440 + } 441 + 442 + static void da9030_battery_setup_psy(struct da9030_charger *charger) 443 + { 444 + struct power_supply *psy = &charger->psy; 445 + struct power_supply_info *info = charger->battery_info; 446 + 447 + psy->name = info->name; 448 + psy->use_for_apm = info->use_for_apm; 449 + psy->type = POWER_SUPPLY_TYPE_BATTERY; 450 + psy->get_property = da9030_battery_get_property; 451 + 452 + psy->properties = da9030_battery_props; 453 + psy->num_properties = ARRAY_SIZE(da9030_battery_props); 454 + }; 455 + 456 + static int da9030_battery_charger_init(struct da9030_charger *charger) 457 + { 458 + char v[5]; 459 + int ret; 460 + 461 + v[0] = v[1] = charger->thresholds.vbat_low; 462 + v[2] = charger->thresholds.tbat_high; 463 + v[3] = charger->thresholds.tbat_restart; 464 + v[4] = charger->thresholds.tbat_low; 465 + 466 + ret = da903x_writes(charger->master, DA9030_VBATMON, 5, v); 467 + if (ret) 468 + return ret; 469 + 470 + /* 471 + * Enable reference voltage supply for ADC from the LDO_INTERNAL 472 + * regulator. Must be set before ADC measurements can be made. 473 + */ 474 + ret = da903x_write(charger->master, DA9030_ADC_MAN_CONTROL, 475 + DA9030_ADC_LDO_INT_ENABLE | 476 + DA9030_ADC_TBATREF_ENABLE); 477 + if (ret) 478 + return ret; 479 + 480 + /* enable auto ADC measuremnts */ 481 + return da903x_write(charger->master, DA9030_ADC_AUTO_CONTROL, 482 + DA9030_ADC_TBAT_ENABLE | DA9030_ADC_VBAT_IN_TXON | 483 + DA9030_ADC_VCH_ENABLE | DA9030_ADC_ICH_ENABLE | 484 + DA9030_ADC_VBAT_ENABLE | 485 + DA9030_ADC_AUTO_SLEEP_ENABLE); 486 + } 487 + 488 + static int da9030_battery_probe(struct platform_device *pdev) 489 + { 490 + struct da9030_charger *charger; 491 + struct da9030_battery_info *pdata = pdev->dev.platform_data; 492 + int ret; 493 + 494 + if (pdata == NULL) 495 + return -EINVAL; 496 + 497 + if (pdata->charge_milliamp >= 1500 || 498 + pdata->charge_millivolt < 4000 || 499 + pdata->charge_millivolt > 4350) 500 + return -EINVAL; 501 + 502 + charger = kzalloc(sizeof(*charger), GFP_KERNEL); 503 + if (charger == NULL) 504 + return -ENOMEM; 505 + 506 + charger->master = pdev->dev.parent; 507 + 508 + /* 10 seconds between monotor runs unless platfrom defines other 509 + interval */ 510 + charger->interval = msecs_to_jiffies( 511 + (pdata->batmon_interval ? : 10) * 1000); 512 + 513 + charger->charge_milliamp = pdata->charge_milliamp; 514 + charger->charge_millivolt = pdata->charge_millivolt; 515 + charger->battery_info = pdata->battery_info; 516 + charger->battery_low = pdata->battery_low; 517 + charger->battery_critical = pdata->battery_critical; 518 + 519 + da9030_battery_convert_thresholds(charger, pdata); 520 + 521 + ret = da9030_battery_charger_init(charger); 522 + if (ret) 523 + goto err_charger_init; 524 + 525 + INIT_DELAYED_WORK(&charger->work, da9030_charging_monitor); 526 + schedule_delayed_work(&charger->work, charger->interval); 527 + 528 + charger->nb.notifier_call = da9030_battery_event; 529 + ret = da903x_register_notifier(charger->master, &charger->nb, 530 + DA9030_EVENT_CHDET | 531 + DA9030_EVENT_VBATMON | 532 + DA9030_EVENT_CHIOVER | 533 + DA9030_EVENT_TBAT); 534 + if (ret) 535 + goto err_notifier; 536 + 537 + da9030_battery_setup_psy(charger); 538 + ret = power_supply_register(&pdev->dev, &charger->psy); 539 + if (ret) 540 + goto err_ps_register; 541 + 542 + charger->debug_file = da9030_bat_create_debugfs(charger); 543 + platform_set_drvdata(pdev, charger); 544 + return 0; 545 + 546 + err_ps_register: 547 + da903x_unregister_notifier(charger->master, &charger->nb, 548 + DA9030_EVENT_CHDET | DA9030_EVENT_VBATMON | 549 + DA9030_EVENT_CHIOVER | DA9030_EVENT_TBAT); 550 + err_notifier: 551 + cancel_delayed_work(&charger->work); 552 + 553 + err_charger_init: 554 + kfree(charger); 555 + 556 + return ret; 557 + } 558 + 559 + static int da9030_battery_remove(struct platform_device *dev) 560 + { 561 + struct da9030_charger *charger = platform_get_drvdata(dev); 562 + 563 + da9030_bat_remove_debugfs(charger); 564 + 565 + da903x_unregister_notifier(charger->master, &charger->nb, 566 + DA9030_EVENT_CHDET | DA9030_EVENT_VBATMON | 567 + DA9030_EVENT_CHIOVER | DA9030_EVENT_TBAT); 568 + cancel_delayed_work(&charger->work); 569 + power_supply_unregister(&charger->psy); 570 + 571 + kfree(charger); 572 + 573 + return 0; 574 + } 575 + 576 + static struct platform_driver da903x_battery_driver = { 577 + .driver = { 578 + .name = "da903x-battery", 579 + .owner = THIS_MODULE, 580 + }, 581 + .probe = da9030_battery_probe, 582 + .remove = da9030_battery_remove, 583 + }; 584 + 585 + static int da903x_battery_init(void) 586 + { 587 + return platform_driver_register(&da903x_battery_driver); 588 + } 589 + 590 + static void da903x_battery_exit(void) 591 + { 592 + platform_driver_unregister(&da903x_battery_driver); 593 + } 594 + 595 + module_init(da903x_battery_init); 596 + module_exit(da903x_battery_exit); 597 + 598 + MODULE_DESCRIPTION("DA9030 battery charger driver"); 599 + MODULE_AUTHOR("Mike Rapoport, CompuLab"); 600 + MODULE_LICENSE("GPL");
+1 -1
drivers/power/power_supply_sysfs.c
··· 45 45 }; 46 46 static char *health_text[] = { 47 47 "Unknown", "Good", "Overheat", "Dead", "Over voltage", 48 - "Unspecified failure" 48 + "Unspecified failure", "Cold", 49 49 }; 50 50 static char *technology_text[] = { 51 51 "Unknown", "NiMH", "Li-ion", "Li-poly", "LiFe", "NiCd",
+532
drivers/power/wm8350_power.c
··· 1 + /* 2 + * Battery driver for wm8350 PMIC 3 + * 4 + * Copyright 2007, 2008 Wolfson Microelectronics PLC. 5 + * 6 + * Based on OLPC Battery Driver 7 + * 8 + * Copyright 2006 David Woodhouse <dwmw2@infradead.org> 9 + * 10 + * This program is free software; you can redistribute it and/or modify 11 + * it under the terms of the GNU General Public License version 2 as 12 + * published by the Free Software Foundation. 13 + */ 14 + 15 + #include <linux/module.h> 16 + #include <linux/err.h> 17 + #include <linux/platform_device.h> 18 + #include <linux/power_supply.h> 19 + #include <linux/mfd/wm8350/supply.h> 20 + #include <linux/mfd/wm8350/core.h> 21 + #include <linux/mfd/wm8350/comparator.h> 22 + 23 + static int wm8350_read_battery_uvolts(struct wm8350 *wm8350) 24 + { 25 + return wm8350_read_auxadc(wm8350, WM8350_AUXADC_BATT, 0, 0) 26 + * WM8350_AUX_COEFF; 27 + } 28 + 29 + static int wm8350_read_line_uvolts(struct wm8350 *wm8350) 30 + { 31 + return wm8350_read_auxadc(wm8350, WM8350_AUXADC_LINE, 0, 0) 32 + * WM8350_AUX_COEFF; 33 + } 34 + 35 + static int wm8350_read_usb_uvolts(struct wm8350 *wm8350) 36 + { 37 + return wm8350_read_auxadc(wm8350, WM8350_AUXADC_USB, 0, 0) 38 + * WM8350_AUX_COEFF; 39 + } 40 + 41 + #define WM8350_BATT_SUPPLY 1 42 + #define WM8350_USB_SUPPLY 2 43 + #define WM8350_LINE_SUPPLY 4 44 + 45 + static inline int wm8350_charge_time_min(struct wm8350 *wm8350, int min) 46 + { 47 + if (!wm8350->power.rev_g_coeff) 48 + return (((min - 30) / 15) & 0xf) << 8; 49 + else 50 + return (((min - 30) / 30) & 0xf) << 8; 51 + } 52 + 53 + static int wm8350_get_supplies(struct wm8350 *wm8350) 54 + { 55 + u16 sm, ov, co, chrg; 56 + int supplies = 0; 57 + 58 + sm = wm8350_reg_read(wm8350, WM8350_STATE_MACHINE_STATUS); 59 + ov = wm8350_reg_read(wm8350, WM8350_MISC_OVERRIDES); 60 + co = wm8350_reg_read(wm8350, WM8350_COMPARATOR_OVERRIDES); 61 + chrg = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2); 62 + 63 + /* USB_SM */ 64 + sm = (sm & WM8350_USB_SM_MASK) >> WM8350_USB_SM_SHIFT; 65 + 66 + /* CHG_ISEL */ 67 + chrg &= WM8350_CHG_ISEL_MASK; 68 + 69 + /* If the USB state machine is active then we're using that with or 70 + * without battery, otherwise check for wall supply */ 71 + if (((sm == WM8350_USB_SM_100_SLV) || 72 + (sm == WM8350_USB_SM_500_SLV) || 73 + (sm == WM8350_USB_SM_STDBY_SLV)) 74 + && !(ov & WM8350_USB_LIMIT_OVRDE)) 75 + supplies = WM8350_USB_SUPPLY; 76 + else if (((sm == WM8350_USB_SM_100_SLV) || 77 + (sm == WM8350_USB_SM_500_SLV) || 78 + (sm == WM8350_USB_SM_STDBY_SLV)) 79 + && (ov & WM8350_USB_LIMIT_OVRDE) && (chrg == 0)) 80 + supplies = WM8350_USB_SUPPLY | WM8350_BATT_SUPPLY; 81 + else if (co & WM8350_WALL_FB_OVRDE) 82 + supplies = WM8350_LINE_SUPPLY; 83 + else 84 + supplies = WM8350_BATT_SUPPLY; 85 + 86 + return supplies; 87 + } 88 + 89 + static int wm8350_charger_config(struct wm8350 *wm8350, 90 + struct wm8350_charger_policy *policy) 91 + { 92 + u16 reg, eoc_mA, fast_limit_mA; 93 + 94 + if (!policy) { 95 + dev_warn(wm8350->dev, 96 + "No charger policy, charger not configured.\n"); 97 + return -EINVAL; 98 + } 99 + 100 + /* make sure USB fast charge current is not > 500mA */ 101 + if (policy->fast_limit_USB_mA > 500) { 102 + dev_err(wm8350->dev, "USB fast charge > 500mA\n"); 103 + return -EINVAL; 104 + } 105 + 106 + eoc_mA = WM8350_CHG_EOC_mA(policy->eoc_mA); 107 + 108 + wm8350_reg_unlock(wm8350); 109 + 110 + reg = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1) 111 + & WM8350_CHG_ENA_R168; 112 + wm8350_reg_write(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1, 113 + reg | eoc_mA | policy->trickle_start_mV | 114 + WM8350_CHG_TRICKLE_TEMP_CHOKE | 115 + WM8350_CHG_TRICKLE_USB_CHOKE | 116 + WM8350_CHG_FAST_USB_THROTTLE); 117 + 118 + if (wm8350_get_supplies(wm8350) & WM8350_USB_SUPPLY) { 119 + fast_limit_mA = 120 + WM8350_CHG_FAST_LIMIT_mA(policy->fast_limit_USB_mA); 121 + wm8350_reg_write(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2, 122 + policy->charge_mV | policy->trickle_charge_USB_mA | 123 + fast_limit_mA | wm8350_charge_time_min(wm8350, 124 + policy->charge_timeout)); 125 + 126 + } else { 127 + fast_limit_mA = 128 + WM8350_CHG_FAST_LIMIT_mA(policy->fast_limit_mA); 129 + wm8350_reg_write(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2, 130 + policy->charge_mV | policy->trickle_charge_mA | 131 + fast_limit_mA | wm8350_charge_time_min(wm8350, 132 + policy->charge_timeout)); 133 + } 134 + 135 + wm8350_reg_lock(wm8350); 136 + return 0; 137 + } 138 + 139 + static int wm8350_batt_status(struct wm8350 *wm8350) 140 + { 141 + u16 state; 142 + 143 + state = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2); 144 + state &= WM8350_CHG_STS_MASK; 145 + 146 + switch (state) { 147 + case WM8350_CHG_STS_OFF: 148 + return POWER_SUPPLY_STATUS_DISCHARGING; 149 + 150 + case WM8350_CHG_STS_TRICKLE: 151 + case WM8350_CHG_STS_FAST: 152 + return POWER_SUPPLY_STATUS_CHARGING; 153 + 154 + default: 155 + return POWER_SUPPLY_STATUS_UNKNOWN; 156 + } 157 + } 158 + 159 + static ssize_t charger_state_show(struct device *dev, 160 + struct device_attribute *attr, char *buf) 161 + { 162 + struct wm8350 *wm8350 = dev_get_drvdata(dev); 163 + char *charge; 164 + int state; 165 + 166 + state = wm8350_reg_read(wm8350, WM8350_BATTERY_CHARGER_CONTROL_2) & 167 + WM8350_CHG_STS_MASK; 168 + switch (state) { 169 + case WM8350_CHG_STS_OFF: 170 + charge = "Charger Off"; 171 + break; 172 + case WM8350_CHG_STS_TRICKLE: 173 + charge = "Trickle Charging"; 174 + break; 175 + case WM8350_CHG_STS_FAST: 176 + charge = "Fast Charging"; 177 + break; 178 + default: 179 + return 0; 180 + } 181 + 182 + return sprintf(buf, "%s\n", charge); 183 + } 184 + 185 + static DEVICE_ATTR(charger_state, 0444, charger_state_show, NULL); 186 + 187 + static void wm8350_charger_handler(struct wm8350 *wm8350, int irq, void *data) 188 + { 189 + struct wm8350_power *power = &wm8350->power; 190 + struct wm8350_charger_policy *policy = power->policy; 191 + 192 + switch (irq) { 193 + case WM8350_IRQ_CHG_BAT_FAIL: 194 + dev_err(wm8350->dev, "battery failed\n"); 195 + break; 196 + case WM8350_IRQ_CHG_TO: 197 + dev_err(wm8350->dev, "charger timeout\n"); 198 + power_supply_changed(&power->battery); 199 + break; 200 + 201 + case WM8350_IRQ_CHG_BAT_HOT: 202 + case WM8350_IRQ_CHG_BAT_COLD: 203 + case WM8350_IRQ_CHG_START: 204 + case WM8350_IRQ_CHG_END: 205 + power_supply_changed(&power->battery); 206 + break; 207 + 208 + case WM8350_IRQ_CHG_FAST_RDY: 209 + dev_dbg(wm8350->dev, "fast charger ready\n"); 210 + wm8350_charger_config(wm8350, policy); 211 + wm8350_reg_unlock(wm8350); 212 + wm8350_set_bits(wm8350, WM8350_BATTERY_CHARGER_CONTROL_1, 213 + WM8350_CHG_FAST); 214 + wm8350_reg_lock(wm8350); 215 + break; 216 + 217 + case WM8350_IRQ_CHG_VBATT_LT_3P9: 218 + dev_warn(wm8350->dev, "battery < 3.9V\n"); 219 + break; 220 + case WM8350_IRQ_CHG_VBATT_LT_3P1: 221 + dev_warn(wm8350->dev, "battery < 3.1V\n"); 222 + break; 223 + case WM8350_IRQ_CHG_VBATT_LT_2P85: 224 + dev_warn(wm8350->dev, "battery < 2.85V\n"); 225 + break; 226 + 227 + /* Supply change. We will overnotify but it should do 228 + * no harm. */ 229 + case WM8350_IRQ_EXT_USB_FB: 230 + case WM8350_IRQ_EXT_WALL_FB: 231 + wm8350_charger_config(wm8350, policy); 232 + case WM8350_IRQ_EXT_BAT_FB: /* Fall through */ 233 + power_supply_changed(&power->battery); 234 + power_supply_changed(&power->usb); 235 + power_supply_changed(&power->ac); 236 + break; 237 + 238 + default: 239 + dev_err(wm8350->dev, "Unknown interrupt %d\n", irq); 240 + } 241 + } 242 + 243 + /********************************************************************* 244 + * AC Power 245 + *********************************************************************/ 246 + static int wm8350_ac_get_prop(struct power_supply *psy, 247 + enum power_supply_property psp, 248 + union power_supply_propval *val) 249 + { 250 + struct wm8350 *wm8350 = dev_get_drvdata(psy->dev->parent); 251 + int ret = 0; 252 + 253 + switch (psp) { 254 + case POWER_SUPPLY_PROP_ONLINE: 255 + val->intval = !!(wm8350_get_supplies(wm8350) & 256 + WM8350_LINE_SUPPLY); 257 + break; 258 + case POWER_SUPPLY_PROP_VOLTAGE_NOW: 259 + val->intval = wm8350_read_line_uvolts(wm8350); 260 + break; 261 + default: 262 + ret = -EINVAL; 263 + break; 264 + } 265 + return ret; 266 + } 267 + 268 + static enum power_supply_property wm8350_ac_props[] = { 269 + POWER_SUPPLY_PROP_ONLINE, 270 + POWER_SUPPLY_PROP_VOLTAGE_NOW, 271 + }; 272 + 273 + /********************************************************************* 274 + * USB Power 275 + *********************************************************************/ 276 + static int wm8350_usb_get_prop(struct power_supply *psy, 277 + enum power_supply_property psp, 278 + union power_supply_propval *val) 279 + { 280 + struct wm8350 *wm8350 = dev_get_drvdata(psy->dev->parent); 281 + int ret = 0; 282 + 283 + switch (psp) { 284 + case POWER_SUPPLY_PROP_ONLINE: 285 + val->intval = !!(wm8350_get_supplies(wm8350) & 286 + WM8350_USB_SUPPLY); 287 + break; 288 + case POWER_SUPPLY_PROP_VOLTAGE_NOW: 289 + val->intval = wm8350_read_usb_uvolts(wm8350); 290 + break; 291 + default: 292 + ret = -EINVAL; 293 + break; 294 + } 295 + return ret; 296 + } 297 + 298 + static enum power_supply_property wm8350_usb_props[] = { 299 + POWER_SUPPLY_PROP_ONLINE, 300 + POWER_SUPPLY_PROP_VOLTAGE_NOW, 301 + }; 302 + 303 + /********************************************************************* 304 + * Battery properties 305 + *********************************************************************/ 306 + 307 + static int wm8350_bat_check_health(struct wm8350 *wm8350) 308 + { 309 + u16 reg; 310 + 311 + if (wm8350_read_battery_uvolts(wm8350) < 2850000) 312 + return POWER_SUPPLY_HEALTH_UNSPEC_FAILURE; 313 + 314 + reg = wm8350_reg_read(wm8350, WM8350_CHARGER_OVERRIDES); 315 + if (reg & WM8350_CHG_BATT_HOT_OVRDE) 316 + return POWER_SUPPLY_HEALTH_OVERHEAT; 317 + 318 + if (reg & WM8350_CHG_BATT_COLD_OVRDE) 319 + return POWER_SUPPLY_HEALTH_COLD; 320 + 321 + return POWER_SUPPLY_HEALTH_GOOD; 322 + } 323 + 324 + static int wm8350_bat_get_property(struct power_supply *psy, 325 + enum power_supply_property psp, 326 + union power_supply_propval *val) 327 + { 328 + struct wm8350 *wm8350 = dev_get_drvdata(psy->dev->parent); 329 + int ret = 0; 330 + 331 + switch (psp) { 332 + case POWER_SUPPLY_PROP_STATUS: 333 + val->intval = wm8350_batt_status(wm8350); 334 + break; 335 + case POWER_SUPPLY_PROP_ONLINE: 336 + val->intval = !!(wm8350_get_supplies(wm8350) & 337 + WM8350_BATT_SUPPLY); 338 + break; 339 + case POWER_SUPPLY_PROP_VOLTAGE_NOW: 340 + val->intval = wm8350_read_battery_uvolts(wm8350); 341 + break; 342 + case POWER_SUPPLY_PROP_HEALTH: 343 + val->intval = wm8350_bat_check_health(wm8350); 344 + break; 345 + default: 346 + ret = -EINVAL; 347 + break; 348 + } 349 + 350 + return ret; 351 + } 352 + 353 + static enum power_supply_property wm8350_bat_props[] = { 354 + POWER_SUPPLY_PROP_STATUS, 355 + POWER_SUPPLY_PROP_ONLINE, 356 + POWER_SUPPLY_PROP_VOLTAGE_NOW, 357 + POWER_SUPPLY_PROP_HEALTH, 358 + }; 359 + 360 + /********************************************************************* 361 + * Initialisation 362 + *********************************************************************/ 363 + 364 + static void wm8350_init_charger(struct wm8350 *wm8350) 365 + { 366 + /* register our interest in charger events */ 367 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT, 368 + wm8350_charger_handler, NULL); 369 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); 370 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD, 371 + wm8350_charger_handler, NULL); 372 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); 373 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL, 374 + wm8350_charger_handler, NULL); 375 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); 376 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_TO, 377 + wm8350_charger_handler, NULL); 378 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_TO); 379 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_END, 380 + wm8350_charger_handler, NULL); 381 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_END); 382 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_START, 383 + wm8350_charger_handler, NULL); 384 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_START); 385 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY, 386 + wm8350_charger_handler, NULL); 387 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_FAST_RDY); 388 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9, 389 + wm8350_charger_handler, NULL); 390 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); 391 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1, 392 + wm8350_charger_handler, NULL); 393 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); 394 + wm8350_register_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85, 395 + wm8350_charger_handler, NULL); 396 + wm8350_unmask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); 397 + 398 + /* and supply change events */ 399 + wm8350_register_irq(wm8350, WM8350_IRQ_EXT_USB_FB, 400 + wm8350_charger_handler, NULL); 401 + wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); 402 + wm8350_register_irq(wm8350, WM8350_IRQ_EXT_WALL_FB, 403 + wm8350_charger_handler, NULL); 404 + wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); 405 + wm8350_register_irq(wm8350, WM8350_IRQ_EXT_BAT_FB, 406 + wm8350_charger_handler, NULL); 407 + wm8350_unmask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); 408 + } 409 + 410 + static void free_charger_irq(struct wm8350 *wm8350) 411 + { 412 + wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); 413 + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_HOT); 414 + wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); 415 + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_COLD); 416 + wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); 417 + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_BAT_FAIL); 418 + wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_TO); 419 + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_TO); 420 + wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_END); 421 + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_END); 422 + wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_START); 423 + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_START); 424 + wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); 425 + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P9); 426 + wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); 427 + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_3P1); 428 + wm8350_mask_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); 429 + wm8350_free_irq(wm8350, WM8350_IRQ_CHG_VBATT_LT_2P85); 430 + wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_USB_FB); 431 + wm8350_free_irq(wm8350, WM8350_IRQ_EXT_USB_FB); 432 + wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); 433 + wm8350_free_irq(wm8350, WM8350_IRQ_EXT_WALL_FB); 434 + wm8350_mask_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); 435 + wm8350_free_irq(wm8350, WM8350_IRQ_EXT_BAT_FB); 436 + } 437 + 438 + static __devinit int wm8350_power_probe(struct platform_device *pdev) 439 + { 440 + struct wm8350 *wm8350 = platform_get_drvdata(pdev); 441 + struct wm8350_power *power = &wm8350->power; 442 + struct wm8350_charger_policy *policy = power->policy; 443 + struct power_supply *usb = &power->usb; 444 + struct power_supply *battery = &power->battery; 445 + struct power_supply *ac = &power->ac; 446 + int ret; 447 + 448 + ac->name = "wm8350-ac"; 449 + ac->type = POWER_SUPPLY_TYPE_MAINS; 450 + ac->properties = wm8350_ac_props; 451 + ac->num_properties = ARRAY_SIZE(wm8350_ac_props); 452 + ac->get_property = wm8350_ac_get_prop; 453 + ret = power_supply_register(&pdev->dev, ac); 454 + if (ret) 455 + return ret; 456 + 457 + battery->name = "wm8350-battery"; 458 + battery->properties = wm8350_bat_props; 459 + battery->num_properties = ARRAY_SIZE(wm8350_bat_props); 460 + battery->get_property = wm8350_bat_get_property; 461 + battery->use_for_apm = 1; 462 + ret = power_supply_register(&pdev->dev, battery); 463 + if (ret) 464 + goto battery_failed; 465 + 466 + usb->name = "wm8350-usb", 467 + usb->type = POWER_SUPPLY_TYPE_USB; 468 + usb->properties = wm8350_usb_props; 469 + usb->num_properties = ARRAY_SIZE(wm8350_usb_props); 470 + usb->get_property = wm8350_usb_get_prop; 471 + ret = power_supply_register(&pdev->dev, usb); 472 + if (ret) 473 + goto usb_failed; 474 + 475 + ret = device_create_file(&pdev->dev, &dev_attr_charger_state); 476 + if (ret < 0) 477 + dev_warn(wm8350->dev, "failed to add charge sysfs: %d\n", ret); 478 + ret = 0; 479 + 480 + wm8350_init_charger(wm8350); 481 + if (wm8350_charger_config(wm8350, policy) == 0) { 482 + wm8350_reg_unlock(wm8350); 483 + wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CHG_ENA); 484 + wm8350_reg_lock(wm8350); 485 + } 486 + 487 + return ret; 488 + 489 + usb_failed: 490 + power_supply_unregister(battery); 491 + battery_failed: 492 + power_supply_unregister(ac); 493 + 494 + return ret; 495 + } 496 + 497 + static __devexit int wm8350_power_remove(struct platform_device *pdev) 498 + { 499 + struct wm8350 *wm8350 = platform_get_drvdata(pdev); 500 + struct wm8350_power *power = &wm8350->power; 501 + 502 + free_charger_irq(wm8350); 503 + device_remove_file(&pdev->dev, &dev_attr_charger_state); 504 + power_supply_unregister(&power->battery); 505 + power_supply_unregister(&power->ac); 506 + power_supply_unregister(&power->usb); 507 + return 0; 508 + } 509 + 510 + static struct platform_driver wm8350_power_driver = { 511 + .probe = wm8350_power_probe, 512 + .remove = __devexit_p(wm8350_power_remove), 513 + .driver = { 514 + .name = "wm8350-power", 515 + }, 516 + }; 517 + 518 + static int __init wm8350_power_init(void) 519 + { 520 + return platform_driver_register(&wm8350_power_driver); 521 + } 522 + module_init(wm8350_power_init); 523 + 524 + static void __exit wm8350_power_exit(void) 525 + { 526 + platform_driver_unregister(&wm8350_power_driver); 527 + } 528 + module_exit(wm8350_power_exit); 529 + 530 + MODULE_LICENSE("GPL"); 531 + MODULE_DESCRIPTION("Power supply driver for WM8350"); 532 + MODULE_ALIAS("platform:wm8350-power");
+7
drivers/regulator/wm8350-regulator.c
··· 1380 1380 if (wm8350->pmic.pdev[reg]) 1381 1381 return -EBUSY; 1382 1382 1383 + if (reg >= WM8350_DCDC_1 && reg <= WM8350_DCDC_6 && 1384 + reg > wm8350->pmic.max_dcdc) 1385 + return -ENODEV; 1386 + if (reg >= WM8350_ISINK_A && reg <= WM8350_ISINK_B && 1387 + reg > wm8350->pmic.max_isink) 1388 + return -ENODEV; 1389 + 1383 1390 pdev = platform_device_alloc("wm8350-regulator", reg); 1384 1391 if (!pdev) 1385 1392 return -ENOMEM;
+79
include/linux/i2c/dm355evm_msp.h
··· 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 */
+48 -33
include/linux/i2c/twl4030.h
··· 78 78 * IMPORTANT: For twl4030_i2c_write(), allocate num_bytes + 1 79 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); 82 - int twl4030_i2c_read(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, unsigned num_bytes); 83 83 84 84 /*----------------------------------------------------------------------*/ 85 85 ··· 278 278 struct twl4030_keypad_data *keypad; 279 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 293 /* REVISIT more to come ... _nothing_ should be hard-wired */ 282 294 }; 283 295 284 296 /*----------------------------------------------------------------------*/ 285 297 286 298 int twl4030_sih_setup(int module); 287 - 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 299 315 300 /* Offsets to Power Registers */ 316 301 #define TWL4030_VDAC_DEV_GRP 0x3B ··· 306 321 #define TWL4030_VAUX2_DEDICATED 0x1E 307 322 #define TWL4030_VAUX3_DEV_GRP 0x1F 308 323 #define TWL4030_VAUX3_DEDICATED 0x22 309 - 310 - /* TWL4030 GPIO interrupt definitions */ 311 - 312 - #define TWL4030_GPIO_IRQ_NO(n) (TWL4030_GPIO_IRQ_BASE + (n)) 313 324 314 325 /* 315 326 * Exported TWL4030 GPIO APIs ··· 320 339 #else 321 340 static inline int twl4030charger_usb_en(int enable) { return 0; } 322 341 #endif 342 + 343 + /*----------------------------------------------------------------------*/ 344 + 345 + /* Linux-specific regulator identifiers ... for now, we only support 346 + * the LDOs, and leave the three buck converters alone. VDD1 and VDD2 347 + * need to tie into hardware based voltage scaling (cpufreq etc), while 348 + * VIO is generally fixed. 349 + */ 350 + 351 + /* EXTERNAL dc-to-dc buck converters */ 352 + #define TWL4030_REG_VDD1 0 353 + #define TWL4030_REG_VDD2 1 354 + #define TWL4030_REG_VIO 2 355 + 356 + /* EXTERNAL LDOs */ 357 + #define TWL4030_REG_VDAC 3 358 + #define TWL4030_REG_VPLL1 4 359 + #define TWL4030_REG_VPLL2 5 /* not on all chips */ 360 + #define TWL4030_REG_VMMC1 6 361 + #define TWL4030_REG_VMMC2 7 /* not on all chips */ 362 + #define TWL4030_REG_VSIM 8 /* not on all chips */ 363 + #define TWL4030_REG_VAUX1 9 /* not on all chips */ 364 + #define TWL4030_REG_VAUX2_4030 10 /* (twl4030-specific) */ 365 + #define TWL4030_REG_VAUX2 11 /* (twl5030 and newer) */ 366 + #define TWL4030_REG_VAUX3 12 /* not on all chips */ 367 + #define TWL4030_REG_VAUX4 13 /* not on all chips */ 368 + 369 + /* INTERNAL LDOs */ 370 + #define TWL4030_REG_VINTANA1 14 371 + #define TWL4030_REG_VINTANA2 15 372 + #define TWL4030_REG_VINTDIG 16 373 + #define TWL4030_REG_VUSB1V5 17 374 + #define TWL4030_REG_VUSB1V8 18 375 + #define TWL4030_REG_VUSB3V1 19 323 376 324 377 #endif /* End of __TWL4030_H */
+42 -2
include/linux/mfd/da903x.h
··· 32 32 DA9030_ID_LDO18, 33 33 DA9030_ID_LDO19, 34 34 DA9030_ID_LDO_INT, /* LDO Internal */ 35 + DA9030_ID_BAT, /* battery charger */ 35 36 36 37 DA9034_ID_LED_1, 37 38 DA9034_ID_LED_2, ··· 92 91 int interval_ms; /* sampling interval while pen down */ 93 92 int x_inverted; 94 93 int y_inverted; 94 + }; 95 + 96 + /* DA9030 battery charger data */ 97 + struct power_supply_info; 98 + 99 + struct da9030_battery_info { 100 + /* battery parameters */ 101 + struct power_supply_info *battery_info; 102 + 103 + /* current and voltage to use for battery charging */ 104 + unsigned int charge_milliamp; 105 + unsigned int charge_millivolt; 106 + 107 + /* voltage thresholds (in millivolts) */ 108 + int vbat_low; 109 + int vbat_crit; 110 + int vbat_charge_start; 111 + int vbat_charge_stop; 112 + int vbat_charge_restart; 113 + 114 + /* battery nominal minimal and maximal voltages in millivolts */ 115 + int vcharge_min; 116 + int vcharge_max; 117 + 118 + /* Temperature thresholds. These are DA9030 register values 119 + "as is" and should be measured for each battery type */ 120 + int tbat_low; 121 + int tbat_high; 122 + int tbat_restart; 123 + 124 + 125 + /* battery monitor interval (seconds) */ 126 + unsigned int batmon_interval; 127 + 128 + /* platform callbacks for battery low and critical events */ 129 + void (*battery_low)(void); 130 + void (*battery_critical)(void); 95 131 }; 96 132 97 133 struct da903x_subdev_info { ··· 228 190 extern int da903x_query_status(struct device *dev, unsigned int status); 229 191 230 192 231 - /* NOTE: the two functions below are not intended for use outside 232 - * of the DA9034 sub-device drivers 193 + /* NOTE: the functions below are not intended for use outside 194 + * of the DA903x sub-device drivers 233 195 */ 234 196 extern int da903x_write(struct device *dev, int reg, uint8_t val); 197 + extern int da903x_writes(struct device *dev, int reg, int len, uint8_t *val); 235 198 extern int da903x_read(struct device *dev, int reg, uint8_t *val); 199 + extern int da903x_reads(struct device *dev, int reg, int len, uint8_t *val); 236 200 extern int da903x_update(struct device *dev, int reg, uint8_t val, uint8_t mask); 237 201 extern int da903x_set_bits(struct device *dev, int reg, uint8_t bit_mask); 238 202 extern int da903x_clr_bits(struct device *dev, int reg, uint8_t bit_mask);
+8
include/linux/mfd/wm8350/comparator.h
··· 164 164 #define WM8350_AUXADC_BATT 6 165 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 175 #endif
+50 -2
include/linux/mfd/wm8350/core.h
··· 29 29 */ 30 30 #define WM8350_RESET_ID 0x00 31 31 #define WM8350_ID 0x01 32 + #define WM8350_REVISION 0x02 32 33 #define WM8350_SYSTEM_CONTROL_1 0x03 33 34 #define WM8350_SYSTEM_CONTROL_2 0x04 34 35 #define WM8350_SYSTEM_HIBERNATE 0x05 ··· 58 57 #define WM8350_OVER_CURRENT_INT_STATUS_MASK 0x25 59 58 #define WM8350_GPIO_INT_STATUS_MASK 0x26 60 59 #define WM8350_COMPARATOR_INT_STATUS_MASK 0x27 60 + #define WM8350_CHARGER_OVERRIDES 0xE2 61 + #define WM8350_MISC_OVERRIDES 0xE3 62 + #define WM8350_COMPARATOR_OVERRIDES 0xE7 63 + #define WM8350_STATE_MACHINE_STATUS 0xE9 61 64 62 65 #define WM8350_MAX_REGISTER 0xFF 63 66 ··· 80 75 #define WM8350_CHIP_REV_MASK 0x7000 81 76 #define WM8350_CONF_STS_MASK 0x0C00 82 77 #define WM8350_CUST_ID_MASK 0x00FF 78 + 79 + /* 80 + * R2 (0x02) - Revision 81 + */ 82 + #define WM8350_MASK_REV_MASK 0x00FF 83 83 84 84 /* 85 85 * R3 (0x03) - System Control 1 ··· 533 523 #define WM8350_DC2_STS 0x0002 534 524 #define WM8350_DC1_STS 0x0001 535 525 526 + /* 527 + * R226 (0xE2) - Charger status 528 + */ 529 + #define WM8350_CHG_BATT_HOT_OVRDE 0x8000 530 + #define WM8350_CHG_BATT_COLD_OVRDE 0x4000 531 + 532 + /* 533 + * R227 (0xE3) - Misc Overrides 534 + */ 535 + #define WM8350_USB_LIMIT_OVRDE 0x0400 536 + 537 + /* 538 + * R227 (0xE7) - Comparator Overrides 539 + */ 540 + #define WM8350_USB_FB_OVRDE 0x8000 541 + #define WM8350_WALL_FB_OVRDE 0x4000 542 + #define WM8350_BATT_FB_OVRDE 0x2000 543 + 544 + 545 + /* 546 + * R233 (0xE9) - State Machinine Status 547 + */ 548 + #define WM8350_USB_SM_MASK 0x0700 549 + #define WM8350_USB_SM_SHIFT 8 550 + 551 + #define WM8350_USB_SM_100_SLV 1 552 + #define WM8350_USB_SM_500_SLV 5 553 + #define WM8350_USB_SM_STDBY_SLV 7 554 + 536 555 /* WM8350 wake up conditions */ 537 556 #define WM8350_IRQ_WKUP_OFF_STATE 43 538 557 #define WM8350_IRQ_WKUP_HIB_STATE 44 ··· 575 536 #define WM8350_REV_E 0x4 576 537 #define WM8350_REV_F 0x5 577 538 #define WM8350_REV_G 0x6 539 + #define WM8350_REV_H 0x7 578 540 579 541 #define WM8350_NUM_IRQ 63 580 542 ··· 589 549 extern const u16 wm8350_mode1_defaults[]; 590 550 extern const u16 wm8350_mode2_defaults[]; 591 551 extern const u16 wm8350_mode3_defaults[]; 552 + extern const u16 wm8351_mode0_defaults[]; 553 + extern const u16 wm8351_mode1_defaults[]; 554 + extern const u16 wm8351_mode2_defaults[]; 555 + extern const u16 wm8351_mode3_defaults[]; 556 + extern const u16 wm8352_mode0_defaults[]; 557 + extern const u16 wm8352_mode1_defaults[]; 558 + extern const u16 wm8352_mode2_defaults[]; 559 + extern const u16 wm8352_mode3_defaults[]; 592 560 593 561 struct wm8350; 594 562 ··· 606 558 }; 607 559 608 560 struct wm8350 { 609 - int rev; /* chip revision */ 610 - 611 561 struct device *dev; 612 562 613 563 /* device IO */ ··· 617 571 int (*write_dev)(struct wm8350 *wm8350, char reg, int size, 618 572 void *src); 619 573 u16 *reg_cache; 574 + 575 + struct mutex auxadc_mutex; 620 576 621 577 /* Interrupt handling */ 622 578 struct work_struct irq_work;
+4
include/linux/mfd/wm8350/pmic.h
··· 701 701 struct regulator_init_data; 702 702 703 703 struct wm8350_pmic { 704 + /* Number of regulators of each type on this device */ 705 + int max_dcdc; 706 + int max_isink; 707 + 704 708 /* ISINK to DCDC mapping */ 705 709 int isink_A_dcdc; 706 710 int isink_B_dcdc;
+24 -1
include/linux/mfd/wm8350/supply.h
··· 13 13 #ifndef __LINUX_MFD_WM8350_SUPPLY_H_ 14 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 20 * Charger registers ··· 105 104 #define WM8350_IRQ_EXT_WALL_FB 37 106 105 #define WM8350_IRQ_EXT_BAT_FB 38 107 106 107 + /* 108 + * Policy to control charger state machine. 109 + */ 110 + struct wm8350_charger_policy { 111 + 112 + /* charger state machine policy - set in machine driver */ 113 + int eoc_mA; /* end of charge current (mA) */ 114 + int charge_mV; /* charge voltage */ 115 + int fast_limit_mA; /* fast charge current limit */ 116 + int fast_limit_USB_mA; /* USB fast charge current limit */ 117 + int charge_timeout; /* charge timeout (mins) */ 118 + int trickle_start_mV; /* trickle charge starts at mV */ 119 + int trickle_charge_mA; /* trickle charge current */ 120 + int trickle_charge_USB_mA; /* USB trickle charge current */ 121 + }; 122 + 108 123 struct wm8350_power { 109 124 struct platform_device *pdev; 125 + struct power_supply battery; 126 + struct power_supply usb; 127 + struct power_supply ac; 128 + struct wm8350_charger_policy *policy; 129 + 130 + int rev_g_coeff; 110 131 }; 111 132 112 133 #endif
+1
include/linux/power_supply.h
··· 45 45 POWER_SUPPLY_HEALTH_DEAD, 46 46 POWER_SUPPLY_HEALTH_OVERVOLTAGE, 47 47 POWER_SUPPLY_HEALTH_UNSPEC_FAILURE, 48 + POWER_SUPPLY_HEALTH_COLD, 48 49 }; 49 50 50 51 enum {