linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] Random GPIO updates
@ 2011-12-07 16:22 Mark Brown
  2011-12-07 16:23 ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
  2011-12-29 14:00 ` [PATCH 0/4] Random GPIO updates Mark Brown
  0 siblings, 2 replies; 14+ messages in thread
From: Mark Brown @ 2011-12-07 16:22 UTC (permalink / raw)
  To: Grant Likely; +Cc: linux-kernel, Kukjin Kim

This is a fairly random selection of updates I've been sitting on for
the gpios, partly built up over your sabbatical but a couple predating
that.  No real theme here except for time.

The following changes since commit 5611cc4572e889b62a7b4c72a413536bf6a9c416:

  Linux 3.2-rc4 (2011-12-01 14:56:01 -0800)

are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git gpio/misc

Mark Brown (4):
      gpio: Explicitly index samsung_gpio_cfgs
      gpio: Fix typo in comment in Samsung driver
      gpio: Convert GPIO drivers to module_platform_driver
      gpio: Add decode of WM8994 GPIO configuration

 drivers/gpio/gpio-adp5520.c    |   12 +------
 drivers/gpio/gpio-cs5535.c     |   13 +------
 drivers/gpio/gpio-da9052.c     |   12 +------
 drivers/gpio/gpio-generic.c    |   12 +------
 drivers/gpio/gpio-janz-ttl.c   |   13 +------
 drivers/gpio/gpio-rdc321x.c    |   13 +------
 drivers/gpio/gpio-samsung.c    |   31 ++++++++++------
 drivers/gpio/gpio-sch.c        |   13 +------
 drivers/gpio/gpio-timberdale.c |   13 +------
 drivers/gpio/gpio-ucb1400.c    |   13 +------
 drivers/gpio/gpio-vr41xx.c     |   13 +------
 drivers/gpio/gpio-vx855.c      |   12 +------
 drivers/gpio/gpio-wm8994.c     |   79 +++++++++++++++++++++++++++++++++++++++-
 13 files changed, 108 insertions(+), 141 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs
  2011-12-07 16:22 [PATCH 0/4] Random GPIO updates Mark Brown
@ 2011-12-07 16:23 ` Mark Brown
  2011-12-07 16:23   ` [PATCH 2/4] gpio: Fix typo in comment in Samsung driver Mark Brown
                     ` (4 more replies)
  2011-12-29 14:00 ` [PATCH 0/4] Random GPIO updates Mark Brown
  1 sibling, 5 replies; 14+ messages in thread
From: Mark Brown @ 2011-12-07 16:23 UTC (permalink / raw)
  To: Grant Likely; +Cc: Kukjin Kim, linux-kernel, Mark Brown

Make it easier to follow the by number references into samsung_gpio_cfgs
by putting the indexes into the code initialising the array, improving
readability a bit. Ideally we wouldn't be using magic array indexes at all
but this is easier than coming up with a better way.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/gpio/gpio-samsung.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index 6b4d23f..f1c1ecd 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -470,33 +470,42 @@ static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = {
 #endif
 
 static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
-	{
+	[0] = {
 		.cfg_eint	= 0x0,
-	}, {
+	},
+	[1] = {
 		.cfg_eint	= 0x3,
-	}, {
+	},
+	[2] = {
 		.cfg_eint	= 0x7,
-	}, {
+	},
+	[3] = {
 		.cfg_eint	= 0xF,
-	}, {
+	},
+	[4] = {
 		.cfg_eint	= 0x0,
 		.set_config	= samsung_gpio_setcfg_2bit,
 		.get_config	= samsung_gpio_getcfg_2bit,
-	}, {
+	},
+	[5] = {
 		.cfg_eint	= 0x2,
 		.set_config	= samsung_gpio_setcfg_2bit,
 		.get_config	= samsung_gpio_getcfg_2bit,
-	}, {
+	},
+	[6] = {
 		.cfg_eint	= 0x3,
 		.set_config	= samsung_gpio_setcfg_2bit,
 		.get_config	= samsung_gpio_getcfg_2bit,
-	}, {
+	},
+	[7] = {
 		.set_config	= samsung_gpio_setcfg_2bit,
 		.get_config	= samsung_gpio_getcfg_2bit,
-	}, {
+	},
+	[8] = {
 		.set_pull	= exynos4_gpio_setpull,
 		.get_pull	= exynos4_gpio_getpull,
-	}, {
+	},
+	[9] = {
 		.cfg_eint	= 0x3,
 		.set_pull	= exynos4_gpio_setpull,
 		.get_pull	= exynos4_gpio_getpull,
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 2/4] gpio: Fix typo in comment in Samsung driver
  2011-12-07 16:23 ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
@ 2011-12-07 16:23   ` Mark Brown
  2011-12-08  0:28     ` Kukjin Kim
  2012-01-02  7:27     ` Grant Likely
  2011-12-07 16:24   ` [PATCH 3/4] gpio: Convert GPIO drivers to module_platform_driver Mark Brown
                     ` (3 subsequent siblings)
  4 siblings, 2 replies; 14+ messages in thread
From: Mark Brown @ 2011-12-07 16:23 UTC (permalink / raw)
  To: Grant Likely; +Cc: Kukjin Kim, linux-kernel, Mark Brown

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/gpio/gpio-samsung.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
index f1c1ecd..f44c020 100644
--- a/drivers/gpio/gpio-samsung.c
+++ b/drivers/gpio/gpio-samsung.c
@@ -233,7 +233,7 @@ static int samsung_gpio_setcfg_2bit(struct samsung_gpio_chip *chip,
  * @chip: The gpio chip that is being configured.
  * @off: The offset for the GPIO being configured.
  *
- * The reverse of samsung_gpio_setcfg_2bit(). Will return a value whicg
+ * The reverse of samsung_gpio_setcfg_2bit(). Will return a value which
  * could be directly passed back to samsung_gpio_setcfg_2bit(), from the
  * S3C_GPIO_SPECIAL() macro.
  */
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 3/4] gpio: Convert GPIO drivers to module_platform_driver
  2011-12-07 16:23 ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
  2011-12-07 16:23   ` [PATCH 2/4] gpio: Fix typo in comment in Samsung driver Mark Brown
@ 2011-12-07 16:24   ` Mark Brown
  2012-01-02  7:27     ` Grant Likely
  2011-12-07 16:24   ` [PATCH 4/4] gpio: Add decode of WM8994 GPIO configuration Mark Brown
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2011-12-07 16:24 UTC (permalink / raw)
  To: Grant Likely; +Cc: Kukjin Kim, linux-kernel, Mark Brown

Where appropriate factor out some boilerplate code for platform device
registration into module_platform_driver. Drivers that don't use the
standard module_init initcall haven't been converted.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/gpio/gpio-adp5520.c    |   12 +-----------
 drivers/gpio/gpio-cs5535.c     |   13 +------------
 drivers/gpio/gpio-da9052.c     |   12 +-----------
 drivers/gpio/gpio-generic.c    |   12 +-----------
 drivers/gpio/gpio-janz-ttl.c   |   13 +------------
 drivers/gpio/gpio-rdc321x.c    |   13 +------------
 drivers/gpio/gpio-sch.c        |   13 +------------
 drivers/gpio/gpio-timberdale.c |   13 +------------
 drivers/gpio/gpio-ucb1400.c    |   13 +------------
 drivers/gpio/gpio-vr41xx.c     |   13 +------------
 drivers/gpio/gpio-vx855.c      |   12 +-----------
 11 files changed, 11 insertions(+), 128 deletions(-)

diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c
index 9f27815..2f263cc 100644
--- a/drivers/gpio/gpio-adp5520.c
+++ b/drivers/gpio/gpio-adp5520.c
@@ -193,17 +193,7 @@ static struct platform_driver adp5520_gpio_driver = {
 	.remove		= __devexit_p(adp5520_gpio_remove),
 };
 
-static int __init adp5520_gpio_init(void)
-{
-	return platform_driver_register(&adp5520_gpio_driver);
-}
-module_init(adp5520_gpio_init);
-
-static void __exit adp5520_gpio_exit(void)
-{
-	platform_driver_unregister(&adp5520_gpio_driver);
-}
-module_exit(adp5520_gpio_exit);
+module_platform_driver(adp5520_gpio_driver);
 
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("GPIO ADP5520 Driver");
diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c
index 6e16cba..a6403a0 100644
--- a/drivers/gpio/gpio-cs5535.c
+++ b/drivers/gpio/gpio-cs5535.c
@@ -382,18 +382,7 @@ static struct platform_driver cs5535_gpio_driver = {
 	.remove = __devexit_p(cs5535_gpio_remove),
 };
 
-static int __init cs5535_gpio_init(void)
-{
-	return platform_driver_register(&cs5535_gpio_driver);
-}
-
-static void __exit cs5535_gpio_exit(void)
-{
-	platform_driver_unregister(&cs5535_gpio_driver);
-}
-
-module_init(cs5535_gpio_init);
-module_exit(cs5535_gpio_exit);
+module_platform_driver(cs5535_gpio_driver);
 
 MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
 MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver");
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c
index 038f5eb..58ac377 100644
--- a/drivers/gpio/gpio-da9052.c
+++ b/drivers/gpio/gpio-da9052.c
@@ -259,17 +259,7 @@ static struct platform_driver da9052_gpio_driver = {
 	},
 };
 
-static int __init da9052_gpio_init(void)
-{
-	return platform_driver_register(&da9052_gpio_driver);
-}
-module_init(da9052_gpio_init);
-
-static void __exit da9052_gpio_exit(void)
-{
-	return platform_driver_unregister(&da9052_gpio_driver);
-}
-module_exit(da9052_gpio_exit);
+module_platform_driver(da9052_gpio_driver);
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("DA9052 GPIO Device Driver");
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index 4e24436..e38dd0c 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -524,17 +524,7 @@ static struct platform_driver bgpio_driver = {
 	.remove = __devexit_p(bgpio_pdev_remove),
 };
 
-static int __init bgpio_platform_init(void)
-{
-	return platform_driver_register(&bgpio_driver);
-}
-module_init(bgpio_platform_init);
-
-static void __exit bgpio_platform_exit(void)
-{
-	platform_driver_unregister(&bgpio_driver);
-}
-module_exit(bgpio_platform_exit);
+module_platform_driver(bgpio_driver);
 
 #endif /* CONFIG_GPIO_GENERIC_PLATFORM */
 
diff --git a/drivers/gpio/gpio-janz-ttl.c b/drivers/gpio/gpio-janz-ttl.c
index 813ac07..9ec698e 100644
--- a/drivers/gpio/gpio-janz-ttl.c
+++ b/drivers/gpio/gpio-janz-ttl.c
@@ -239,20 +239,9 @@ static struct platform_driver ttl_driver = {
 	.remove		= __devexit_p(ttl_remove),
 };
 
-static int __init ttl_init(void)
-{
-	return platform_driver_register(&ttl_driver);
-}
-
-static void __exit ttl_exit(void)
-{
-	platform_driver_unregister(&ttl_driver);
-}
+module_platform_driver(ttl_driver);
 
 MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>");
 MODULE_DESCRIPTION("Janz MODULbus VMOD-TTL Driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:janz-ttl");
-
-module_init(ttl_init);
-module_exit(ttl_exit);
diff --git a/drivers/gpio/gpio-rdc321x.c b/drivers/gpio/gpio-rdc321x.c
index 2762698..e97016a 100644
--- a/drivers/gpio/gpio-rdc321x.c
+++ b/drivers/gpio/gpio-rdc321x.c
@@ -227,18 +227,7 @@ static struct platform_driver rdc321x_gpio_driver = {
 	.remove		= __devexit_p(rdc321x_gpio_remove),
 };
 
-static int __init rdc321x_gpio_init(void)
-{
-	return platform_driver_register(&rdc321x_gpio_driver);
-}
-
-static void __exit rdc321x_gpio_exit(void)
-{
-	platform_driver_unregister(&rdc321x_gpio_driver);
-}
-
-module_init(rdc321x_gpio_init);
-module_exit(rdc321x_gpio_exit);
+module_platform_driver(rdc321x_gpio_driver);
 
 MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
 MODULE_DESCRIPTION("RDC321x GPIO driver");
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index 1635158..8cadf4d 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -297,18 +297,7 @@ static struct platform_driver sch_gpio_driver = {
 	.remove		= __devexit_p(sch_gpio_remove),
 };
 
-static int __init sch_gpio_init(void)
-{
-	return platform_driver_register(&sch_gpio_driver);
-}
-
-static void __exit sch_gpio_exit(void)
-{
-	platform_driver_unregister(&sch_gpio_driver);
-}
-
-module_init(sch_gpio_init);
-module_exit(sch_gpio_exit);
+module_platform_driver(sch_gpio_driver);
 
 MODULE_AUTHOR("Denis Turischev <denis@compulab.co.il>");
 MODULE_DESCRIPTION("GPIO interface for Intel Poulsbo SCH");
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
index c593bd4..031c6ad 100644
--- a/drivers/gpio/gpio-timberdale.c
+++ b/drivers/gpio/gpio-timberdale.c
@@ -359,18 +359,7 @@ static struct platform_driver timbgpio_platform_driver = {
 
 /*--------------------------------------------------------------------------*/
 
-static int __init timbgpio_init(void)
-{
-	return platform_driver_register(&timbgpio_platform_driver);
-}
-
-static void __exit timbgpio_exit(void)
-{
-	platform_driver_unregister(&timbgpio_platform_driver);
-}
-
-module_init(timbgpio_init);
-module_exit(timbgpio_exit);
+module_platform_driver(timbgpio_platform_driver);
 
 MODULE_DESCRIPTION("Timberdale GPIO driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpio/gpio-ucb1400.c b/drivers/gpio/gpio-ucb1400.c
index 50e6bd1..26405ef 100644
--- a/drivers/gpio/gpio-ucb1400.c
+++ b/drivers/gpio/gpio-ucb1400.c
@@ -103,23 +103,12 @@ static struct platform_driver ucb1400_gpio_driver = {
 	},
 };
 
-static int __init ucb1400_gpio_init(void)
-{
-	return platform_driver_register(&ucb1400_gpio_driver);
-}
-
-static void __exit ucb1400_gpio_exit(void)
-{
-	platform_driver_unregister(&ucb1400_gpio_driver);
-}
-
 void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data)
 {
 	ucbdata = data;
 }
 
-module_init(ucb1400_gpio_init);
-module_exit(ucb1400_gpio_exit);
+module_platform_driver(ucb1400_gpio_driver);
 
 MODULE_DESCRIPTION("Philips UCB1400 GPIO driver");
 MODULE_LICENSE("GPL");
diff --git a/drivers/gpio/gpio-vr41xx.c b/drivers/gpio/gpio-vr41xx.c
index 98723cb..82d5c20 100644
--- a/drivers/gpio/gpio-vr41xx.c
+++ b/drivers/gpio/gpio-vr41xx.c
@@ -571,15 +571,4 @@ static struct platform_driver giu_device_driver = {
 	},
 };
 
-static int __init vr41xx_giu_init(void)
-{
-	return platform_driver_register(&giu_device_driver);
-}
-
-static void __exit vr41xx_giu_exit(void)
-{
-	platform_driver_unregister(&giu_device_driver);
-}
-
-module_init(vr41xx_giu_init);
-module_exit(vr41xx_giu_exit);
+module_platform_driver(giu_device_driver);
diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c
index ef5aabd..76ebfe5 100644
--- a/drivers/gpio/gpio-vx855.c
+++ b/drivers/gpio/gpio-vx855.c
@@ -315,17 +315,7 @@ static struct platform_driver vx855gpio_driver = {
 	.remove		= __devexit_p(vx855gpio_remove),
 };
 
-static int vx855gpio_init(void)
-{
-	return platform_driver_register(&vx855gpio_driver);
-}
-module_init(vx855gpio_init);
-
-static void vx855gpio_exit(void)
-{
-	platform_driver_unregister(&vx855gpio_driver);
-}
-module_exit(vx855gpio_exit);
+module_platform_driver(vx855gpio_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Harald Welte <HaraldWelte@viatech.com>");
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH 4/4] gpio: Add decode of WM8994 GPIO configuration
  2011-12-07 16:23 ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
  2011-12-07 16:23   ` [PATCH 2/4] gpio: Fix typo in comment in Samsung driver Mark Brown
  2011-12-07 16:24   ` [PATCH 3/4] gpio: Convert GPIO drivers to module_platform_driver Mark Brown
@ 2011-12-07 16:24   ` Mark Brown
  2012-01-02  7:28     ` Grant Likely
  2011-12-08  0:27   ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Kukjin Kim
  2012-01-02  7:27   ` Grant Likely
  4 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2011-12-07 16:24 UTC (permalink / raw)
  To: Grant Likely; +Cc: Kukjin Kim, linux-kernel, Mark Brown

For the human reader.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpio/gpio-wm8994.c |   79 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 2 deletions(-)

diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
index 96198f3..92ea535 100644
--- a/drivers/gpio/gpio-wm8994.c
+++ b/drivers/gpio/gpio-wm8994.c
@@ -117,6 +117,60 @@ static int wm8994_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
 
 
 #ifdef CONFIG_DEBUG_FS
+static const char *wm8994_gpio_fn(u16 fn)
+{
+	switch (fn) {
+	case WM8994_GP_FN_PIN_SPECIFIC:
+		return "pin-specific";
+	case WM8994_GP_FN_GPIO:
+		return "GPIO";
+	case WM8994_GP_FN_SDOUT:
+		return "SDOUT";
+	case WM8994_GP_FN_IRQ:
+		return "IRQ";
+	case WM8994_GP_FN_TEMPERATURE:
+		return "Temperature";
+	case WM8994_GP_FN_MICBIAS1_DET:
+		return "MICBIAS1 detect";
+	case WM8994_GP_FN_MICBIAS1_SHORT:
+		return "MICBIAS1 short";
+	case WM8994_GP_FN_MICBIAS2_DET:
+		return "MICBIAS2 detect";
+	case WM8994_GP_FN_MICBIAS2_SHORT:
+		return "MICBIAS2 short";
+	case WM8994_GP_FN_FLL1_LOCK:
+		return "FLL1 lock";
+	case WM8994_GP_FN_FLL2_LOCK:
+		return "FLL2 lock";
+	case WM8994_GP_FN_SRC1_LOCK:
+		return "SRC1 lock";
+	case WM8994_GP_FN_SRC2_LOCK:
+		return "SRC2 lock";
+	case WM8994_GP_FN_DRC1_ACT:
+		return "DRC1 activity";
+	case WM8994_GP_FN_DRC2_ACT:
+		return "DRC2 activity";
+	case WM8994_GP_FN_DRC3_ACT:
+		return "DRC3 activity";
+	case WM8994_GP_FN_WSEQ_STATUS:
+		return "Write sequencer";
+	case WM8994_GP_FN_FIFO_ERROR:
+		return "FIFO error";
+	case WM8994_GP_FN_OPCLK:
+		return "OPCLK";
+	case WM8994_GP_FN_THW:
+		return "Thermal warning";
+	case WM8994_GP_FN_DCS_DONE:
+		return "DC servo";
+	case WM8994_GP_FN_FLL1_OUT:
+		return "FLL1 output";
+	case WM8994_GP_FN_FLL2_OUT:
+		return "FLL1 output";
+	default:
+		return "Unknown";
+	}
+}
+
 static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 {
 	struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
@@ -148,8 +202,29 @@ static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
 			continue;
 		}
 
-		/* No decode yet; note that GPIO2 is special */
-		seq_printf(s, "(%x)\n", reg);
+		if (reg & WM8994_GPN_DIR)
+			seq_printf(s, "in ");
+		else
+			seq_printf(s, "out ");
+
+		if (reg & WM8994_GPN_PU)
+			seq_printf(s, "pull up ");
+
+		if (reg & WM8994_GPN_PD)
+			seq_printf(s, "pull down ");
+
+		if (reg & WM8994_GPN_POL)
+			seq_printf(s, "inverted ");
+		else
+			seq_printf(s, "noninverted ");
+
+		if (reg & WM8994_GPN_OP_CFG)
+			seq_printf(s, "open drain ");
+		else
+			seq_printf(s, "CMOS ");
+
+		seq_printf(s, "%s (%x)\n",
+			   wm8994_gpio_fn(reg & WM8994_GPN_FN_MASK), reg);
 	}
 }
 #else
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* RE: [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs
  2011-12-07 16:23 ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
                     ` (2 preceding siblings ...)
  2011-12-07 16:24   ` [PATCH 4/4] gpio: Add decode of WM8994 GPIO configuration Mark Brown
@ 2011-12-08  0:27   ` Kukjin Kim
  2012-01-02  7:27   ` Grant Likely
  4 siblings, 0 replies; 14+ messages in thread
From: Kukjin Kim @ 2011-12-08  0:27 UTC (permalink / raw)
  To: 'Mark Brown', 'Grant Likely'; +Cc: linux-kernel

Mark Brown wrote:
> 
> Make it easier to follow the by number references into samsung_gpio_cfgs
> by putting the indexes into the code initialising the array, improving
> readability a bit. Ideally we wouldn't be using magic array indexes at all
> but this is easier than coming up with a better way.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

> ---
>  drivers/gpio/gpio-samsung.c |   29 +++++++++++++++++++----------
>  1 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
> index 6b4d23f..f1c1ecd 100644
> --- a/drivers/gpio/gpio-samsung.c
> +++ b/drivers/gpio/gpio-samsung.c
> @@ -470,33 +470,42 @@ static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = {
>  #endif
> 
>  static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
> -	{
> +	[0] = {
>  		.cfg_eint	= 0x0,
> -	}, {
> +	},
> +	[1] = {
>  		.cfg_eint	= 0x3,
> -	}, {
> +	},
> +	[2] = {
>  		.cfg_eint	= 0x7,
> -	}, {
> +	},
> +	[3] = {
>  		.cfg_eint	= 0xF,
> -	}, {
> +	},
> +	[4] = {
>  		.cfg_eint	= 0x0,
>  		.set_config	= samsung_gpio_setcfg_2bit,
>  		.get_config	= samsung_gpio_getcfg_2bit,
> -	}, {
> +	},
> +	[5] = {
>  		.cfg_eint	= 0x2,
>  		.set_config	= samsung_gpio_setcfg_2bit,
>  		.get_config	= samsung_gpio_getcfg_2bit,
> -	}, {
> +	},
> +	[6] = {
>  		.cfg_eint	= 0x3,
>  		.set_config	= samsung_gpio_setcfg_2bit,
>  		.get_config	= samsung_gpio_getcfg_2bit,
> -	}, {
> +	},
> +	[7] = {
>  		.set_config	= samsung_gpio_setcfg_2bit,
>  		.get_config	= samsung_gpio_getcfg_2bit,
> -	}, {
> +	},
> +	[8] = {
>  		.set_pull	= exynos4_gpio_setpull,
>  		.get_pull	= exynos4_gpio_getpull,
> -	}, {
> +	},
> +	[9] = {
>  		.cfg_eint	= 0x3,
>  		.set_pull	= exynos4_gpio_setpull,
>  		.get_pull	= exynos4_gpio_getpull,
> --
> 1.7.7.3


^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH 2/4] gpio: Fix typo in comment in Samsung driver
  2011-12-07 16:23   ` [PATCH 2/4] gpio: Fix typo in comment in Samsung driver Mark Brown
@ 2011-12-08  0:28     ` Kukjin Kim
  2012-01-02  7:27     ` Grant Likely
  1 sibling, 0 replies; 14+ messages in thread
From: Kukjin Kim @ 2011-12-08  0:28 UTC (permalink / raw)
  To: 'Mark Brown', 'Grant Likely'; +Cc: linux-kernel

Mark Brown wrote:
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

> ---
>  drivers/gpio/gpio-samsung.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
> index f1c1ecd..f44c020 100644
> --- a/drivers/gpio/gpio-samsung.c
> +++ b/drivers/gpio/gpio-samsung.c
> @@ -233,7 +233,7 @@ static int samsung_gpio_setcfg_2bit(struct samsung_gpio_chip *chip,
>   * @chip: The gpio chip that is being configured.
>   * @off: The offset for the GPIO being configured.
>   *
> - * The reverse of samsung_gpio_setcfg_2bit(). Will return a value whicg
> + * The reverse of samsung_gpio_setcfg_2bit(). Will return a value which
>   * could be directly passed back to samsung_gpio_setcfg_2bit(), from the
>   * S3C_GPIO_SPECIAL() macro.
>   */
> --
> 1.7.7.3


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/4] Random GPIO updates
  2011-12-07 16:22 [PATCH 0/4] Random GPIO updates Mark Brown
  2011-12-07 16:23 ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
@ 2011-12-29 14:00 ` Mark Brown
  2012-01-02  1:06   ` Kukjin Kim
  1 sibling, 1 reply; 14+ messages in thread
From: Mark Brown @ 2011-12-29 14:00 UTC (permalink / raw)
  To: Grant Likely, Linus Walleij; +Cc: linux-kernel, Kukjin Kim

On Thu, Dec 08, 2011 at 12:22:57AM +0800, Mark Brown wrote:

> This is a fairly random selection of updates I've been sitting on for
> the gpios, partly built up over your sabbatical but a couple predating
> that.  No real theme here except for time.

Adding Linus to the CCs for this since he became GPIO comaintainer
(sorry, should've done this when reposting the patches).

> The following changes since commit 5611cc4572e889b62a7b4c72a413536bf6a9c416:

>   Linux 3.2-rc4 (2011-12-01 14:56:01 -0800)

> are available in the git repository at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git gpio/misc

> Mark Brown (4):
>       gpio: Explicitly index samsung_gpio_cfgs
>       gpio: Fix typo in comment in Samsung driver
>       gpio: Convert GPIO drivers to module_platform_driver
>       gpio: Add decode of WM8994 GPIO configuration

>  drivers/gpio/gpio-adp5520.c    |   12 +------
>  drivers/gpio/gpio-cs5535.c     |   13 +------
>  drivers/gpio/gpio-da9052.c     |   12 +------
>  drivers/gpio/gpio-generic.c    |   12 +------
>  drivers/gpio/gpio-janz-ttl.c   |   13 +------
>  drivers/gpio/gpio-rdc321x.c    |   13 +------
>  drivers/gpio/gpio-samsung.c    |   31 ++++++++++------
>  drivers/gpio/gpio-sch.c        |   13 +------
>  drivers/gpio/gpio-timberdale.c |   13 +------
>  drivers/gpio/gpio-ucb1400.c    |   13 +------
>  drivers/gpio/gpio-vr41xx.c     |   13 +------
>  drivers/gpio/gpio-vx855.c      |   12 +------
>  drivers/gpio/gpio-wm8994.c     |   79 +++++++++++++++++++++++++++++++++++++++-
>  13 files changed, 108 insertions(+), 141 deletions(-)

^ permalink raw reply	[flat|nested] 14+ messages in thread

* RE: [PATCH 0/4] Random GPIO updates
  2011-12-29 14:00 ` [PATCH 0/4] Random GPIO updates Mark Brown
@ 2012-01-02  1:06   ` Kukjin Kim
  0 siblings, 0 replies; 14+ messages in thread
From: Kukjin Kim @ 2012-01-02  1:06 UTC (permalink / raw)
  To: 'Mark Brown', 'Grant Likely', 'Linus Walleij'
  Cc: linux-kernel

Mark Brown wrote:
> 
> On Thu, Dec 08, 2011 at 12:22:57AM +0800, Mark Brown wrote:
> 
> > This is a fairly random selection of updates I've been sitting on for
> > the gpios, partly built up over your sabbatical but a couple predating
> > that.  No real theme here except for time.
> 
> Adding Linus to the CCs for this since he became GPIO comaintainer
> (sorry, should've done this when reposting the patches).
> 
Hi Linus,

For Samsung stuff:
Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, Senior Engineer,
SW Solution Development Team, Samsung Electronics Co., Ltd.

> > The following changes since commit
> 5611cc4572e889b62a7b4c72a413536bf6a9c416:
> 
> >   Linux 3.2-rc4 (2011-12-01 14:56:01 -0800)
> 
> > are available in the git repository at:
> >   git://git.kernel.org/pub/scm/linux/kernel/git/broonie/misc.git
> gpio/misc
> 
> > Mark Brown (4):
> >       gpio: Explicitly index samsung_gpio_cfgs
> >       gpio: Fix typo in comment in Samsung driver
> >       gpio: Convert GPIO drivers to module_platform_driver
> >       gpio: Add decode of WM8994 GPIO configuration
> 
> >  drivers/gpio/gpio-adp5520.c    |   12 +------
> >  drivers/gpio/gpio-cs5535.c     |   13 +------
> >  drivers/gpio/gpio-da9052.c     |   12 +------
> >  drivers/gpio/gpio-generic.c    |   12 +------
> >  drivers/gpio/gpio-janz-ttl.c   |   13 +------
> >  drivers/gpio/gpio-rdc321x.c    |   13 +------
> >  drivers/gpio/gpio-samsung.c    |   31 ++++++++++------
> >  drivers/gpio/gpio-sch.c        |   13 +------
> >  drivers/gpio/gpio-timberdale.c |   13 +------
> >  drivers/gpio/gpio-ucb1400.c    |   13 +------
> >  drivers/gpio/gpio-vr41xx.c     |   13 +------
> >  drivers/gpio/gpio-vx855.c      |   12 +------
> >  drivers/gpio/gpio-wm8994.c     |   79
> +++++++++++++++++++++++++++++++++++++++-
> >  13 files changed, 108 insertions(+), 141 deletions(-)


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs
  2011-12-07 16:23 ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
                     ` (3 preceding siblings ...)
  2011-12-08  0:27   ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Kukjin Kim
@ 2012-01-02  7:27   ` Grant Likely
  4 siblings, 0 replies; 14+ messages in thread
From: Grant Likely @ 2012-01-02  7:27 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kukjin Kim, linux-kernel

On Thu, Dec 08, 2011 at 12:23:58AM +0800, Mark Brown wrote:
> Make it easier to follow the by number references into samsung_gpio_cfgs
> by putting the indexes into the code initialising the array, improving
> readability a bit. Ideally we wouldn't be using magic array indexes at all
> but this is easier than coming up with a better way.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Applied, thanks.

g.

> ---
>  drivers/gpio/gpio-samsung.c |   29 +++++++++++++++++++----------
>  1 files changed, 19 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
> index 6b4d23f..f1c1ecd 100644
> --- a/drivers/gpio/gpio-samsung.c
> +++ b/drivers/gpio/gpio-samsung.c
> @@ -470,33 +470,42 @@ static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = {
>  #endif
>  
>  static struct samsung_gpio_cfg samsung_gpio_cfgs[] = {
> -	{
> +	[0] = {
>  		.cfg_eint	= 0x0,
> -	}, {
> +	},
> +	[1] = {
>  		.cfg_eint	= 0x3,
> -	}, {
> +	},
> +	[2] = {
>  		.cfg_eint	= 0x7,
> -	}, {
> +	},
> +	[3] = {
>  		.cfg_eint	= 0xF,
> -	}, {
> +	},
> +	[4] = {
>  		.cfg_eint	= 0x0,
>  		.set_config	= samsung_gpio_setcfg_2bit,
>  		.get_config	= samsung_gpio_getcfg_2bit,
> -	}, {
> +	},
> +	[5] = {
>  		.cfg_eint	= 0x2,
>  		.set_config	= samsung_gpio_setcfg_2bit,
>  		.get_config	= samsung_gpio_getcfg_2bit,
> -	}, {
> +	},
> +	[6] = {
>  		.cfg_eint	= 0x3,
>  		.set_config	= samsung_gpio_setcfg_2bit,
>  		.get_config	= samsung_gpio_getcfg_2bit,
> -	}, {
> +	},
> +	[7] = {
>  		.set_config	= samsung_gpio_setcfg_2bit,
>  		.get_config	= samsung_gpio_getcfg_2bit,
> -	}, {
> +	},
> +	[8] = {
>  		.set_pull	= exynos4_gpio_setpull,
>  		.get_pull	= exynos4_gpio_getpull,
> -	}, {
> +	},
> +	[9] = {
>  		.cfg_eint	= 0x3,
>  		.set_pull	= exynos4_gpio_setpull,
>  		.get_pull	= exynos4_gpio_getpull,
> -- 
> 1.7.7.3
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/4] gpio: Fix typo in comment in Samsung driver
  2011-12-07 16:23   ` [PATCH 2/4] gpio: Fix typo in comment in Samsung driver Mark Brown
  2011-12-08  0:28     ` Kukjin Kim
@ 2012-01-02  7:27     ` Grant Likely
  1 sibling, 0 replies; 14+ messages in thread
From: Grant Likely @ 2012-01-02  7:27 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kukjin Kim, linux-kernel

On Thu, Dec 08, 2011 at 12:23:59AM +0800, Mark Brown wrote:
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Applied, thanks.

g.

> ---
>  drivers/gpio/gpio-samsung.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c
> index f1c1ecd..f44c020 100644
> --- a/drivers/gpio/gpio-samsung.c
> +++ b/drivers/gpio/gpio-samsung.c
> @@ -233,7 +233,7 @@ static int samsung_gpio_setcfg_2bit(struct samsung_gpio_chip *chip,
>   * @chip: The gpio chip that is being configured.
>   * @off: The offset for the GPIO being configured.
>   *
> - * The reverse of samsung_gpio_setcfg_2bit(). Will return a value whicg
> + * The reverse of samsung_gpio_setcfg_2bit(). Will return a value which
>   * could be directly passed back to samsung_gpio_setcfg_2bit(), from the
>   * S3C_GPIO_SPECIAL() macro.
>   */
> -- 
> 1.7.7.3
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/4] gpio: Convert GPIO drivers to module_platform_driver
  2011-12-07 16:24   ` [PATCH 3/4] gpio: Convert GPIO drivers to module_platform_driver Mark Brown
@ 2012-01-02  7:27     ` Grant Likely
  0 siblings, 0 replies; 14+ messages in thread
From: Grant Likely @ 2012-01-02  7:27 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kukjin Kim, linux-kernel

On Thu, Dec 08, 2011 at 12:24:00AM +0800, Mark Brown wrote:
> Where appropriate factor out some boilerplate code for platform device
> registration into module_platform_driver. Drivers that don't use the
> standard module_init initcall haven't been converted.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

Applied, thanks.

g.

> ---
>  drivers/gpio/gpio-adp5520.c    |   12 +-----------
>  drivers/gpio/gpio-cs5535.c     |   13 +------------
>  drivers/gpio/gpio-da9052.c     |   12 +-----------
>  drivers/gpio/gpio-generic.c    |   12 +-----------
>  drivers/gpio/gpio-janz-ttl.c   |   13 +------------
>  drivers/gpio/gpio-rdc321x.c    |   13 +------------
>  drivers/gpio/gpio-sch.c        |   13 +------------
>  drivers/gpio/gpio-timberdale.c |   13 +------------
>  drivers/gpio/gpio-ucb1400.c    |   13 +------------
>  drivers/gpio/gpio-vr41xx.c     |   13 +------------
>  drivers/gpio/gpio-vx855.c      |   12 +-----------
>  11 files changed, 11 insertions(+), 128 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c
> index 9f27815..2f263cc 100644
> --- a/drivers/gpio/gpio-adp5520.c
> +++ b/drivers/gpio/gpio-adp5520.c
> @@ -193,17 +193,7 @@ static struct platform_driver adp5520_gpio_driver = {
>  	.remove		= __devexit_p(adp5520_gpio_remove),
>  };
>  
> -static int __init adp5520_gpio_init(void)
> -{
> -	return platform_driver_register(&adp5520_gpio_driver);
> -}
> -module_init(adp5520_gpio_init);
> -
> -static void __exit adp5520_gpio_exit(void)
> -{
> -	platform_driver_unregister(&adp5520_gpio_driver);
> -}
> -module_exit(adp5520_gpio_exit);
> +module_platform_driver(adp5520_gpio_driver);
>  
>  MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
>  MODULE_DESCRIPTION("GPIO ADP5520 Driver");
> diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c
> index 6e16cba..a6403a0 100644
> --- a/drivers/gpio/gpio-cs5535.c
> +++ b/drivers/gpio/gpio-cs5535.c
> @@ -382,18 +382,7 @@ static struct platform_driver cs5535_gpio_driver = {
>  	.remove = __devexit_p(cs5535_gpio_remove),
>  };
>  
> -static int __init cs5535_gpio_init(void)
> -{
> -	return platform_driver_register(&cs5535_gpio_driver);
> -}
> -
> -static void __exit cs5535_gpio_exit(void)
> -{
> -	platform_driver_unregister(&cs5535_gpio_driver);
> -}
> -
> -module_init(cs5535_gpio_init);
> -module_exit(cs5535_gpio_exit);
> +module_platform_driver(cs5535_gpio_driver);
>  
>  MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
>  MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver");
> diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c
> index 038f5eb..58ac377 100644
> --- a/drivers/gpio/gpio-da9052.c
> +++ b/drivers/gpio/gpio-da9052.c
> @@ -259,17 +259,7 @@ static struct platform_driver da9052_gpio_driver = {
>  	},
>  };
>  
> -static int __init da9052_gpio_init(void)
> -{
> -	return platform_driver_register(&da9052_gpio_driver);
> -}
> -module_init(da9052_gpio_init);
> -
> -static void __exit da9052_gpio_exit(void)
> -{
> -	return platform_driver_unregister(&da9052_gpio_driver);
> -}
> -module_exit(da9052_gpio_exit);
> +module_platform_driver(da9052_gpio_driver);
>  
>  MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
>  MODULE_DESCRIPTION("DA9052 GPIO Device Driver");
> diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
> index 4e24436..e38dd0c 100644
> --- a/drivers/gpio/gpio-generic.c
> +++ b/drivers/gpio/gpio-generic.c
> @@ -524,17 +524,7 @@ static struct platform_driver bgpio_driver = {
>  	.remove = __devexit_p(bgpio_pdev_remove),
>  };
>  
> -static int __init bgpio_platform_init(void)
> -{
> -	return platform_driver_register(&bgpio_driver);
> -}
> -module_init(bgpio_platform_init);
> -
> -static void __exit bgpio_platform_exit(void)
> -{
> -	platform_driver_unregister(&bgpio_driver);
> -}
> -module_exit(bgpio_platform_exit);
> +module_platform_driver(bgpio_driver);
>  
>  #endif /* CONFIG_GPIO_GENERIC_PLATFORM */
>  
> diff --git a/drivers/gpio/gpio-janz-ttl.c b/drivers/gpio/gpio-janz-ttl.c
> index 813ac07..9ec698e 100644
> --- a/drivers/gpio/gpio-janz-ttl.c
> +++ b/drivers/gpio/gpio-janz-ttl.c
> @@ -239,20 +239,9 @@ static struct platform_driver ttl_driver = {
>  	.remove		= __devexit_p(ttl_remove),
>  };
>  
> -static int __init ttl_init(void)
> -{
> -	return platform_driver_register(&ttl_driver);
> -}
> -
> -static void __exit ttl_exit(void)
> -{
> -	platform_driver_unregister(&ttl_driver);
> -}
> +module_platform_driver(ttl_driver);
>  
>  MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>");
>  MODULE_DESCRIPTION("Janz MODULbus VMOD-TTL Driver");
>  MODULE_LICENSE("GPL");
>  MODULE_ALIAS("platform:janz-ttl");
> -
> -module_init(ttl_init);
> -module_exit(ttl_exit);
> diff --git a/drivers/gpio/gpio-rdc321x.c b/drivers/gpio/gpio-rdc321x.c
> index 2762698..e97016a 100644
> --- a/drivers/gpio/gpio-rdc321x.c
> +++ b/drivers/gpio/gpio-rdc321x.c
> @@ -227,18 +227,7 @@ static struct platform_driver rdc321x_gpio_driver = {
>  	.remove		= __devexit_p(rdc321x_gpio_remove),
>  };
>  
> -static int __init rdc321x_gpio_init(void)
> -{
> -	return platform_driver_register(&rdc321x_gpio_driver);
> -}
> -
> -static void __exit rdc321x_gpio_exit(void)
> -{
> -	platform_driver_unregister(&rdc321x_gpio_driver);
> -}
> -
> -module_init(rdc321x_gpio_init);
> -module_exit(rdc321x_gpio_exit);
> +module_platform_driver(rdc321x_gpio_driver);
>  
>  MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
>  MODULE_DESCRIPTION("RDC321x GPIO driver");
> diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
> index 1635158..8cadf4d 100644
> --- a/drivers/gpio/gpio-sch.c
> +++ b/drivers/gpio/gpio-sch.c
> @@ -297,18 +297,7 @@ static struct platform_driver sch_gpio_driver = {
>  	.remove		= __devexit_p(sch_gpio_remove),
>  };
>  
> -static int __init sch_gpio_init(void)
> -{
> -	return platform_driver_register(&sch_gpio_driver);
> -}
> -
> -static void __exit sch_gpio_exit(void)
> -{
> -	platform_driver_unregister(&sch_gpio_driver);
> -}
> -
> -module_init(sch_gpio_init);
> -module_exit(sch_gpio_exit);
> +module_platform_driver(sch_gpio_driver);
>  
>  MODULE_AUTHOR("Denis Turischev <denis@compulab.co.il>");
>  MODULE_DESCRIPTION("GPIO interface for Intel Poulsbo SCH");
> diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
> index c593bd4..031c6ad 100644
> --- a/drivers/gpio/gpio-timberdale.c
> +++ b/drivers/gpio/gpio-timberdale.c
> @@ -359,18 +359,7 @@ static struct platform_driver timbgpio_platform_driver = {
>  
>  /*--------------------------------------------------------------------------*/
>  
> -static int __init timbgpio_init(void)
> -{
> -	return platform_driver_register(&timbgpio_platform_driver);
> -}
> -
> -static void __exit timbgpio_exit(void)
> -{
> -	platform_driver_unregister(&timbgpio_platform_driver);
> -}
> -
> -module_init(timbgpio_init);
> -module_exit(timbgpio_exit);
> +module_platform_driver(timbgpio_platform_driver);
>  
>  MODULE_DESCRIPTION("Timberdale GPIO driver");
>  MODULE_LICENSE("GPL v2");
> diff --git a/drivers/gpio/gpio-ucb1400.c b/drivers/gpio/gpio-ucb1400.c
> index 50e6bd1..26405ef 100644
> --- a/drivers/gpio/gpio-ucb1400.c
> +++ b/drivers/gpio/gpio-ucb1400.c
> @@ -103,23 +103,12 @@ static struct platform_driver ucb1400_gpio_driver = {
>  	},
>  };
>  
> -static int __init ucb1400_gpio_init(void)
> -{
> -	return platform_driver_register(&ucb1400_gpio_driver);
> -}
> -
> -static void __exit ucb1400_gpio_exit(void)
> -{
> -	platform_driver_unregister(&ucb1400_gpio_driver);
> -}
> -
>  void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data)
>  {
>  	ucbdata = data;
>  }
>  
> -module_init(ucb1400_gpio_init);
> -module_exit(ucb1400_gpio_exit);
> +module_platform_driver(ucb1400_gpio_driver);
>  
>  MODULE_DESCRIPTION("Philips UCB1400 GPIO driver");
>  MODULE_LICENSE("GPL");
> diff --git a/drivers/gpio/gpio-vr41xx.c b/drivers/gpio/gpio-vr41xx.c
> index 98723cb..82d5c20 100644
> --- a/drivers/gpio/gpio-vr41xx.c
> +++ b/drivers/gpio/gpio-vr41xx.c
> @@ -571,15 +571,4 @@ static struct platform_driver giu_device_driver = {
>  	},
>  };
>  
> -static int __init vr41xx_giu_init(void)
> -{
> -	return platform_driver_register(&giu_device_driver);
> -}
> -
> -static void __exit vr41xx_giu_exit(void)
> -{
> -	platform_driver_unregister(&giu_device_driver);
> -}
> -
> -module_init(vr41xx_giu_init);
> -module_exit(vr41xx_giu_exit);
> +module_platform_driver(giu_device_driver);
> diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c
> index ef5aabd..76ebfe5 100644
> --- a/drivers/gpio/gpio-vx855.c
> +++ b/drivers/gpio/gpio-vx855.c
> @@ -315,17 +315,7 @@ static struct platform_driver vx855gpio_driver = {
>  	.remove		= __devexit_p(vx855gpio_remove),
>  };
>  
> -static int vx855gpio_init(void)
> -{
> -	return platform_driver_register(&vx855gpio_driver);
> -}
> -module_init(vx855gpio_init);
> -
> -static void vx855gpio_exit(void)
> -{
> -	platform_driver_unregister(&vx855gpio_driver);
> -}
> -module_exit(vx855gpio_exit);
> +module_platform_driver(vx855gpio_driver);
>  
>  MODULE_LICENSE("GPL");
>  MODULE_AUTHOR("Harald Welte <HaraldWelte@viatech.com>");
> -- 
> 1.7.7.3
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/4] gpio: Add decode of WM8994 GPIO configuration
  2011-12-07 16:24   ` [PATCH 4/4] gpio: Add decode of WM8994 GPIO configuration Mark Brown
@ 2012-01-02  7:28     ` Grant Likely
  0 siblings, 0 replies; 14+ messages in thread
From: Grant Likely @ 2012-01-02  7:28 UTC (permalink / raw)
  To: Mark Brown; +Cc: Kukjin Kim, linux-kernel

On Thu, Dec 08, 2011 at 12:24:01AM +0800, Mark Brown wrote:
> For the human reader.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> Acked-by: Linus Walleij <linus.walleij@linaro.org>

Applied, thanks.  Personally, I would have preferred a lookup table for
the _gpio_fn() stuff, but it isn't even close to a big enough complaint
for me to reject the patch.  :-)

g.

> ---
>  drivers/gpio/gpio-wm8994.c |   79 ++++++++++++++++++++++++++++++++++++++++++-
>  1 files changed, 77 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c
> index 96198f3..92ea535 100644
> --- a/drivers/gpio/gpio-wm8994.c
> +++ b/drivers/gpio/gpio-wm8994.c
> @@ -117,6 +117,60 @@ static int wm8994_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
>  
>  
>  #ifdef CONFIG_DEBUG_FS
> +static const char *wm8994_gpio_fn(u16 fn)
> +{
> +	switch (fn) {
> +	case WM8994_GP_FN_PIN_SPECIFIC:
> +		return "pin-specific";
> +	case WM8994_GP_FN_GPIO:
> +		return "GPIO";
> +	case WM8994_GP_FN_SDOUT:
> +		return "SDOUT";
> +	case WM8994_GP_FN_IRQ:
> +		return "IRQ";
> +	case WM8994_GP_FN_TEMPERATURE:
> +		return "Temperature";
> +	case WM8994_GP_FN_MICBIAS1_DET:
> +		return "MICBIAS1 detect";
> +	case WM8994_GP_FN_MICBIAS1_SHORT:
> +		return "MICBIAS1 short";
> +	case WM8994_GP_FN_MICBIAS2_DET:
> +		return "MICBIAS2 detect";
> +	case WM8994_GP_FN_MICBIAS2_SHORT:
> +		return "MICBIAS2 short";
> +	case WM8994_GP_FN_FLL1_LOCK:
> +		return "FLL1 lock";
> +	case WM8994_GP_FN_FLL2_LOCK:
> +		return "FLL2 lock";
> +	case WM8994_GP_FN_SRC1_LOCK:
> +		return "SRC1 lock";
> +	case WM8994_GP_FN_SRC2_LOCK:
> +		return "SRC2 lock";
> +	case WM8994_GP_FN_DRC1_ACT:
> +		return "DRC1 activity";
> +	case WM8994_GP_FN_DRC2_ACT:
> +		return "DRC2 activity";
> +	case WM8994_GP_FN_DRC3_ACT:
> +		return "DRC3 activity";
> +	case WM8994_GP_FN_WSEQ_STATUS:
> +		return "Write sequencer";
> +	case WM8994_GP_FN_FIFO_ERROR:
> +		return "FIFO error";
> +	case WM8994_GP_FN_OPCLK:
> +		return "OPCLK";
> +	case WM8994_GP_FN_THW:
> +		return "Thermal warning";
> +	case WM8994_GP_FN_DCS_DONE:
> +		return "DC servo";
> +	case WM8994_GP_FN_FLL1_OUT:
> +		return "FLL1 output";
> +	case WM8994_GP_FN_FLL2_OUT:
> +		return "FLL1 output";
> +	default:
> +		return "Unknown";
> +	}
> +}
> +
>  static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
>  {
>  	struct wm8994_gpio *wm8994_gpio = to_wm8994_gpio(chip);
> @@ -148,8 +202,29 @@ static void wm8994_gpio_dbg_show(struct seq_file *s, struct gpio_chip *chip)
>  			continue;
>  		}
>  
> -		/* No decode yet; note that GPIO2 is special */
> -		seq_printf(s, "(%x)\n", reg);
> +		if (reg & WM8994_GPN_DIR)
> +			seq_printf(s, "in ");
> +		else
> +			seq_printf(s, "out ");
> +
> +		if (reg & WM8994_GPN_PU)
> +			seq_printf(s, "pull up ");
> +
> +		if (reg & WM8994_GPN_PD)
> +			seq_printf(s, "pull down ");
> +
> +		if (reg & WM8994_GPN_POL)
> +			seq_printf(s, "inverted ");
> +		else
> +			seq_printf(s, "noninverted ");
> +
> +		if (reg & WM8994_GPN_OP_CFG)
> +			seq_printf(s, "open drain ");
> +		else
> +			seq_printf(s, "CMOS ");
> +
> +		seq_printf(s, "%s (%x)\n",
> +			   wm8994_gpio_fn(reg & WM8994_GPN_FN_MASK), reg);
>  	}
>  }
>  #else
> -- 
> 1.7.7.3
> 

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/4] gpio: Convert GPIO drivers to module_platform_driver
  2011-12-21  0:20 [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
@ 2011-12-21  0:20 ` Mark Brown
  0 siblings, 0 replies; 14+ messages in thread
From: Mark Brown @ 2011-12-21  0:20 UTC (permalink / raw)
  To: Linus Walleij, Grant Likely; +Cc: linux-kernel, Mark Brown

Where appropriate factor out some boilerplate code for platform device
registration into module_platform_driver. Drivers that don't use the
standard module_init initcall haven't been converted.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/gpio/gpio-adp5520.c    |   12 +-----------
 drivers/gpio/gpio-cs5535.c     |   13 +------------
 drivers/gpio/gpio-da9052.c     |   12 +-----------
 drivers/gpio/gpio-generic.c    |   12 +-----------
 drivers/gpio/gpio-janz-ttl.c   |   13 +------------
 drivers/gpio/gpio-rdc321x.c    |   13 +------------
 drivers/gpio/gpio-sch.c        |   13 +------------
 drivers/gpio/gpio-timberdale.c |   13 +------------
 drivers/gpio/gpio-ucb1400.c    |   13 +------------
 drivers/gpio/gpio-vr41xx.c     |   13 +------------
 drivers/gpio/gpio-vx855.c      |   12 +-----------
 11 files changed, 11 insertions(+), 128 deletions(-)

diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c
index 9f27815..2f263cc 100644
--- a/drivers/gpio/gpio-adp5520.c
+++ b/drivers/gpio/gpio-adp5520.c
@@ -193,17 +193,7 @@ static struct platform_driver adp5520_gpio_driver = {
 	.remove		= __devexit_p(adp5520_gpio_remove),
 };
 
-static int __init adp5520_gpio_init(void)
-{
-	return platform_driver_register(&adp5520_gpio_driver);
-}
-module_init(adp5520_gpio_init);
-
-static void __exit adp5520_gpio_exit(void)
-{
-	platform_driver_unregister(&adp5520_gpio_driver);
-}
-module_exit(adp5520_gpio_exit);
+module_platform_driver(adp5520_gpio_driver);
 
 MODULE_AUTHOR("Michael Hennerich <hennerich@blackfin.uclinux.org>");
 MODULE_DESCRIPTION("GPIO ADP5520 Driver");
diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c
index 693a81b..19eda1b 100644
--- a/drivers/gpio/gpio-cs5535.c
+++ b/drivers/gpio/gpio-cs5535.c
@@ -381,18 +381,7 @@ static struct platform_driver cs5535_gpio_driver = {
 	.remove = __devexit_p(cs5535_gpio_remove),
 };
 
-static int __init cs5535_gpio_init(void)
-{
-	return platform_driver_register(&cs5535_gpio_driver);
-}
-
-static void __exit cs5535_gpio_exit(void)
-{
-	platform_driver_unregister(&cs5535_gpio_driver);
-}
-
-module_init(cs5535_gpio_init);
-module_exit(cs5535_gpio_exit);
+module_platform_driver(cs5535_gpio_driver);
 
 MODULE_AUTHOR("Andres Salomon <dilinger@queued.net>");
 MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver");
diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c
index f8ce29e..56dd047 100644
--- a/drivers/gpio/gpio-da9052.c
+++ b/drivers/gpio/gpio-da9052.c
@@ -254,17 +254,7 @@ static struct platform_driver da9052_gpio_driver = {
 	},
 };
 
-static int __init da9052_gpio_init(void)
-{
-	return platform_driver_register(&da9052_gpio_driver);
-}
-module_init(da9052_gpio_init);
-
-static void __exit da9052_gpio_exit(void)
-{
-	return platform_driver_unregister(&da9052_gpio_driver);
-}
-module_exit(da9052_gpio_exit);
+module_platform_driver(da9052_gpio_driver);
 
 MODULE_AUTHOR("David Dajun Chen <dchen@diasemi.com>");
 MODULE_DESCRIPTION("DA9052 GPIO Device Driver");
diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c
index 4e24436..e38dd0c 100644
--- a/drivers/gpio/gpio-generic.c
+++ b/drivers/gpio/gpio-generic.c
@@ -524,17 +524,7 @@ static struct platform_driver bgpio_driver = {
 	.remove = __devexit_p(bgpio_pdev_remove),
 };
 
-static int __init bgpio_platform_init(void)
-{
-	return platform_driver_register(&bgpio_driver);
-}
-module_init(bgpio_platform_init);
-
-static void __exit bgpio_platform_exit(void)
-{
-	platform_driver_unregister(&bgpio_driver);
-}
-module_exit(bgpio_platform_exit);
+module_platform_driver(bgpio_driver);
 
 #endif /* CONFIG_GPIO_GENERIC_PLATFORM */
 
diff --git a/drivers/gpio/gpio-janz-ttl.c b/drivers/gpio/gpio-janz-ttl.c
index 6f7fda0..f2f000d 100644
--- a/drivers/gpio/gpio-janz-ttl.c
+++ b/drivers/gpio/gpio-janz-ttl.c
@@ -237,20 +237,9 @@ static struct platform_driver ttl_driver = {
 	.remove		= __devexit_p(ttl_remove),
 };
 
-static int __init ttl_init(void)
-{
-	return platform_driver_register(&ttl_driver);
-}
-
-static void __exit ttl_exit(void)
-{
-	platform_driver_unregister(&ttl_driver);
-}
+module_platform_driver(ttl_driver);
 
 MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>");
 MODULE_DESCRIPTION("Janz MODULbus VMOD-TTL Driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:janz-ttl");
-
-module_init(ttl_init);
-module_exit(ttl_exit);
diff --git a/drivers/gpio/gpio-rdc321x.c b/drivers/gpio/gpio-rdc321x.c
index 2762698..e97016a 100644
--- a/drivers/gpio/gpio-rdc321x.c
+++ b/drivers/gpio/gpio-rdc321x.c
@@ -227,18 +227,7 @@ static struct platform_driver rdc321x_gpio_driver = {
 	.remove		= __devexit_p(rdc321x_gpio_remove),
 };
 
-static int __init rdc321x_gpio_init(void)
-{
-	return platform_driver_register(&rdc321x_gpio_driver);
-}
-
-static void __exit rdc321x_gpio_exit(void)
-{
-	platform_driver_unregister(&rdc321x_gpio_driver);
-}
-
-module_init(rdc321x_gpio_init);
-module_exit(rdc321x_gpio_exit);
+module_platform_driver(rdc321x_gpio_driver);
 
 MODULE_AUTHOR("Florian Fainelli <florian@openwrt.org>");
 MODULE_DESCRIPTION("RDC321x GPIO driver");
diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c
index 1635158..8cadf4d 100644
--- a/drivers/gpio/gpio-sch.c
+++ b/drivers/gpio/gpio-sch.c
@@ -297,18 +297,7 @@ static struct platform_driver sch_gpio_driver = {
 	.remove		= __devexit_p(sch_gpio_remove),
 };
 
-static int __init sch_gpio_init(void)
-{
-	return platform_driver_register(&sch_gpio_driver);
-}
-
-static void __exit sch_gpio_exit(void)
-{
-	platform_driver_unregister(&sch_gpio_driver);
-}
-
-module_init(sch_gpio_init);
-module_exit(sch_gpio_exit);
+module_platform_driver(sch_gpio_driver);
 
 MODULE_AUTHOR("Denis Turischev <denis@compulab.co.il>");
 MODULE_DESCRIPTION("GPIO interface for Intel Poulsbo SCH");
diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c
index c593bd4..031c6ad 100644
--- a/drivers/gpio/gpio-timberdale.c
+++ b/drivers/gpio/gpio-timberdale.c
@@ -359,18 +359,7 @@ static struct platform_driver timbgpio_platform_driver = {
 
 /*--------------------------------------------------------------------------*/
 
-static int __init timbgpio_init(void)
-{
-	return platform_driver_register(&timbgpio_platform_driver);
-}
-
-static void __exit timbgpio_exit(void)
-{
-	platform_driver_unregister(&timbgpio_platform_driver);
-}
-
-module_init(timbgpio_init);
-module_exit(timbgpio_exit);
+module_platform_driver(timbgpio_platform_driver);
 
 MODULE_DESCRIPTION("Timberdale GPIO driver");
 MODULE_LICENSE("GPL v2");
diff --git a/drivers/gpio/gpio-ucb1400.c b/drivers/gpio/gpio-ucb1400.c
index 50e6bd1..26405ef 100644
--- a/drivers/gpio/gpio-ucb1400.c
+++ b/drivers/gpio/gpio-ucb1400.c
@@ -103,23 +103,12 @@ static struct platform_driver ucb1400_gpio_driver = {
 	},
 };
 
-static int __init ucb1400_gpio_init(void)
-{
-	return platform_driver_register(&ucb1400_gpio_driver);
-}
-
-static void __exit ucb1400_gpio_exit(void)
-{
-	platform_driver_unregister(&ucb1400_gpio_driver);
-}
-
 void __init ucb1400_gpio_set_data(struct ucb1400_gpio_data *data)
 {
 	ucbdata = data;
 }
 
-module_init(ucb1400_gpio_init);
-module_exit(ucb1400_gpio_exit);
+module_platform_driver(ucb1400_gpio_driver);
 
 MODULE_DESCRIPTION("Philips UCB1400 GPIO driver");
 MODULE_LICENSE("GPL");
diff --git a/drivers/gpio/gpio-vr41xx.c b/drivers/gpio/gpio-vr41xx.c
index 98723cb..82d5c20 100644
--- a/drivers/gpio/gpio-vr41xx.c
+++ b/drivers/gpio/gpio-vr41xx.c
@@ -571,15 +571,4 @@ static struct platform_driver giu_device_driver = {
 	},
 };
 
-static int __init vr41xx_giu_init(void)
-{
-	return platform_driver_register(&giu_device_driver);
-}
-
-static void __exit vr41xx_giu_exit(void)
-{
-	platform_driver_unregister(&giu_device_driver);
-}
-
-module_init(vr41xx_giu_init);
-module_exit(vr41xx_giu_exit);
+module_platform_driver(giu_device_driver);
diff --git a/drivers/gpio/gpio-vx855.c b/drivers/gpio/gpio-vx855.c
index ef5aabd..76ebfe5 100644
--- a/drivers/gpio/gpio-vx855.c
+++ b/drivers/gpio/gpio-vx855.c
@@ -315,17 +315,7 @@ static struct platform_driver vx855gpio_driver = {
 	.remove		= __devexit_p(vx855gpio_remove),
 };
 
-static int vx855gpio_init(void)
-{
-	return platform_driver_register(&vx855gpio_driver);
-}
-module_init(vx855gpio_init);
-
-static void vx855gpio_exit(void)
-{
-	platform_driver_unregister(&vx855gpio_driver);
-}
-module_exit(vx855gpio_exit);
+module_platform_driver(vx855gpio_driver);
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Harald Welte <HaraldWelte@viatech.com>");
-- 
1.7.7.3


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2012-01-02  7:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-07 16:22 [PATCH 0/4] Random GPIO updates Mark Brown
2011-12-07 16:23 ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
2011-12-07 16:23   ` [PATCH 2/4] gpio: Fix typo in comment in Samsung driver Mark Brown
2011-12-08  0:28     ` Kukjin Kim
2012-01-02  7:27     ` Grant Likely
2011-12-07 16:24   ` [PATCH 3/4] gpio: Convert GPIO drivers to module_platform_driver Mark Brown
2012-01-02  7:27     ` Grant Likely
2011-12-07 16:24   ` [PATCH 4/4] gpio: Add decode of WM8994 GPIO configuration Mark Brown
2012-01-02  7:28     ` Grant Likely
2011-12-08  0:27   ` [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Kukjin Kim
2012-01-02  7:27   ` Grant Likely
2011-12-29 14:00 ` [PATCH 0/4] Random GPIO updates Mark Brown
2012-01-02  1:06   ` Kukjin Kim
2011-12-21  0:20 [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs Mark Brown
2011-12-21  0:20 ` [PATCH 3/4] gpio: Convert GPIO drivers to module_platform_driver Mark Brown

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