From 868fea0507308b6548bba7debe5f5c2d5ca47fca Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Fri, 28 Oct 2011 09:23:32 +0900 Subject: pch_gpio: Support new device LAPIS Semiconductor ML7831 IOH ML7831 is companion chip for Intel Atom E6xx series. Signed-off-by: Tomoya MORINAGA Signed-off-by: Grant Likely --- drivers/gpio/Kconfig | 11 ++++++----- drivers/gpio/gpio-pch.c | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) (limited to 'drivers/gpio') diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig index 8482a23887dc..4e04157a3683 100644 --- a/drivers/gpio/Kconfig +++ b/drivers/gpio/Kconfig @@ -387,7 +387,7 @@ config GPIO_LANGWELL Say Y here to support Intel Langwell/Penwell GPIO. config GPIO_PCH - tristate "Intel EG20T PCH / OKI SEMICONDUCTOR ML7223 IOH GPIO" + tristate "Intel EG20T PCH/LAPIS Semiconductor IOH(ML7223/ML7831) GPIO" depends on PCI && X86 select GENERIC_IRQ_CHIP help @@ -395,11 +395,12 @@ config GPIO_PCH which is an IOH(Input/Output Hub) for x86 embedded processor. This driver can access PCH GPIO device. - This driver also can be used for OKI SEMICONDUCTOR IOH(Input/ - Output Hub), ML7223. + This driver also can be used for LAPIS Semiconductor IOH(Input/ + Output Hub), ML7223 and ML7831. ML7223 IOH is for MP(Media Phone) use. - ML7223 is companion chip for Intel Atom E6xx series. - ML7223 is completely compatible for Intel EG20T PCH. + ML7831 IOH is for general purpose use. + ML7223/ML7831 is companion chip for Intel Atom E6xx series. + ML7223/ML7831 is completely compatible for Intel EG20T PCH. config GPIO_ML_IOH tristate "OKI SEMICONDUCTOR ML7213 IOH GPIO support" diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index a6008e123d04..eb574f2c5a92 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -524,6 +524,7 @@ static DEFINE_PCI_DEVICE_TABLE(pch_gpio_pcidev_id) = { { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x8803) }, { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8014) }, { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8043) }, + { PCI_DEVICE(PCI_VENDOR_ID_ROHM, 0x8803) }, { 0, } }; MODULE_DEVICE_TABLE(pci, pch_gpio_pcidev_id); -- cgit v1.2.3-59-g8ed1b From f4574beb9655dbe6a1513f308f0070e9e5e1ad0e Mon Sep 17 00:00:00 2001 From: Tomoya MORINAGA Date: Fri, 28 Oct 2011 09:23:33 +0900 Subject: pch_gpio: Change company name OKI SEMICONDUCTOR to LAPIS Semiconductor On October 1 in 2011, OKI SEMICONDUCTOR Co., Ltd. changed the company name in to LAPIS Semiconductor Co., Ltd. Signed-off-by: Tomoya MORINAGA Signed-off-by: Grant Likely --- drivers/gpio/gpio-pch.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/gpio') diff --git a/drivers/gpio/gpio-pch.c b/drivers/gpio/gpio-pch.c index eb574f2c5a92..f0603297f829 100644 --- a/drivers/gpio/gpio-pch.c +++ b/drivers/gpio/gpio-pch.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 OKI SEMICONDUCTOR Co., LTD. + * Copyright (C) 2011 LAPIS Semiconductor Co., Ltd. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -49,8 +49,8 @@ struct pch_regs { enum pch_type_t { INTEL_EG20T_PCH, - OKISEMI_ML7223m_IOH, /* OKISEMI ML7223 IOH PCIe Bus-m */ - OKISEMI_ML7223n_IOH /* OKISEMI ML7223 IOH PCIe Bus-n */ + OKISEMI_ML7223m_IOH, /* LAPIS Semiconductor ML7223 IOH PCIe Bus-m */ + OKISEMI_ML7223n_IOH /* LAPIS Semiconductor ML7223 IOH PCIe Bus-n */ }; /* Specifies number of GPIO PINS */ -- cgit v1.2.3-59-g8ed1b From 64842aad5ec5ea3b6f6e716ce53a863f7c409da8 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Sun, 6 Nov 2011 11:36:18 -0700 Subject: gpiolib: output basic details and consolidate gpio device drivers This patch adds a kernel message, containing GPIO range and device name on successful device registration, and removes duplicate messages from the following drivers: * gpio-adp5588 * gpio-bt8xx * gpio-cs5535 * gpio-janz-ttl * gpio-nomadik * gpio-pcf857x * gpio-xilinx * drivers/of/gpio.c Signed-off-by: Hartmut Knaack [grant.likely@secretlab.ca: squashed 2 patches together] Signed-off-by: Grant Likely --- drivers/gpio/gpio-adp5588.c | 5 ++--- drivers/gpio/gpio-bt8xx.c | 3 --- drivers/gpio/gpio-cs5535.c | 1 - drivers/gpio/gpio-janz-ttl.c | 2 -- drivers/gpio/gpio-nomadik.c | 4 ++-- drivers/gpio/gpio-pcf857x.c | 5 +---- drivers/gpio/gpio-xilinx.c | 1 - drivers/gpio/gpiolib.c | 4 ++++ drivers/of/gpio.c | 2 -- 9 files changed, 9 insertions(+), 18 deletions(-) (limited to 'drivers/gpio') diff --git a/drivers/gpio/gpio-adp5588.c b/drivers/gpio/gpio-adp5588.c index 3525ad918771..9ad1703d1408 100644 --- a/drivers/gpio/gpio-adp5588.c +++ b/drivers/gpio/gpio-adp5588.c @@ -418,9 +418,8 @@ static int __devinit adp5588_gpio_probe(struct i2c_client *client, if (ret) goto err_irq; - dev_info(&client->dev, "gpios %d..%d (IRQ Base %d) on a %s Rev. %d\n", - gc->base, gc->base + gc->ngpio - 1, - pdata->irq_base, client->name, revid); + dev_info(&client->dev, "IRQ Base: %d Rev.: %d\n", + pdata->irq_base, revid); if (pdata->setup) { ret = pdata->setup(client, gc->base, gc->ngpio, pdata->context); diff --git a/drivers/gpio/gpio-bt8xx.c b/drivers/gpio/gpio-bt8xx.c index ec57936aef62..5ca4098ba092 100644 --- a/drivers/gpio/gpio-bt8xx.c +++ b/drivers/gpio/gpio-bt8xx.c @@ -223,9 +223,6 @@ static int bt8xxgpio_probe(struct pci_dev *dev, goto err_release_mem; } - printk(KERN_INFO "bt8xxgpio: Abusing BT8xx card for GPIOs %d to %d\n", - bg->gpio.base, bg->gpio.base + BT8XXGPIO_NR_GPIOS - 1); - return 0; err_release_mem: diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c index 6e16cba56ad2..693a81beb3c7 100644 --- a/drivers/gpio/gpio-cs5535.c +++ b/drivers/gpio/gpio-cs5535.c @@ -347,7 +347,6 @@ static int __devinit cs5535_gpio_probe(struct platform_device *pdev) if (err) goto release_region; - dev_info(&pdev->dev, "GPIO support successfully loaded.\n"); return 0; release_region: diff --git a/drivers/gpio/gpio-janz-ttl.c b/drivers/gpio/gpio-janz-ttl.c index 813ac077e5d7..6f7fda0b61ab 100644 --- a/drivers/gpio/gpio-janz-ttl.c +++ b/drivers/gpio/gpio-janz-ttl.c @@ -201,8 +201,6 @@ static int __devinit ttl_probe(struct platform_device *pdev) goto out_iounmap_regs; } - dev_info(&pdev->dev, "module %d: registered GPIO device\n", - pdata->modno); return 0; out_iounmap_regs: diff --git a/drivers/gpio/gpio-nomadik.c b/drivers/gpio/gpio-nomadik.c index 1ebedfb6d46d..839624f9fe6a 100644 --- a/drivers/gpio/gpio-nomadik.c +++ b/drivers/gpio/gpio-nomadik.c @@ -1150,8 +1150,8 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev) nmk_gpio_init_irq(nmk_chip); - dev_info(&dev->dev, "Bits %i-%i at address %p\n", - nmk_chip->chip.base, nmk_chip->chip.base+31, nmk_chip->addr); + dev_info(&dev->dev, "at address %p\n", + nmk_chip->addr); return 0; out_free: diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index 3e1f1ecd07be..2d1de9e7e9bd 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c @@ -290,10 +290,7 @@ static int pcf857x_probe(struct i2c_client *client, * methods can't be called from sleeping contexts. */ - dev_info(&client->dev, "gpios %d..%d on a %s%s\n", - gpio->chip.base, - gpio->chip.base + gpio->chip.ngpio - 1, - client->name, + dev_info(&client->dev, "%s\n", client->irq ? " (irq ignored)" : ""); /* Let platform code set up the GPIOs and their users. diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c index 0ce6ac9898b1..79b0fe8a7253 100644 --- a/drivers/gpio/gpio-xilinx.c +++ b/drivers/gpio/gpio-xilinx.c @@ -206,7 +206,6 @@ static int __devinit xgpio_of_probe(struct device_node *np) np->full_name, status); return status; } - pr_info("XGpio: %s: registered\n", np->full_name); return 0; } diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index a971e3d043ba..698f59ea7c18 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -1089,6 +1089,10 @@ unlock: if (status) goto fail; + pr_info("gpiochip_add: registered GPIOs %d to %d on device: %s\n", + chip->base, chip->base + chip->ngpio - 1, + chip->label ? : "generic"); + return 0; fail: /* failures here can mean systems won't boot... */ diff --git a/drivers/of/gpio.c b/drivers/of/gpio.c index ef0105fa52b1..ea4f2faab222 100644 --- a/drivers/of/gpio.c +++ b/drivers/of/gpio.c @@ -198,8 +198,6 @@ int of_mm_gpiochip_add(struct device_node *np, if (ret) goto err2; - pr_debug("%s: registered as generic GPIO chip, base is %d\n", - np->full_name, gc->base); return 0; err2: iounmap(mm_gc->regs); -- cgit v1.2.3-59-g8ed1b From 1a2d397a6eb5cf40c382d9e3d4bc04aaeb025336 Mon Sep 17 00:00:00 2001 From: Grant Likely Date: Mon, 12 Dec 2011 09:25:57 -0700 Subject: gpio/powerpc: Eliminate duplication of of_get_named_gpio_flags() A large chunk of qe_pin_request() is unnecessarily cut-and-paste directly from of_get_named_gpio_flags(). This patch cuts out the duplicate code and replaces it with a call to of_get_gpio(). v2: fixed compile error due to missing gpio_to_chip() Signed-off-by: Grant Likely Cc: Benjamin Herrenschmidt Cc: Kumar Gala --- arch/powerpc/sysdev/qe_lib/gpio.c | 42 ++++++++------------------------------- drivers/gpio/gpiolib.c | 2 +- include/asm-generic/gpio.h | 1 + 3 files changed, 10 insertions(+), 35 deletions(-) (limited to 'drivers/gpio') diff --git a/arch/powerpc/sysdev/qe_lib/gpio.c b/arch/powerpc/sysdev/qe_lib/gpio.c index e23f23cf9f5c..521e67a49dc4 100644 --- a/arch/powerpc/sysdev/qe_lib/gpio.c +++ b/arch/powerpc/sysdev/qe_lib/gpio.c @@ -139,14 +139,10 @@ struct qe_pin { struct qe_pin *qe_pin_request(struct device_node *np, int index) { struct qe_pin *qe_pin; - struct device_node *gpio_np; struct gpio_chip *gc; struct of_mm_gpio_chip *mm_gc; struct qe_gpio_chip *qe_gc; int err; - int size; - const void *gpio_spec; - const u32 *gpio_cells; unsigned long flags; qe_pin = kzalloc(sizeof(*qe_pin), GFP_KERNEL); @@ -155,45 +151,25 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index) return ERR_PTR(-ENOMEM); } - err = of_parse_phandles_with_args(np, "gpios", "#gpio-cells", index, - &gpio_np, &gpio_spec); - if (err) { - pr_debug("%s: can't parse gpios property\n", __func__); + err = of_get_gpio(np, index); + if (err < 0) + goto err0; + gc = gpio_to_chip(err); + if (WARN_ON(!gc)) goto err0; - } - if (!of_device_is_compatible(gpio_np, "fsl,mpc8323-qe-pario-bank")) { + if (!of_device_is_compatible(gc->of_node, "fsl,mpc8323-qe-pario-bank")) { pr_debug("%s: tried to get a non-qe pin\n", __func__); err = -EINVAL; - goto err1; - } - - gc = of_node_to_gpiochip(gpio_np); - if (!gc) { - pr_debug("%s: gpio controller %s isn't registered\n", - np->full_name, gpio_np->full_name); - err = -ENODEV; - goto err1; - } - - gpio_cells = of_get_property(gpio_np, "#gpio-cells", &size); - if (!gpio_cells || size != sizeof(*gpio_cells) || - *gpio_cells != gc->of_gpio_n_cells) { - pr_debug("%s: wrong #gpio-cells for %s\n", - np->full_name, gpio_np->full_name); - err = -EINVAL; - goto err1; + goto err0; } - err = gc->of_xlate(gc, np, gpio_spec, NULL); - if (err < 0) - goto err1; - mm_gc = to_of_mm_gpio_chip(gc); qe_gc = to_qe_gpio_chip(mm_gc); spin_lock_irqsave(&qe_gc->lock, flags); + err -= gc->base; if (test_and_set_bit(QE_PIN_REQUESTED, &qe_gc->pin_flags[err]) == 0) { qe_pin->controller = qe_gc; qe_pin->num = err; @@ -206,8 +182,6 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index) if (!err) return qe_pin; -err1: - of_node_put(gpio_np); err0: kfree(qe_pin); pr_debug("%s failed with status %d\n", __func__, err); diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 698f59ea7c18..17fdf4b6af93 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -114,7 +114,7 @@ static int gpio_ensure_requested(struct gpio_desc *desc, unsigned offset) } /* caller holds gpio_lock *OR* gpio is marked as requested */ -static inline struct gpio_chip *gpio_to_chip(unsigned gpio) +struct gpio_chip *gpio_to_chip(unsigned gpio) { return gpio_desc[gpio].chip; } diff --git a/include/asm-generic/gpio.h b/include/asm-generic/gpio.h index 8c8621097fa0..6b10bdc105d6 100644 --- a/include/asm-generic/gpio.h +++ b/include/asm-generic/gpio.h @@ -135,6 +135,7 @@ struct gpio_chip { extern const char *gpiochip_is_requested(struct gpio_chip *chip, unsigned offset); +extern struct gpio_chip *gpio_to_chip(unsigned gpio); extern int __must_check gpiochip_reserve(int start, int ngpio); /* add/remove chips */ -- cgit v1.2.3-59-g8ed1b From 2985479f198c6bceded56fa5cf51457a8d273513 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 00:23:58 +0800 Subject: 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. Signed-off-by: Mark Brown Acked-by: Kukjin Kim Signed-off-by: Grant Likely --- drivers/gpio/gpio-samsung.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'drivers/gpio') diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 866251852719..42bb1cd99288 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c @@ -467,33 +467,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, -- cgit v1.2.3-59-g8ed1b From f134759955bbb5bf28a8d2c6fe5aa201d1ffb860 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 00:23:59 +0800 Subject: gpio: Fix typo in comment in Samsung driver Signed-off-by: Mark Brown Acked-by: Kukjin Kim Signed-off-by: Grant Likely --- drivers/gpio/gpio-samsung.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpio') diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index 42bb1cd99288..f9b127957565 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c @@ -230,7 +230,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. */ -- cgit v1.2.3-59-g8ed1b From 6f61415e9c4c0ab02c8eda7671bb652db4863cc0 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 00:24:00 +0800 Subject: gpio: Convert GPIO drivers to module_platform_driver 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 Signed-off-by: Grant Likely --- 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(-) (limited to 'drivers/gpio') diff --git a/drivers/gpio/gpio-adp5520.c b/drivers/gpio/gpio-adp5520.c index 9f2781537001..2f263cc32561 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 "); MODULE_DESCRIPTION("GPIO ADP5520 Driver"); diff --git a/drivers/gpio/gpio-cs5535.c b/drivers/gpio/gpio-cs5535.c index 693a81beb3c7..19eda1bbe343 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 "); MODULE_DESCRIPTION("AMD CS5535/CS5536 GPIO driver"); diff --git a/drivers/gpio/gpio-da9052.c b/drivers/gpio/gpio-da9052.c index 038f5eb8b13d..58ac3777f0c4 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 "); MODULE_DESCRIPTION("DA9052 GPIO Device Driver"); diff --git a/drivers/gpio/gpio-generic.c b/drivers/gpio/gpio-generic.c index 4e24436b0f82..e38dd0c31973 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 6f7fda0b61ab..f2f000dd70b3 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 "); 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 2762698e0204..e97016af6443 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 "); MODULE_DESCRIPTION("RDC321x GPIO driver"); diff --git a/drivers/gpio/gpio-sch.c b/drivers/gpio/gpio-sch.c index 163515845494..8cadf4d683a8 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 "); MODULE_DESCRIPTION("GPIO interface for Intel Poulsbo SCH"); diff --git a/drivers/gpio/gpio-timberdale.c b/drivers/gpio/gpio-timberdale.c index c593bd46bfb6..031c6adf5b65 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 50e6bd1392ce..26405efe0f9f 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 98723cb9ac68..82d5c20ad3cb 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 ef5aabd8b8b7..76ebfe5ff702 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 "); -- cgit v1.2.3-59-g8ed1b From d0ad5e89256c351ddd40167152c24a88efcb0f6d Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 8 Dec 2011 00:24:01 +0800 Subject: gpio: Add decode of WM8994 GPIO configuration For the human reader. Signed-off-by: Mark Brown Acked-by: Linus Walleij Signed-off-by: Grant Likely --- drivers/gpio/gpio-wm8994.c | 79 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 2 deletions(-) (limited to 'drivers/gpio') diff --git a/drivers/gpio/gpio-wm8994.c b/drivers/gpio/gpio-wm8994.c index 96198f3fab73..92ea5350dfe9 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 -- cgit v1.2.3-59-g8ed1b