Skip to contentSkip to conversation

Random GPIO updates

PATCH Applied Mark Brown 3 participants 13 messages Dec 7, 2011 – Jan 2, 2012

Subsystems (5)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

cover Random GPIO updates

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(-)
author
#1 lore raw

PATCH 1/4 gpio: Explicitly index samsung_gpio_cfgs

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.

---
 drivers/gpio/gpio-samsung.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)
drivers/gpio/gpio-samsung.c +19 -10
index 6b4d23f..f1c1ecd 100644
@@ -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,
Signature · 1 line
1.7.7.3
author
#2 lore raw

PATCH 2/4 gpio: Fix typo in comment in Samsung driver

---
 drivers/gpio/gpio-samsung.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/gpio-samsung.c +1 -1
index f1c1ecd..f44c020 100644
@@ -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.
  */
Signature · 1 line
1.7.7.3
Acked-by on v1 2/4
#3 lore raw

RE: [PATCH 2/4] gpio: Fix typo in comment in Samsung driver

Quoted 2 lines · Mark Brown

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

Quoted 19 lines
---
 drivers/gpio/gpio-samsung.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/gpio-samsung.c +1 -2
index f1c1ecd..f44c020 100644
@@ -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

Applied
#4 lore raw

Re: [PATCH 2/4] gpio: Fix typo in comment in Samsung driver

In reply to Mark Brown
Quoted 1 line · Mark Brown

Applied, thanks.

g.

Quoted 20 lines
---
 drivers/gpio/gpio-samsung.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/gpio/gpio-samsung.c +1 -1
index f1c1ecd..f44c020 100644
@@ -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.
  */
Signature · 1 line
1.7.7.3
author
#5 lore raw

PATCH 3/4 gpio: Convert GPIO drivers to module_platform_driver

In reply to 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.

---
 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(-)
drivers/gpio/gpio-adp5520.c +1 -11
index 9f27815..2f263cc 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("GPIO ADP5520 Driver");
drivers/gpio/gpio-cs5535.c +1 -12
index 6e16cba..a6403a0 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver");
drivers/gpio/gpio-da9052.c +1 -11
index 038f5eb..58ac377 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("DA9052 GPIO Device Driver");
drivers/gpio/gpio-generic.c +1 -11
index 4e24436..e38dd0c 100644
@@ -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 */
 
drivers/gpio/gpio-janz-ttl.c +1 -12
index 813ac07..9ec698e 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("Janz MODULbus VMOD-TTL Driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:janz-ttl");
-
-module_init(ttl_init);
-module_exit(ttl_exit);
drivers/gpio/gpio-rdc321x.c +1 -12
index 2762698..e97016a 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("RDC321x GPIO driver");
drivers/gpio/gpio-sch.c +1 -12
index 1635158..8cadf4d 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("GPIO interface for Intel Poulsbo SCH");
drivers/gpio/gpio-timberdale.c +1 -12
index c593bd4..031c6ad 100644
@@ -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");
drivers/gpio/gpio-ucb1400.c +1 -12
index 50e6bd1..26405ef 100644
@@ -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");
drivers/gpio/gpio-vr41xx.c +1 -12
index 98723cb..82d5c20 100644
@@ -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);
drivers/gpio/gpio-vx855.c +1 -11
index ef5aabd..76ebfe5 100644
@@ -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 <[email protected]>");
Signature · 1 line
1.7.7.3
Applied
#6 lore raw

Re: [PATCH 3/4] gpio: Convert GPIO drivers to module_platform_driver

Quoted 5 lines · 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.

Applied, thanks.

g.

Quoted 281 lines
---
 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(-)
drivers/gpio/gpio-adp5520.c +1 -11
index 9f27815..2f263cc 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("GPIO ADP5520 Driver");
drivers/gpio/gpio-cs5535.c +1 -12
index 6e16cba..a6403a0 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver");
drivers/gpio/gpio-da9052.c +1 -11
index 038f5eb..58ac377 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("DA9052 GPIO Device Driver");
drivers/gpio/gpio-generic.c +1 -11
index 4e24436..e38dd0c 100644
@@ -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 */
 
drivers/gpio/gpio-janz-ttl.c +1 -12
index 813ac07..9ec698e 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("Janz MODULbus VMOD-TTL Driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:janz-ttl");
-
-module_init(ttl_init);
-module_exit(ttl_exit);
drivers/gpio/gpio-rdc321x.c +1 -12
index 2762698..e97016a 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("RDC321x GPIO driver");
drivers/gpio/gpio-sch.c +1 -12
index 1635158..8cadf4d 100644
@@ -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 <[email protected]>");
 MODULE_DESCRIPTION("GPIO interface for Intel Poulsbo SCH");
drivers/gpio/gpio-timberdale.c +1 -12
index c593bd4..031c6ad 100644
@@ -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");
drivers/gpio/gpio-ucb1400.c +1 -12
index 50e6bd1..26405ef 100644
@@ -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");
drivers/gpio/gpio-vr41xx.c +1 -12
index 98723cb..82d5c20 100644
@@ -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);
drivers/gpio/gpio-vx855.c +1 -11
index ef5aabd..76ebfe5 100644
@@ -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 <[email protected]>");
Signature · 1 line
1.7.7.3
author
#7 lore raw

PATCH 4/4 gpio: Add decode of WM8994 GPIO configuration

In reply to Mark Brown

For the human reader.

---
 drivers/gpio/gpio-wm8994.c |   79 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 2 deletions(-)
drivers/gpio/gpio-wm8994.c +77 -2
index 96198f3..92ea535 100644
@@ -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
Signature · 1 line
1.7.7.3
Applied
#8 lore raw

Re: [PATCH 4/4] gpio: Add decode of WM8994 GPIO configuration

Quoted 4 lines · Mark Brown

For the human reader.

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.

Quoted 104 lines
---
 drivers/gpio/gpio-wm8994.c |   79 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 77 insertions(+), 2 deletions(-)
drivers/gpio/gpio-wm8994.c +77 -2
index 96198f3..92ea535 100644
@@ -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
Signature · 1 line
1.7.7.3
Acked-by on v1 1/4
#9 lore raw

RE: [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs

In reply to Mark Brown
Quoted 7 lines · 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.

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

Quoted 63 lines
---
 drivers/gpio/gpio-samsung.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)
drivers/gpio/gpio-samsung.c +19 -11
index 6b4d23f..f1c1ecd 100644
@@ -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

Applied
#10 lore raw

Re: [PATCH 1/4] gpio: Explicitly index samsung_gpio_cfgs

In reply to Mark Brown
Quoted 6 lines · 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.

Applied, thanks.

g.

Quoted 64 lines
---
 drivers/gpio/gpio-samsung.c |   29 +++++++++++++++++++----------
 1 files changed, 19 insertions(+), 10 deletions(-)
drivers/gpio/gpio-samsung.c +19 -10
index 6b4d23f..f1c1ecd 100644
@@ -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,
Signature · 1 line
1.7.7.3
author
#11 lore raw
In reply to Mark Brown
Quoted 3 lines · Mark Brown

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

Quoted 27 lines

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(-)
Acked-by
#12 lore raw
Quoted 10 lines · Mark Brown
Quoted 3 lines · Mark Brown

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:

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd.

Quoted 30 lines
Quoted 1 line

The following changes since commit

5611cc4572e889b62a7b4c72a413536bf6a9c416:

Quoted 4 lines

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

Quoted 6 lines

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

Quoted 13 lines
 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

+++++++++++++++++++++++++++++++++++++++-

Quoted 1 line
 13 files changed, 108 insertions(+), 141 deletions(-)