WM831x drivers
Subsystems (13)
cover WM831x drivers
The following patch series adds initial support for the WM813x series of PMICs.
Since these devices have functionality that crosses many subsystems the patches cross many kernel trees. For clarity I'm presenting this initial submission as a single series but I have endeavoured to split things up so that the patches can be applied separately to the various subsystems. In order to avoid merge issues as patches are applied the platform data for the devices is included in the core patches.
Due to Kconfig and Makefile collisons I've also included the patch adding hwmon support for the WM835x series of PMICs to the series. Other than the build system updates there is no interdependence between those two patches.
Mark Brown (22):
mfd: Allow multiple MFD cells with the same name
mfd: Initial core support for WM831x series devices
mfd: Add WM831x interrupt support
mfd: Add WM831x AUXADC support
mfd: Conditionally add WM831x backlight subdevice
mfd: Add basic WM831x OTP support
mfd: Export ISEL values from WM831x core
mfd: Hook WM831x into build system
backlight: Add WM831x backlight driver
gpio: Add WM831X GPIO driver
hwmon: Add WM835x PMIC hardware monitoring driver
hwmon: WM831x PMIC hardware monitoring driver
Input: Add support for the WM831x ON pin
leds: Add WM831x status LED driver
power_supply: Add driver for the PMU on WM831x PMICs
regulator: Add WM831x DC-DC buck convertor support
regulator: Add WM831x LDO support
regulator: Add WM831x EPE support
regulator: Add WM831x DC-DC boost convertor support
regulator: Add WM831x ISINK support
RTC: Add support for RTCs on Wolfson WM831x devices [WATCHDOG] Add support for WM831x watchdog
Documentation/hwmon/wm831x | 37 + Documentation/hwmon/wm8350 | 26 + drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/wm831x-gpio.c | 252 ++++++ drivers/hwmon/Kconfig | 21 + drivers/hwmon/Makefile | 2 + drivers/hwmon/wm831x-hwmon.c | 236 ++++++ drivers/hwmon/wm8350-hwmon.c | 151 ++++ drivers/input/misc/Kconfig | 10 + drivers/input/misc/Makefile | 1 + drivers/input/misc/wm831x-on.c | 163 ++++ drivers/leds/Kconfig | 7 + drivers/leds/Makefile | 1 + drivers/leds/leds-wm831x-status.c | 341 ++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 2 + drivers/mfd/mfd-core.c | 2 +- drivers/mfd/wm831x-core.c | 1549 ++++++++++++++++++++++++++++++++++ drivers/mfd/wm831x-irq.c | 559 ++++++++++++ drivers/mfd/wm831x-otp.c | 83 ++ drivers/mfd/wm8350-core.c | 3 + drivers/power/Kconfig | 7 + drivers/power/Makefile | 1 + drivers/power/wm831x_power.c | 779 +++++++++++++++++ drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 3 + drivers/regulator/wm831x-dcdc.c | 862 +++++++++++++++++++ drivers/regulator/wm831x-isink.c | 260 ++++++ drivers/regulator/wm831x-ldo.c | 852 +++++++++++++++++++ drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-wm831x.c | 538 ++++++++++++ drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/wm831x_bl.c | 250 ++++++ drivers/watchdog/Kconfig | 7 + drivers/watchdog/Makefile | 1 + drivers/watchdog/wm831x_wdt.c | 441 ++++++++++ include/linux/mfd/core.h | 1 + include/linux/mfd/wm831x/auxadc.h | 216 +++++ include/linux/mfd/wm831x/core.h | 289 +++++++ include/linux/mfd/wm831x/gpio.h | 55 ++ include/linux/mfd/wm831x/irq.h | 764 +++++++++++++++++ include/linux/mfd/wm831x/otp.h | 162 ++++ include/linux/mfd/wm831x/pdata.h | 113 +++ include/linux/mfd/wm831x/pmu.h | 189 +++++ include/linux/mfd/wm831x/regulator.h | 1218 ++++++++++++++++++++++++++ include/linux/mfd/wm831x/status.h | 34 + include/linux/mfd/wm831x/watchdog.h | 52 ++ include/linux/mfd/wm8350/core.h | 6 + 51 files changed, 10589 insertions(+), 1 deletions(-) create mode 100644 Documentation/hwmon/wm831x create mode 100644 Documentation/hwmon/wm8350 create mode 100644 drivers/gpio/wm831x-gpio.c create mode 100644 drivers/hwmon/wm831x-hwmon.c create mode 100644 drivers/hwmon/wm8350-hwmon.c create mode 100644 drivers/input/misc/wm831x-on.c create mode 100644 drivers/leds/leds-wm831x-status.c create mode 100644 drivers/mfd/wm831x-core.c create mode 100644 drivers/mfd/wm831x-irq.c create mode 100644 drivers/mfd/wm831x-otp.c create mode 100644 drivers/power/wm831x_power.c create mode 100644 drivers/regulator/wm831x-dcdc.c create mode 100644 drivers/regulator/wm831x-isink.c create mode 100644 drivers/regulator/wm831x-ldo.c create mode 100644 drivers/rtc/rtc-wm831x.c create mode 100644 drivers/video/backlight/wm831x_bl.c create mode 100644 drivers/watchdog/wm831x_wdt.c create mode 100644 include/linux/mfd/wm831x/auxadc.h create mode 100644 include/linux/mfd/wm831x/core.h create mode 100644 include/linux/mfd/wm831x/gpio.h create mode 100644 include/linux/mfd/wm831x/irq.h create mode 100644 include/linux/mfd/wm831x/otp.h create mode 100644 include/linux/mfd/wm831x/pdata.h create mode 100644 include/linux/mfd/wm831x/pmu.h create mode 100644 include/linux/mfd/wm831x/regulator.h create mode 100644 include/linux/mfd/wm831x/status.h create mode 100644 include/linux/mfd/wm831x/watchdog.h
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
PATCH 1/22 mfd: Allow multiple MFD cells with the same name
Provide basic support for MFDs having multiple cells of a given type with different IDs by adding an id to the mfd_cell structure and then adding that to the id passed in to mfd_add_devices().
As it stands this approach requires that MFDs using this feature deal with ensuring that there aren't any ID collisions resulting from multiple MFDs of the same type being instantiated. This needs to happen with the existing code too, but with this approach there is a knock on effect on the IDs for non-duplicated devices.
--- drivers/mfd/mfd-core.c | 2 +- include/linux/mfd/core.h | 1 + 2 files changed, 2 insertions(+), 1 deletions(-)
drivers/mfd/mfd-core.c +1 -1
@@ -25,7 +25,7 @@ static int mfd_add_device(struct device *parent, int id,int ret = -ENOMEM ;int r; - pdev =platform_device_alloc (cell->name, id); + pdev =platform_device_alloc (cell->name, id + cell->id);if (!pdev) goto fail_alloc;
include/linux/mfd/core.h +1 -0
@@ -23,6 +23,7 @@*/ struct mfd_cell {const char *name; +int id;int (*enable)(struct platform_device *dev);int (*disable)(struct platform_device *dev);
Signature · 1 line
1.6.3.3
PATCH 2/22 mfd: Initial core support for WM831x series devices
In reply to Mark BrownThe WM831x series of devices are register compatible processor power management subsystems, providing regulator and power path management facilities along with other services like watchdog, RTC and touch panel controllers.
This patch adds very basic support, providing basic single register I2C access, handling of the security key and registration of the devices.
--- drivers/mfd/wm831x-core.c | 1357 ++++++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/core.h | 247 +++++++ include/linux/mfd/wm831x/pdata.h | 107 +++ 3 files changed, 1711 insertions(+), 0 deletions(-) create mode 100644 drivers/mfd/wm831x-core.c create mode 100644 include/linux/mfd/wm831x/core.h create mode 100644 include/linux/mfd/wm831x/pdata.h
drivers/mfd/wm831x-core.c new file +1357 -0
@@ -0,0 +1,1357 @@ +/* +* wm831x-core.c -- Device access for Wolfson WM831x PMICs +* +* Copyright 2009 Wolfson Microelectronics PLC. +* +* Author: Mark Brown <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/i2c.h> +#include <linux/mfd/core.h> + +#include <linux/mfd/wm831x/core.h> +#include <linux/mfd/wm831x/pdata.h> + +enum wm831x_parent { +WM8310 =0 , +WM8311 =1 , +WM8312 =2 , +}; + +static int wm831x_reg_locked (struct wm831x *wm831x,unsigned short reg) +{ +if (!wm831x->locked) +return 0 ; + +switch (reg) { +case WM831X_WATCHDOG : +case WM831X_DC4_CONTROL : +case WM831X_ON_PIN_CONTROL : +case WM831X_BACKUP_CHARGER_CONTROL : +case WM831X_CHARGER_CONTROL_1 : +case WM831X_CHARGER_CONTROL_2 : +return 1 ; + +default : +return 0 ; + } +} + +/** +* wm831x_reg_unlock: Unlock user keyed registers +* +* The WM831x has a user key preventing writes to particularly +* critical registers. This function locks those registers, +* allowing writes to them. +*/ +void wm831x_reg_lock (struct wm831x *wm831x) +{ +int ret; + + ret =wm831x_reg_write (wm831x,WM831X_SECURITY_KEY ,0 ); +if (ret ==0 ) { +dev_vdbg (wm831x->dev,"Registers locked\n" ); + +mutex_lock (&wm831x->io_lock); +WARN_ON (wm831x->locked); + wm831x->locked =1 ; +mutex_unlock (&wm831x->io_lock); + }else { +dev_err (wm831x->dev,"Failed to lock registers: %d\n" , ret); + } + +} +EXPORT_SYMBOL_GPL (wm831x_reg_lock); + +/** +* wm831x_reg_unlock: Unlock user keyed registers +* +* The WM831x has a user key preventing writes to particularly +* critical registers. This function locks those registers, +* preventing spurious writes. +*/ +int wm831x_reg_unlock (struct wm831x *wm831x) +{ +int ret; + +/* 0x9716 is the value required to unlock the registers */ + ret =wm831x_reg_write (wm831x,WM831X_SECURITY_KEY ,0x9716 ); +if (ret ==0 ) { +dev_vdbg (wm831x->dev,"Registers unlocked\n" ); + +mutex_lock (&wm831x->io_lock); +WARN_ON (!wm831x->locked); + wm831x->locked =0 ; +mutex_unlock (&wm831x->io_lock); + } + +return ret; +} +EXPORT_SYMBOL_GPL (wm831x_reg_unlock); + +static int wm831x_read (struct wm831x *wm831x,unsigned short reg, +int bytes,void *dest) +{ +int ret, i; +u16 *buf = dest; + +BUG_ON (bytes %2 ); +BUG_ON (bytes <=0 ); + + ret = wm831x->read_dev (wm831x, reg, bytes, dest); +if (ret <0 ) +return ret; + +for (i =0 ; i < bytes /2 ; i++) { + buf[i] =be16_to_cpu (buf[i]); + +dev_vdbg (wm831x->dev,"Read %04x from R%d(0x%x)\n" , + buf[i], reg + i, reg + i); + } + +return 0 ; +} + +/** +* wm831x_reg_read: Read a single WM831x register. +* +* @wm831x: Device to read from. +* @reg: Register to read. +*/ +int wm831x_reg_read (struct wm831x *wm831x,unsigned short reg) +{ +unsigned short val; +int ret; + +mutex_lock (&wm831x->io_lock); + + ret =wm831x_read (wm831x, reg,2 , &val); + +mutex_unlock (&wm831x->io_lock); + +if (ret <0 ) +return ret; +else +return val; +} +EXPORT_SYMBOL_GPL (wm831x_reg_read); + +/** +* wm831x_bulk_read: Read multiple WM831x registers +* +* @wm831x: Device to read from +* @reg: First register +* @count: Number of registers +* @buf: Buffer to fill. +*/ +int wm831x_bulk_read (struct wm831x *wm831x,unsigned short reg, +int count,u16 *buf) +{ +int ret; + +mutex_lock (&wm831x->io_lock); + + ret =wm831x_read (wm831x, reg, count *2 , buf); + +mutex_unlock (&wm831x->io_lock); + +return ret; +} +EXPORT_SYMBOL_GPL (wm831x_bulk_read); + +static int wm831x_write (struct wm831x *wm831x,unsigned short reg, +int bytes,void *src) +{ +u16 *buf = src; +int i; + +BUG_ON (bytes %2 ); +BUG_ON (bytes <=0 ); + +for (i =0 ; i < bytes /2 ; i++) { +if (wm831x_reg_locked (wm831x, reg)) +return -EPERM ; + +dev_vdbg (wm831x->dev,"Write %04x to R%d(0x%x)\n" , + buf[i], reg + i, reg + i); + + buf[i] =cpu_to_be16 (buf[i]); + } + +return wm831x->write_dev (wm831x, reg, bytes, src); +} + +/** +* wm831x_reg_write: Write a single WM831x register. +* +* @wm831x: Device to write to. +* @reg: Register to write to. +* @val: Value to write. +*/ +int wm831x_reg_write (struct wm831x *wm831x,unsigned short reg, +unsigned short val) +{ +int ret; + +mutex_lock (&wm831x->io_lock); + + ret =wm831x_write (wm831x, reg,2 , &val); + +mutex_unlock (&wm831x->io_lock); + +return ret; +} +EXPORT_SYMBOL_GPL (wm831x_reg_write); + +/** +* wm831x_set_bits: Set the value of a bitfield in a WM831x register +* +* @wm831x: Device to write to. +* @reg: Register to write to. +* @mask: Mask of bits to set. +* @val: Value to set (unshifted) +*/ +int wm831x_set_bits (struct wm831x *wm831x,unsigned short reg, +unsigned short mask,unsigned short val) +{ +int ret; +u16 r; + +mutex_lock (&wm831x->io_lock); + + ret =wm831x_read (wm831x, reg,2 , &r); +if (ret <0 ) + goto out; + + r &= ~mask; + r |= val; + + ret =wm831x_write (wm831x, reg,2 , &r); + +out: +mutex_unlock (&wm831x->io_lock); + +return ret; +} +EXPORT_SYMBOL_GPL (wm831x_set_bits); + +static struct resource wm831x_dcdc1_resources[] = { + { + .start =WM831X_DC1_CONTROL_1 , + .end =WM831X_DC1_DVS_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_DC1 , + .end =WM831X_IRQ_UV_DC1 , + .flags =IORESOURCE_IRQ , + }, + { + .name ="HC" , + .start =WM831X_IRQ_HC_DC1 , + .end =WM831X_IRQ_HC_DC1 , + .flags =IORESOURCE_IRQ , + }, +}; + + +static struct resource wm831x_dcdc2_resources[] = { + { + .start =WM831X_DC2_CONTROL_1 , + .end =WM831X_DC2_DVS_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_DC2 , + .end =WM831X_IRQ_UV_DC2 , + .flags =IORESOURCE_IRQ , + }, + { + .name ="HC" , + .start =WM831X_IRQ_HC_DC2 , + .end =WM831X_IRQ_HC_DC2 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_dcdc3_resources[] = { + { + .start =WM831X_DC3_CONTROL_1 , + .end =WM831X_DC3_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_DC3 , + .end =WM831X_IRQ_UV_DC3 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_dcdc4_resources[] = { + { + .start =WM831X_DC4_CONTROL , + .end =WM831X_DC4_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_DC4 , + .end =WM831X_IRQ_UV_DC4 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_gpio_resources[] = { + { + .start =WM831X_IRQ_GPIO_1 , + .end =WM831X_IRQ_GPIO_16 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_isink1_resources[] = { + { + .start =WM831X_CURRENT_SINK_1 , + .end =WM831X_CURRENT_SINK_1 , + .flags =IORESOURCE_IO , + }, + { + .start =WM831X_IRQ_CS1 , + .end =WM831X_IRQ_CS1 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_isink2_resources[] = { + { + .start =WM831X_CURRENT_SINK_2 , + .end =WM831X_CURRENT_SINK_2 , + .flags =IORESOURCE_IO , + }, + { + .start =WM831X_IRQ_CS2 , + .end =WM831X_IRQ_CS2 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo1_resources[] = { + { + .start =WM831X_LDO1_CONTROL , + .end =WM831X_LDO1_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO1 , + .end =WM831X_IRQ_UV_LDO1 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo2_resources[] = { + { + .start =WM831X_LDO2_CONTROL , + .end =WM831X_LDO2_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO2 , + .end =WM831X_IRQ_UV_LDO2 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo3_resources[] = { + { + .start =WM831X_LDO3_CONTROL , + .end =WM831X_LDO3_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO3 , + .end =WM831X_IRQ_UV_LDO3 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo4_resources[] = { + { + .start =WM831X_LDO4_CONTROL , + .end =WM831X_LDO4_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO4 , + .end =WM831X_IRQ_UV_LDO4 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo5_resources[] = { + { + .start =WM831X_LDO5_CONTROL , + .end =WM831X_LDO5_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO5 , + .end =WM831X_IRQ_UV_LDO5 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo6_resources[] = { + { + .start =WM831X_LDO6_CONTROL , + .end =WM831X_LDO6_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO6 , + .end =WM831X_IRQ_UV_LDO6 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo7_resources[] = { + { + .start =WM831X_LDO7_CONTROL , + .end =WM831X_LDO7_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO7 , + .end =WM831X_IRQ_UV_LDO7 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo8_resources[] = { + { + .start =WM831X_LDO8_CONTROL , + .end =WM831X_LDO8_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO8 , + .end =WM831X_IRQ_UV_LDO8 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo9_resources[] = { + { + .start =WM831X_LDO9_CONTROL , + .end =WM831X_LDO9_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO9 , + .end =WM831X_IRQ_UV_LDO9 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo10_resources[] = { + { + .start =WM831X_LDO10_CONTROL , + .end =WM831X_LDO10_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, + { + .name ="UV" , + .start =WM831X_IRQ_UV_LDO10 , + .end =WM831X_IRQ_UV_LDO10 , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_ldo11_resources[] = { + { + .start =WM831X_LDO11_ON_CONTROL , + .end =WM831X_LDO11_SLEEP_CONTROL , + .flags =IORESOURCE_IO , + }, +}; + +static struct resource wm831x_on_resources[] = { + { + .start =WM831X_IRQ_ON , + .end =WM831X_IRQ_ON , + .flags =IORESOURCE_IRQ , + }, +}; + + +static struct resource wm831x_power_resources[] = { + { + .name ="SYSLO" , + .start =WM831X_IRQ_PPM_SYSLO , + .end =WM831X_IRQ_PPM_SYSLO , + .flags =IORESOURCE_IRQ , + }, + { + .name ="PWR SRC" , + .start =WM831X_IRQ_PPM_PWR_SRC , + .end =WM831X_IRQ_PPM_PWR_SRC , + .flags =IORESOURCE_IRQ , + }, + { + .name ="USB CURR" , + .start =WM831X_IRQ_PPM_USB_CURR , + .end =WM831X_IRQ_PPM_USB_CURR , + .flags =IORESOURCE_IRQ , + }, + { + .name ="BATT HOT" , + .start =WM831X_IRQ_CHG_BATT_HOT , + .end =WM831X_IRQ_CHG_BATT_HOT , + .flags =IORESOURCE_IRQ , + }, + { + .name ="BATT COLD" , + .start =WM831X_IRQ_CHG_BATT_COLD , + .end =WM831X_IRQ_CHG_BATT_COLD , + .flags =IORESOURCE_IRQ , + }, + { + .name ="BATT FAIL" , + .start =WM831X_IRQ_CHG_BATT_FAIL , + .end =WM831X_IRQ_CHG_BATT_FAIL , + .flags =IORESOURCE_IRQ , + }, + { + .name ="OV" , + .start =WM831X_IRQ_CHG_OV , + .end =WM831X_IRQ_CHG_OV , + .flags =IORESOURCE_IRQ , + }, + { + .name ="END" , + .start =WM831X_IRQ_CHG_END , + .end =WM831X_IRQ_CHG_END , + .flags =IORESOURCE_IRQ , + }, + { + .name ="TO" , + .start =WM831X_IRQ_CHG_TO , + .end =WM831X_IRQ_CHG_TO , + .flags =IORESOURCE_IRQ , + }, + { + .name ="MODE" , + .start =WM831X_IRQ_CHG_MODE , + .end =WM831X_IRQ_CHG_MODE , + .flags =IORESOURCE_IRQ , + }, + { + .name ="START" , + .start =WM831X_IRQ_CHG_START , + .end =WM831X_IRQ_CHG_START , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_rtc_resources[] = { + { + .name ="PER" , + .start =WM831X_IRQ_RTC_PER , + .end =WM831X_IRQ_RTC_PER , + .flags =IORESOURCE_IRQ , + }, + { + .name ="ALM" , + .start =WM831X_IRQ_RTC_ALM , + .end =WM831X_IRQ_RTC_ALM , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_status1_resources[] = { + { + .start =WM831X_STATUS_LED_1 , + .end =WM831X_STATUS_LED_1 , + .flags =IORESOURCE_IO , + }, +}; + +static struct resource wm831x_status2_resources[] = { + { + .start =WM831X_STATUS_LED_2 , + .end =WM831X_STATUS_LED_2 , + .flags =IORESOURCE_IO , + }, +}; + +static struct resource wm831x_touch_resources[] = { + { + .name ="TCHPD" , + .start =WM831X_IRQ_TCHPD , + .end =WM831X_IRQ_TCHPD , + .flags =IORESOURCE_IRQ , + }, + { + .name ="TCHDATA" , + .start =WM831X_IRQ_TCHDATA , + .end =WM831X_IRQ_TCHDATA , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct resource wm831x_wdt_resources[] = { + { + .start =WM831X_IRQ_WDOG_TO , + .end =WM831X_IRQ_WDOG_TO , + .flags =IORESOURCE_IRQ , + }, +}; + +static struct mfd_cell wm8310_devs[] = { + { + .name ="wm831x-buckv" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_dcdc1_resources), + .resources = wm831x_dcdc1_resources, + }, + { + .name ="wm831x-buckv" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_dcdc2_resources), + .resources = wm831x_dcdc2_resources, + }, + { + .name ="wm831x-buckp" , + .id =3 , + .num_resources =ARRAY_SIZE (wm831x_dcdc3_resources), + .resources = wm831x_dcdc3_resources, + }, + { + .name ="wm831x-boostp" , + .id =4 , + .num_resources =ARRAY_SIZE (wm831x_dcdc4_resources), + .resources = wm831x_dcdc4_resources, + }, + { + .name ="wm831x-epe" , + .id =1 , + }, + { + .name ="wm831x-epe" , + .id =2 , + }, + { + .name ="wm831x-gpio" , + .num_resources =ARRAY_SIZE (wm831x_gpio_resources), + .resources = wm831x_gpio_resources, + }, + { + .name ="wm831x-hwmon" , + }, + { + .name ="wm831x-isink" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_isink1_resources), + .resources = wm831x_isink1_resources, + }, + { + .name ="wm831x-isink" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_isink2_resources), + .resources = wm831x_isink2_resources, + }, + { + .name ="wm831x-ldo" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_ldo1_resources), + .resources = wm831x_ldo1_resources, + }, + { + .name ="wm831x-ldo" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_ldo2_resources), + .resources = wm831x_ldo2_resources, + }, + { + .name ="wm831x-ldo" , + .id =3 , + .num_resources =ARRAY_SIZE (wm831x_ldo3_resources), + .resources = wm831x_ldo3_resources, + }, + { + .name ="wm831x-ldo" , + .id =4 , + .num_resources =ARRAY_SIZE (wm831x_ldo4_resources), + .resources = wm831x_ldo4_resources, + }, + { + .name ="wm831x-ldo" , + .id =5 , + .num_resources =ARRAY_SIZE (wm831x_ldo5_resources), + .resources = wm831x_ldo5_resources, + }, + { + .name ="wm831x-ldo" , + .id =6 , + .num_resources =ARRAY_SIZE (wm831x_ldo6_resources), + .resources = wm831x_ldo6_resources, + }, + { + .name ="wm831x-aldo" , + .id =7 , + .num_resources =ARRAY_SIZE (wm831x_ldo7_resources), + .resources = wm831x_ldo7_resources, + }, + { + .name ="wm831x-aldo" , + .id =8 , + .num_resources =ARRAY_SIZE (wm831x_ldo8_resources), + .resources = wm831x_ldo8_resources, + }, + { + .name ="wm831x-aldo" , + .id =9 , + .num_resources =ARRAY_SIZE (wm831x_ldo9_resources), + .resources = wm831x_ldo9_resources, + }, + { + .name ="wm831x-aldo" , + .id =10 , + .num_resources =ARRAY_SIZE (wm831x_ldo10_resources), + .resources = wm831x_ldo10_resources, + }, + { + .name ="wm831x-alive-ldo" , + .id =11 , + .num_resources =ARRAY_SIZE (wm831x_ldo11_resources), + .resources = wm831x_ldo11_resources, + }, + { + .name ="wm831x-on" , + .num_resources =ARRAY_SIZE (wm831x_on_resources), + .resources = wm831x_on_resources, + }, + { + .name ="wm831x-power" , + .num_resources =ARRAY_SIZE (wm831x_power_resources), + .resources = wm831x_power_resources, + }, + { + .name ="wm831x-rtc" , + .num_resources =ARRAY_SIZE (wm831x_rtc_resources), + .resources = wm831x_rtc_resources, + }, + { + .name ="wm831x-status" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_status1_resources), + .resources = wm831x_status1_resources, + }, + { + .name ="wm831x-status" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_status2_resources), + .resources = wm831x_status2_resources, + }, + { + .name ="wm831x-watchdog" , + .num_resources =ARRAY_SIZE (wm831x_wdt_resources), + .resources = wm831x_wdt_resources, + }, +}; + +static struct mfd_cell wm8311_devs[] = { + { + .name ="wm831x-buckv" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_dcdc1_resources), + .resources = wm831x_dcdc1_resources, + }, + { + .name ="wm831x-buckv" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_dcdc2_resources), + .resources = wm831x_dcdc2_resources, + }, + { + .name ="wm831x-buckp" , + .id =3 , + .num_resources =ARRAY_SIZE (wm831x_dcdc3_resources), + .resources = wm831x_dcdc3_resources, + }, + { + .name ="wm831x-boostp" , + .id =4 , + .num_resources =ARRAY_SIZE (wm831x_dcdc4_resources), + .resources = wm831x_dcdc4_resources, + }, + { + .name ="wm831x-epe" , + .id =1 , + }, + { + .name ="wm831x-epe" , + .id =2 , + }, + { + .name ="wm831x-gpio" , + .num_resources =ARRAY_SIZE (wm831x_gpio_resources), + .resources = wm831x_gpio_resources, + }, + { + .name ="wm831x-hwmon" , + }, + { + .name ="wm831x-isink" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_isink1_resources), + .resources = wm831x_isink1_resources, + }, + { + .name ="wm831x-isink" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_isink2_resources), + .resources = wm831x_isink2_resources, + }, + { + .name ="wm831x-ldo" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_ldo1_resources), + .resources = wm831x_ldo1_resources, + }, + { + .name ="wm831x-ldo" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_ldo2_resources), + .resources = wm831x_ldo2_resources, + }, + { + .name ="wm831x-ldo" , + .id =3 , + .num_resources =ARRAY_SIZE (wm831x_ldo3_resources), + .resources = wm831x_ldo3_resources, + }, + { + .name ="wm831x-ldo" , + .id =4 , + .num_resources =ARRAY_SIZE (wm831x_ldo4_resources), + .resources = wm831x_ldo4_resources, + }, + { + .name ="wm831x-ldo" , + .id =5 , + .num_resources =ARRAY_SIZE (wm831x_ldo5_resources), + .resources = wm831x_ldo5_resources, + }, + { + .name ="wm831x-aldo" , + .id =7 , + .num_resources =ARRAY_SIZE (wm831x_ldo7_resources), + .resources = wm831x_ldo7_resources, + }, + { + .name ="wm831x-alive-ldo" , + .id =11 , + .num_resources =ARRAY_SIZE (wm831x_ldo11_resources), + .resources = wm831x_ldo11_resources, + }, + { + .name ="wm831x-on" , + .num_resources =ARRAY_SIZE (wm831x_on_resources), + .resources = wm831x_on_resources, + }, + { + .name ="wm831x-power" , + .num_resources =ARRAY_SIZE (wm831x_power_resources), + .resources = wm831x_power_resources, + }, + { + .name ="wm831x-rtc" , + .num_resources =ARRAY_SIZE (wm831x_rtc_resources), + .resources = wm831x_rtc_resources, + }, + { + .name ="wm831x-status" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_status1_resources), + .resources = wm831x_status1_resources, + }, + { + .name ="wm831x-status" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_status2_resources), + .resources = wm831x_status2_resources, + }, + { + .name ="wm831x-touch" , + .num_resources =ARRAY_SIZE (wm831x_touch_resources), + .resources = wm831x_touch_resources, + }, + { + .name ="wm831x-watchdog" , + .num_resources =ARRAY_SIZE (wm831x_wdt_resources), + .resources = wm831x_wdt_resources, + }, +}; + +static struct mfd_cell wm8312_devs[] = { + { + .name ="wm831x-buckv" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_dcdc1_resources), + .resources = wm831x_dcdc1_resources, + }, + { + .name ="wm831x-buckv" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_dcdc2_resources), + .resources = wm831x_dcdc2_resources, + }, + { + .name ="wm831x-buckp" , + .id =3 , + .num_resources =ARRAY_SIZE (wm831x_dcdc3_resources), + .resources = wm831x_dcdc3_resources, + }, + { + .name ="wm831x-boostp" , + .id =4 , + .num_resources =ARRAY_SIZE (wm831x_dcdc4_resources), + .resources = wm831x_dcdc4_resources, + }, + { + .name ="wm831x-epe" , + .id =1 , + }, + { + .name ="wm831x-epe" , + .id =2 , + }, + { + .name ="wm831x-gpio" , + .num_resources =ARRAY_SIZE (wm831x_gpio_resources), + .resources = wm831x_gpio_resources, + }, + { + .name ="wm831x-hwmon" , + }, + { + .name ="wm831x-isink" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_isink1_resources), + .resources = wm831x_isink1_resources, + }, + { + .name ="wm831x-isink" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_isink2_resources), + .resources = wm831x_isink2_resources, + }, + { + .name ="wm831x-ldo" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_ldo1_resources), + .resources = wm831x_ldo1_resources, + }, + { + .name ="wm831x-ldo" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_ldo2_resources), + .resources = wm831x_ldo2_resources, + }, + { + .name ="wm831x-ldo" , + .id =3 , + .num_resources =ARRAY_SIZE (wm831x_ldo3_resources), + .resources = wm831x_ldo3_resources, + }, + { + .name ="wm831x-ldo" , + .id =4 , + .num_resources =ARRAY_SIZE (wm831x_ldo4_resources), + .resources = wm831x_ldo4_resources, + }, + { + .name ="wm831x-ldo" , + .id =5 , + .num_resources =ARRAY_SIZE (wm831x_ldo5_resources), + .resources = wm831x_ldo5_resources, + }, + { + .name ="wm831x-ldo" , + .id =6 , + .num_resources =ARRAY_SIZE (wm831x_ldo6_resources), + .resources = wm831x_ldo6_resources, + }, + { + .name ="wm831x-aldo" , + .id =7 , + .num_resources =ARRAY_SIZE (wm831x_ldo7_resources), + .resources = wm831x_ldo7_resources, + }, + { + .name ="wm831x-aldo" , + .id =8 , + .num_resources =ARRAY_SIZE (wm831x_ldo8_resources), + .resources = wm831x_ldo8_resources, + }, + { + .name ="wm831x-aldo" , + .id =9 , + .num_resources =ARRAY_SIZE (wm831x_ldo9_resources), + .resources = wm831x_ldo9_resources, + }, + { + .name ="wm831x-aldo" , + .id =10 , + .num_resources =ARRAY_SIZE (wm831x_ldo10_resources), + .resources = wm831x_ldo10_resources, + }, + { + .name ="wm831x-alive-ldo" , + .id =11 , + .num_resources =ARRAY_SIZE (wm831x_ldo11_resources), + .resources = wm831x_ldo11_resources, + }, + { + .name ="wm831x-on" , + .num_resources =ARRAY_SIZE (wm831x_on_resources), + .resources = wm831x_on_resources, + }, + { + .name ="wm831x-power" , + .num_resources =ARRAY_SIZE (wm831x_power_resources), + .resources = wm831x_power_resources, + }, + { + .name ="wm831x-rtc" , + .num_resources =ARRAY_SIZE (wm831x_rtc_resources), + .resources = wm831x_rtc_resources, + }, + { + .name ="wm831x-status" , + .id =1 , + .num_resources =ARRAY_SIZE (wm831x_status1_resources), + .resources = wm831x_status1_resources, + }, + { + .name ="wm831x-status" , + .id =2 , + .num_resources =ARRAY_SIZE (wm831x_status2_resources), + .resources = wm831x_status2_resources, + }, + { + .name ="wm831x-touch" , + .num_resources =ARRAY_SIZE (wm831x_touch_resources), + .resources = wm831x_touch_resources, + }, + { + .name ="wm831x-watchdog" , + .num_resources =ARRAY_SIZE (wm831x_wdt_resources), + .resources = wm831x_wdt_resources, + }, +}; + +/* +* Instantiate the generic non-control parts of the device. +*/ +static int wm831x_device_init (struct wm831x *wm831x,unsigned long id,int irq) +{ +struct wm831x_pdata *pdata = wm831x->dev->platform_data; +int rev; +enum wm831x_parent parent; +int ret; + +mutex_init (&wm831x->io_lock); +mutex_init (&wm831x->key_lock); +dev_set_drvdata (wm831x->dev, wm831x); + + ret =wm831x_reg_read (wm831x,WM831X_PARENT_ID ); +if (ret <0 ) { +dev_err (wm831x->dev,"Failed to read parent ID: %d\n" , ret); + goto err; + } +if (ret !=0x6204 ) { +dev_err (wm831x->dev,"Device is not a WM831x: ID %x\n" , ret); + ret = -EINVAL ; + goto err; + } + + ret =wm831x_reg_read (wm831x,WM831X_REVISION ); +if (ret <0 ) { +dev_err (wm831x->dev,"Failed to read revision: %d\n" , ret); + goto err; + } + rev = (ret &WM831X_PARENT_REV_MASK ) >>WM831X_PARENT_REV_SHIFT ; + + ret =wm831x_reg_read (wm831x,WM831X_RESET_ID ); +if (ret <0 ) { +dev_err (wm831x->dev,"Failed to read device ID: %d\n" , ret); + goto err; + } + +switch (ret) { +case 0x8310 : + parent =WM8310 ; +switch (rev) { +case 0 : +dev_info (wm831x->dev,"WM8310 revision %c\n" , +'A' + rev); +break ; + } +break ; + +case 0x8311 : + parent =WM8311 ; +switch (rev) { +case 0 : +dev_info (wm831x->dev,"WM8311 revision %c\n" , +'A' + rev); +break ; + } +break ; + +case 0x8312 : + parent =WM8312 ; +switch (rev) { +case 0 : +dev_info (wm831x->dev,"WM8312 revision %c\n" , +'A' + rev); +break ; + } +break ; + +case 0 : +/* Some engineering samples do not have the ID set, +* rely on the device being registered correctly. +* This will need revisiting for future devices with +* multiple dies. +*/ + parent = id; +switch (rev) { +case 0 : +dev_info (wm831x->dev,"WM831%d ES revision %c\n" , + parent,'A' + rev); +break ; + } +break ; + +default : +dev_err (wm831x->dev,"Unknown WM831x device %04x\n" , ret); + ret = -EINVAL ; + goto err; + } + +/* This will need revisiting in future but is OK for all +* current parts. +*/ +if (parent != id) +dev_warn (wm831x->dev,"Device was registered as a WM831%lu\n" , + id); + +/* Bootstrap the user key */ + ret =wm831x_reg_read (wm831x,WM831X_SECURITY_KEY ); +if (ret <0 ) { +dev_err (wm831x->dev,"Failed to read security key: %d\n" , ret); + goto err; + } +if (ret !=0 ) { +dev_warn (wm831x->dev,"Security key had non-zero value %x\n" , + ret); +wm831x_reg_write (wm831x,WM831X_SECURITY_KEY ,0 ); + } + wm831x->locked =1 ; + +if (pdata && pdata->pre_init) { + ret = pdata->pre_init (wm831x); +if (ret !=0 ) { +dev_err (wm831x->dev,"pre_init() failed: %d\n" , ret); + goto err; + } + } + +/* The core device is up, instantiate the subdevices. */ +switch (parent) { +case WM8310 : + ret =mfd_add_devices (wm831x->dev,-1 , + wm8310_devs,ARRAY_SIZE (wm8310_devs), +NULL ,0 ); +break ; + +case WM8311 : + ret =mfd_add_devices (wm831x->dev,-1 , + wm8311_devs,ARRAY_SIZE (wm8311_devs), +NULL ,0 ); +break ; + +case WM8312 : + ret =mfd_add_devices (wm831x->dev,-1 , + wm8312_devs,ARRAY_SIZE (wm8312_devs), +NULL ,0 ); +break ; + +default : +/* If this happens the bus probe function is buggy */ +BUG (); + } + +if (ret !=0 ) { +dev_err (wm831x->dev,"Failed to add children\n" ); + goto err; + } + +if (pdata && pdata->post_init) { + ret = pdata->post_init (wm831x); +if (ret !=0 ) { +dev_err (wm831x->dev,"post_init() failed: %d\n" , ret); + goto err; + } + } + +return 0 ; + +err: +mfd_remove_devices (wm831x->dev); +kfree (wm831x); +return ret; +} + +static void wm831x_device_exit (struct wm831x *wm831x) +{ +mfd_remove_devices (wm831x->dev); +kfree (wm831x); +} + +static int wm831x_i2c_read_device (struct wm831x *wm831x,unsigned short reg, +int bytes,void *dest) +{ +struct i2c_client *i2c = wm831x->control_data; +int ret; +u16 r =cpu_to_be16 (reg); + + ret =i2c_master_send (i2c, (unsigned char *)&r,2 ); +if (ret <0 ) +return ret; +if (ret !=2 ) +return -EIO ; + + ret =i2c_master_recv (i2c, dest, bytes); +if (ret <0 ) +return ret; +if (ret != bytes) +return -EIO ; +return 0 ; +} + +/* Currently we allocate the write buffer on the stack; this is OK for +* small writes - if we need to do large writes this will need to be +* revised. +*/ +static int wm831x_i2c_write_device (struct wm831x *wm831x,unsigned short reg, +int bytes,void *src) +{ +struct i2c_client *i2c = wm831x->control_data; +unsigned char msg[bytes +2 ]; +int ret; + + reg =cpu_to_be16 (reg); +memcpy (&msg[0 ], ®,2 ); +memcpy (&msg[2 ], src, bytes); + + ret =i2c_master_send (i2c, msg, bytes +2 ); +if (ret <0 ) +return ret; +if (ret < bytes +2 ) +return -EIO ; + +return 0 ; +} + +static int wm831x_i2c_probe (struct i2c_client *i2c, +const struct i2c_device_id *id) +{ +struct wm831x *wm831x; + + wm831x =kzalloc (sizeof (struct wm831x ),GFP_KERNEL ); +if (wm831x ==NULL ) { +kfree (i2c); +return -ENOMEM ; + } + +i2c_set_clientdata (i2c, wm831x); + wm831x->dev = &i2c->dev; + wm831x->control_data = i2c; + wm831x->read_dev = wm831x_i2c_read_device; + wm831x->write_dev = wm831x_i2c_write_device; + +return wm831x_device_init (wm831x, id->driver_data, i2c->irq); +} + +static int wm831x_i2c_remove (struct i2c_client *i2c) +{ +struct wm831x *wm831x =i2c_get_clientdata (i2c); + +wm831x_device_exit (wm831x); + +return 0 ; +} + +static const struct i2c_device_id wm831x_i2c_id[] = { + {"wm8310" ,WM8310 }, + {"wm8311" ,WM8311 }, + {"wm8312" ,WM8312 }, + { } +}; +MODULE_DEVICE_TABLE (i2c, wm831x_i2c_id); + + +static struct i2c_driver wm831x_i2c_driver = { + .driver = { + .name ="wm831x" , + .owner =THIS_MODULE , + }, + .probe = wm831x_i2c_probe, + .remove = wm831x_i2c_remove, + .id_table = wm831x_i2c_id, +}; + +static int __init wm831x_i2c_init (void ) +{ +int ret; + + ret =i2c_add_driver (&wm831x_i2c_driver); +if (ret !=0 ) +pr_err ("Failed to register wm831x I2C driver: %d\n" , ret); + +return ret; +} +subsys_initcall (wm831x_i2c_init); + +static void __exit wm831x_i2c_exit(void) +{ +i2c_del_driver (&wm831x_i2c_driver); +} +module_exit (wm831x_i2c_exit); + +MODULE_DESCRIPTION ("I2C support for the WM831X AudioPlus PMIC" ); +MODULE_LICENSE ("GPL" ); +MODULE_AUTHOR ("Mark Brown" );
include/linux/mfd/wm831x/core.h new file +247 -0
247 lines not on this page · raw message
include/linux/mfd/wm831x/pdata.h new file +107 -0
107 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 1/1 mfd: Fix comment cut'n'paste in register lock code
--- drivers/mfd/wm831x-core.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/wm831x-core.c +3 -3
@@ -115,11 +115,11 @@ static int wm831x_reg_locked(struct wm831x *wm831x, unsigned short reg) }/** -* wm831x_reg_unlock: Unlock user keyed registers +* wm831x_reg_lock: Unlock user keyed registers * * The WM831x has a user key preventing writes to particularly * critical registers. This function locks those registers, -* allowing writes to them. +* disallowing writes to them. */ void wm831x_reg_lock (struct wm831x *wm831x) {
@@ -145,7 +145,7 @@ EXPORT_SYMBOL_GPL(wm831x_reg_lock);* * The WM831x has a user key preventing writes to particularly * critical registers. This function locks those registers, -* preventing spurious writes. +* allowing writes to them. */ int wm831x_reg_unlock (struct wm831x *wm831x) {
Signature · 1 line
1.6.3.3
PATCH 3/22 mfd: Add WM831x interrupt support
In reply to Mark BrownThe WM831x includes an interrupt controller managing interrupts for the various functions on the chip. This patch adds support for the core interrupt block on the device.
Ideally this would be supported by genirq, particularly for the GPIOs, but currently genirq is unable to cope with controllers on interrupt driven buses so we cut'n'paste the generic interface. Once genirq is able to cope chips like this it should be a case of filing the prefixes off the code and redoing wm831x-irq.c to move over.
--- drivers/mfd/wm831x-core.c | 12 +- drivers/mfd/wm831x-irq.c | 559 ++++++++++++++++++++++++++++ include/linux/mfd/wm831x/core.h | 21 + include/linux/mfd/wm831x/irq.h | 764 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 1354 insertions(+), 2 deletions(-) create mode 100644 drivers/mfd/wm831x-irq.c create mode 100644 include/linux/mfd/wm831x/irq.h
drivers/mfd/wm831x-core.c +10 -2
@@ -19,6 +19,7 @@#include <linux/mfd/wm831x/core.h> #include <linux/mfd/wm831x/pdata.h> +#include <linux/mfd/wm831x/irq.h> enum wm831x_parent {WM8310 =0 ,
@@ -1189,6 +1190,10 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) } } + ret =wm831x_irq_init (wm831x, irq); +if (ret !=0 ) + goto err; +/* The core device is up, instantiate the subdevices. */ switch (parent) {case WM8310 :
@@ -1216,19 +1221,21 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)if (ret !=0 ) {dev_err (wm831x->dev,"Failed to add children\n" ); - goto err; + goto err_irq; }if (pdata && pdata->post_init) { ret = pdata->post_init (wm831x);if (ret !=0 ) {dev_err (wm831x->dev,"post_init() failed: %d\n" , ret); - goto err; + goto err_irq; } }return 0 ; +err_irq: +wm831x_irq_exit (wm831x); err:mfd_remove_devices (wm831x->dev);kfree (wm831x);
@@ -1238,6 +1245,7 @@ err:static void wm831x_device_exit (struct wm831x *wm831x) {mfd_remove_devices (wm831x->dev); +wm831x_irq_exit (wm831x);kfree (wm831x); }
drivers/mfd/wm831x-irq.c new file +559 -0
559 lines not on this page · raw message
include/linux/mfd/wm831x/core.h +21 -0
@@ -15,6 +15,9 @@#ifndef __MFD_WM831X_CORE_H__#define __MFD_WM831X_CORE_H__ +#include <linux/interrupt.h> +#include <linux/workqueue.h> +/* * Register values. */
@@ -224,6 +227,13 @@ struct wm831x {void *control_data; +int irq;/* Our chip IRQ */ +struct mutex irq_lock; +struct workqueue_struct *irq_wq; +struct work_struct irq_work; +unsigned int irq_base; +int irq_masks[5 ]; +/* The WM831x has a security key blocking access to certain * registers. The mutex is taken by the accessors for locking * and unlocking the security key, locked is used to fail
@@ -244,4 +254,15 @@ int wm831x_set_bits(struct wm831x *wm831x, unsigned short reg,int wm831x_bulk_read (struct wm831x *wm831x,unsigned short reg,int count,u16 *buf); +int wm831x_irq_init (struct wm831x *wm831x,int irq); +void wm831x_irq_exit (struct wm831x *wm831x); + +int __must_check wm831x_request_irq (struct wm831x *wm831x, +unsigned int irq,irq_handler_t handler, +unsigned long flags,const char *name, +void *dev); +void wm831x_free_irq (struct wm831x *wm831x,unsigned int ,void *); +void wm831x_disable_irq (struct wm831x *wm831x,int irq); +void wm831x_enable_irq (struct wm831x *wm831x,int irq); +#endif
include/linux/mfd/wm831x/irq.h new file +764 -0
764 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 4/22 mfd: Add WM831x AUXADC support
In reply to Mark BrownThe WM831x contains an auxiliary ADC with a number of switchable inputs which is used to monitor some of the voltages and temperatures in the system and has some external inputs which can be used for machine specific purposes. Provide an API allowing drivers to read values from the ADC.
An internal reference voltage is provided to allow callibration of the ADC. This is used to calibrate the device at startup.
The hardware also supports continuous readings and digital comparators. These are not yet supported by the driver.
--- drivers/mfd/wm831x-core.c | 101 +++++++++++++++++ include/linux/mfd/wm831x/auxadc.h | 216 +++++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/core.h | 2 + 3 files changed, 319 insertions(+), 0 deletions(-) create mode 100644 include/linux/mfd/wm831x/auxadc.h
drivers/mfd/wm831x-core.c +101 -0
@@ -15,11 +15,14 @@#include <linux/kernel.h> #include <linux/module.h> #include <linux/i2c.h> +#include <linux/bcd.h> +#include <linux/delay.h> #include <linux/mfd/core.h> #include <linux/mfd/wm831x/core.h> #include <linux/mfd/wm831x/pdata.h> #include <linux/mfd/wm831x/irq.h> +#include <linux/mfd/wm831x/auxadc.h> enum wm831x_parent {WM8310 =0 ,
@@ -244,6 +247,103 @@ out: }EXPORT_SYMBOL_GPL (wm831x_set_bits); +/** +* wm831x_auxadc_read: Read a value from the WM831x AUXADC +* +* @wm831x: Device to read from. +* @input: AUXADC input to read. +*/ +int wm831x_auxadc_read (struct wm831x *wm831x,enum wm831x_auxadc input) +{ +int tries =10 ; +int ret, src; + +mutex_lock (&wm831x->auxadc_lock); + + ret =wm831x_set_bits (wm831x,WM831X_AUXADC_CONTROL , +WM831X_AUX_ENA ,WM831X_AUX_ENA ); +if (ret <0 ) { +dev_err (wm831x->dev,"Failed to enable AUXADC: %d\n" , ret); + goto out; + } + +/* We force a single source at present */ + src = input; + ret =wm831x_reg_write (wm831x,WM831X_AUXADC_SOURCE , +1 << src); +if (ret <0 ) { +dev_err (wm831x->dev,"Failed to set AUXADC source: %d\n" , ret); + goto out; + } + + ret =wm831x_set_bits (wm831x,WM831X_AUXADC_CONTROL , +WM831X_AUX_CVT_ENA ,WM831X_AUX_CVT_ENA ); +if (ret <0 ) { +dev_err (wm831x->dev,"Failed to start AUXADC: %d\n" , ret); + goto disable; + } + +do { +msleep (1 ); + + ret =wm831x_reg_read (wm831x,WM831X_AUXADC_CONTROL ); +if (ret <0 ) + ret =WM831X_AUX_CVT_ENA ; + }while ((ret &WM831X_AUX_CVT_ENA ) && --tries); + +if (ret &WM831X_AUX_CVT_ENA ) { +dev_err (wm831x->dev,"Timed out reading AUXADC\n" ); + ret = -EBUSY ; + goto disable; + } + + ret =wm831x_reg_read (wm831x,WM831X_AUXADC_DATA ); +if (ret <0 ) { +dev_err (wm831x->dev,"Failed to read AUXADC data: %d\n" , ret); + }else { + src = ((ret &WM831X_AUX_DATA_SRC_MASK ) + >>WM831X_AUX_DATA_SRC_SHIFT ) -1 ; + +if (src ==14 ) + src =WM831X_AUX_CAL ; + +if (src != input) { +dev_err (wm831x->dev,"Data from source %d not %d\n" , + src, input); + ret = -EINVAL ; + }else { + ret &=WM831X_AUX_DATA_MASK ; + } + } + +disable: +wm831x_set_bits (wm831x,WM831X_AUXADC_CONTROL ,WM831X_AUX_ENA ,0 ); +out: +mutex_unlock (&wm831x->auxadc_lock); +return ret; +} +EXPORT_SYMBOL_GPL (wm831x_auxadc_read); + +/** +* wm831x_auxadc_read_uv: Read a voltage from the WM831x AUXADC +* +* @wm831x: Device to read from. +* @input: AUXADC input to read. +*/ +int wm831x_auxadc_read_uv (struct wm831x *wm831x,enum wm831x_auxadc input) +{ +int ret; + + ret =wm831x_auxadc_read (wm831x, input); +if (ret <0 ) +return ret; + + ret *=1465 ; + +return ret; +} +EXPORT_SYMBOL_GPL (wm831x_auxadc_read_uv); +static struct resource wm831x_dcdc1_resources[] = { { .start =WM831X_DC1_CONTROL_1 ,
@@ -1084,6 +1184,7 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)mutex_init (&wm831x->io_lock);mutex_init (&wm831x->key_lock); +mutex_init (&wm831x->auxadc_lock);dev_set_drvdata (wm831x->dev, wm831x); ret =wm831x_reg_read (wm831x,WM831X_PARENT_ID );
include/linux/mfd/wm831x/auxadc.h new file +216 -0
216 lines not on this page · raw message
include/linux/mfd/wm831x/core.h +2 -0
@@ -234,6 +234,8 @@ struct wm831x {unsigned int irq_base;int irq_masks[5 ]; +struct mutex auxadc_lock; +/* The WM831x has a security key blocking access to certain * registers. The mutex is taken by the accessors for locking * and unlocking the security key, locked is used to fail
Signature · 1 line
1.6.3.3
PATCH 5/22 mfd: Conditionally add WM831x backlight subdevice
In reply to Mark BrownThe WM831x backlight driver requires at least the specification of the current sink to use and a maximum current to allow them to function and will actively interfere with other users of the regulators it uses if misconfigured so only register the subdevice for it if this platform data has been supplied.
--- drivers/mfd/wm831x-core.c | 15 +++++++++++++++ include/linux/mfd/wm831x/pdata.h | 6 ++++++ 2 files changed, 21 insertions(+), 0 deletions(-)
drivers/mfd/wm831x-core.c +15 -0
@@ -1172,6 +1172,12 @@ static struct mfd_cell wm8312_devs[] = { }, }; +static struct mfd_cell backlight_devs[] = { + { + .name ="wm831x-backlight" , + }, +}; +/* * Instantiate the generic non-control parts of the device. */
@@ -1325,6 +1331,15 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) goto err_irq; } +if (pdata && pdata->backlight) { +/* Treat errors as non-critical */ + ret =mfd_add_devices (wm831x->dev,-1 , backlight_devs, +ARRAY_SIZE (backlight_devs),NULL ,0 ); +if (ret <0 ) +dev_err (wm831x->dev,"Failed to add backlight: %d\n" , + ret); + } +if (pdata && pdata->post_init) { ret = pdata->post_init (wm831x);if (ret !=0 ) {
include/linux/mfd/wm831x/pdata.h +6 -0
@@ -18,6 +18,11 @@struct wm831x ;struct regulator_init_data ; +struct wm831x_backlight_pdata { +int isink;/** ISINK to use, 1 or 2 */ +int max_uA;/** Maximum current to allow */ +}; +struct wm831x_backup_pdata {int charger_enable;int no_constant_voltage;/** Disable constant voltage charging */
@@ -87,6 +92,7 @@ struct wm831x_pdata {int (*post_init)(struct wm831x *wm831x);int gpio_base; +struct wm831x_backlight_pdata *backlight;struct wm831x_backup_pdata *backup;struct wm831x_battery_pdata *battery;struct wm831x_touch_pdata *touch;
Signature · 1 line
1.6.3.3
PATCH 6/22 mfd: Add basic WM831x OTP support
In reply to Mark BrownThe WM831x series of devices use OTP (One Time Programmable, a type of PROM) to store system configuration. At run time this data is visible via registers.
Currently the only explicitly supported feature is that the unique ID provided by every WM831x device is exported to user space via sysfs. Other configuration data may be read by system-specific code in the pre_init() and post_init() platform data operations.
--- drivers/mfd/wm831x-core.c | 4 + drivers/mfd/wm831x-otp.c | 83 ++++++++++++++++++++ include/linux/mfd/wm831x/otp.h | 162 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 249 insertions(+), 0 deletions(-) create mode 100644 drivers/mfd/wm831x-otp.c create mode 100644 include/linux/mfd/wm831x/otp.h
drivers/mfd/wm831x-core.c +4 -0
@@ -23,6 +23,7 @@#include <linux/mfd/wm831x/pdata.h> #include <linux/mfd/wm831x/irq.h> #include <linux/mfd/wm831x/auxadc.h> +#include <linux/mfd/wm831x/otp.h> enum wm831x_parent {WM8310 =0 ,
@@ -1340,6 +1341,8 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq) ret); } +wm831x_otp_init (wm831x); +if (pdata && pdata->post_init) { ret = pdata->post_init (wm831x);if (ret !=0 ) {
@@ -1360,6 +1363,7 @@ err:static void wm831x_device_exit (struct wm831x *wm831x) { +wm831x_otp_exit (wm831x);mfd_remove_devices (wm831x->dev);wm831x_irq_exit (wm831x);kfree (wm831x);
drivers/mfd/wm831x-otp.c new file +83 -0
83 lines not on this page · raw message
include/linux/mfd/wm831x/otp.h new file +162 -0
162 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 7/22 mfd: Export ISEL values from WM831x core
In reply to Mark BrownThe current settings which can be used with the WM831x current sinks can't easily be mapped between register values and currents at run time without a lookup table since the values scale logarithmically to match the way the human eye interprets brightness. This lookup table is inclided in the core since several drivers need to use it.
--- drivers/mfd/wm831x-core.c | 64 ++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/regulator.h | 21 +++++++++++ 2 files changed, 85 insertions(+), 0 deletions(-) create mode 100644 include/linux/mfd/wm831x/regulator.h
drivers/mfd/wm831x-core.c +64 -0
@@ -24,6 +24,70 @@#include <linux/mfd/wm831x/irq.h> #include <linux/mfd/wm831x/auxadc.h> #include <linux/mfd/wm831x/otp.h> +#include <linux/mfd/wm831x/regulator.h> + +/* Current settings - values are 2*2^(reg_val/4) microamps. These are +* exported since they are used by multiple drivers. +*/ +int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL ] = { +2 , +2 , +3 , +3 , +4 , +5 , +6 , +7 , +8 , +10 , +11 , +13 , +16 , +19 , +23 , +27 , +32 , +38 , +45 , +54 , +64 , +76 , +91 , +108 , +128 , +152 , +181 , +215 , +256 , +304 , +362 , +431 , +512 , +609 , +724 , +861 , +1024 , +1218 , +1448 , +1722 , +2048 , +2435 , +2896 , +3444 , +4096 , +4871 , +5793 , +6889 , +8192 , +9742 , +11585 , +13777 , +16384 , +19484 , +23170 , +27554 , +}; +EXPORT_SYMBOL_GPL (wm831x_isinkv_values);enum wm831x_parent {WM8310 =0 ,
include/linux/mfd/wm831x/regulator.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* linux/mfd/wm831x/regulator.h -- Regulator definitons for wm831x +* +* Copyright 2009 Wolfson Microelectronics PLC. +* +* Author: Mark Brown <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +*/ + +#ifndef __MFD_WM831X_REGULATOR_H__ +#define __MFD_WM831X_REGULATOR_H__ + +#define WM831X_ISINK_MAX_ISEL 56 +extern int wm831x_isinkv_values[WM831X_ISINK_MAX_ISEL ]; + +#endif
Signature · 1 line
1.6.3.3
PATCH 8/22 mfd: Hook WM831x into build system
In reply to Mark Brown--- drivers/mfd/Kconfig | 10 ++++++++++ drivers/mfd/Makefile | 2 ++ 2 files changed, 12 insertions(+), 0 deletions(-)
drivers/mfd/Kconfig +10 -0
@@ -157,6 +157,16 @@ config MFD_WM8400 the device, additional drivers must be enabled in order to use the functionality of the device. +config MFD_WM831X + tristate "Support Wolfson Microelectronics WM831x PMICs" + select MFD_CORE + depends on I2C + help + Support for the Wolfson Microelecronics WM831x PMICs. This + driver provides common support for accessing the device, + additional drivers must be enabled in order to use the + functionality of the device. + config MFD_WM8350 tristate
drivers/mfd/Makefile +2 -0
@@ -15,6 +15,8 @@ obj-$(CONFIG_MFD_TC6387XB) += tc6387xb.o obj-$(CONFIG_MFD_TC6393XB) += tc6393xb.o obj-$(CONFIG_MFD_WM8400) += wm8400-core.o +wm831x-objs := wm831x-core.o wm831x-irq.o wm831x-otp.o +obj-$(CONFIG_MFD_WM831X) += wm831x.o wm8350-objs := wm8350-core.o wm8350-regmap.o wm8350-gpio.o obj-$(CONFIG_MFD_WM8350) += wm8350.o obj-$(CONFIG_MFD_WM8350_I2C) += wm8350-i2c.o
Signature · 1 line
1.6.3.3
PATCH 9/22 backlight: Add WM831x backlight driver
In reply to Mark BrownThe WM831x series of PMICs provide DC-DC boost convertors and current sinks which can be used together to drive LEDs for use as backlights. Expose this functionality via the backlight API.
Since when used in this configuration the current sink and boost convertor are very tightly coupled with a multi-stage startup for the current sink which overlaps with the boost convertor startup this driver bypasses the regulator API. Machine inititialisation is responsible for ensuring that the regulators are not accessed via both APIs.
--- drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/wm831x_bl.c | 250 +++++++++++++++++++++++++++++++++++ 3 files changed, 258 insertions(+), 0 deletions(-) create mode 100644 drivers/video/backlight/wm831x_bl.c
drivers/video/backlight/Kconfig +7 -0
@@ -229,3 +229,10 @@ config BACKLIGHT_SAHARA help If you have a Tabletkiosk Sahara Touch-iT, say y to enable the backlight driver. + +config BACKLIGHT_WM831X + tristate "WM831x PMIC Backlight Driver" + depends on BACKLIGHT_CLASS_DEVICE && MFD_WM831X + help + If you have a backlight driven by the ISINK and DCDC of a + WM831x PMIC say y to enable the backlight driver for it.
drivers/video/backlight/Makefile +1 -0
@@ -24,4 +24,5 @@ obj-$(CONFIG_BACKLIGHT_DA903X) += da903x_bl.o obj-$(CONFIG_BACKLIGHT_MBP_NVIDIA) += mbp_nvidia_bl.o obj-$(CONFIG_BACKLIGHT_TOSA) += tosa_bl.o obj-$(CONFIG_BACKLIGHT_SAHARA) += kb3886_bl.o +obj-$(CONFIG_BACKLIGHT_WM831X) += wm831x_bl.o
drivers/video/backlight/wm831x_bl.c new file +250 -0
250 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 10/22 gpio: Add WM831X GPIO driver
In reply to Mark BrownAdd support for the GPIO pins on the WM831x. No direct support is currently supplied for configuring non-gpiolib functionality such as pull configuration and alternate functions, soft configuration of these will be provided in a future patch.
Currently use of these pins as interrupts is not supported due to the ongoing issues with generic irq not support interrupt controllers on interrupt driven buses. Users can directly request the interrupts with the wm831x-specific APIs currently provided if required.
--- drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/wm831x-gpio.c | 252 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/gpio.h | 55 +++++++++ 4 files changed, 315 insertions(+), 0 deletions(-) create mode 100644 drivers/gpio/wm831x-gpio.c create mode 100644 include/linux/mfd/wm831x/gpio.h
drivers/gpio/Kconfig +7 -0
@@ -155,6 +155,13 @@ config GPIO_TWL4030 Say yes here to access the GPIO signals of various multi-function power management chips from Texas Instruments. +config GPIO_WM831X + tristate "WM831x GPIOs" + depends on MFD_WM831X + help + Say yes here to access the GPIO signals of WM831x power management + chips from Wolfson Microelectronics. + comment "PCI GPIO expanders:" config GPIO_BT8XX
drivers/gpio/Makefile +1 -0
@@ -14,3 +14,4 @@ obj-$(CONFIG_GPIO_TWL4030) += twl4030-gpio.o obj-$(CONFIG_GPIO_XILINX) += xilinx_gpio.o obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o +obj-$(CONFIG_GPIO_WM831X) += wm831x-gpio.o
drivers/gpio/wm831x-gpio.c new file +252 -0
252 lines not on this page · raw message
include/linux/mfd/wm831x/gpio.h new file +55 -0
55 lines not on this page · raw message
Signature · 1 line
1.6.3.3
Re: [PATCH 10/22] gpio: Add WM831X GPIO driver
Quoted 5 lines · Mark Brown
Add support for the GPIO pins on the WM831x. No direct support is currently supplied for configuring non-gpiolib functionality such as pull configuration and alternate functions, soft configuration of these will be provided in a future patch.
Quoted 7 lines
Currently use of these pins as interrupts is not supported due to the ongoing issues with generic irq not support interrupt controllers on interrupt driven buses. Users can directly request the interrupts with the wm831x-specific APIs currently provided if required.
Signed-off-by Mark Brown <[email protected]>Cc David Brownell <[email protected]>
Quoted 359 lines
--- drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/wm831x-gpio.c | 252 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/gpio.h | 55 +++++++++ 4 files changed, 315 insertions(+), 0 deletions(-) create mode 100644 drivers/gpio/wm831x-gpio.c create mode 100644 include/linux/mfd/wm831x/gpio.hdrivers/gpio/Kconfig +7
-0@@ -155,6 +155,13 @@ config GPIO_TWL4030 Say yes here to access the GPIO signals of various multi-function power management chips from Texas Instruments. +config GPIO_WM831X + tristate "WM831x GPIOs" + depends on MFD_WM831X + help + Say yes here to access the GPIO signals of WM831x power management + chips from Wolfson Microelectronics. + comment "PCI GPIO expanders:" config GPIO_BT8XXdrivers/gpio/Makefile +1
-0@@ -14,3 +14,4 @@ obj-$(CONFIG_GPIO_TWL4030) += twl4030-gpio.o obj-$(CONFIG_GPIO_XILINX) += xilinx_gpio.o obj-$(CONFIG_GPIO_BT8XX) += bt8xxgpio.o obj-$(CONFIG_GPIO_VR41XX) += vr41xx_giu.o +obj-$(CONFIG_GPIO_WM831X) += wm831x-gpio.odrivers/gpio/wm831x-gpio.c new file +252
-0@@ -0,0 +1,252 @@ +/* +* wm831x-gpio.c -- gpiolib support for Wolfson WM831x PMICs +* +* Copyright 2009 Wolfson Microelectronics PLC. +* +* Author: Mark Brown <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/gpio.h> +#include <linux/mfd/core.h> +#include <linux/platform_device.h> +#include <linux/seq_file.h> + +#include <linux/mfd/wm831x/core.h> +#include <linux/mfd/wm831x/pdata.h> +#include <linux/mfd/wm831x/gpio.h> + +#define WM831X_GPIO_MAX 16 + +struct wm831x_gpio { +struct wm831x *wm831x; +struct gpio_chip gpio_chip; +}; + +static inline struct wm831x_gpio *to_wm831x_gpio (struct gpio_chip *chip) +{ + return container_of(chip, struct wm831x_gpio, gpio_chip); +} + +static int wm831x_gpio_direction_in (struct gpio_chip *chip,unsigned offset) +{ +struct wm831x_gpio *wm831x_gpio =to_wm831x_gpio (chip); +struct wm831x *wm831x = wm831x_gpio->wm831x; + +return wm831x_set_bits (wm831x,WM831X_GPIO1_CONTROL + offset, +WM831X_GPN_DIR |WM831X_GPN_TRI , +WM831X_GPN_DIR ); +} + +static int wm831x_gpio_get (struct gpio_chip *chip,unsigned offset) +{ +struct wm831x_gpio *wm831x_gpio =to_wm831x_gpio (chip); +struct wm831x *wm831x = wm831x_gpio->wm831x; +int ret; + + ret =wm831x_reg_read (wm831x,WM831X_GPIO_LEVEL ); +if (ret <0 ) +return ret; + +if (ret &1 << offset) +return 1 ; +else +return 0 ; +} + +static int wm831x_gpio_direction_out (struct gpio_chip *chip, +unsigned offset,int value) +{ +struct wm831x_gpio *wm831x_gpio =to_wm831x_gpio (chip); +struct wm831x *wm831x = wm831x_gpio->wm831x; + +return wm831x_set_bits (wm831x,WM831X_GPIO1_CONTROL + offset, +WM831X_GPN_DIR |WM831X_GPN_TRI ,0 ); +} + +static void wm831x_gpio_set (struct gpio_chip *chip,unsigned offset,int value) +{ +struct wm831x_gpio *wm831x_gpio =to_wm831x_gpio (chip); +struct wm831x *wm831x = wm831x_gpio->wm831x; + +wm831x_set_bits (wm831x,WM831X_GPIO_LEVEL ,1 << offset, + value << offset); +} + +#ifdef CONFIG_DEBUG_FS +static void wm831x_gpio_dbg_show (struct seq_file *s,struct gpio_chip *chip) +{ +struct wm831x_gpio *wm831x_gpio =to_wm831x_gpio (chip); +struct wm831x *wm831x = wm831x_gpio->wm831x; +int i; + +for (i =0 ; i < chip->ngpio; i++) { +int gpio = i + chip->base; +int reg; +const char *label, *pull, *powerdomain; + +/* We report the GPIO even if it's not requested since +* we're also reporting things like alternate +* functions which apply even when the GPIO is not in +* use as a GPIO. +*/ + label =gpiochip_is_requested (chip, i); +if (!label) + label ="Unrequested" ; + +seq_printf (s," gpio-%-3d (%-20.20s) " , gpio, label); + + reg =wm831x_reg_read (wm831x,WM831X_GPIO1_CONTROL + i); +if (reg <0 ) { +dev_err (wm831x->dev, +"GPIO control %d read failed: %d\n" , + gpio, reg); +seq_printf (s,"\n" ); +continue ; + } + +switch (reg &WM831X_GPN_PULL_MASK ) { +case WM831X_GPIO_PULL_NONE : + pull ="nopull" ; +break ; +case WM831X_GPIO_PULL_DOWN : + pull ="pulldown" ; +break ; +case WM831X_GPIO_PULL_UP : + pull ="pullup" ; +default : + pull ="INVALID PULL" ; +break ; + } + +switch (i +1 ) { + case 1 ... 3: + case 7 ... 9: +if (reg &WM831X_GPN_PWR_DOM ) + powerdomain ="VPMIC" ; +else + powerdomain ="DBVDD" ; +break ; + + case 4 ... 6: + case 10 ... 12: +if (reg &WM831X_GPN_PWR_DOM ) + powerdomain ="SYSVDD" ; +else + powerdomain ="DBVDD" ; +break ; + + case 13 ... 16: + powerdomain ="TPVDD" ; +break ; + +default : +BUG (); +break ; + } + +seq_printf (s," %s %s %s %s%s\n" +" %s%s (0x%4x)\n" , + reg &WM831X_GPN_DIR ?"in" :"out" , +wm831x_gpio_get (chip, i) ?"high" :"low" , + pull, + powerdomain, + reg &WM831X_GPN_POL ?" inverted" :"" , + reg &WM831X_GPN_OD ?"open-drain" :"CMOS" , + reg &WM831X_GPN_TRI ?" tristated" :"" , + reg); + } +} +#else +#define wm831x_gpio_dbg_show NULL +#endif + +static struct gpio_chip template_chip = { + .label ="wm831x" , + .owner =THIS_MODULE , + .direction_input = wm831x_gpio_direction_in, + .get = wm831x_gpio_get, + .direction_output = wm831x_gpio_direction_out, + .set = wm831x_gpio_set, + .dbg_show = wm831x_gpio_dbg_show, + .can_sleep =1 , +}; + +static int __devinit wm831x_gpio_probe (struct platform_device *pdev) +{ +struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent); +struct wm831x_pdata *pdata = wm831x->dev->platform_data; +struct wm831x_gpio *wm831x_gpio; +int ret; + + wm831x_gpio =kzalloc (sizeof (*wm831x_gpio),GFP_KERNEL ); +if (wm831x_gpio ==NULL ) +return -ENOMEM ; + + wm831x_gpio->wm831x = wm831x; + wm831x_gpio->gpio_chip = template_chip; + wm831x_gpio->gpio_chip.ngpio =WM831X_GPIO_MAX ; + wm831x_gpio->gpio_chip.dev = &pdev->dev; +if (pdata && pdata->gpio_base) + wm831x_gpio->gpio_chip.base = pdata->gpio_base; +else + wm831x_gpio->gpio_chip.base =-1 ; + + ret =gpiochip_add (&wm831x_gpio->gpio_chip); +if (ret <0 ) { +dev_err (&pdev->dev,"Could not register gpiochip, %d\n" , + ret); + goto err; + } + +platform_set_drvdata (pdev, wm831x_gpio); + +return ret; + +err: +kfree (wm831x_gpio); +return ret; +} + +static int __devexit wm831x_gpio_remove(struct platform_device *pdev) +{ +struct wm831x_gpio *wm831x_gpio =platform_get_drvdata (pdev); +int ret; + + ret =gpiochip_remove (&wm831x_gpio->gpio_chip); +if (ret ==0 ) +kfree (wm831x_gpio); + +return ret; +} + +static struct platform_driver wm831x_gpio_driver = { + .driver.name ="wm831x-gpio" , + .driver.owner =THIS_MODULE , + .probe = wm831x_gpio_probe, + .remove =__devexit_p (wm831x_gpio_remove), +}; + +static int __init wm831x_gpio_init (void ) +{ +return platform_driver_register (&wm831x_gpio_driver); +} +subsys_initcall (wm831x_gpio_init); + +static void __exit wm831x_gpio_exit(void) +{ +platform_driver_unregister (&wm831x_gpio_driver); +} +module_exit (wm831x_gpio_exit); + +MODULE_AUTHOR ("Mark Brown <[email protected]>" ); +MODULE_DESCRIPTION ("GPIO interface for WM831x PMICs" ); +MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:wm831x-gpio" );include/linux/mfd/wm831x/gpio.h new file +55
-0@@ -0,0 +1,55 @@ +/* +* include/linux/mfd/wm831x/gpio.h -- GPIO for WM831x +* +* Copyright 2009 Wolfson Microelectronics PLC. +* +* Author: Mark Brown <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +*/ + +#ifndef __MFD_WM831X_GPIO_H__ +#define __MFD_WM831X_GPIO_H__ + +/* +* R16440-16455 (0x4038-0x4047) - GPIOx Control +*/ +#define WM831X_GPN_DIR 0x8000/* GPN_DIR */ +#define WM831X_GPN_DIR_MASK 0x8000/* GPN_DIR */ +#define WM831X_GPN_DIR_SHIFT 15/* GPN_DIR */ +#define WM831X_GPN_DIR_WIDTH 1/* GPN_DIR */ +#define WM831X_GPN_PULL_MASK 0x6000/* GPN_PULL - [14:13] */ +#define WM831X_GPN_PULL_SHIFT 13/* GPN_PULL - [14:13] */ +#define WM831X_GPN_PULL_WIDTH 2/* GPN_PULL - [14:13] */ +#define WM831X_GPN_INT_MODE 0x1000/* GPN_INT_MODE */ +#define WM831X_GPN_INT_MODE_MASK 0x1000/* GPN_INT_MODE */ +#define WM831X_GPN_INT_MODE_SHIFT 12/* GPN_INT_MODE */ +#define WM831X_GPN_INT_MODE_WIDTH 1/* GPN_INT_MODE */ +#define WM831X_GPN_PWR_DOM 0x0800/* GPN_PWR_DOM */ +#define WM831X_GPN_PWR_DOM_MASK 0x0800/* GPN_PWR_DOM */ +#define WM831X_GPN_PWR_DOM_SHIFT 11/* GPN_PWR_DOM */ +#define WM831X_GPN_PWR_DOM_WIDTH 1/* GPN_PWR_DOM */ +#define WM831X_GPN_POL 0x0400/* GPN_POL */ +#define WM831X_GPN_POL_MASK 0x0400/* GPN_POL */ +#define WM831X_GPN_POL_SHIFT 10/* GPN_POL */ +#define WM831X_GPN_POL_WIDTH 1/* GPN_POL */ +#define WM831X_GPN_OD 0x0200/* GPN_OD */ +#define WM831X_GPN_OD_MASK 0x0200/* GPN_OD */ +#define WM831X_GPN_OD_SHIFT 9/* GPN_OD */ +#define WM831X_GPN_OD_WIDTH 1/* GPN_OD */ +#define WM831X_GPN_TRI 0x0080/* GPN_TRI */ +#define WM831X_GPN_TRI_MASK 0x0080/* GPN_TRI */ +#define WM831X_GPN_TRI_SHIFT 7/* GPN_TRI */ +#define WM831X_GPN_TRI_WIDTH 1/* GPN_TRI */ +#define WM831X_GPN_FN_MASK 0x000F/* GPN_FN - [3:0] */ +#define WM831X_GPN_FN_SHIFT 0/* GPN_FN - [3:0] */ +#define WM831X_GPN_FN_WIDTH 4/* GPN_FN - [3:0] */ + +#define WM831X_GPIO_PULL_NONE (0 << WM831X_GPN_PULL_SHIFT) +#define WM831X_GPIO_PULL_DOWN (1 << WM831X_GPN_PULL_SHIFT) +#define WM831X_GPIO_PULL_UP (2 << WM831X_GPN_PULL_SHIFT) +#endif Signature · 1 line
1.6.3.3
PATCH 11/22 hwmon: Add WM835x PMIC hardware monitoring driver
In reply to Mark BrownThis driver provides reporting of the status supply voltage rails of the WM835x series of PMICs via the hwmon API.
--- Documentation/hwmon/wm8350 | 26 +++++++ drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/wm8350-hwmon.c | 151 +++++++++++++++++++++++++++++++++++++++ drivers/mfd/wm8350-core.c | 3 + include/linux/mfd/wm8350/core.h | 6 ++ 6 files changed, 197 insertions(+), 0 deletions(-) create mode 100644 Documentation/hwmon/wm8350 create mode 100644 drivers/hwmon/wm8350-hwmon.c
Documentation/hwmon/wm8350 new file +26 -0
@@ -0,0 +1,26 @@ +Kernel driver wm8350-hwmon +============= + +Supported chips: + * Wolfson Microelectronics WM835x PMICs + Prefix: 'wm8350' + Datasheet: + http://www.wolfsonmicro.com/products/WM8350 + http://www.wolfsonmicro.com/products/WM8351 + http://www.wolfsonmicro.com/products/WM8352 + +Authors: Mark Brown <[email protected]> + +Description +----------- + +The WM835x series of PMICs include an AUXADC which can be used to +monitor a range of system operating parameters, including the voltages +of the major supplies within the system. Currently the driver provides +simple access to these major supplies. + +Voltage Monitoring +------------------ + +Voltages are sampled by a 12 bit ADC. For the internal supplies the ADC +is referenced to the system VRTC.
drivers/hwmon/Kconfig +10 -0
@@ -930,6 +930,16 @@ config SENSORS_W83627EHF This driver can also be built as a module. If so, the module will be called w83627ehf. +config SENSORS_WM8350 + tristate "Wolfson Microelectronics WM835x" + depends on MFD_WM8350 + help + If you say yes here you get support for the hardware + monitoring features of the WM835x series of PMICs. + + This driver can also be built as a module. If so, the module + will be called wm8350-hwmon. + config SENSORS_ULTRA45 tristate "Sun Ultra45 PIC16F747" depends on SPARC64
drivers/hwmon/Makefile +1 -0
@@ -90,6 +90,7 @@ obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o +obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y) EXTRA_CFLAGS += -DDEBUG
drivers/hwmon/wm8350-hwmon.c new file +151 -0
151 lines not on this page · raw message
drivers/mfd/wm8350-core.c +3 -0
@@ -1472,6 +1472,8 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, &(wm8350->codec.pdev));wm8350_client_dev_register (wm8350,"wm8350-gpio" , &(wm8350->gpio.pdev)); +wm8350_client_dev_register (wm8350,"wm8350-hwmon" , + &(wm8350->hwmon.pdev));wm8350_client_dev_register (wm8350,"wm8350-power" , &(wm8350->power.pdev));wm8350_client_dev_register (wm8350,"wm8350-rtc" , &(wm8350->rtc.pdev));
@@ -1498,6 +1500,7 @@ void wm8350_device_exit(struct wm8350 *wm8350)platform_device_unregister (wm8350->wdt.pdev);platform_device_unregister (wm8350->rtc.pdev);platform_device_unregister (wm8350->power.pdev); +platform_device_unregister (wm8350->hwmon.pdev);platform_device_unregister (wm8350->gpio.pdev);platform_device_unregister (wm8350->codec.pdev);
include/linux/mfd/wm8350/core.h +6 -0
@@ -605,6 +605,11 @@ struct wm8350_irq {void *data; }; +struct wm8350_hwmon { +struct platform_device *pdev; +struct device *classdev; +}; +struct wm8350 {struct device *dev;
@@ -629,6 +634,7 @@ struct wm8350 {/* Client devices */ struct wm8350_codec codec;struct wm8350_gpio gpio; +struct wm8350_hwmon hwmon;struct wm8350_pmic pmic;struct wm8350_power power;struct wm8350_rtc rtc;
Signature · 7 lines
1.6.3.3 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
PATCH 12/22 hwmon: WM831x PMIC hardware monitoring driver
In reply to Mark BrownThis driver adds support for the hardware monitoring features of the WM831x PMICs to the hwmon API. Monitoring is provided for the system voltages supported natively by the WM831x, the chip temperature, the battery temperature and the auxiliary inputs of the WM831x.
Currently no alarms are supported, though digital comparators on the WM831x devices would allow these to be provided.
Since the auxiliary and battery temperature input scaling depends on the system configuration raw ADC values are reported with scaling left to userspace.
--- Documentation/hwmon/wm831x | 37 +++++++ drivers/hwmon/Kconfig | 11 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/wm831x-hwmon.c | 236 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 285 insertions(+), 0 deletions(-) create mode 100644 Documentation/hwmon/wm831x create mode 100644 drivers/hwmon/wm831x-hwmon.c
Documentation/hwmon/wm831x new file +37 -0
@@ -0,0 +1,37 @@ +Kernel driver wm831x-hwmon +============= + +Supported chips: + * Wolfson Microelectronics WM831x PMICs + Prefix: 'wm831x' + Datasheet: + http://www.wolfsonmicro.com/products/WM8310 + http://www.wolfsonmicro.com/products/WM8311 + http://www.wolfsonmicro.com/products/WM8312 + +Authors: Mark Brown <[email protected]> + +Description +----------- + +The WM831x series of PMICs include an AUXADC which can be used to +monitor a range of system operating parameters, including the voltages +of the major supplies within the system. Currently the driver provides +reporting of all the input values but does not provide any alarms. + +Voltage Monitoring +------------------ + +Voltages are sampled by a 12 bit ADC. Voltages in milivolts are 1.465 +times the ADC value. + +Temperature Monitoring +---------------------- + +Temperatures are sampled by a 12 bit ADC. Chip and battery temperatures +are available. The chip temperature is calculated as: + + Degrees celsius = (512.8 - data) / 1.0983 + +while the battery temperature calculation will depend on the NTC +termistor component.
drivers/hwmon/Kconfig +11 -0
@@ -930,6 +930,17 @@ config SENSORS_W83627EHF This driver can also be built as a module. If so, the module will be called w83627ehf. +config SENSORS_WM831X + tristate "WM831x PMICs" + depends on MFD_WM831X + help + If you say yes here you get support for the hardware + monitoring functionality of the Wolfson Microelectronics + WM831x series of PMICs. + + This driver can also be built as a module. If so, the module + will be called wm831x-hwmon. + config SENSORS_WM8350 tristate "Wolfson Microelectronics WM835x" depends on MFD_WM8350
drivers/hwmon/Makefile +1 -0
@@ -90,6 +90,7 @@ obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o +obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
drivers/hwmon/wm831x-hwmon.c new file +236 -0
236 lines not on this page · raw message
Signature · 7 lines
1.6.3.3 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 12/22] hwmon: WM831x PMIC hardware monitoring driver
Hi Mark,
Quoted 15 lines · Mark Brown
This driver adds support for the hardware monitoring features of the WM831x PMICs to the hwmon API. Monitoring is provided for the system voltages supported natively by the WM831x, the chip temperature, the battery temperature and the auxiliary inputs of the WM831x.
Currently no alarms are supported, though digital comparators on the WM831x devices would allow these to be provided.
Since the auxiliary and battery temperature input scaling depends on the system configuration raw ADC values are reported with scaling left to userspace.
Signed-off-by Mark Brown <[email protected]>
Quoted 8 lines
--- Documentation/hwmon/wm831x | 37 +++++++ drivers/hwmon/Kconfig | 11 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/wm831x-hwmon.c | 236 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 285 insertions(+), 0 deletions(-) create mode 100644 Documentation/hwmon/wm831x create mode 100644 drivers/hwmon/wm831x-hwmon.c
Quick review:
Quoted 30 lines
Documentation/hwmon/wm831x new file +24
-0@@ -0,0 +1,37 @@ +Kernel driver wm831x-hwmon +============= + +Supported chips: + * Wolfson Microelectronics WM831x PMICs + Prefix: 'wm831x' + Datasheet: + http://www.wolfsonmicro.com/products/WM8310 + http://www.wolfsonmicro.com/products/WM8311 + http://www.wolfsonmicro.com/products/WM8312 + +Authors: Mark Brown <[email protected]> + +Description +----------- + +The WM831x series of PMICs include an AUXADC which can be used to +monitor a range of system operating parameters, including the voltages +of the major supplies within the system. Currently the driver provides +reporting of all the input values but does not provide any alarms. + +Voltage Monitoring +------------------ +
Documentation/hwmon/wm831x line 34
Quoted 10 lines
Documentation/hwmon/wm831x new file +10
-0+Voltages are sampled by a 12 bit ADC. Voltages in milivolts are 1.465 +times the ADC value. + +Temperature Monitoring +---------------------- + +Temperatures are sampled by a 12 bit ADC. Chip and battery temperatures +are available. The chip temperature is calculated as: + + Degrees celsius = (512.8 - data) / 1.0983
The driver code says 512.18.
Quoted 30 lines
Documentation/hwmon/wm831x new file +3
-0+ +while the battery temperature calculation will depend on the NTC +termistor component.drivers/hwmon/Kconfig +11
-0@@ -930,6 +930,17 @@ config SENSORS_W83627EHF This driver can also be built as a module. If so, the module will be called w83627ehf. +config SENSORS_WM831X + tristate "WM831x PMICs" + depends on MFD_WM831X + help + If you say yes here you get support for the hardware + monitoring functionality of the Wolfson Microelectronics + WM831x series of PMICs. + + This driver can also be built as a module. If so, the module + will be called wm831x-hwmon. + config SENSORS_WM8350 tristate "Wolfson Microelectronics WM835x" depends on MFD_WM8350drivers/hwmon/Makefile +0
-0
drivers/hwmon/Makefile obj-$(CONFIG_SENSORS_VT8231) += vt8231.o · line 93
Quoted 4 lines
drivers/hwmon/Makefile +1
-0@@ -90,6 +90,7 @@ obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o +obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o
FWIW, I tend to dislike "x" for digits in driver names. What if a WM8315 chip is ever released and is incompatible with the WM8310 as far as hardware monitoring is concerned? The driver name suggests the new chip is supported while it isn't.
Additionally it is inconsistent with the naming of the WM8350 driver below.
Quoted 43 lines
drivers/hwmon/Makefile +0
-0obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)drivers/hwmon/wm831x-hwmon.c new file +34
-0@@ -0,0 +1,236 @@ +/* +* drivers/hwmon/wm831x-hwmon.c - Wolfson Microelectronics WM831x PMIC +* hardware monitoring features. +* +* Copyright (C) 2009 Wolfson Microelectronics plc +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License v2 as published by the +* Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/err.h> +#include <linux/hwmon.h> +#include <linux/hwmon-sysfs.h> + +#include <linux/mfd/wm831x/core.h> +#include <linux/mfd/wm831x/auxadc.h> + +struct wm831x_hwmon { +struct wm831x *wm831x; +struct device *classdev; +};
drivers/hwmon/wm831x-hwmon.c line 44
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c new file +10
-0+ +static ssize_t show_name (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"wm831x\n" ); +} + +static const char *input_names[] = { + [WM831X_AUX_SYSVDD ] ="SYSVDD" , + [WM831X_AUX_USB ] ="USB" ,
Stray spaces before commas.
drivers/hwmon/wm831x-hwmon.c line 45
Quoted 1 line
drivers/hwmon/wm831x-hwmon.c new file +1
-0+ [WM831X_AUX_BKUP_BATT] = "Backup battery",
This one isn't used anywhere?
Quoted 25 lines
drivers/hwmon/wm831x-hwmon.c new file +25
-0+ [WM831X_AUX_BATT] = "Battery", + [WM831X_AUX_WALL] = "WALL", + [WM831X_AUX_CHIP_TEMP] = "PMIC", + [WM831X_AUX_BATT_TEMP] = "Battery", +}; + + +static ssize_t show_voltage (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct wm831x_hwmon *hwmon =dev_get_drvdata (dev); +int channel =to_sensor_dev_attr (attr)->index; +int ret; + + ret =wm831x_auxadc_read_uv (hwmon->wm831x, channel); +if (ret <0 ) +return ret; + +return sprintf (buf,"%d\n" ,DIV_ROUND_CLOSEST (ret,1000 )); +} + +static ssize_t show_chip_temp (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct wm831x_hwmon *hwmon =dev_get_drvdata (dev);
drivers/hwmon/wm831x-hwmon.c line 80
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c new file +10
-0+int channel =to_sensor_dev_attr (attr)->index; +int ret; + + ret =wm831x_auxadc_read (hwmon->wm831x, channel); +if (ret <0 ) +return ret; + +/* Degrees celsius = (512.18-ret) / 1.0983 */ + ret =512180 - (ret *1000 ); + ret = (ret *10000 ) /10983 ;
DIV_ROUND_CLOSEST() would give you a more accurate result.
Quoted 8 lines
drivers/hwmon/wm831x-hwmon.c new file +8
-0+ +return sprintf (buf,"%d\n" , ret); +} + +static ssize_t show_batt_temp (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct wm831x_hwmon *hwmon =dev_get_drvdata (dev);
drivers/hwmon/wm831x-hwmon.c line 98
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c new file +10
-0+int channel =to_sensor_dev_attr (attr)->index; +int ret; + + ret =wm831x_auxadc_read (hwmon->wm831x, channel); +if (ret <0 ) +return ret; + +/* The conversion depends on the battery, leave to userspace */ +return sprintf (buf,"%d\n" , ret); +}
This is a problem. You are not supposed to return raw register values through the sysfs interface. Returning the voltage reading at the chip's pin is OK because you still return a voltage value. But a raw register value is not something the user should see. I agree that technically speaking, a good sensors.conf configuration file would work it out, but conceptually this is wrong.
Can you say more about these batteries and how temperature measurement is different between them? If you can export a voltage reading to userspace than that would be OK (as I recall, we have at least one driver doing that already.)
drivers/hwmon/wm831x-hwmon.c line 110
Quoted 12 lines
drivers/hwmon/wm831x-hwmon.c new file +12
-0+ +static ssize_t show_label (struct device *dev, +struct device_attribute *attr,char *buf) +{ +int channel =to_sensor_dev_attr (attr)->index; + +return sprintf (buf,"%s\n" , input_names[channel]); +} + +#define WM831X_VOLTAGE (id, name) \ + static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage, \ + NULL, name);
Trailing semi-colon not needed.
drivers/hwmon/wm831x-hwmon.c line 114
Quoted 4 lines
drivers/hwmon/wm831x-hwmon.c new file +4
-0+ +#define WM831X_NAMED_VOLTAGE (id, name) \ + static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\ + NULL, name); \
I guess you could just call WM831X_VOLTAGE(id, name).
Quoted 37 lines
drivers/hwmon/wm831x-hwmon.c new file +37
-0+ static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \ + NULL, name) + +static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); + +WM831X_VOLTAGE (0 ,WM831X_AUX_AUX1 ); +WM831X_VOLTAGE (1 ,WM831X_AUX_AUX2 ); +WM831X_VOLTAGE (2 ,WM831X_AUX_AUX3 ); +WM831X_VOLTAGE (3 ,WM831X_AUX_AUX4 ); + +WM831X_NAMED_VOLTAGE (4 ,WM831X_AUX_SYSVDD ); +WM831X_NAMED_VOLTAGE (5 ,WM831X_AUX_USB ); +WM831X_NAMED_VOLTAGE (6 ,WM831X_AUX_BATT ); +WM831X_NAMED_VOLTAGE (7 ,WM831X_AUX_WALL ); + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_chip_temp, NULL, + WM831X_AUX_CHIP_TEMP); +static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, + WM831X_AUX_CHIP_TEMP); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_batt_temp, NULL, + WM831X_AUX_BATT_TEMP); +static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, show_label, NULL, + WM831X_AUX_BATT_TEMP); + +static struct attribute *wm831x_attributes[] = { + &dev_attr_name.attr, + + &sensor_dev_attr_in0_input.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + + &sensor_dev_attr_in4_input.dev_attr.attr, + &sensor_dev_attr_in4_label.dev_attr.attr, + &sensor_dev_attr_in5_input.dev_attr.attr, + &sensor_dev_attr_in5_label.dev_attr.attr, + &sensor_dev_attr_in6_input.dev_attr.attr,
drivers/hwmon/wm831x-hwmon.c line 161
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c new file +10
-0+ &sensor_dev_attr_in6_label.dev_attr.attr, + &sensor_dev_attr_in7_input.dev_attr.attr, + &sensor_dev_attr_in7_label.dev_attr.attr, + + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_label.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp2_label.dev_attr.attr, + + NULL,
Trailing comma unneeded, you're never going to add something after this NULL.
Quoted 33 lines
drivers/hwmon/wm831x-hwmon.c new file +33
-0+}; + +static const struct attribute_group wm831x_attr_group = { + .attrs = wm831x_attributes, +}; + +static int __devinit wm831x_hwmon_probe (struct platform_device *pdev) +{ +struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent); +struct wm831x_hwmon *hwmon; +int ret; + + hwmon =kzalloc (sizeof (struct wm831x_hwmon ),GFP_KERNEL ); +if (!hwmon) +return -ENOMEM ; + + hwmon->wm831x = wm831x; + + ret =sysfs_create_group (&pdev->dev.kobj, &wm831x_attr_group); +if (ret) + goto err; + + hwmon->classdev =hwmon_device_register (&pdev->dev); +if (IS_ERR (hwmon->classdev)) { + ret =PTR_ERR (hwmon->classdev); + goto err_sysfs; + } + +platform_set_drvdata (pdev, hwmon); + +return 0 ; + +err_sysfs:
drivers/hwmon/wm831x-hwmon.c line 204
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c new file +10
-0+sysfs_remove_group (&pdev->dev.kobj, &wm831x_attr_group); +err: +kfree (hwmon); +return ret; +} + +static int __devexit wm831x_hwmon_remove(struct platform_device *pdev) +{ +struct wm831x_hwmon *hwmon =platform_get_drvdata (pdev); +
May I suggest adding:
platform_set_drvdata(pdev, NULL);
to avoid leaving a dangling pointer behind?
Quoted 22 lines
drivers/hwmon/wm831x-hwmon.c new file +22
-0+hwmon_device_unregister (hwmon->classdev); +sysfs_remove_group (&pdev->dev.kobj, &wm831x_attr_group); +kfree (hwmon); + +return 0 ; +} + +static struct platform_driver wm831x_hwmon_driver = { + .probe = wm831x_hwmon_probe, + .remove =__devexit_p (wm831x_hwmon_remove), + .driver = { + .name ="wm831x-hwmon" , + .owner =THIS_MODULE , + }, +}; + +static int __init wm831x_hwmon_init (void ) +{ +return platform_driver_register (&wm831x_hwmon_driver); +} +module_init (wm831x_hwmon_init); +
drivers/hwmon/wm831x-hwmon.c line 236
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c new file +10
-0+static void __exit wm831x_hwmon_exit(void) +{ +platform_driver_unregister (&wm831x_hwmon_driver); +} +module_exit (wm831x_hwmon_exit); + +MODULE_AUTHOR ("Mark Brown <[email protected]>" ); +MODULE_DESCRIPTION ("WM831x Hardware Monitoring" ); +MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:wm831x-hwmon" );
The rest looks good to me.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 12/22] hwmon: WM831x PMIC hardware monitoring driver
Quoted 8 lines · Jean Delvare
Documentation/hwmon/wm831x line 34
Quoted 4 lines · Mark Brown
Documentation/hwmon/wm831x new file +3
-0+Temperatures are sampled by a 12 bit ADC. Chip and battery temperatures +are available. The chip temperature is calculated as: + Degrees celsius = (512.8 - data) / 1.0983The driver code says 512.18.
The code is correct, will update.
Quoted 4 lines
Quoted 2 lines
obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o
+obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.oFWIW, I tend to dislike "x" for digits in driver names. What if a
Neither naming convention is entirely satisfactory; whatever is chosen will cause hassle or confusion or some point. It's one of those things where I do find myself wishing for code names.
Quoted 2 lines
Additionally it is inconsistent with the naming of the WM8350 driver below.
Yes, the WM8350 drivers (well, most of it) predate the WM8351 and WM8352.
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c line 98
Quoted 3 lines
drivers/hwmon/wm831x-hwmon.c new file +3
-0+/* The conversion depends on the battery, leave to userspace */ +return sprintf (buf,"%d\n" , ret); +}This is a problem. You are not supposed to return raw register values through the sysfs interface. Returning the voltage reading at the chip's pin is OK because you still return a voltage value. But a raw register value is not something the user should see. I agree that technically speaking, a good sensors.conf configuration file would work it out, but conceptually this is wrong.
Hrm, OK. There's a potential small loss of accuracy from converting to a voltage since the voltages are reported as milivolts but it is just a simple multiplier.
Quoted 4 lines
Can you say more about these batteries and how temperature measurement is different between them? If you can export a voltage reading to userspace than that would be OK (as I recall, we have at least one driver doing that already.)
Not really; it's intended to be a NTC thermistor but the driver is rather at the mercy of the battery and any other external components that the board has added. I'll convert to reporting as a voltage for consistency with the ABI.
Quoted 5 lines
drivers/hwmon/wm831x-hwmon.c line 114
Quoted 3 lines
drivers/hwmon/wm831x-hwmon.c new file +3
-0+#define WM831X_NAMED_VOLTAGE (id, name) \ + static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\ + NULL, name); \I guess you could just call
WM831X_VOLTAGE(id, name).
That clashes with the unnamed voltage above. I could also call them _NAMED and _UNNAMED, I suppose.
I've fixed all your other issues, will repost tomorrow.
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [lm-sensors] [PATCH 12/22] hwmon: WM831x PMIC hardware monitoring driver
Quoted 10 lines · Mark Brown
Quoted 6 lines · Jean Delvare
drivers/hwmon/wm831x-hwmon.c line 114
Quoted 3 lines · Mark Brown
drivers/hwmon/wm831x-hwmon.c new file +3
-0+#define WM831X_NAMED_VOLTAGE (id, name) \ + static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\ + NULL, name); \I guess you could just call
WM831X_VOLTAGE(id, name).That clashes with the unnamed voltage above. I could also call them
_NAMEDand_UNNAMED, I suppose.
Sorry for not being clear. I simply meant you could write the following:
define WM831X_VOLTAGE(id, name) \ static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage, \ NULL, name)
#define WM831X_NAMED_VOLTAGE(id, name) \ WM831X_VOLTAGE(id, name); \ static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \ NULL, name)
Which makes it more obvious that WM831X_NAMED_VOLTAGE is WM831X_VOLTAGE
+ label. But it's really up to you which way you prefer.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
PATCH 1/1 hwmon: WM831x PMIC hardware monitoring driver
In reply to Mark BrownThis driver adds support for the hardware monitoring features of the WM831x PMICs to the hwmon API. Monitoring is provided for the system voltages supported natively by the WM831x, the chip temperature, the battery temperature and the auxiliary inputs of the WM831x.
Currently no alarms are supported, though digital comparators on the WM831x devices would allow these to be provided.
Since the auxiliary and battery temperature input scaling depends on the system configuration the value is reported as a voltage to userspace.
---
Changes from review from Jean:
- Hook up backup battery monitoring.
- Use DIV_ROUND_CLOSEST().
- Report battery temperature as a voltage.
- Various formatting cleanups.
Documentation/hwmon/wm831x | 37 +++++++ drivers/hwmon/Kconfig | 11 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/wm831x-hwmon.c | 240 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 289 insertions(+), 0 deletions(-) create mode 100644 Documentation/hwmon/wm831x create mode 100644 drivers/hwmon/wm831x-hwmon.c
Documentation/hwmon/wm831x new file +37 -0
@@ -0,0 +1,37 @@ +Kernel driver wm831x-hwmon +============= + +Supported chips: + * Wolfson Microelectronics WM831x PMICs + Prefix: 'wm831x' + Datasheet: + http://www.wolfsonmicro.com/products/WM8310 + http://www.wolfsonmicro.com/products/WM8311 + http://www.wolfsonmicro.com/products/WM8312 + +Authors: Mark Brown <[email protected]> + +Description +----------- + +The WM831x series of PMICs include an AUXADC which can be used to +monitor a range of system operating parameters, including the voltages +of the major supplies within the system. Currently the driver provides +reporting of all the input values but does not provide any alarms. + +Voltage Monitoring +------------------ + +Voltages are sampled by a 12 bit ADC. Voltages in milivolts are 1.465 +times the ADC value. + +Temperature Monitoring +---------------------- + +Temperatures are sampled by a 12 bit ADC. Chip and battery temperatures +are available. The chip temperature is calculated as: + + Degrees celsius = (512.18 - data) / 1.0983 + +while the battery temperature calculation will depend on the NTC +termistor component.
drivers/hwmon/Kconfig +11 -0
@@ -930,6 +930,17 @@ config SENSORS_W83627EHF This driver can also be built as a module. If so, the module will be called w83627ehf. +config SENSORS_WM831X + tristate "WM831x PMICs" + depends on MFD_WM831X + help + If you say yes here you get support for the hardware + monitoring functionality of the Wolfson Microelectronics + WM831x series of PMICs. + + This driver can also be built as a module. If so, the module + will be called wm831x-hwmon. + config SENSORS_WM8350 tristate "Wolfson Microelectronics WM835x" depends on MFD_WM8350
drivers/hwmon/Makefile +1 -0
@@ -90,6 +90,7 @@ obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o +obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
drivers/hwmon/wm831x-hwmon.c new file +240 -0
240 lines not on this page · raw message
Signature · 7 lines
1.6.3.3 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [PATCH] hwmon: WM831x PMIC hardware monitoring driver
Hi Mark,
Quoted 65 lines · Mark Brown
This driver adds support for the hardware monitoring features of the WM831x PMICs to the hwmon API. Monitoring is provided for the system voltages supported natively by the WM831x, the chip temperature, the battery temperature and the auxiliary inputs of the WM831x.
Currently no alarms are supported, though digital comparators on the WM831x devices would allow these to be provided.
Since the auxiliary and battery temperature input scaling depends on the system configuration the value is reported as a voltage to userspace.
---
Changes from review from Jean:
- Hook up backup battery monitoring.
- UseDIV_ROUND_CLOSEST().
- Report battery temperature as a voltage.
- Various formatting cleanups.Documentation/hwmon/wm831x | 37 +++++++ drivers/hwmon/Kconfig | 11 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/wm831x-hwmon.c | 240 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 289 insertions(+), 0 deletions(-) create mode 100644 Documentation/hwmon/wm831x create mode 100644 drivers/hwmon/wm831x-hwmon.cDocumentation/hwmon/wm831x new file +27
-0@@ -0,0 +1,37 @@ +Kernel driver wm831x-hwmon +============= + +Supported chips: + * Wolfson Microelectronics WM831x PMICs + Prefix: 'wm831x' + Datasheet: + http://www.wolfsonmicro.com/products/WM8310 + http://www.wolfsonmicro.com/products/WM8311 + http://www.wolfsonmicro.com/products/WM8312 + +Authors: Mark Brown <[email protected]> + +Description +----------- + +The WM831x series of PMICs include an AUXADC which can be used to +monitor a range of system operating parameters, including the voltages +of the major supplies within the system. Currently the driver provides +reporting of all the input values but does not provide any alarms. + +Voltage Monitoring +------------------ + +Voltages are sampled by a 12 bit ADC. Voltages in milivolts are 1.465 +times the ADC value. +
Documentation/hwmon/wm831x line 37
Quoted 10 lines
Documentation/hwmon/wm831x new file +10
-0+Temperature Monitoring +---------------------- + +Temperatures are sampled by a 12 bit ADC. Chip and battery temperatures +are available. The chip temperature is calculated as: + + Degrees celsius = (512.18 - data) / 1.0983 + +while the battery temperature calculation will depend on the NTC +termistor component.
I think the correct spelling is thermistor.
Quoted 129 lines
drivers/hwmon/Kconfig +11
-0@@ -930,6 +930,17 @@ config SENSORS_W83627EHF This driver can also be built as a module. If so, the module will be called w83627ehf. +config SENSORS_WM831X + tristate "WM831x PMICs" + depends on MFD_WM831X + help + If you say yes here you get support for the hardware + monitoring functionality of the Wolfson Microelectronics + WM831x series of PMICs. + + This driver can also be built as a module. If so, the module + will be called wm831x-hwmon. + config SENSORS_WM8350 tristate "Wolfson Microelectronics WM835x" depends on MFD_WM8350drivers/hwmon/Makefile +1
-0@@ -90,6 +90,7 @@ obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o +obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)drivers/hwmon/wm831x-hwmon.c new file +89
-0@@ -0,0 +1,240 @@ +/* +* drivers/hwmon/wm831x-hwmon.c - Wolfson Microelectronics WM831x PMIC +* hardware monitoring features. +* +* Copyright (C) 2009 Wolfson Microelectronics plc +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License v2 as published by the +* Free Software Foundation. +* +* This program is distributed in the hope that it will be useful, but WITHOUT +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +* more details. +* +* You should have received a copy of the GNU General Public License along with +* this program; if not, write to the Free Software Foundation, Inc., +* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA +*/ + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/platform_device.h> +#include <linux/err.h> +#include <linux/hwmon.h> +#include <linux/hwmon-sysfs.h> + +#include <linux/mfd/wm831x/core.h> +#include <linux/mfd/wm831x/auxadc.h> + +struct wm831x_hwmon { +struct wm831x *wm831x; +struct device *classdev; +}; + +static ssize_t show_name (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"wm831x\n" ); +} + +static const char *input_names[] = { + [WM831X_AUX_SYSVDD ] ="SYSVDD" , + [WM831X_AUX_USB ] ="USB" , + [WM831X_AUX_BKUP_BATT ] ="Backup battery" , + [WM831X_AUX_BATT ] ="Battery" , + [WM831X_AUX_WALL ] ="WALL" , + [WM831X_AUX_CHIP_TEMP ] ="PMIC" , + [WM831X_AUX_BATT_TEMP ] ="Battery" , +}; + + +static ssize_t show_voltage (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct wm831x_hwmon *hwmon =dev_get_drvdata (dev); +int channel =to_sensor_dev_attr (attr)->index; +int ret; + + ret =wm831x_auxadc_read_uv (hwmon->wm831x, channel); +if (ret <0 ) +return ret; + +return sprintf (buf,"%d\n" ,DIV_ROUND_CLOSEST (ret,1000 )); +} + +static ssize_t show_chip_temp (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct wm831x_hwmon *hwmon =dev_get_drvdata (dev); +int channel =to_sensor_dev_attr (attr)->index; +int ret; + + ret =wm831x_auxadc_read (hwmon->wm831x, channel); +if (ret <0 ) +return ret; + +/* Degrees celsius = (512.18-ret) / 1.0983 */ + ret =512180 - (ret *1000 ); + ret =DIV_ROUND_CLOSEST (ret *10000 ,10983 ); + +return sprintf (buf,"%d\n" , ret); +} + +static ssize_t show_batt_temp (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct wm831x_hwmon *hwmon =dev_get_drvdata (dev); +int channel =to_sensor_dev_attr (attr)->index;
drivers/hwmon/wm831x-hwmon.c line 99
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c new file +10
-0+int ret; + + ret =wm831x_auxadc_read_uv (hwmon->wm831x, channel); +if (ret <0 ) +return ret; + +/* The conversion depends on the battery, leave to userspace but +* report as voltage for ABI reasons. */ +return sprintf (buf,"%d\n" ,DIV_ROUND_CLOSEST (ret,1000 )); +}
If I am not mistaken, the above function is an exact copy of show_voltage(), so you might as well use it?
Quoted 102 lines
drivers/hwmon/wm831x-hwmon.c new file +102
-0+ +static ssize_t show_label (struct device *dev, +struct device_attribute *attr,char *buf) +{ +int channel =to_sensor_dev_attr (attr)->index; + +return sprintf (buf,"%s\n" , input_names[channel]); +} + +#define WM831X_VOLTAGE (id, name) \ + static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage, \ + NULL, name) + +#define WM831X_NAMED_VOLTAGE (id, name) \ + WM831X_VOLTAGE(id, name); \ + static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \ + NULL, name) + +static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); + +WM831X_VOLTAGE (0 ,WM831X_AUX_AUX1 ); +WM831X_VOLTAGE (1 ,WM831X_AUX_AUX2 ); +WM831X_VOLTAGE (2 ,WM831X_AUX_AUX3 ); +WM831X_VOLTAGE (3 ,WM831X_AUX_AUX4 ); + +WM831X_NAMED_VOLTAGE (4 ,WM831X_AUX_SYSVDD ); +WM831X_NAMED_VOLTAGE (5 ,WM831X_AUX_USB ); +WM831X_NAMED_VOLTAGE (6 ,WM831X_AUX_BATT ); +WM831X_NAMED_VOLTAGE (7 ,WM831X_AUX_WALL ); +WM831X_NAMED_VOLTAGE (8 ,WM831X_AUX_BKUP_BATT ); + +static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, show_chip_temp, NULL, + WM831X_AUX_CHIP_TEMP); +static SENSOR_DEVICE_ATTR(temp1_label, S_IRUGO, show_label, NULL, + WM831X_AUX_CHIP_TEMP); +static SENSOR_DEVICE_ATTR(temp2_input, S_IRUGO, show_batt_temp, NULL, + WM831X_AUX_BATT_TEMP); +static SENSOR_DEVICE_ATTR(temp2_label, S_IRUGO, show_label, NULL, + WM831X_AUX_BATT_TEMP); + +static struct attribute *wm831x_attributes[] = { + &dev_attr_name.attr, + + &sensor_dev_attr_in0_input.dev_attr.attr, + &sensor_dev_attr_in1_input.dev_attr.attr, + &sensor_dev_attr_in2_input.dev_attr.attr, + &sensor_dev_attr_in3_input.dev_attr.attr, + + &sensor_dev_attr_in4_input.dev_attr.attr, + &sensor_dev_attr_in4_label.dev_attr.attr, + &sensor_dev_attr_in5_input.dev_attr.attr, + &sensor_dev_attr_in5_label.dev_attr.attr, + &sensor_dev_attr_in6_input.dev_attr.attr, + &sensor_dev_attr_in6_label.dev_attr.attr, + &sensor_dev_attr_in7_input.dev_attr.attr, + &sensor_dev_attr_in7_label.dev_attr.attr, + &sensor_dev_attr_in8_input.dev_attr.attr, + &sensor_dev_attr_in8_label.dev_attr.attr, + + &sensor_dev_attr_temp1_input.dev_attr.attr, + &sensor_dev_attr_temp1_label.dev_attr.attr, + &sensor_dev_attr_temp2_input.dev_attr.attr, + &sensor_dev_attr_temp2_label.dev_attr.attr, + +NULL +}; + +static const struct attribute_group wm831x_attr_group = { + .attrs = wm831x_attributes, +}; + +static int __devinit wm831x_hwmon_probe (struct platform_device *pdev) +{ +struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent); +struct wm831x_hwmon *hwmon; +int ret; + + hwmon =kzalloc (sizeof (struct wm831x_hwmon ),GFP_KERNEL ); +if (!hwmon) +return -ENOMEM ; + + hwmon->wm831x = wm831x; + + ret =sysfs_create_group (&pdev->dev.kobj, &wm831x_attr_group); +if (ret) + goto err; + + hwmon->classdev =hwmon_device_register (&pdev->dev); +if (IS_ERR (hwmon->classdev)) { + ret =PTR_ERR (hwmon->classdev); + goto err_sysfs; + } + +platform_set_drvdata (pdev, hwmon); + +return 0 ; + +err_sysfs: +sysfs_remove_group (&pdev->dev.kobj, &wm831x_attr_group); +err: +kfree (hwmon); +return ret;
drivers/hwmon/wm831x-hwmon.c line 211
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c new file +10
-0+} + +static int __devexit wm831x_hwmon_remove(struct platform_device *pdev) +{ +struct wm831x_hwmon *hwmon =platform_get_drvdata (pdev); + +hwmon_device_unregister (hwmon->classdev); +sysfs_remove_group (&pdev->dev.kobj, &wm831x_attr_group); +kfree (hwmon); +platform_set_drvdata (pdev,NULL );
Preferably the other way around (yes I am nitpicking ;))
Quoted 19 lines
drivers/hwmon/wm831x-hwmon.c new file +19
-0+ +return 0 ; +} + +static struct platform_driver wm831x_hwmon_driver = { + .probe = wm831x_hwmon_probe, + .remove =__devexit_p (wm831x_hwmon_remove), + .driver = { + .name ="wm831x-hwmon" , + .owner =THIS_MODULE , + }, +}; + +static int __init wm831x_hwmon_init (void ) +{ +return platform_driver_register (&wm831x_hwmon_driver); +} +module_init (wm831x_hwmon_init); +
drivers/hwmon/wm831x-hwmon.c line 240
Quoted 10 lines
drivers/hwmon/wm831x-hwmon.c new file +10
-0+static void __exit wm831x_hwmon_exit(void) +{ +platform_driver_unregister (&wm831x_hwmon_driver); +} +module_exit (wm831x_hwmon_exit); + +MODULE_AUTHOR ("Mark Brown <[email protected]>" ); +MODULE_DESCRIPTION ("WM831x Hardware Monitoring" ); +MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:wm831x-hwmon" );
All the rest looks good to me now, so:
And as I said before for the wm8350-hwmon driver: I can pick this patch and push it to Linux in 2.6.32 if you want, but if you want it to take a different route this is equally fine with me. Just tell me if you want me to pick it.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Re: [PATCH] hwmon: WM831x PMIC hardware monitoring driver
Quoted 5 lines · Jean Delvare
Quoted 3 lines · Mark Brown
drivers/hwmon/wm831x-hwmon.c new file +3
-0+static ssize_t show_batt_temp (struct device *dev, +struct device_attribute *attr,char *buf) +{
...
Quoted 7 lines
drivers/hwmon/wm831x-hwmon.c line 99
Quoted 4 lines
drivers/hwmon/wm831x-hwmon.c new file +4
-0+/* The conversion depends on the battery, leave to userspace but +* report as voltage for ABI reasons. */ +return sprintf (buf,"%d\n" ,DIV_ROUND_CLOSEST (ret,1000 )); +}If I am not mistaken, the above function is an exact copy of
show_voltage(), so you might as well use it?
It is now, yes, except for the comment explaining why we're reporting as a voltage.
Quoted 8 lines
All the rest looks good to me now, so:
Acked-by Jean Delvare <[email protected]>And as I said before for the wm8350-hwmon driver: I can pick this patch and push it to Linux in 2.6.32 if you want, but if you want it to take a different route this is equally fine with me. Just tell me if you want me to pick it.
I'm more than happy for you to take both - the only reason that I asked you to hold off on the wm8350 patch originally was that I knew I was going to be releasing this driver and there would be collisions with the Kconfig stuff which was due to be released very soon.
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
PATCH 1/1 hwmon: WM831x PMIC hardware monitoring driver
This driver adds support for the hardware monitoring features of the WM831x PMICs to the hwmon API. Monitoring is provided for the system voltages supported natively by the WM831x, the chip temperature, the battery temperature and the auxiliary inputs of the WM831x.
Currently no alarms are supported, though digital comparators on the WM831x devices would allow these to be provided.
Since the auxiliary and battery temperature input scaling depends on the system configuration the value is reported as a voltage to userspace.
---
Fix typo, ordering of NULL of driver data and factor out battery temperature report.
Documentation/hwmon/wm831x | 37 +++++++ drivers/hwmon/Kconfig | 11 ++ drivers/hwmon/Makefile | 1 + drivers/hwmon/wm831x-hwmon.c | 226 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 275 insertions(+), 0 deletions(-) create mode 100644 Documentation/hwmon/wm831x create mode 100644 drivers/hwmon/wm831x-hwmon.c
Documentation/hwmon/wm831x new file +37 -0
@@ -0,0 +1,37 @@ +Kernel driver wm831x-hwmon +============= + +Supported chips: + * Wolfson Microelectronics WM831x PMICs + Prefix: 'wm831x' + Datasheet: + http://www.wolfsonmicro.com/products/WM8310 + http://www.wolfsonmicro.com/products/WM8311 + http://www.wolfsonmicro.com/products/WM8312 + +Authors: Mark Brown <[email protected]> + +Description +----------- + +The WM831x series of PMICs include an AUXADC which can be used to +monitor a range of system operating parameters, including the voltages +of the major supplies within the system. Currently the driver provides +reporting of all the input values but does not provide any alarms. + +Voltage Monitoring +------------------ + +Voltages are sampled by a 12 bit ADC. Voltages in milivolts are 1.465 +times the ADC value. + +Temperature Monitoring +---------------------- + +Temperatures are sampled by a 12 bit ADC. Chip and battery temperatures +are available. The chip temperature is calculated as: + + Degrees celsius = (512.18 - data) / 1.0983 + +while the battery temperature calculation will depend on the NTC +thermistor component.
drivers/hwmon/Kconfig +11 -0
@@ -930,6 +930,17 @@ config SENSORS_W83627EHF This driver can also be built as a module. If so, the module will be called w83627ehf. +config SENSORS_WM831X + tristate "WM831x PMICs" + depends on MFD_WM831X + help + If you say yes here you get support for the hardware + monitoring functionality of the Wolfson Microelectronics + WM831x series of PMICs. + + This driver can also be built as a module. If so, the module + will be called wm831x-hwmon. + config SENSORS_WM8350 tristate "Wolfson Microelectronics WM835x" depends on MFD_WM8350
drivers/hwmon/Makefile +1 -0
@@ -90,6 +90,7 @@ obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o +obj-$(CONFIG_SENSORS_WM831X) += wm831x-hwmon.o obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
drivers/hwmon/wm831x-hwmon.c new file +226 -0
226 lines not on this page · raw message
Signature · 7 lines
1.6.3.3 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Samuel Ortiz
AppliedRe: [PATCH] hwmon: WM831x PMIC hardware monitoring driver
In reply to Mark BrownHi Jean, Mark,
Quoted 29 lines · Mark Brown
Quoted 5 lines · Jean Delvare
Quoted 3 lines · Mark Brown
drivers/hwmon/wm831x-hwmon.c new file +3
-0+static ssize_t show_batt_temp (struct device *dev, +struct device_attribute *attr,char *buf) +{...
Quoted 7 lines
drivers/hwmon/wm831x-hwmon.c line 99
Quoted 4 lines
drivers/hwmon/wm831x-hwmon.c new file +4
-0+/* The conversion depends on the battery, leave to userspace but +* report as voltage for ABI reasons. */ +return sprintf (buf,"%d\n" ,DIV_ROUND_CLOSEST (ret,1000 )); +}If I am not mistaken, the above function is an exact copy of
show_voltage(), so you might as well use it?It is now, yes, except for the comment explaining why we're reporting as a voltage.
Quoted 8 lines
All the rest looks good to me now, so:
Acked-by Jean Delvare <[email protected]>And as I said before for the wm8350-hwmon driver: I can pick this patch and push it to Linux in 2.6.32 if you want, but if you want it to take a different route this is equally fine with me. Just tell me if you want me to pick it.
Quoted 4 lines
I'm more than happy for you to take both - the only reason that I asked you to hold off on the wm8350 patch originally was that I knew I was going to be releasing this driver and there would be collisions with the
Kconfigstuff which was due to be released very soon.
I applied both patches to my for-next branch. Jean, if you prefer them to go through your tree, please go ahead and I'll remove them from mine.
Cheers,
Samuel.
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Re: [PATCH] hwmon: WM831x PMIC hardware monitoring driver
Hi Samuel,
Quoted 11 lines · Samuel Ortiz
Hi Jean, Mark,
Quoted 8 lines · Mark Brown
Quoted 6 lines · Jean Delvare
Acked-by Jean Delvare <[email protected]>And as I said before for the wm8350-hwmon driver: I can pick this patch and push it to Linux in 2.6.32 if you want, but if you want it to take a different route this is equally fine with me. Just tell me if you want me to pick it.
Quoted 7 lines
Quoted 4 lines
I'm more than happy for you to take both - the only reason that I asked you to hold off on the wm8350 patch originally was that I knew I was going to be releasing this driver and there would be collisions with the
Kconfigstuff which was due to be released very soon.I applied both patches to my for-next branch. Jean, if you prefer them to go through your tree, please go ahead and I'll remove them from mine.
This is totally fine with me, thanks for picking them. I've just moved to a new place and my backlog is big, so I am grateful for any work others may offload from me :)
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
PATCH 13/22 Input: Add support for the WM831x ON pin
In reply to Mark BrownThe WM831x series of PMICs support control of initial power on through the ON pin on the device with soft control of the pin at other times. Represent this to userspace as KEY_POWER.
--- drivers/input/misc/Kconfig | 10 +++ drivers/input/misc/Makefile | 1 + drivers/input/misc/wm831x-on.c | 163 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/core.h | 19 +++++ 4 files changed, 193 insertions(+), 0 deletions(-) create mode 100644 drivers/input/misc/wm831x-on.c
drivers/input/misc/Kconfig +10 -0
@@ -279,4 +279,14 @@ config INPUT_BFIN_ROTARY To compile this driver as a module, choose M here: the module will be called bfin-rotary. +config INPUT_WM831X_ON + tristate "WM831X ON pin" + depends on MFD_WM831X + help + Support the ON pin of WM831X PMICs as an input device + reporting power button status. + + To compile this driver as a module, choose M here: the module + will be called wm831x_on. + endif
drivers/input/misc/Makefile +1 -0
@@ -26,4 +26,5 @@ obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o obj-$(CONFIG_INPUT_UINPUT) += uinput.o obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o +obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o obj-$(CONFIG_INPUT_YEALINK) += yealink.o
drivers/input/misc/wm831x-on.c new file +163 -0
163 lines not on this page · raw message
include/linux/mfd/wm831x/core.h +19 -0
@@ -216,6 +216,25 @@#define WM831X_PARENT_ID_SHIFT 0/* PARENT_ID - [15:0] */ #define WM831X_PARENT_ID_WIDTH 16/* PARENT_ID - [15:0] */ +/* +* R16389 (0x4005) - ON Pin Control +*/ +#define WM831X_ON_PIN_SECACT_MASK 0x0300/* ON_PIN_SECACT - [9:8] */ +#define WM831X_ON_PIN_SECACT_SHIFT 8/* ON_PIN_SECACT - [9:8] */ +#define WM831X_ON_PIN_SECACT_WIDTH 2/* ON_PIN_SECACT - [9:8] */ +#define WM831X_ON_PIN_PRIMACT_MASK 0x0030/* ON_PIN_PRIMACT - [5:4] */ +#define WM831X_ON_PIN_PRIMACT_SHIFT 4/* ON_PIN_PRIMACT - [5:4] */ +#define WM831X_ON_PIN_PRIMACT_WIDTH 2/* ON_PIN_PRIMACT - [5:4] */ +#define WM831X_ON_PIN_STS 0x0008/* ON_PIN_STS */ +#define WM831X_ON_PIN_STS_MASK 0x0008/* ON_PIN_STS */ +#define WM831X_ON_PIN_STS_SHIFT 3/* ON_PIN_STS */ +#define WM831X_ON_PIN_STS_WIDTH 1/* ON_PIN_STS */ +#define WM831X_ON_PIN_TO_MASK 0x0003/* ON_PIN_TO - [1:0] */ +#define WM831X_ON_PIN_TO_SHIFT 0/* ON_PIN_TO - [1:0] */ +#define WM831X_ON_PIN_TO_WIDTH 2/* ON_PIN_TO - [1:0] */ + +struct regulator_dev ; +struct wm831x {struct mutex io_lock;
Signature · 1 line
1.6.3.3
Re: [PATCH 13/22] Input: Add support for the WM831x ON pin
Hi Mark,
drivers/input/misc/wm831x-on.c line 3
Quoted 6 lines · Mark Brown
drivers/input/misc/wm831x-on.c new file +3
-0@@ -0,0 +1,163 @@ +/** +* wm831x-on.c - WM831X ON pind river +*
"Pind river"? ;)
drivers/input/misc/wm831x-on.c line 66
Quoted 6 lines
drivers/input/misc/wm831x-on.c new file +6
-0+ +static irqreturn_t wm831x_on_irq (int irq,void *data) +{ +struct wm831x_on *wm831x_on = data; + +schedule_work (&wm831x_on->work.work);
schedule_delayed_work(&wm831x_on->work, 0); - I prefer not to expose delayed work implementation details.
Other than that:
Freel free to push this with the rest of the series. If that does not work out let me know and I will get this driver into my tree.
Thanks!
Signature · 1 line
Dmitry
Re: [PATCH 13/22] Input: Add support for the WM831x ON pin
Quoted 5 lines · Dmitry Torokhov
Quoted 1 line · Mark Brown
+ *
wm831x-on.c- WM831X ON pind river"Pind river"? ;)
Err, yes. Highly innovative new technology!
Quoted 9 lines
drivers/input/misc/wm831x-on.c line 66
Quoted 5 lines
drivers/input/misc/wm831x-on.c new file +5
-0+static irqreturn_t wm831x_on_irq (int irq,void *data) +{ +struct wm831x_on *wm831x_on = data; + +schedule_work (&wm831x_on->work.work);
schedule_delayed_work(&wm831x_on->work, 0); - I prefer not to expose delayed work implementation details.
Quoted 6 lines
Other than that:
Acked-by Dmitry Torokhov <[email protected]>Freel free to push this with the rest of the series. If that does not work out let me know and I will get this driver into my tree.
OK, I'll fix that when I resend. Thanks.
PATCH 1/1 Input: Add support for the WM831x ON pin
In reply to Mark BrownThe WM831x series of PMICs support control of initial power on through the ON pin on the device with soft control of the pin at other times. Represent this to userspace as KEY_POWER.
---
- Typo fix.
- Use schedule_delayed_work(work, 0) rather than schedule_work().
drivers/input/misc/Kconfig | 10 +++ drivers/input/misc/Makefile | 1 + drivers/input/misc/wm831x-on.c | 163 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/core.h | 19 +++++ 4 files changed, 193 insertions(+), 0 deletions(-) create mode 100644 drivers/input/misc/wm831x-on.c
drivers/input/misc/Kconfig +10 -0
@@ -279,4 +279,14 @@ config INPUT_BFIN_ROTARY To compile this driver as a module, choose M here: the module will be called bfin-rotary. +config INPUT_WM831X_ON + tristate "WM831X ON pin" + depends on MFD_WM831X + help + Support the ON pin of WM831X PMICs as an input device + reporting power button status. + + To compile this driver as a module, choose M here: the module + will be called wm831x_on. + endif
drivers/input/misc/Makefile +1 -0
@@ -26,4 +26,5 @@ obj-$(CONFIG_INPUT_SPARCSPKR) += sparcspkr.o obj-$(CONFIG_INPUT_TWL4030_PWRBUTTON) += twl4030-pwrbutton.o obj-$(CONFIG_INPUT_UINPUT) += uinput.o obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o +obj-$(CONFIG_INPUT_WM831X_ON) += wm831x-on.o obj-$(CONFIG_INPUT_YEALINK) += yealink.o
drivers/input/misc/wm831x-on.c new file +163 -0
163 lines not on this page · raw message
include/linux/mfd/wm831x/core.h +19 -0
@@ -216,6 +216,25 @@#define WM831X_PARENT_ID_SHIFT 0/* PARENT_ID - [15:0] */ #define WM831X_PARENT_ID_WIDTH 16/* PARENT_ID - [15:0] */ +/* +* R16389 (0x4005) - ON Pin Control +*/ +#define WM831X_ON_PIN_SECACT_MASK 0x0300/* ON_PIN_SECACT - [9:8] */ +#define WM831X_ON_PIN_SECACT_SHIFT 8/* ON_PIN_SECACT - [9:8] */ +#define WM831X_ON_PIN_SECACT_WIDTH 2/* ON_PIN_SECACT - [9:8] */ +#define WM831X_ON_PIN_PRIMACT_MASK 0x0030/* ON_PIN_PRIMACT - [5:4] */ +#define WM831X_ON_PIN_PRIMACT_SHIFT 4/* ON_PIN_PRIMACT - [5:4] */ +#define WM831X_ON_PIN_PRIMACT_WIDTH 2/* ON_PIN_PRIMACT - [5:4] */ +#define WM831X_ON_PIN_STS 0x0008/* ON_PIN_STS */ +#define WM831X_ON_PIN_STS_MASK 0x0008/* ON_PIN_STS */ +#define WM831X_ON_PIN_STS_SHIFT 3/* ON_PIN_STS */ +#define WM831X_ON_PIN_STS_WIDTH 1/* ON_PIN_STS */ +#define WM831X_ON_PIN_TO_MASK 0x0003/* ON_PIN_TO - [1:0] */ +#define WM831X_ON_PIN_TO_SHIFT 0/* ON_PIN_TO - [1:0] */ +#define WM831X_ON_PIN_TO_WIDTH 2/* ON_PIN_TO - [1:0] */ + +struct regulator_dev ; +struct wm831x {struct mutex io_lock;
Signature · 1 line
1.6.3.3
PATCH 14/22 leds: Add WM831x status LED driver
In reply to Mark BrownThe WM831x devices feature two software controlled status LEDs with hardware assisted blinking.
The device can also autonomously control the LEDs based on a selection of sources. This can be configured at boot time using either platform data or the chip OTP. A sysfs file in the style of that for triggers allowing the control source to be configured at run time. Triggers can't be used here since they can't depend on the implementation details of a specific LED type.
--- drivers/leds/Kconfig | 7 + drivers/leds/Makefile | 1 + drivers/leds/leds-wm831x-status.c | 341 +++++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/status.h | 34 ++++ 4 files changed, 383 insertions(+), 0 deletions(-) create mode 100644 drivers/leds/leds-wm831x-status.c create mode 100644 include/linux/mfd/wm831x/status.h
drivers/leds/Kconfig +7 -0
@@ -195,6 +195,13 @@ config LEDS_PCA955X LED driver chips accessed via the I2C bus. Supported devices include PCA9550, PCA9551, PCA9552, and PCA9553. +config LEDS_WM831X_STATUS + tristate "LED support for status LEDs on WM831x PMICs" + depends on LEDS_CLASS && MFD_WM831X + help + This option enables support for the status LEDs of the WM831x + series of PMICs. + config LEDS_WM8350 tristate "LED Support for WM8350 AudioPlus PMIC" depends on LEDS_CLASS && MFD_WM8350
drivers/leds/Makefile +1 -0
@@ -26,6 +26,7 @@ obj-$(CONFIG_LEDS_HP6XX) += leds-hp6xx.o obj-$(CONFIG_LEDS_FSG) += leds-fsg.o obj-$(CONFIG_LEDS_PCA955X) += leds-pca955x.o obj-$(CONFIG_LEDS_DA903X) += leds-da903x.o +obj-$(CONFIG_LEDS_WM831X_STATUS) += leds-wm831x-status.o obj-$(CONFIG_LEDS_WM8350) += leds-wm8350.o obj-$(CONFIG_LEDS_PWM) += leds-pwm.o
drivers/leds/leds-wm831x-status.c new file +341 -0
341 lines not on this page · raw message
include/linux/mfd/wm831x/status.h new file +34 -0
@@ -0,0 +1,34 @@ +/* +* include/linux/mfd/wm831x/status.h -- Status LEDs for WM831x +* +* Copyright 2009 Wolfson Microelectronics PLC. +* +* Author: Mark Brown <[email protected]> +* +* This program is free software; you can redistribute it and/or modify it +* under the terms of the GNU General Public License as published by the +* Free Software Foundation; either version 2 of the License, or (at your +* option) any later version. +* +*/ + +#ifndef __MFD_WM831X_STATUS_H__ +#define __MFD_WM831X_STATUS_H__ + +#define WM831X_LED_SRC_MASK 0xC000/* LED_SRC - [15:14] */ +#define WM831X_LED_SRC_SHIFT 14/* LED_SRC - [15:14] */ +#define WM831X_LED_SRC_WIDTH 2/* LED_SRC - [15:14] */ +#define WM831X_LED_MODE_MASK 0x0300/* LED_MODE - [9:8] */ +#define WM831X_LED_MODE_SHIFT 8/* LED_MODE - [9:8] */ +#define WM831X_LED_MODE_WIDTH 2/* LED_MODE - [9:8] */ +#define WM831X_LED_SEQ_LEN_MASK 0x0030/* LED_SEQ_LEN - [5:4] */ +#define WM831X_LED_SEQ_LEN_SHIFT 4/* LED_SEQ_LEN - [5:4] */ +#define WM831X_LED_SEQ_LEN_WIDTH 2/* LED_SEQ_LEN - [5:4] */ +#define WM831X_LED_DUR_MASK 0x000C/* LED_DUR - [3:2] */ +#define WM831X_LED_DUR_SHIFT 2/* LED_DUR - [3:2] */ +#define WM831X_LED_DUR_WIDTH 2/* LED_DUR - [3:2] */ +#define WM831X_LED_DUTY_CYC_MASK 0x0003/* LED_DUTY_CYC - [1:0] */ +#define WM831X_LED_DUTY_CYC_SHIFT 0/* LED_DUTY_CYC - [1:0] */ +#define WM831X_LED_DUTY_CYC_WIDTH 2/* LED_DUTY_CYC - [1:0] */ + +#endif
Signature · 1 line
1.6.3.3
PATCH 15/22 power_supply: Add driver for the PMU on WM831x PMICs
In reply to Mark BrownThe WM831x PMICs provide power path management from three sources:
a wall supply, USB and a battery with integrated charger. They also provide an additional backup supply with integrated for maintaining always on functionality such as the RTC and monitoring of power switches.
After some initial configuration at startup the device operates autonomously, the driver simply provides reporting of the current state.
--- drivers/power/Kconfig | 7 + drivers/power/Makefile | 1 + drivers/power/wm831x_power.c | 779 ++++++++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/pmu.h | 189 ++++++++++ 4 files changed, 976 insertions(+), 0 deletions(-) create mode 100644 drivers/power/wm831x_power.c create mode 100644 include/linux/mfd/wm831x/pmu.h
drivers/power/Kconfig +7 -0
@@ -29,6 +29,13 @@ config APM_POWER Say Y here to enable support APM status emulation using battery class devices. +config WM831X_POWER + tristate "WM831X PMU support" + depends on MFD_WM831X + help + Say Y here to enable support for the power management unit + provided by Wolfson Microelectronics WM831x PMICs. + config WM8350_POWER tristate "WM8350 PMU support" depends on MFD_WM8350
drivers/power/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-$(CONFIG_POWER_SUPPLY) += power_supply.o obj-$(CONFIG_PDA_POWER) += pda_power.o obj-$(CONFIG_APM_POWER) += apm_power.o +obj-$(CONFIG_WM831X_POWER) += wm831x_power.o obj-$(CONFIG_WM8350_POWER) += wm8350_power.o obj-$(CONFIG_BATTERY_DS2760) += ds2760_battery.o
drivers/power/wm831x_power.c new file +779 -0
779 lines not on this page · raw message
include/linux/mfd/wm831x/pmu.h new file +189 -0
189 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 16/22 regulator: Add WM831x DC-DC buck convertor support
In reply to Mark BrownThe WM831x series of devices all have 3 DC-DC buck convertors. This driver implements software control for these regulators via the regulator API. Use with split hardware/software control of individual regulators is not supported, though regulators not controlled by software may be controlled via the hardware control interfaces.
--- drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/wm831x-dcdc.c | 643 ++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/regulator.h | 571 ++++++++++++++++++++++++++++++ 4 files changed, 1222 insertions(+), 0 deletions(-) create mode 100644 drivers/regulator/wm831x-dcdc.c
drivers/regulator/Kconfig +7 -0
@@ -82,6 +82,13 @@ config REGULATOR_TWL4030 This driver supports the voltage regulators provided by this family of companion chips. +config REGULATOR_WM831X + tristate "Wolfson Microelcronics WM831x PMIC regulators" + depends on MFD_WM831X + help + Support the voltage and current regulators of the WM831x series + of PMIC devices. + config REGULATOR_WM8350 tristate "Wolfson Microelectroncis WM8350 AudioPlus PMIC" depends on MFD_WM8350
drivers/regulator/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_TWL4030) += twl4030-regulator.o +obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
drivers/regulator/wm831x-dcdc.c new file +643 -0
643 lines not on this page · raw message
include/linux/mfd/wm831x/regulator.h +571 -0
577 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 17/23 regulator: Add WM831x DC-DC buck convertor support
The WM831x series of devices all have 3 DC-DC buck convertors. This driver implements software control for these regulators via the regulator API. Use with split hardware/software control of individual regulators is not supported, though regulators not controlled by software may be controlled via the hardware control interfaces.
---
Support missing platform data for the main chip.
drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 1 + drivers/regulator/wm831x-dcdc.c | 643 ++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/regulator.h | 571 ++++++++++++++++++++++++++++++ 4 files changed, 1222 insertions(+), 0 deletions(-) create mode 100644 drivers/regulator/wm831x-dcdc.c
drivers/regulator/Kconfig +7 -0
@@ -82,6 +82,13 @@ config REGULATOR_TWL4030 This driver supports the voltage regulators provided by this family of companion chips. +config REGULATOR_WM831X + tristate "Wolfson Microelcronics WM831x PMIC regulators" + depends on MFD_WM831X + help + Support the voltage and current regulators of the WM831x series + of PMIC devices. + config REGULATOR_WM8350 tristate "Wolfson Microelectroncis WM8350 AudioPlus PMIC" depends on MFD_WM8350
drivers/regulator/Makefile +1 -0
@@ -12,6 +12,7 @@ obj-$(CONFIG_REGULATOR_BQ24022) += bq24022.o obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_TWL4030) += twl4030-regulator.o +obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
drivers/regulator/wm831x-dcdc.c new file +643 -0
643 lines not on this page · raw message
include/linux/mfd/wm831x/regulator.h +571 -0
577 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 17/22 regulator: Add WM831x LDO support
In reply to Mark BrownThe WM831x series of devices provide three types of LDO:
- General purpose LDOs supporting voltages from 0.9-3.3V
- High performance analogue LDOs supporting voltages from 1-3.5V
- Very low power consumption LDOs intended to support always on functionality.
This patch adds support for all three kinds of LDO. Each regulator is probed as an individual platform device with resources used to provide the register map location of the regulator. Mixed hardware and software control of regulators is not current supported.
--- drivers/regulator/Makefile | 1 + drivers/regulator/wm831x-ldo.c | 852 ++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/regulator.h | 626 +++++++++++++++++++++++++ 3 files changed, 1479 insertions(+), 0 deletions(-) create mode 100644 drivers/regulator/wm831x-ldo.c
drivers/regulator/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_TWL4030) += twl4030-regulator.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o +obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
drivers/regulator/wm831x-ldo.c new file +852 -0
852 lines not on this page · raw message
include/linux/mfd/wm831x/regulator.h +626 -0
638 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 18/23 regulator: Add WM831x LDO support
The WM831x series of devices provide three types of LDO:
- General purpose LDOs supporting voltages from 0.9-3.3V
- High performance analogue LDOs supporting voltages from 1-3.5V
- Very low power consumption LDOs intended to support always on functionality.
This patch adds support for all three kinds of LDO. Each regulator is probed as an individual platform device with resources used to provide the register map location of the regulator. Mixed hardware and software control of regulators is not current supported.
---
Support missing platform data for the chip as a whole.
drivers/regulator/Makefile | 1 + drivers/regulator/wm831x-ldo.c | 852 ++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/regulator.h | 626 +++++++++++++++++++++++++ 3 files changed, 1479 insertions(+), 0 deletions(-) create mode 100644 drivers/regulator/wm831x-ldo.c
drivers/regulator/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_TWL4030) += twl4030-regulator.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o +obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o obj-$(CONFIG_REGULATOR_DA903X) += da903x.o
drivers/regulator/wm831x-ldo.c new file +852 -0
852 lines not on this page · raw message
include/linux/mfd/wm831x/regulator.h +626 -0
638 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 18/22 regulator: Add WM831x EPE support
In reply to Mark BrownThe WM831x series of PMICs provide two optional outputs for controlling external devices during power sequencing, for example an external regulator. While in essence these are GPIOs the hardware presents them as DCDCs with very little control so provide support via the regulator API in that fashion.
--- drivers/regulator/wm831x-dcdc.c | 88 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-)
drivers/regulator/wm831x-dcdc.c +88 -0
@@ -613,6 +613,89 @@ static struct platform_driver wm831x_buckp_driver = { }, }; +/* +* External Power Enable +* +* These aren't actually DCDCs but look like them in hardware so share +* code. +*/ + +#define WM831X_EPE_BASE 6 + +static struct regulator_ops wm831x_epe_ops = { + .is_enabled = wm831x_dcdc_is_enabled, + .enable = wm831x_dcdc_enable, + .disable = wm831x_dcdc_disable, + .get_status = wm831x_dcdc_get_status, +}; + +static __devinit int wm831x_epe_probe (struct platform_device *pdev) +{ +struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent); +struct wm831x_pdata *pdata = wm831x->dev->platform_data; +int id = pdev->id %ARRAY_SIZE (pdata->epe); +struct wm831x_dcdc *dcdc; +int ret; + +dev_dbg (&pdev->dev,"Probing EPE%d\n" , id +1 ); + +if (pdata->epe[id] ==NULL ) +return -ENODEV ; + + dcdc =kzalloc (sizeof (struct wm831x_dcdc ),GFP_KERNEL ); +if (dcdc ==NULL ) { +dev_err (&pdev->dev,"Unable to allocate private data\n" ); +return -ENOMEM ; + } + + dcdc->wm831x = wm831x; + +/* For current parts this is correct; probably need to revisit +* in future. +*/ +snprintf (dcdc->name,sizeof (dcdc->name),"EPE%d" , id +1 ); + dcdc->desc.name = dcdc->name; + dcdc->desc.id = id +WM831X_EPE_BASE ;/* Offset in DCDC registers */ + dcdc->desc.ops = &wm831x_epe_ops; + dcdc->desc.type =REGULATOR_VOLTAGE ; + dcdc->desc.owner =THIS_MODULE ; + + dcdc->regulator =regulator_register (&dcdc->desc, &pdev->dev, + pdata->epe[id], dcdc); +if (IS_ERR (dcdc->regulator)) { + ret =PTR_ERR (dcdc->regulator); +dev_err (wm831x->dev,"Failed to register EPE%d: %d\n" , + id +1 , ret); + goto err; + } + +platform_set_drvdata (pdev, dcdc); + +return 0 ; + +err: +kfree (dcdc); +return ret; +} + +static __devexit int wm831x_epe_remove(struct platform_device *pdev) +{ +struct wm831x_dcdc *dcdc =platform_get_drvdata (pdev); + +regulator_unregister (dcdc->regulator); +kfree (dcdc); + +return 0 ; +} + +static struct platform_driver wm831x_epe_driver = { + .probe = wm831x_epe_probe, + .remove =__devexit_p (wm831x_epe_remove), + .driver = { + .name ="wm831x-epe" , + }, +}; +static int __init wm831x_dcdc_init (void ) {int ret;
@@ -624,12 +707,17 @@ static int __init wm831x_dcdc_init(void)if (ret !=0 )pr_err ("Failed to register WM831x BUCKP driver: %d\n" , ret); + ret =platform_driver_register (&wm831x_epe_driver); +if (ret !=0 ) +pr_err ("Failed to register WM831x EPE driver: %d\n" , ret); +return 0 ; }subsys_initcall (wm831x_dcdc_init); static void __exit wm831x_dcdc_exit(void) { +platform_driver_unregister (&wm831x_epe_driver);platform_driver_unregister (&wm831x_buckp_driver);platform_driver_unregister (&wm831x_buckv_driver); }
Signature · 1 line
1.6.3.3
PATCH 19/23 regulator: Add WM831x EPE support
The WM831x series of PMICs provide two optional outputs for controlling external devices during power sequencing, for example an external regulator. While in essence these are GPIOs the hardware presents them as DCDCs with very little control so provide support via the regulator API in that fashion.
---
Support missing platform data for the chip as a whole.
drivers/regulator/wm831x-dcdc.c | 88 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 88 insertions(+), 0 deletions(-)
drivers/regulator/wm831x-dcdc.c +88 -0
@@ -613,6 +613,89 @@ static struct platform_driver wm831x_buckp_driver = { }, }; +/* +* External Power Enable +* +* These aren't actually DCDCs but look like them in hardware so share +* code. +*/ + +#define WM831X_EPE_BASE 6 + +static struct regulator_ops wm831x_epe_ops = { + .is_enabled = wm831x_dcdc_is_enabled, + .enable = wm831x_dcdc_enable, + .disable = wm831x_dcdc_disable, + .get_status = wm831x_dcdc_get_status, +}; + +static __devinit int wm831x_epe_probe (struct platform_device *pdev) +{ +struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent); +struct wm831x_pdata *pdata = wm831x->dev->platform_data; +int id = pdev->id %ARRAY_SIZE (pdata->epe); +struct wm831x_dcdc *dcdc; +int ret; + +dev_dbg (&pdev->dev,"Probing EPE%d\n" , id +1 ); + +if (pdata ==NULL || pdata->epe[id] ==NULL ) +return -ENODEV ; + + dcdc =kzalloc (sizeof (struct wm831x_dcdc ),GFP_KERNEL ); +if (dcdc ==NULL ) { +dev_err (&pdev->dev,"Unable to allocate private data\n" ); +return -ENOMEM ; + } + + dcdc->wm831x = wm831x; + +/* For current parts this is correct; probably need to revisit +* in future. +*/ +snprintf (dcdc->name,sizeof (dcdc->name),"EPE%d" , id +1 ); + dcdc->desc.name = dcdc->name; + dcdc->desc.id = id +WM831X_EPE_BASE ;/* Offset in DCDC registers */ + dcdc->desc.ops = &wm831x_epe_ops; + dcdc->desc.type =REGULATOR_VOLTAGE ; + dcdc->desc.owner =THIS_MODULE ; + + dcdc->regulator =regulator_register (&dcdc->desc, &pdev->dev, + pdata->epe[id], dcdc); +if (IS_ERR (dcdc->regulator)) { + ret =PTR_ERR (dcdc->regulator); +dev_err (wm831x->dev,"Failed to register EPE%d: %d\n" , + id +1 , ret); + goto err; + } + +platform_set_drvdata (pdev, dcdc); + +return 0 ; + +err: +kfree (dcdc); +return ret; +} + +static __devexit int wm831x_epe_remove(struct platform_device *pdev) +{ +struct wm831x_dcdc *dcdc =platform_get_drvdata (pdev); + +regulator_unregister (dcdc->regulator); +kfree (dcdc); + +return 0 ; +} + +static struct platform_driver wm831x_epe_driver = { + .probe = wm831x_epe_probe, + .remove =__devexit_p (wm831x_epe_remove), + .driver = { + .name ="wm831x-epe" , + }, +}; +static int __init wm831x_dcdc_init (void ) {int ret;
@@ -624,12 +707,17 @@ static int __init wm831x_dcdc_init(void)if (ret !=0 )pr_err ("Failed to register WM831x BUCKP driver: %d\n" , ret); + ret =platform_driver_register (&wm831x_epe_driver); +if (ret !=0 ) +pr_err ("Failed to register WM831x EPE driver: %d\n" , ret); +return 0 ; }subsys_initcall (wm831x_dcdc_init); static void __exit wm831x_dcdc_exit(void) { +platform_driver_unregister (&wm831x_epe_driver);platform_driver_unregister (&wm831x_buckp_driver);platform_driver_unregister (&wm831x_buckv_driver); }
Signature · 1 line
1.6.3.3
PATCH 19/22 regulator: Add WM831x DC-DC boost convertor support
In reply to Mark BrownThe WM831x series of PMICs include a single DC-DC boost convertor. This adds basic support for this convertor.
--- drivers/regulator/wm831x-dcdc.c | 131 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 131 insertions(+), 0 deletions(-)
drivers/regulator/wm831x-dcdc.c +131 -0
@@ -614,6 +614,132 @@ static struct platform_driver wm831x_buckp_driver = { };/* +* DCDC boost convertors +*/ + +static int wm831x_boostp_get_status (struct regulator_dev *rdev) +{ +struct wm831x_dcdc *dcdc =rdev_get_drvdata (rdev); +struct wm831x *wm831x = dcdc->wm831x; +int ret; + +/* First, check for errors */ + ret =wm831x_reg_read (wm831x,WM831X_DCDC_UV_STATUS ); +if (ret <0 ) +return ret; + +if (ret & (1 <<rdev_get_id (rdev))) { +dev_dbg (wm831x->dev,"DCDC%d under voltage\n" , +rdev_get_id (rdev) +1 ); +return REGULATOR_STATUS_ERROR ; + } + +/* Is the regulator on? */ + ret =wm831x_reg_read (wm831x,WM831X_DCDC_STATUS ); +if (ret <0 ) +return ret; +if (ret & (1 <<rdev_get_id (rdev))) +return REGULATOR_STATUS_ON ; +else +return REGULATOR_STATUS_OFF ; +} + +static struct regulator_ops wm831x_boostp_ops = { + .get_status = wm831x_boostp_get_status, + + .is_enabled = wm831x_dcdc_is_enabled, + .enable = wm831x_dcdc_enable, + .disable = wm831x_dcdc_disable, +}; + +static __devinit int wm831x_boostp_probe (struct platform_device *pdev) +{ +struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent); +struct wm831x_pdata *pdata = wm831x->dev->platform_data; +int id = pdev->id %ARRAY_SIZE (pdata->dcdc); +struct wm831x_dcdc *dcdc; +struct resource *res; +int ret, irq; + +dev_dbg (&pdev->dev,"Probing DCDC%d\n" , id +1 ); + +if (pdata->dcdc[id] ==NULL ) +return -ENODEV ; + + dcdc =kzalloc (sizeof (struct wm831x_dcdc ),GFP_KERNEL ); +if (dcdc ==NULL ) { +dev_err (&pdev->dev,"Unable to allocate private data\n" ); +return -ENOMEM ; + } + + dcdc->wm831x = wm831x; + + res =platform_get_resource (pdev,IORESOURCE_IO ,0 ); +if (res ==NULL ) { +dev_err (&pdev->dev,"No I/O resource\n" ); + ret = -EINVAL ; + goto err; + } + dcdc->base = res->start; + +snprintf (dcdc->name,sizeof (dcdc->name),"DCDC%d" , id +1 ); + dcdc->desc.name = dcdc->name; + dcdc->desc.id = id; + dcdc->desc.type =REGULATOR_VOLTAGE ; + dcdc->desc.ops = &wm831x_boostp_ops; + dcdc->desc.owner =THIS_MODULE ; + + dcdc->regulator =regulator_register (&dcdc->desc, &pdev->dev, + pdata->dcdc[id], dcdc); +if (IS_ERR (dcdc->regulator)) { + ret =PTR_ERR (dcdc->regulator); +dev_err (wm831x->dev,"Failed to register DCDC%d: %d\n" , + id +1 , ret); + goto err; + } + + irq =platform_get_irq_byname (pdev,"UV" ); + ret =wm831x_request_irq (wm831x, irq, wm831x_dcdc_uv_irq, +IRQF_TRIGGER_RISING , dcdc->name, + dcdc); +if (ret !=0 ) { +dev_err (&pdev->dev,"Failed to request UV IRQ %d: %d\n" , + irq, ret); + goto err_regulator; + } + +platform_set_drvdata (pdev, dcdc); + +return 0 ; + +err_regulator: +regulator_unregister (dcdc->regulator); +err: +kfree (dcdc); +return ret; +} + +static __devexit int wm831x_boostp_remove(struct platform_device *pdev) +{ +struct wm831x_dcdc *dcdc =platform_get_drvdata (pdev); +struct wm831x *wm831x = dcdc->wm831x; + +wm831x_free_irq (wm831x,platform_get_irq_byname (pdev,"UV" ), dcdc); +regulator_unregister (dcdc->regulator); +kfree (dcdc); + +return 0 ; +} + +static struct platform_driver wm831x_boostp_driver = { + .probe = wm831x_boostp_probe, + .remove =__devexit_p (wm831x_boostp_remove), + .driver = { + .name ="wm831x-boostp" , + }, +}; + +/* * External Power Enable * * These aren't actually DCDCs but look like them in hardware so share
@@ -707,6 +833,10 @@ static int __init wm831x_dcdc_init(void)if (ret !=0 )pr_err ("Failed to register WM831x BUCKP driver: %d\n" , ret); + ret =platform_driver_register (&wm831x_boostp_driver); +if (ret !=0 ) +pr_err ("Failed to register WM831x BOOST driver: %d\n" , ret); + ret =platform_driver_register (&wm831x_epe_driver);if (ret !=0 )pr_err ("Failed to register WM831x EPE driver: %d\n" , ret);
@@ -718,6 +848,7 @@ subsys_initcall(wm831x_dcdc_init); static void __exit wm831x_dcdc_exit(void) {platform_driver_unregister (&wm831x_epe_driver); +platform_driver_unregister (&wm831x_boostp_driver);platform_driver_unregister (&wm831x_buckp_driver);platform_driver_unregister (&wm831x_buckv_driver); }
Signature · 1 line
1.6.3.3
PATCH 1/1 regulator: Add WM831x DC-DC boost convertor support
The WM831x series of PMICs include a single DC-DC boost convertor. This adds basic support for this convertor.
---
Support missing platform data for the chip as a whole.
drivers/regulator/wm831x-dcdc.c | 131 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 131 insertions(+), 0 deletions(-)
drivers/regulator/wm831x-dcdc.c +131 -0
@@ -614,6 +614,132 @@ static struct platform_driver wm831x_buckp_driver = { };/* +* DCDC boost convertors +*/ + +static int wm831x_boostp_get_status (struct regulator_dev *rdev) +{ +struct wm831x_dcdc *dcdc =rdev_get_drvdata (rdev); +struct wm831x *wm831x = dcdc->wm831x; +int ret; + +/* First, check for errors */ + ret =wm831x_reg_read (wm831x,WM831X_DCDC_UV_STATUS ); +if (ret <0 ) +return ret; + +if (ret & (1 <<rdev_get_id (rdev))) { +dev_dbg (wm831x->dev,"DCDC%d under voltage\n" , +rdev_get_id (rdev) +1 ); +return REGULATOR_STATUS_ERROR ; + } + +/* Is the regulator on? */ + ret =wm831x_reg_read (wm831x,WM831X_DCDC_STATUS ); +if (ret <0 ) +return ret; +if (ret & (1 <<rdev_get_id (rdev))) +return REGULATOR_STATUS_ON ; +else +return REGULATOR_STATUS_OFF ; +} + +static struct regulator_ops wm831x_boostp_ops = { + .get_status = wm831x_boostp_get_status, + + .is_enabled = wm831x_dcdc_is_enabled, + .enable = wm831x_dcdc_enable, + .disable = wm831x_dcdc_disable, +}; + +static __devinit int wm831x_boostp_probe (struct platform_device *pdev) +{ +struct wm831x *wm831x =dev_get_drvdata (pdev->dev.parent); +struct wm831x_pdata *pdata = wm831x->dev->platform_data; +int id = pdev->id %ARRAY_SIZE (pdata->dcdc); +struct wm831x_dcdc *dcdc; +struct resource *res; +int ret, irq; + +dev_dbg (&pdev->dev,"Probing DCDC%d\n" , id +1 ); + +if (pdata ==NULL || pdata->dcdc[id] ==NULL ) +return -ENODEV ; + + dcdc =kzalloc (sizeof (struct wm831x_dcdc ),GFP_KERNEL ); +if (dcdc ==NULL ) { +dev_err (&pdev->dev,"Unable to allocate private data\n" ); +return -ENOMEM ; + } + + dcdc->wm831x = wm831x; + + res =platform_get_resource (pdev,IORESOURCE_IO ,0 ); +if (res ==NULL ) { +dev_err (&pdev->dev,"No I/O resource\n" ); + ret = -EINVAL ; + goto err; + } + dcdc->base = res->start; + +snprintf (dcdc->name,sizeof (dcdc->name),"DCDC%d" , id +1 ); + dcdc->desc.name = dcdc->name; + dcdc->desc.id = id; + dcdc->desc.type =REGULATOR_VOLTAGE ; + dcdc->desc.ops = &wm831x_boostp_ops; + dcdc->desc.owner =THIS_MODULE ; + + dcdc->regulator =regulator_register (&dcdc->desc, &pdev->dev, + pdata->dcdc[id], dcdc); +if (IS_ERR (dcdc->regulator)) { + ret =PTR_ERR (dcdc->regulator); +dev_err (wm831x->dev,"Failed to register DCDC%d: %d\n" , + id +1 , ret); + goto err; + } + + irq =platform_get_irq_byname (pdev,"UV" ); + ret =wm831x_request_irq (wm831x, irq, wm831x_dcdc_uv_irq, +IRQF_TRIGGER_RISING , dcdc->name, + dcdc); +if (ret !=0 ) { +dev_err (&pdev->dev,"Failed to request UV IRQ %d: %d\n" , + irq, ret); + goto err_regulator; + } + +platform_set_drvdata (pdev, dcdc); + +return 0 ; + +err_regulator: +regulator_unregister (dcdc->regulator); +err: +kfree (dcdc); +return ret; +} + +static __devexit int wm831x_boostp_remove(struct platform_device *pdev) +{ +struct wm831x_dcdc *dcdc =platform_get_drvdata (pdev); +struct wm831x *wm831x = dcdc->wm831x; + +wm831x_free_irq (wm831x,platform_get_irq_byname (pdev,"UV" ), dcdc); +regulator_unregister (dcdc->regulator); +kfree (dcdc); + +return 0 ; +} + +static struct platform_driver wm831x_boostp_driver = { + .probe = wm831x_boostp_probe, + .remove =__devexit_p (wm831x_boostp_remove), + .driver = { + .name ="wm831x-boostp" , + }, +}; + +/* * External Power Enable * * These aren't actually DCDCs but look like them in hardware so share
@@ -707,6 +833,10 @@ static int __init wm831x_dcdc_init(void)if (ret !=0 )pr_err ("Failed to register WM831x BUCKP driver: %d\n" , ret); + ret =platform_driver_register (&wm831x_boostp_driver); +if (ret !=0 ) +pr_err ("Failed to register WM831x BOOST driver: %d\n" , ret); + ret =platform_driver_register (&wm831x_epe_driver);if (ret !=0 )pr_err ("Failed to register WM831x EPE driver: %d\n" , ret);
@@ -718,6 +848,7 @@ subsys_initcall(wm831x_dcdc_init); static void __exit wm831x_dcdc_exit(void) {platform_driver_unregister (&wm831x_epe_driver); +platform_driver_unregister (&wm831x_boostp_driver);platform_driver_unregister (&wm831x_buckp_driver);platform_driver_unregister (&wm831x_buckv_driver); }
Signature · 1 line
1.6.3.3
PATCH 20/22 regulator: Add WM831x ISINK support
In reply to Mark BrownThe WM831x series of PMICs provide two constant current sinks designed to drive strings of serially connected LEDs for applications such as backlights. This driver adds support for those regulators.
--- drivers/regulator/Makefile | 1 + drivers/regulator/wm831x-isink.c | 260 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 261 insertions(+), 0 deletions(-) create mode 100644 drivers/regulator/wm831x-isink.c
drivers/regulator/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_TWL4030) += twl4030-regulator.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o +obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
drivers/regulator/wm831x-isink.c new file +260 -0
260 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 1/1 regulator: Add WM831x ISINK support
The WM831x series of PMICs provide two constant current sinks designed to drive strings of serially connected LEDs for applications such as backlights. This driver adds support for those regulators.
---
Support missing platform data for the core chip.
drivers/regulator/Makefile | 1 + drivers/regulator/wm831x-isink.c | 260 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 261 insertions(+), 0 deletions(-) create mode 100644 drivers/regulator/wm831x-isink.c
drivers/regulator/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_REGULATOR_LP3971) += lp3971.o obj-$(CONFIG_REGULATOR_MAX1586) += max1586.o obj-$(CONFIG_REGULATOR_TWL4030) += twl4030-regulator.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-dcdc.o +obj-$(CONFIG_REGULATOR_WM831X) += wm831x-isink.o obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
drivers/regulator/wm831x-isink.c new file +260 -0
260 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 21/22 RTC: Add support for RTCs on Wolfson WM831x devices
In reply to Mark BrownThe WM831x series of PMICs contain RTC functionality. The hardware provides a 32 bit counter incrementing at 1Hz together with a per tick interrupt and an alarm value. For simplicity the driver chooses to define the epoch for the counter as the Unix epoch - if required platform data can be used in future to customise this.
When powered on from a completely cold state the RTC reports that it has not been configured - when this happens an error is returned when attempting to read the RTC in order to avoid use of values we know to be invalid.
The hardware also provides security features which mean that it can ignore attempts to set the RTC time in certain circumstances, most notably if the RTC is written to too often. These errors are detected by verifying the written RTC value.
--- drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-wm831x.c | 538 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 549 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-wm831x.c
drivers/rtc/Kconfig +10 -0
@@ -537,6 +537,16 @@ config RTC_DRV_V3020 This driver can also be built as a module. If so, the module will be called rtc-v3020. +config RTC_DRV_WM831X + tristate "Wolfson Microelectronics WM831x RTC" + depends on MFD_WM831X + help + If you say yes here you will get support for the RTC subsystem + of the Wolfson Microelectronics WM831X series PMICs. + + This driver can also be built as a module. If so, the module + will be called "rtc-wm831x". + config RTC_DRV_WM8350 tristate "Wolfson Microelectronics WM8350 RTC" depends on MFD_WM8350
drivers/rtc/Makefile +1 -0
@@ -76,6 +76,7 @@ obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl4030.o obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o +obj-$(CONFIG_RTC_DRV_WM831X) += rtc-wm831x.o obj-$(CONFIG_RTC_DRV_WM8350) += rtc-wm8350.o obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o obj-$(CONFIG_RTC_DRV_PCF50633) += rtc-pcf50633.o
drivers/rtc/rtc-wm831x.c new file +538 -0
538 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 1/1 RTC: Add support for RTCs on Wolfson WM831x devices
The WM831x series of PMICs contain RTC functionality. The hardware provides a 32 bit counter incrementing at 1Hz together with a per tick interrupt and an alarm value. For simplicity the driver chooses to define the epoch for the counter as the Unix epoch - if required platform data can be used in future to customise this.
When powered on from a completely cold state the RTC reports that it has not been configured - when this happens an error is returned when attempting to read the RTC in order to avoid use of values we know to be invalid.
The hardware also provides security features which mean that it can ignore attempts to set the RTC time in certain circumstances, most notably if the RTC is written to too often. These errors are detected by verifying the written RTC value.
---
Fix some cut'n'paste errors that crept in squashing things down to release.
drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-wm831x.c | 538 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 549 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-wm831x.c
drivers/rtc/Kconfig +10 -0
@@ -537,6 +537,16 @@ config RTC_DRV_V3020 This driver can also be built as a module. If so, the module will be called rtc-v3020. +config RTC_DRV_WM831X + tristate "Wolfson Microelectronics WM831x RTC" + depends on MFD_WM831X + help + If you say yes here you will get support for the RTC subsystem + of the Wolfson Microelectronics WM831X series PMICs. + + This driver can also be built as a module. If so, the module + will be called "rtc-wm831x". + config RTC_DRV_WM8350 tristate "Wolfson Microelectronics WM8350 RTC" depends on MFD_WM8350
drivers/rtc/Makefile +1 -0
@@ -76,6 +76,7 @@ obj-$(CONFIG_RTC_DRV_TWL4030) += rtc-twl4030.o obj-$(CONFIG_RTC_DRV_TX4939) += rtc-tx4939.o obj-$(CONFIG_RTC_DRV_V3020) += rtc-v3020.o obj-$(CONFIG_RTC_DRV_VR41XX) += rtc-vr41xx.o +obj-$(CONFIG_RTC_DRV_WM831X) += rtc-wm831x.o obj-$(CONFIG_RTC_DRV_WM8350) += rtc-wm8350.o obj-$(CONFIG_RTC_DRV_X1205) += rtc-x1205.o obj-$(CONFIG_RTC_DRV_PCF50633) += rtc-pcf50633.o
drivers/rtc/rtc-wm831x.c new file +538 -0
538 lines not on this page · raw message
Signature · 1 line
1.6.3.3
PATCH 22/22 Add support for WM831x watchdog
In reply to Mark BrownThe WM831x series of devices provide a watchdog with configurable behaviour on timer expiry.
Currently this driver support refreshes via a register or GPIO line and autonomous refreshes from a hardware source (eg, a clock).
--- drivers/watchdog/Kconfig | 7 + drivers/watchdog/Makefile | 1 + drivers/watchdog/wm831x_wdt.c | 441 +++++++++++++++++++++++++++++++++++ include/linux/mfd/wm831x/watchdog.h | 52 ++++ 4 files changed, 501 insertions(+), 0 deletions(-) create mode 100644 drivers/watchdog/wm831x_wdt.c create mode 100644 include/linux/mfd/wm831x/watchdog.h
drivers/watchdog/Kconfig +7 -0
@@ -55,6 +55,13 @@ config SOFT_WATCHDOG To compile this driver as a module, choose M here: the module will be called softdog. +config WM831X_WATCHDOG + tristate "WM831x watchdog" + depends on MFD_WM831X + help + Support for the watchdog in the WM831x AudioPlus PMICs. When + the watchdog triggers the system will be reset. + config WM8350_WATCHDOG tristate "WM8350 watchdog" depends on MFD_WM8350
drivers/watchdog/Makefile +1 -0
@@ -139,5 +139,6 @@ obj-$(CONFIG_WATCHDOG_CP1XXX) += cpwd.o # XTENSA Architecture # Architecture Independant +obj-$(CONFIG_WM831X_WATCHDOG) += wm831x_wdt.o obj-$(CONFIG_WM8350_WATCHDOG) += wm8350_wdt.o obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
drivers/watchdog/wm831x_wdt.c new file +441 -0
441 lines not on this page · raw message
include/linux/mfd/wm831x/watchdog.h new file +52 -0
52 lines not on this page · raw message
Signature · 1 line
1.6.3.3
Hi Mark,
Quoted 10 lines · Mark Brown
The following patch series adds initial support for the WM813x series of PMICs.
Since these devices have functionality that crosses many subsystems the patches cross many kernel trees. For clarity I'm presenting this initial submission as a single series but I have endeavoured to split things up so that the patches can be applied separately to the various subsystems. In order to avoid merge issues as patches are applied the platform data for the devices is included in the core patches.
Quoted 4 lines
Due to
KconfigandMakefilecollisons I've also included the patch adding hwmon support for the WM835x series of PMICs to the series. Other than the build system updates there is no interdependence between those two patches.
I applied patches [1-8], the gpio one, the 2 hwmon ones and the input one. I'll now wait for some more feedback for the remaining patches.
Thanks for your work.
Cheers,
Samuel.
Quoted 103 lines
Mark Brown (22):
mfd: Allow multiple MFD cells with the same name
mfd: Initial core support for WM831x series devices
mfd: Add WM831x interrupt support
mfd: Add WM831x AUXADC support
mfd: Conditionally add WM831x backlight subdevice
mfd: Add basic WM831x OTP support
mfd: Export ISEL values from WM831x core
mfd: Hook WM831x into build system
backlight: Add WM831x backlight driver
gpio: Add WM831X GPIO driver
hwmon: Add WM835x PMIC hardware monitoring driver
hwmon: WM831x PMIC hardware monitoring driver
Input: Add support for the WM831x ON pin
leds: Add WM831x status LED driver
power_supply: Add driver for the PMU on WM831x PMICs
regulator: Add WM831x DC-DC buck convertor support
regulator: Add WM831x LDO support
regulator: Add WM831x EPE support
regulator: Add WM831x DC-DC boost convertor support
regulator: Add WM831x ISINK support
RTC: Add support for RTCs on Wolfson WM831x devices [WATCHDOG] Add support for WM831x watchdogDocumentation/hwmon/wm831x | 37 + Documentation/hwmon/wm8350 | 26 + drivers/gpio/Kconfig | 7 + drivers/gpio/Makefile | 1 + drivers/gpio/wm831x-gpio.c | 252 ++++++ drivers/hwmon/Kconfig | 21 + drivers/hwmon/Makefile | 2 + drivers/hwmon/wm831x-hwmon.c | 236 ++++++ drivers/hwmon/wm8350-hwmon.c | 151 ++++ drivers/input/misc/Kconfig | 10 + drivers/input/misc/Makefile | 1 + drivers/input/misc/wm831x-on.c | 163 ++++ drivers/leds/Kconfig | 7 + drivers/leds/Makefile | 1 + drivers/leds/leds-wm831x-status.c | 341 ++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 2 + drivers/mfd/mfd-core.c | 2 +- drivers/mfd/wm831x-core.c | 1549 ++++++++++++++++++++++++++++++++++ drivers/mfd/wm831x-irq.c | 559 ++++++++++++ drivers/mfd/wm831x-otp.c | 83 ++ drivers/mfd/wm8350-core.c | 3 + drivers/power/Kconfig | 7 + drivers/power/Makefile | 1 + drivers/power/wm831x_power.c | 779 +++++++++++++++++ drivers/regulator/Kconfig | 7 + drivers/regulator/Makefile | 3 + drivers/regulator/wm831x-dcdc.c | 862 +++++++++++++++++++ drivers/regulator/wm831x-isink.c | 260 ++++++ drivers/regulator/wm831x-ldo.c | 852 +++++++++++++++++++ drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-wm831x.c | 538 ++++++++++++ drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/wm831x_bl.c | 250 ++++++ drivers/watchdog/Kconfig | 7 + drivers/watchdog/Makefile | 1 + drivers/watchdog/wm831x_wdt.c | 441 ++++++++++ include/linux/mfd/core.h | 1 + include/linux/mfd/wm831x/auxadc.h | 216 +++++ include/linux/mfd/wm831x/core.h | 289 +++++++ include/linux/mfd/wm831x/gpio.h | 55 ++ include/linux/mfd/wm831x/irq.h | 764 +++++++++++++++++ include/linux/mfd/wm831x/otp.h | 162 ++++ include/linux/mfd/wm831x/pdata.h | 113 +++ include/linux/mfd/wm831x/pmu.h | 189 +++++ include/linux/mfd/wm831x/regulator.h | 1218 ++++++++++++++++++++++++++ include/linux/mfd/wm831x/status.h | 34 + include/linux/mfd/wm831x/watchdog.h | 52 ++ include/linux/mfd/wm8350/core.h | 6 + 51 files changed, 10589 insertions(+), 1 deletions(-) create mode 100644 Documentation/hwmon/wm831x create mode 100644 Documentation/hwmon/wm8350 create mode 100644 drivers/gpio/wm831x-gpio.c create mode 100644 drivers/hwmon/wm831x-hwmon.c create mode 100644 drivers/hwmon/wm8350-hwmon.c create mode 100644 drivers/input/misc/wm831x-on.c create mode 100644 drivers/leds/leds-wm831x-status.c create mode 100644 drivers/mfd/wm831x-core.c create mode 100644 drivers/mfd/wm831x-irq.c create mode 100644 drivers/mfd/wm831x-otp.c create mode 100644 drivers/power/wm831x_power.c create mode 100644 drivers/regulator/wm831x-dcdc.c create mode 100644 drivers/regulator/wm831x-isink.c create mode 100644 drivers/regulator/wm831x-ldo.c create mode 100644 drivers/rtc/rtc-wm831x.c create mode 100644 drivers/video/backlight/wm831x_bl.c create mode 100644 drivers/watchdog/wm831x_wdt.c create mode 100644 include/linux/mfd/wm831x/auxadc.h create mode 100644 include/linux/mfd/wm831x/core.h create mode 100644 include/linux/mfd/wm831x/gpio.h create mode 100644 include/linux/mfd/wm831x/irq.h create mode 100644 include/linux/mfd/wm831x/otp.h create mode 100644 include/linux/mfd/wm831x/pdata.h create mode 100644 include/linux/mfd/wm831x/pmu.h create mode 100644 include/linux/mfd/wm831x/regulator.h create mode 100644 include/linux/mfd/wm831x/status.h create mode 100644 include/linux/mfd/wm831x/watchdog.h
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/
Quoted 13 lines · Samuel Ortiz
Hi Mark,
Quoted 10 lines · Mark Brown
The following patch series adds initial support for the WM813x series of PMICs.
Since these devices have functionality that crosses many subsystems the patches cross many kernel trees. For clarity I'm presenting this initial submission as a single series but I have endeavoured to split things up so that the patches can be applied separately to the various subsystems. In order to avoid merge issues as patches are applied the platform data for the devices is included in the core patches.
Quoted 7 lines
Quoted 4 lines
Due to
KconfigandMakefilecollisons I've also included the patch adding hwmon support for the WM835x series of PMICs to the series. Other than the build system updates there is no interdependence between those two patches.I applied patches [1-8], the gpio one, the 2 hwmon ones and the input one. I'll now wait for some more feedback for the remaining patches.
Regulator patches :-
Acked-by Liam Girdwood <[email protected]>
Thanks
Liam
Hi Liam
Quoted 18 lines · Liam Girdwood
Quoted 17 lines · Samuel Ortiz
Hi Mark,
Quoted 14 lines · Mark Brown
The following patch series adds initial support for the WM813x series of PMICs.
Since these devices have functionality that crosses many subsystems the patches cross many kernel trees. For clarity I'm presenting this initial submission as a single series but I have endeavoured to split things up so that the patches can be applied separately to the various subsystems. In order to avoid merge issues as patches are applied the platform data for the devices is included in the core patches.
Due to
KconfigandMakefilecollisons I've also included the patch adding hwmon support for the WM835x series of PMICs to the series. Other than the build system updates there is no interdependence between those two patches.
Quoted 7 lines
Quoted 3 lines
I applied patches [1-8], the gpio one, the 2 hwmon ones and the input one. I'll now wait for some more feedback for the remaining patches.
Regulator patches :-
Acked-by Liam Girdwood <[email protected]>
Thanks Liam, I applied all 5 of them to my for-next branch
Cheers,
Samuel.
Quoted 5 lines
Thanks
Liam
Signature · 2 lines
Intel Open Source Technology Centre http://oss.intel.com/