From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Samuel Ortiz <sameo@linux.intel.com>
Cc: linux-kernel@vger.kernel.org,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
David Brownell <dbrownell@users.sourceforge.net>
Subject: [PATCH 2/4] gpiolib: Make WM831x GPIO count dynamic
Date: Thu, 1 Oct 2009 15:41:05 +0100 [thread overview]
Message-ID: <1254408067-15908-2-git-send-email-broonie@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <1254408067-15908-1-git-send-email-broonie@opensource.wolfsonmicro.com>
This supports future devices with fewer GPIOs.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: David Brownell <dbrownell@users.sourceforge.net>
---
drivers/gpio/wm831x-gpio.c | 4 +---
drivers/mfd/wm831x-core.c | 3 +++
include/linux/mfd/wm831x/core.h | 2 ++
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpio/wm831x-gpio.c b/drivers/gpio/wm831x-gpio.c
index f9c09a5..f5e4934 100644
--- a/drivers/gpio/wm831x-gpio.c
+++ b/drivers/gpio/wm831x-gpio.c
@@ -23,8 +23,6 @@
#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;
@@ -192,7 +190,7 @@ static int __devinit wm831x_gpio_probe(struct platform_device *pdev)
wm831x_gpio->wm831x = wm831x;
wm831x_gpio->gpio_chip = template_chip;
- wm831x_gpio->gpio_chip.ngpio = WM831X_GPIO_MAX;
+ wm831x_gpio->gpio_chip.ngpio = wm831x->num_gpio;
wm831x_gpio->gpio_chip.dev = &pdev->dev;
if (pdata && pdata->gpio_base)
wm831x_gpio->gpio_chip.base = pdata->gpio_base;
diff --git a/drivers/mfd/wm831x-core.c b/drivers/mfd/wm831x-core.c
index 143ab83..fa651e5 100644
--- a/drivers/mfd/wm831x-core.c
+++ b/drivers/mfd/wm831x-core.c
@@ -1293,16 +1293,19 @@ static int wm831x_device_init(struct wm831x *wm831x, unsigned long id, int irq)
switch (ret) {
case WM8310:
parent = WM8310;
+ wm831x->num_gpio = 16;
dev_info(wm831x->dev, "WM8310 revision %c\n", 'A' + rev);
break;
case WM8311:
parent = WM8311;
+ wm831x->num_gpio = 16;
dev_info(wm831x->dev, "WM8311 revision %c\n", 'A' + rev);
break;
case WM8312:
parent = WM8312;
+ wm831x->num_gpio = 16;
dev_info(wm831x->dev, "WM8312 revision %c\n", 'A' + rev);
break;
diff --git a/include/linux/mfd/wm831x/core.h b/include/linux/mfd/wm831x/core.h
index 91eb493..c1bc59f 100644
--- a/include/linux/mfd/wm831x/core.h
+++ b/include/linux/mfd/wm831x/core.h
@@ -253,6 +253,8 @@ struct wm831x {
unsigned int irq_base;
int irq_masks[5];
+ int num_gpio;
+
struct mutex auxadc_lock;
/* The WM831x has a security key blocking access to certain
--
1.6.4.3
next prev parent reply other threads:[~2009-10-01 14:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 14:41 [PATCH 1/4] mfd: Refactor WM831x chip identification Mark Brown
2009-10-01 14:41 ` Mark Brown [this message]
2009-10-01 14:41 ` [PATCH 3/4] power_supply: Factor out WM831x backup battery charger Mark Brown
2009-10-01 14:41 ` [PATCH 4/4] mfd: Add support for WM8320 PMICs Mark Brown
2009-10-01 14:55 ` [PATCH 3/4] power_supply: Factor out WM831x backup battery charger Anton Vorontsov
2009-10-01 15:03 ` Mark Brown
2009-10-01 15:27 ` Samuel Ortiz
2009-10-01 15:30 ` Anton Vorontsov
2009-10-01 15:35 ` [PATCH 1/4] mfd: Refactor WM831x chip identification Samuel Ortiz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1254408067-15908-2-git-send-email-broonie@opensource.wolfsonmicro.com \
--to=broonie@opensource.wolfsonmicro.com \
--cc=dbrownell@users.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sameo@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome