* [PATCH 0/22] WM831x drivers @ 2009-07-27 13:45 Mark Brown 2009-07-27 13:46 ` [PATCH 13/22] Input: Add support for the WM831x ON pin Mark Brown 2009-08-04 11:35 ` [PATCH 0/22] WM831x drivers Samuel Ortiz 0 siblings, 2 replies; 8+ messages in thread From: Mark Brown @ 2009-07-27 13:45 UTC (permalink / raw) To: Samuel Ortiz, Richard Purdie, David Brownell, Dmitry Torokhov Cc: linux-kernel, lm-sensors, linux-input, rtc-linux 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 ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 13/22] Input: Add support for the WM831x ON pin 2009-07-27 13:45 [PATCH 0/22] WM831x drivers Mark Brown @ 2009-07-27 13:46 ` Mark Brown 2009-07-27 15:38 ` Dmitry Torokhov 2009-07-28 14:13 ` [PATCH] " Mark Brown 2009-08-04 11:35 ` [PATCH 0/22] WM831x drivers Samuel Ortiz 1 sibling, 2 replies; 8+ messages in thread From: Mark Brown @ 2009-07-27 13:46 UTC (permalink / raw) To: Samuel Ortiz Cc: linux-kernel, Mark Brown, Dmitry Torokhov, Dmitry Torokhov, linux-input The 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. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Dmitry Torokhov <dtor@mail.ru> Cc: linux-input@vger.kernel.org --- 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 diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index cbe21bc..852941d 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -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 diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 79c1e9a..c97533f 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -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 diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c new file mode 100644 index 0000000..4c3941c --- /dev/null +++ b/drivers/input/misc/wm831x-on.c @@ -0,0 +1,163 @@ +/** + * wm831x-on.c - WM831X ON pind river + * + * Copyright (C) 2009 Wolfson Microelectronics plc + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of this + * archive for more details. + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <linux/module.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/input.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/workqueue.h> +#include <linux/mfd/wm831x/core.h> + +struct wm831x_on { + struct input_dev *dev; + struct delayed_work work; + struct wm831x *wm831x; +}; + +/* + * The chip gives us an interrupt when the ON pin is asserted but we + * then need to poll to see when the pin is deasserted. + */ +static void wm831x_poll_on(struct work_struct *work) +{ + struct wm831x_on *wm831x_on = container_of(work, struct wm831x_on, + work.work); + struct wm831x *wm831x = wm831x_on->wm831x; + int poll, ret; + + ret = wm831x_reg_read(wm831x, WM831X_ON_PIN_CONTROL); + if (ret >= 0) { + poll = !(ret & WM831X_ON_PIN_STS); + + input_report_key(wm831x_on->dev, KEY_POWER, poll); + input_sync(wm831x_on->dev); + } else { + dev_err(wm831x->dev, "Failed to read ON status: %d\n", ret); + poll = 1; + } + + if (poll) + schedule_delayed_work(&wm831x_on->work, 100); +} + +static irqreturn_t wm831x_on_irq(int irq, void *data) +{ + struct wm831x_on *wm831x_on = data; + + schedule_work(&wm831x_on->work.work); + + return IRQ_HANDLED; +} + +static int __devinit wm831x_on_probe(struct platform_device *pdev) +{ + struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); + struct wm831x_on *wm831x_on; + int irq = platform_get_irq(pdev, 0); + int ret; + + wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL); + if (!wm831x_on) { + dev_err(&pdev->dev, "Can't allocate data\n"); + return -ENOMEM; + } + + wm831x_on->wm831x = wm831x; + INIT_DELAYED_WORK(&wm831x_on->work, wm831x_poll_on); + + wm831x_on->dev = input_allocate_device(); + if (!wm831x_on->dev) { + dev_err(&pdev->dev, "Can't allocate input dev\n"); + ret = -ENOMEM; + goto err; + } + + wm831x_on->dev->evbit[0] = BIT_MASK(EV_KEY); + wm831x_on->dev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER); + wm831x_on->dev->name = "wm831x_on"; + wm831x_on->dev->phys = "wm831x_on/input0"; + wm831x_on->dev->dev.parent = &pdev->dev; + + ret = wm831x_request_irq(wm831x, irq, wm831x_on_irq, + IRQF_TRIGGER_RISING, "wm831x_on", wm831x_on); + if (ret < 0) { + dev_err(&pdev->dev, "Unable to request IRQ: %d\n", ret); + goto err_input_dev; + } + ret = input_register_device(wm831x_on->dev); + if (ret) { + dev_dbg(&pdev->dev, "Can't register input device: %d\n", ret); + goto err_irq; + } + + platform_set_drvdata(pdev, wm831x_on); + + return 0; + +err_irq: + wm831x_free_irq(wm831x, irq, NULL); +err_input_dev: + input_free_device(wm831x_on->dev); +err: + kfree(wm831x_on); + return ret; +} + +static int __devexit wm831x_on_remove(struct platform_device *pdev) +{ + struct wm831x_on *wm831x_on = platform_get_drvdata(pdev); + int irq = platform_get_irq(pdev, 0); + + wm831x_free_irq(wm831x_on->wm831x, irq, wm831x_on); + cancel_delayed_work_sync(&wm831x_on->work); + input_unregister_device(wm831x_on->dev); + kfree(wm831x_on); + + return 0; +} + +static struct platform_driver wm831x_on_driver = { + .probe = wm831x_on_probe, + .remove = __devexit_p(wm831x_on_remove), + .driver = { + .name = "wm831x-on", + .owner = THIS_MODULE, + }, +}; + +static int __init wm831x_on_init(void) +{ + return platform_driver_register(&wm831x_on_driver); +} +module_init(wm831x_on_init); + +static void __exit wm831x_on_exit(void) +{ + platform_driver_unregister(&wm831x_on_driver); +} +module_exit(wm831x_on_exit); + +MODULE_ALIAS("platform:wm831x-on"); +MODULE_DESCRIPTION("WM831x ON pin"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); + diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h index d7134df..91eb493 100644 --- a/include/linux/mfd/wm831x/core.h +++ b/include/linux/mfd/wm831x/core.h @@ -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; -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 13/22] Input: Add support for the WM831x ON pin 2009-07-27 13:46 ` [PATCH 13/22] Input: Add support for the WM831x ON pin Mark Brown @ 2009-07-27 15:38 ` Dmitry Torokhov 2009-07-27 15:41 ` Mark Brown 2009-07-28 14:13 ` [PATCH] " Mark Brown 1 sibling, 1 reply; 8+ messages in thread From: Dmitry Torokhov @ 2009-07-27 15:38 UTC (permalink / raw) To: Mark Brown; +Cc: Samuel Ortiz, linux-kernel, linux-input Hi Mark, On Mon, Jul 27, 2009 at 02:46:03PM +0100, Mark Brown wrote: > --- /dev/null > +++ b/drivers/input/misc/wm831x-on.c > @@ -0,0 +1,163 @@ > +/** > + * wm831x-on.c - WM831X ON pind river > + * "Pind river"? ;) > + > +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: Acked-by: Dmitry Torokhov <dtor@mail.ru> 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! -- Dmitry ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 13/22] Input: Add support for the WM831x ON pin 2009-07-27 15:38 ` Dmitry Torokhov @ 2009-07-27 15:41 ` Mark Brown 0 siblings, 0 replies; 8+ messages in thread From: Mark Brown @ 2009-07-27 15:41 UTC (permalink / raw) To: Dmitry Torokhov; +Cc: Samuel Ortiz, linux-kernel, linux-input On Mon, Jul 27, 2009 at 08:38:05AM -0700, Dmitry Torokhov wrote: > On Mon, Jul 27, 2009 at 02:46:03PM +0100, Mark Brown wrote: > > + * wm831x-on.c - WM831X ON pind river > "Pind river"? ;) Err, yes. Highly innovative new technology! > > +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: > Acked-by: Dmitry Torokhov <dtor@mail.ru> > 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. ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] Input: Add support for the WM831x ON pin 2009-07-27 13:46 ` [PATCH 13/22] Input: Add support for the WM831x ON pin Mark Brown 2009-07-27 15:38 ` Dmitry Torokhov @ 2009-07-28 14:13 ` Mark Brown 1 sibling, 0 replies; 8+ messages in thread From: Mark Brown @ 2009-07-28 14:13 UTC (permalink / raw) To: Samuel Ortiz Cc: linux-kernel, Dmitry Torokhov, Mark Brown, Dmitry Torokhov, linux-input The 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. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Acked-by: Dmitry Torokhov <dtor@mail.ru> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: linux-input@vger.kernel.org --- - 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 diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig index cbe21bc..852941d 100644 --- a/drivers/input/misc/Kconfig +++ b/drivers/input/misc/Kconfig @@ -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 diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile index 79c1e9a..c97533f 100644 --- a/drivers/input/misc/Makefile +++ b/drivers/input/misc/Makefile @@ -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 diff --git a/drivers/input/misc/wm831x-on.c b/drivers/input/misc/wm831x-on.c new file mode 100644 index 0000000..ba4f5dd --- /dev/null +++ b/drivers/input/misc/wm831x-on.c @@ -0,0 +1,163 @@ +/** + * wm831x-on.c - WM831X ON pin driver + * + * Copyright (C) 2009 Wolfson Microelectronics plc + * + * This file is subject to the terms and conditions of the GNU General + * Public License. See the file "COPYING" in the main directory of this + * archive for more details. + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <linux/module.h> +#include <linux/init.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/input.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/workqueue.h> +#include <linux/mfd/wm831x/core.h> + +struct wm831x_on { + struct input_dev *dev; + struct delayed_work work; + struct wm831x *wm831x; +}; + +/* + * The chip gives us an interrupt when the ON pin is asserted but we + * then need to poll to see when the pin is deasserted. + */ +static void wm831x_poll_on(struct work_struct *work) +{ + struct wm831x_on *wm831x_on = container_of(work, struct wm831x_on, + work.work); + struct wm831x *wm831x = wm831x_on->wm831x; + int poll, ret; + + ret = wm831x_reg_read(wm831x, WM831X_ON_PIN_CONTROL); + if (ret >= 0) { + poll = !(ret & WM831X_ON_PIN_STS); + + input_report_key(wm831x_on->dev, KEY_POWER, poll); + input_sync(wm831x_on->dev); + } else { + dev_err(wm831x->dev, "Failed to read ON status: %d\n", ret); + poll = 1; + } + + if (poll) + schedule_delayed_work(&wm831x_on->work, 100); +} + +static irqreturn_t wm831x_on_irq(int irq, void *data) +{ + struct wm831x_on *wm831x_on = data; + + schedule_delayed_work(&wm831x_on->work, 0); + + return IRQ_HANDLED; +} + +static int __devinit wm831x_on_probe(struct platform_device *pdev) +{ + struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); + struct wm831x_on *wm831x_on; + int irq = platform_get_irq(pdev, 0); + int ret; + + wm831x_on = kzalloc(sizeof(struct wm831x_on), GFP_KERNEL); + if (!wm831x_on) { + dev_err(&pdev->dev, "Can't allocate data\n"); + return -ENOMEM; + } + + wm831x_on->wm831x = wm831x; + INIT_DELAYED_WORK(&wm831x_on->work, wm831x_poll_on); + + wm831x_on->dev = input_allocate_device(); + if (!wm831x_on->dev) { + dev_err(&pdev->dev, "Can't allocate input dev\n"); + ret = -ENOMEM; + goto err; + } + + wm831x_on->dev->evbit[0] = BIT_MASK(EV_KEY); + wm831x_on->dev->keybit[BIT_WORD(KEY_POWER)] = BIT_MASK(KEY_POWER); + wm831x_on->dev->name = "wm831x_on"; + wm831x_on->dev->phys = "wm831x_on/input0"; + wm831x_on->dev->dev.parent = &pdev->dev; + + ret = wm831x_request_irq(wm831x, irq, wm831x_on_irq, + IRQF_TRIGGER_RISING, "wm831x_on", wm831x_on); + if (ret < 0) { + dev_err(&pdev->dev, "Unable to request IRQ: %d\n", ret); + goto err_input_dev; + } + ret = input_register_device(wm831x_on->dev); + if (ret) { + dev_dbg(&pdev->dev, "Can't register input device: %d\n", ret); + goto err_irq; + } + + platform_set_drvdata(pdev, wm831x_on); + + return 0; + +err_irq: + wm831x_free_irq(wm831x, irq, NULL); +err_input_dev: + input_free_device(wm831x_on->dev); +err: + kfree(wm831x_on); + return ret; +} + +static int __devexit wm831x_on_remove(struct platform_device *pdev) +{ + struct wm831x_on *wm831x_on = platform_get_drvdata(pdev); + int irq = platform_get_irq(pdev, 0); + + wm831x_free_irq(wm831x_on->wm831x, irq, wm831x_on); + cancel_delayed_work_sync(&wm831x_on->work); + input_unregister_device(wm831x_on->dev); + kfree(wm831x_on); + + return 0; +} + +static struct platform_driver wm831x_on_driver = { + .probe = wm831x_on_probe, + .remove = __devexit_p(wm831x_on_remove), + .driver = { + .name = "wm831x-on", + .owner = THIS_MODULE, + }, +}; + +static int __init wm831x_on_init(void) +{ + return platform_driver_register(&wm831x_on_driver); +} +module_init(wm831x_on_init); + +static void __exit wm831x_on_exit(void) +{ + platform_driver_unregister(&wm831x_on_driver); +} +module_exit(wm831x_on_exit); + +MODULE_ALIAS("platform:wm831x-on"); +MODULE_DESCRIPTION("WM831x ON pin"); +MODULE_LICENSE("GPL"); +MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); + diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h index d7134df..91eb493 100644 --- a/include/linux/mfd/wm831x/core.h +++ b/include/linux/mfd/wm831x/core.h @@ -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; -- 1.6.3.3 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/22] WM831x drivers 2009-07-27 13:45 [PATCH 0/22] WM831x drivers Mark Brown 2009-07-27 13:46 ` [PATCH 13/22] Input: Add support for the WM831x ON pin Mark Brown @ 2009-08-04 11:35 ` Samuel Ortiz 2009-08-04 11:44 ` Liam Girdwood 1 sibling, 1 reply; 8+ messages in thread From: Samuel Ortiz @ 2009-08-04 11:35 UTC (permalink / raw) To: Mark Brown Cc: Richard Purdie, David Brownell, Dmitry Torokhov, Dmitry Torokhov, Jean Delvare, Anton Vorontsov, Liam Girdwood, Alessandro Zummo, Wim Van Sebroeck, linux-kernel, lm-sensors, linux-input, rtc-linux Hi Mark, On Mon, Jul 27, 2009 at 02:45:27PM +0100, Mark Brown wrote: > 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. 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. > 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 -- Intel Open Source Technology Centre http://oss.intel.com/ ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/22] WM831x drivers 2009-08-04 11:35 ` [PATCH 0/22] WM831x drivers Samuel Ortiz @ 2009-08-04 11:44 ` Liam Girdwood 2009-08-04 14:07 ` Samuel Ortiz 0 siblings, 1 reply; 8+ messages in thread From: Liam Girdwood @ 2009-08-04 11:44 UTC (permalink / raw) To: Samuel Ortiz Cc: Mark Brown, Richard Purdie, David Brownell, Dmitry Torokhov, Dmitry Torokhov, Jean Delvare, Anton Vorontsov, Alessandro Zummo, Wim Van Sebroeck, linux-kernel, lm-sensors, linux-input, rtc-linux On Tue, 2009-08-04 at 13:35 +0200, Samuel Ortiz wrote: > Hi Mark, > > On Mon, Jul 27, 2009 at 02:45:27PM +0100, Mark Brown wrote: > > 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. > 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 <lrg@slimlogic.co.uk> Thanks Liam ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/22] WM831x drivers 2009-08-04 11:44 ` Liam Girdwood @ 2009-08-04 14:07 ` Samuel Ortiz 0 siblings, 0 replies; 8+ messages in thread From: Samuel Ortiz @ 2009-08-04 14:07 UTC (permalink / raw) To: Liam Girdwood Cc: Mark Brown, Richard Purdie, David Brownell, Dmitry Torokhov, Dmitry Torokhov, Jean Delvare, Anton Vorontsov, Alessandro Zummo, Wim Van Sebroeck, linux-kernel, lm-sensors, linux-input, rtc-linux Hi Liam On Tue, Aug 04, 2009 at 12:44:09PM +0100, Liam Girdwood wrote: > On Tue, 2009-08-04 at 13:35 +0200, Samuel Ortiz wrote: > > Hi Mark, > > > > On Mon, Jul 27, 2009 at 02:45:27PM +0100, Mark Brown wrote: > > > 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. > > 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 <lrg@slimlogic.co.uk> Thanks Liam, I applied all 5 of them to my for-next branch Cheers, Samuel. > Thanks > > Liam > > -- Intel Open Source Technology Centre http://oss.intel.com/ ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-08-04 14:07 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2009-07-27 13:45 [PATCH 0/22] WM831x drivers Mark Brown 2009-07-27 13:46 ` [PATCH 13/22] Input: Add support for the WM831x ON pin Mark Brown 2009-07-27 15:38 ` Dmitry Torokhov 2009-07-27 15:41 ` Mark Brown 2009-07-28 14:13 ` [PATCH] " Mark Brown 2009-08-04 11:35 ` [PATCH 0/22] WM831x drivers Samuel Ortiz 2009-08-04 11:44 ` Liam Girdwood 2009-08-04 14:07 ` Samuel Ortiz
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).