summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2016-02-25gpio: fix abi regression in sysfsBamvor Jian Zhang1-1/+11
We started to assign the gpio_device as parent for the sysfs but this changes the expected layout of sysfs. Restore the previous behaviour. Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: documenatation: fix GPIO_LOOKUP{,_IDX} documentationGabor Juhos1-6/+5
The 'dev_id' parameter of the GPIO_LOOKUP{,_IDX} macros were removed by commit ad824783fb23 ("gpio: better lookup method for platform GPIOs"). Update the documentation to reflect that. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: mb86s7x: Allow compile test buildAxel Lin1-1/+1
There is no build dependency for this driver, so enable COMPILE_TEST to get better build coverage. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: pisosr: Use gpiod_set_value_cansleep in pisosr_gpio_refresh()Axel Lin1-2/+2
This driver has .can_sleep flag set. So the pisosr_gpio_get() can be called from contexts that can sleep. Thus use the cansleep() variant in pisosr_gpio_refresh(). Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: pisosr: Use devm_gpiod_get_optional for gpio->load_gpioAxel Lin1-7/+4
gpio->load_gpio is optional, so use devm_gpiod_get_optional instead. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Andrew F. Davis <afd@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: xgene: fix type of variable containing error codesAndrzej Hajda1-1/+1
ret variable can contain error values and is compared with zero. Its type must be signed. The problem has been detected using coccinelle script scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci Signed-off-by: Andrzej Hajda <a.hajda@samsung.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: rcar: Use ARCH_RENESASSimon Horman1-1/+1
Make use of ARCH_RENESAS in place of ARCH_SHMOBILE. This is part of an ongoing process to migrate from ARCH_SHMOBILE to ARCH_RENESAS the motivation for which being that RENESAS seems to be a more appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs. Signed-off-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: ts4800: Drop redundant code to set already initialized gpio_chip fieldsAxel Lin1-2/+0
Both chip->base and chip->label are correctly set by bgpio_init(). Signed-off-by: Axel Lin <axel.lin@ingics.com> Tested-by: Julien Grossholtz <julien.grossholtz@savoirfairelinux.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: brcmstb: Use list_for_each_entry at appropriate placesAxel Lin1-9/+4
Use list_for_each_entry to simplify the code a bit. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Gregory Fong <gregory.0xf0@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: ath79: Check valid gpio count for both DT and non-DT casesAxel Lin1-4/+5
Move the code checking valid gpio count to cover both DT and non-DT cases. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Alban Bedel <albeu@free.fr> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25gpio: Propagate all errors in devm_get_gpiod_from_child()Geert Uytterhoeven1-1/+1
devm_get_gpiod_from_child() tries several property suffixes to find a GPIO descriptor. If all suffixes fail and no probe deferral has been detected, it returns the error of the last try. However, if any but the last try fails with a real error (e.g. -EBUSY), this error is not propagated, and -ENOENT will be returned. This confuses drivers that e.g. want to detect if a GPIO is already in use. To fix this, change the loop logic to continue on -ENOENT, which indicates the property was not found and the next suffix should be tried, and propagate all other detected errors. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-23tools: gpio: Small updates for output formatMarkus Pargmann1-2/+2
Use %2d for the GPIO line number. This should align the results horziontally for most gpio chips. The GPIO label uses quotes for real values. For GPIO names this is currently missing. The patch adds the missing quote. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-22gpio: fixup line flags for userspace ABILinus Walleij1-7/+9
This fixes the wrongly indicated lines in the userspace ABI: test for the right BITS, do not treat bit numbers as bitmasks. Reported-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-20Revert "gpio: remove broken irq_to_gpio() interface"Linus Walleij1-0/+12
This reverts commit ee2204a37957daed80418ea8ffc4f5c3146fb8e7.
2016-02-20gpiolib: fix crash when gpiochip removedBamvor Jian Zhang1-3/+2
Commit cb464a88e1ed ("gpio: make the gpiochip a real device") call gpiochip_sysfs_unregister after the gpiochip is empty. It lead to the following crash: [ 163.503994] Unable to handle kernel NULL pointer dereference at virtual address 0000007c [...] [ 163.525394] [<ffffffc0003719a0>] gpiochip_sysfs_unregister+0x44/0xa4 [ 163.525611] [<ffffffc00036f6a0>] gpiochip_remove+0x24/0x154 [ 163.525861] [<ffffffbffc00f0a4>] mockup_gpio_remove+0x38/0x64 [gpio_mockup] [ 163.526101] [<ffffffc00042b4b4>] platform_drv_remove+0x24/0x64 [ 163.526313] [<ffffffc000429cc8>] __device_release_driver+0x7c/0xfc [ 163.526525] [<ffffffc000429e54>] driver_detach+0xbc/0xc0 [ 163.526700] [<ffffffc000429014>] bus_remove_driver+0x58/0xac [ 163.526883] [<ffffffc00042a4cc>] driver_unregister+0x2c/0x4c [ 163.527067] [<ffffffc00042b5c0>] platform_driver_unregister+0x10/0x18 [ 163.527284] [<ffffffbffc00f340>] mock_device_exit+0x10/0x38 [gpio_mockup] [ 163.527593] [<ffffffc00011cefc>] SyS_delete_module+0x1b8/0x1fc [ 163.527799] [<ffffffc000085d8c>] __sys_trace_return+0x0/0x4 [ 163.528049] Code: 940d74b4 f9019abf aa1303e0 940d7439 (7940fac0) [ 163.536273] ---[ end trace 3d1329be504af609 ]--- This patch fix this by changing the code back. Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19gpio: pisosr: add missing unlockSudip Mukherjee1-3/+1
If spi_read() fails then we just returned but we missed unlocking the mutex. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19gpio: X-Gene standby GPIO controller DTS bindingQuan Nguyen1-7/+40
Update description for X-Gene standby GPIO controller DTS binding to support GPIO line configuration as input, output or external IRQ pin. Signed-off-by: Y Vo <yvo@apm.com> Signed-off-by: Quan Nguyen <qnguyen@apm.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19gpio: xgene: Enable X-Gene standby GPIO as interrupt controllerQuan Nguyen1-32/+233
Enable X-Gene standby GPIO controller as interrupt controller to provide its own resources. This avoids ambiguity where GIC interrupt resource is use as X-Gene standby GPIO interrupt resource in user driver. Signed-off-by: Y Vo <yvo@apm.com> Signed-off-by: Quan Nguyen <qnguyen@apm.com> Acked-by: Marc Zyngier <marc.zyngier@arm.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19MIPS: txx9: rbtx4938: switch to gpiochip_add_data()Linus Walleij1-1/+2
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: linux-mips@linux-mips.org Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19MIPS: txx9: iocled: use gpiochip data pointerLinus Walleij1-6/+4
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: linux-mips@linux-mips.org Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19MIPS: rb532: use gpiochip data pointerLinus Walleij1-6/+6
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: linux-mips@linux-mips.org Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19MIPS: txx9: switch to gpiochip_add_data()Linus Walleij1-2/+2
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: linux-mips@linux-mips.org Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19MIPS: jz4740: use gpiochip data pointerLinus Walleij1-4/+6
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: linux-mips@linux-mips.org Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19MIPS: bcm63xx: switch to gpiochip_add_data()Linus Walleij1-2/+2
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: linux-mips@linux-mips.org Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19MIPS: ar7: use gpiochip data pointerLinus Walleij1-17/+9
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: linux-mips@linux-mips.org Cc: Alban Bedel <albeu@free.fr> Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19MIPS: alchemy: switch to gpiochip_add_data()Linus Walleij1-4/+4
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: linux-mips@linux-mips.org Acked-by: Ralf Baechle <ralf@linux-mips.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19m68k: gpio: switch to gpiochip_add_data()Linus Walleij1-1/+1
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: Geert Uytterhoeven <geert@linux-m68k.org> Acked-by: Greg Ungerer <gerg@uclinux.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19blackfin: extgpio: switch to gpiochip_add_data()Linus Walleij1-3/+3
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: Sonic Zhang <sonic.zhang@analog.com> Cc: Steven Miao <realmz6@gmail.com> Cc: adi-buildroot-devel@lists.sourceforge.net Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19blackfin: gpio: switch to gpiochip_add_data()Linus Walleij1-1/+3
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: Sonic Zhang <sonic.zhang@analog.com> Cc: Steven Miao <realmz6@gmail.com> Cc: adi-buildroot-devel@lists.sourceforge.net Acked-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19ARM: plat-orion: use gpiochip data pointerLinus Walleij1-15/+9
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: arm@kernel.org Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19ARM: w90x900: use gpiochip data pointerLinus Walleij1-7/+6
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: arm@kernel.org Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19ARM: simpad: switch to gpiochip_add_data()Linus Walleij1-2/+2
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: arm@kernel.org Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19ARM: s3c24xx: switch to gpiochip_add_data()Linus Walleij1-1/+1
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: arm@kernel.org Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19ARM: ixp4xx: switch to gpiochip_add_data()Linus Walleij1-2/+2
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: arm@kernel.org Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19ARM: imx: switch to gpiochip_add_data()Linus Walleij1-1/+3
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: arm@kernel.org Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19ARM: gemini: switch to gpiochip_add_data()Linus Walleij1-2/+2
We're planning to remove the gpiochip_add() function to swith to gpiochip_add_data() with NULL for data argument. Cc: arm@kernel.org Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19ARM: scoop: use gpiochip data pointerLinus Walleij1-5/+5
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: arm@kernel.org Cc: Richard Purdie <rpurdie@rpsys.net> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19pinctrl: cygnus-gpio: use gpiochip data pointerLinus Walleij1-19/+14
This makes the driver use the data pointer added to the gpio_chip to store a pointer to the state container instead of relying on container_of(). Cc: bcm-kernel-feedback-list@broadcom.com Cc: Scott Branden <sbranden@broadcom.com> Cc: Jon Mason <jonmason@broadcom.com> Acked-by: Ray Jui <rjui@broadcom.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19gpio: add userspace ABI for GPIO line informationLinus Walleij4-14/+156
This adds a GPIO line ABI for getting name, label and a few select flags from the kernel. This hides the kernel internals and only tells userspace what it may need to know: the different in-kernel consumers are masked behind the flag "kernel" and that is all userspace needs to know. However electric characteristics like active low, open drain etc are reflected to userspace, as this is important information. We provide information on all lines on all chips, later on we will likely add a flag for the chardev consumer so we can filter and display only the lines userspace actually uses in e.g. lsgpio, but then we first need an ABI for userspace to grab and use (get/set/select direction) a GPIO line. Sample output from "lsgpio" on ux500: GPIO chip: gpiochip7, "8011e000.gpio", 32 GPIO lines line 0: unnamed unlabeled line 1: unnamed unlabeled (...) line 25: unnamed "SFH7741 Proximity Sensor" [kernel output open-drain] line 26: unnamed unlabeled (...) Tested-by: Michael Welling <mwelling@ieee.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19gpio: store reflect the label to userspaceLinus Walleij5-3/+22
The gpio_chip label is useful for userspace to understand what kind of GPIO chip it is dealing with. Let's store a copy of this label in the gpio_device, add it to the struct passed to userspace for GPIO_GET_CHIPINFO_IOCTL and modify lsgpio to show it. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19gpio: tps65218: remove unused #includeLinus Walleij1-1/+0
Just as it says: after adding the proper interfaces to gpiolib, this is no longer needed. Suggested-by: Nicolas Saenz Julienne <nicolassaenzj@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19gpio: allow setting ARCH_NR_GPIOS from KconfigArnd Bergmann1-0/+4
The ARM version of asm/gpio.h basically just contains the same definitions as the gpiolib version, with the exception of ARCH_NR_GPIOS. This adds the option for overriding the constant through Kconfig to the architecture-independent header, so we can remove the ARM specific file later. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19gpio: ks8695: remove irq_to_gpio functionArnd Bergmann1-12/+0
The ks8695 gpio driver has its own copy of the irq_to_gpio() function. This is completely unused in the mainline kernel after we converted all remaining users several years ago, so we can remove the definition as well. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19gpio: remove broken irq_to_gpio() interfaceArnd Bergmann1-12/+0
gpiolib has removed the irq_to_gpio() API several years ago, but the global header still provided a non-working stub. To prevent new users of this broken function from showing up, let's remove the stubs as well. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-19MIPS: jz4740: Fix surviving instance of irq_to_gpio()Ralf Baechle1-1/+1
This is fallout from commit 832f5dacfa0b ("MIPS: Remove all the uses of custom gpio.h"). Signed-off-by: Ralf Baechle <ralf@linux-mips.org> Suggested-by: Lars-Peter Clausen <lars@metafoo.de>
2016-02-18gpio: use kzalloc to allocate gpio_deviceJosh Cartwright1-1/+1
The use of kmalloc() to allocate the gpio_device leaves the contained struct device object in an unknown state. Calling dev_set_name() on a struct device of unknown state can trigger the free() of an invalid pointer, as seen in the following backtrace (collected by Tony Lindgren): kfree kobject_set_name_vargs dev_set_name gpiochip_add_data omap_gpio_probe platform_drv_probe ... Reported-by: Geert Uytterhoeven <geert+renesas@glider.be> Reported-by: Michael Welling <mwelling@ieee.org> Reported-by: Tony Lindgren <tony@atomide.com> Tested-by: Michael Welling <mwelling@ieee.org> Tested-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Josh Cartwright <joshc@ni.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-16gpio-mcp23s08: correctly handling failed allocationInsu Yun1-0/+2
Since devm_kzalloc can be failed in memory pressure, it needs to check and return -ENOMEM Signed-off-by: Insu Yun <wuninsu@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-16gpio: tps65218: Make tps65218_gpio_output set proper output levelAxel Lin1-0/+1
The .direction_output callback should set proper output level. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-16gpio: tpic2810: Make tpic2810_direction_output set proper output levelAxel Lin1-0/+3
The .direction_output callback should set proper output level. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-16gpio: create an API to detect open drain/source on linesLinus Walleij3-5/+26
My left hand merges code to privatize the descriptor handling while my right hand merges drivers that poke around and disrespect with the same gpiolib internals. So let's expose the proper APIs for drivers to ask the gpiolib core if a line is marked as open drain or open source and get some order around things so this driver compiles again. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Nicolas Saenz Julienne <nicolassaenzj@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>