Commit graph

425950 commits

Author SHA1 Message Date
Mika Westerberg
77c2d7929d gpiolib: Allow GPIO chips to request their own GPIOs
Sometimes it is useful to allow GPIO chips themselves to request GPIOs they
own through gpiolib API. One use case is ACPI ASL code that should be able
to toggle GPIOs through GPIO operation regions.

We can't use gpio_request() because it will pin the module to the kernel
forever (it calls try_module_get()). To solve this we move module refcount
manipulation to gpiod_request() and let __gpiod_request() handle the actual
request. This changes the sequence a bit as now try_module_get() is called
outside of gpio_lock (I think this is safe, try_module_get() handles
serialization it needs already).

Then we provide gpiolib internal functions gpiochip_request/free_own_desc()
that do the same as gpio_request() but don't manipulate module refrence
count. This allows the GPIO chip driver to request and free descriptors it
owns without being pinned to the kernel forever.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-13 10:32:18 +01:00
Markus Mayer
7b7f588b50 MAINTAINERS: Add Broadcom GPIO maintainer
List myself as maintainer for Broadcom's Kona GPIO driver.

Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
Acked-by: Christian Daudt <bcm@fixthebug.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-12 15:58:58 +01:00
Geert Uytterhoeven
22520edc92 gpio: Spelling s/than/that/
Signed-off-by: Geert Uytterhoeven <geert+renesas@linux-m68k.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-12 15:54:54 +01:00
Jean Delvare
5da82cac74 gpio: cs5535: Simplify dependencies
The bus and architecture dependencies are already on MFD_CS5535, so
there is no need to repeat them here.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-12 15:41:33 +01:00
Gary Servin
33bc8411ee gpio: mcp23s08: trivial: fixed coding style issues
This coding style issue was detected using the checkpatch.pl script

Signed-off-by: Gary Servin <garyservin@gmail.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-12 14:52:14 +01:00
Krzysztof Kozlowski
f561b4230c gpio: max732x: Fix possible NULL pointer dereference on i2c_new_dummy error
In max732x_probe() driver allocates dummy I2C device (if number of ports
is greater than 8) with i2c_new_dummy() but it does not check the return
value of this call.

In case of error (i2c_new_device(): memory allocation failure or I2C
address cannot be used) this function returns NULL which is later
dereferenced by i2c_smbus_read_byte() (called from max732x_readb()).

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-12 14:50:51 +01:00
Krzysztof Kozlowski
c75793d8ab gpio: max732x: Fix I2C dummy device resource leak on probe failure
In max732x_probe() driver allocates dummy I2C device (if number of ports
is greater than 8) however it is not unregistered if probe fails later.
Fix the leak by unregistering dummy I2C device if it was allocated.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-12 14:48:13 +01:00
Lad, Prabhakar
49e1f91cd5 devicetree: bindings: gpio-davinic: fix documentation
This patch adds missing #gpio-cells and also adds a
usage example for leds.

Reported-by: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-11 11:20:01 +01:00
Alexander Holler
758afe429c gpio: davinci: fix gpio selection for OF
The driver missed an of_xlate function to translate gpio numbers
as found in the DT to the correct chip and number.

While there I've set #gpio_cells to a fixed value of 2.

I've used gpio-pxa.c as template for those changes and tested my changes
successfully on a da850 board using entries for gpio-leds in a DT. So I didn't
reinvent the wheel but just copied and tested stuff.

Thanks to Grygorii Strashko for the hint to the existing code in gpio-pxa.

Signed-off-by: Alexander Holler <holler@ahsoftware.de>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-11 11:14:19 +01:00
James Hogan
d3e1445327 gpio-tz1090: Replace commas with semi-colons
Replace commas with semicolons between irqchip callback initialisation
statements in tz1090_gpio_bank_probe. The commas appear to be a subtle
remnant of when the irqchips were statically initialised.

Thanks to Thomas Gleixner for spotting it while whipping up a coccinelle
script.

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Cc: linux-metag@vger.kernel.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-07 11:57:00 +08:00
Linus Walleij
f438acdf3d gpio: remove misleading documentation
It is currently debated where the functions to lock a certain
GPIO line as used for IRQs should be called. Delete all
misleading documentation.

Reported-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Acked-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-07 11:56:45 +08:00
Fabio Estevam
76b3627ea5 gpio: gpio-pl061: Use %pa to print 'resource_size_t'
The following build warning is generated when building multi_v7_defconfig with
LPAE option selected:

drivers/gpio/gpio-pl061.c:358:2: warning: format '%x' expects argument of type 'unsigned int', but argument 3 has type 'resource_size_t' [-Wformat=]

Fix it by using %pa to print 'resource_size_t'.

Reported-by: Olof's autobuilder <build@lixom.net>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-07 09:19:38 +08:00
Alan Tull
c7861f37b4 fix build error in gpio-dwapb patch
fix build error with this message:
kernel/irq/Kconfig:41:error: recursive dependency detected!
kernel/irq/Kconfig:41:  symbol GENERIC_IRQ_CHIP is selected by GPIO_DWAPB
drivers/gpio/Kconfig:131:       symbol GPIO_DWAPB depends on IRQ_DOMAIN
kernel/irq/Kconfig:46:  symbol IRQ_DOMAIN is selected by GENERIC_IRQ_CHIP

Signed-off-by: Alan Tull <atull@altera.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-07 09:16:27 +08:00
Linus Walleij
feabf0cd45 gpio: zevio: depend on ARM and OF_GPIO
Instead of just depending on OF and getting build failures,
depend on ARM && OF_GPIO.

Cc: Fabian Vogt <fabian@ritter-vogt.de>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-06 10:29:59 +08:00
Arnd Bergmann
de15011ac4 gpio: remove obsolete tnetv107x driver
The tnetv107x platform is getting removed, so this driver won't
be needed any more.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Alexandre Courbot <gnurou@gmail.com>
Cc: linux-gpio@vger.kernel.org
Acked-by: Sekhar Nori <nsekhar@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-05 10:44:44 +08:00
Jamie Iles
7779b34556 gpio: add a driver for the Synopsys DesignWare APB GPIO block
The Synopsys DesignWare block is used in some ARM devices (picoxcell)
and can be configured to provide multiple banks of GPIO pins.

v12: - Add irq_startup/shutdown
     - do irq_create_mapping() in probe, irq_find_mapping() in to_irq()
     - Adjust mappings to show support for 1 gpio per port.
     - gpio-cells = <1>
v11: - Use NULL when checking existence of 'interrupts' property
     - Bindings descriptions cleanup
v10: - in documentation nr-gpio -> nr-gpios
v9:  - cleanup in dt bindings doc
     - use of_get_child_count()
v8:  - remove socfpga.dtsi changes
     - minor cleanup in devicetree documentation
v7:  - use irq_generic_chip
     - support one irq per gpio line or one irq for many
     - s/bank/port/ and other cleanup
v6:  - (atull) squash the set of patches
     - use linear irq domain
     - build fixes. Original driver was reviewed on v3.2.
     - Fix setting irq edge type for 'rising' and 'both'.
     - Support as a loadable module.
     - Use bgpio_chip's spinlock during register access.
     - Clean up register names to match spec
     - s/bank/port/ because register names use the word 'port'
     - s/nr-gpio/nr-gpios/
     - don't get/put the of_node
     - remove signoffs/acked-by's because of changes
     - other cleanup
v5:  - handle sparse bank population correctly
v3:  - depend on rather than select IRQ_DOMAIN
     - split IRQ support into a separate patch
v2:  - use Rob Herring's irqdomain in generic irq chip patches
     - use reg property to indicate bank index
     - support irqs on both edges based on LinusW's u300 driver

Signed-off-by: Jamie Iles <jamie@jamieiles.com>
Signed-off-by: Alan Tull <atull@altera.com>
Reviewed-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-05 08:59:45 +08:00
Grygorii Strashko
0c6feb0796 gpio: davinci: reuse for keystone soc
The similar GPIO HW block is used by keystone SoCs as
in Davinci SoCs.
Hence, reuse Davinci GPIO driver for Keystone taking into
account that Keystone contains ARM GIC IRQ controller which
is implemented using IRQ Chip.

Documentation:
	http://www.ti.com/lit/ug/sprugv1/sprugv1.pdf

Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-03-04 17:20:04 +08:00
Fabian Vogt
9af4d80ba5 gpio: New driver for LSI ZEVIO SoCs
This driver supports the GPIO controller found in LSI ZEVIO SoCs.
It has been successfully tested on a TI nspire CX calculator.

Signed-off-by: Fabian Vogt <fabian@ritter-vogt.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-27 10:30:42 +01:00
Jean Delvare
f29b9d13dd gpio-ts5500: Add dependency
There is no point in displaying the TS5500-specific driver entries if
TS5500 board support itself isn't enabled.

Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
Cc: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
Acked-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-27 10:18:58 +01:00
Stephen Warren
51e8afc1c4 gpio: document polarity flag best practices
Document what we (Laurent and I, following a mailing list dicussion)
believe are best practices for the polarity flag in a GPIO specifier.

While touching the doc, I made a few minor editing changes to other
areas.

Suggested-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-27 10:13:47 +01:00
Alexander Shiyan
3bde4d26f9 gpio: rc5t583: Remove redundant check
Variable "offset" cannot be negative, so no need to check if it
greater than zero or equal.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-24 14:51:49 +01:00
Alexander Shiyan
58c0f5aa12 gpio: davinci: Use signed type for 'irq' variable
Variable 'irq' is declared as unsigned and then used to store
negative return values from irq_alloc_descs() such as -EINVAL.
This patch fix this by declaring the variable as a signed.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-24 14:50:50 +01:00
Jingoo Han
717f70e39a gpio: omap: Use devm_ioremap_resource()
Use devm_ioremap_resource() in order to make the code simpler,
and remove redundant return value check of platform_get_resource()
because the value is checked by devm_ioremap_resource().

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Acked-by: Kevin Hilman <khilman@linaro.org>
Acked-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-24 14:44:43 +01:00
Jingoo Han
09bafc30b6 gpio: pl061: Use devm_ioremap_resource()
Use devm_ioremap_resource() in order to make the code simpler.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-24 13:15:28 +01:00
Aaron Sierra
2b1f597f7f gpio: pca953x: Fix gpio_base may not default to -1
If no device tree node existed for a device when CONFIG_OF_GPIO was
defined, then gpio_base would not default to -1.

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-13 14:04:30 +01:00
Aaron Sierra
e73760a605 gpio: pca953x: Add Exar XRA1202
Add Exar XRA1202 8-bit GPIO expander to supported list.

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Acked-by: Graeme Smecher <gsmecher@threespeedlogic.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-13 14:02:19 +01:00
Aaron Sierra
eb32b5aae9 gpio: pca953x: Add NXP PCA9698
Add the NXP PCA9698 40-bit GPIO expander to the supported list.
Note: This only enables GPIO functionality.

Tested-by: Bob Schmitz <bschmitz@xes-inc.com>
Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Acked-by: Graeme Smecher <gsmecher@threespeedlogic.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-13 14:00:18 +01:00
Aaron Sierra
1e1916950b gpio: pca953x: Add devices to Kconfig help
The pca953x driver supports tca6424 (24-bit) and pca9505 (40-bit)
devices. They were the only supported devices not mentioned in the
Kconfig help.

Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
Acked-by: Graeme Smecher <gsmecher@threespeedlogic.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-13 13:57:41 +01:00
Jean-Francois Dagenais
1163316e52 gpio: adp5588 - add support for gpio names
which is already found in the common header for adp5588

Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-13 13:52:44 +01:00
Jean-Francois Dagenais
dc1b5ba150 gpio: adp5588 - use "unsigned" for the setup and teardown callbacks
to comply with the rest of the GPIO drivers.

Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-13 13:51:17 +01:00
Jean-Francois Dagenais
992196f28c gpio: adp5588: get value from data out when dir is out
As discussed here: http://ez.analog.com/message/35852,
the 5587 revC and 5588 revB spec sheets contain a mistake
in the GPIO_DAT_STATx register description.

According to R.Shnell at ADI, as well as my own
observations, it should read:
"GPIO data status (shows GPIO state when read for inputs)".

This commit changes the get value function accordingly.

Signed-off-by: Jean-Francois Dagenais <jeff.dagenais@gmail.com>
Acked-by: Michael Hennerich <michael.hennerich@analog.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-13 13:49:16 +01:00
Alexandre Courbot
390d82e312 gpiolib: ACPI: remove gpio_to_desc() usage
gpio_to_desc() must die. Replace one of its usage by the
newly-introduced gpiochip_get_desc() function.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-12 17:15:46 +01:00
Alexandre Courbot
bb1e88ccb7 gpiolib: add gpiochip_get_desc() driver function
Some drivers dealing with a gpio_chip might need to act on its
descriptors directly; one example is pinctrl drivers that need to lock a
GPIO for being used as IRQ using gpiod_lock_as_irq().

This patch exports a gpiochip_get_desc() function that returns the
GPIO descriptor at the requested index. It also sweeps the
gpio_to_chip() function out of the consumer interface since any holder
of a gpio_chip reference can manipulate its GPIOs way beyond what a
consumer should be allowed to do.

As a result, gpio_chip is not visible anymore to simple GPIO consumers.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Jean-Jacques Hiblot <jjhiblot@traphandler.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-12 17:11:35 +01:00
Rahul Bedarkar
90df4fe07f GPIO: gpiolib: correct description of gpiod_direction_output
Signed-off-by: Rahul Bedarkar <rahulbedarkar89@gmail.com>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-12 17:08:30 +01:00
Thomas Petazzoni
01ca59f1bb gpio: mvebu: use chained_irq_{enter,exit} for GIC compatibility
On currently supported SoCs, the GPIO block used on Marvell EBU SoCs
is always connected to the Marvell MPIC. However, we are going to
introduce the support for newer Marvell EBU SoCs that use the
Cortex-A9 core, and therefore use the GIC as their main interrupt
controller, to which the GPIO block controlled by the gpio-mvebu
driver is connected.

The GIC interrupt controller driver uses the fasteoi flow handler. In
order to ensure that the eoi hook of the GIC driver gets called, the
GPIO driver should call chained_irq_enter() and chained_irq_exit() in
its handler. Without this, the first GPIO interrupt locks up the
system because it doesn't get acked at the GIC level.

This change is similar to for example commit
0d978eb734 ("gpio: davinci: use
chained_irq_enter/chained_irq_exit API").

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Jason Cooper <jason@lakedaemon.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-12 16:23:58 +01:00
Vincent Donnefort
ff2ed0491d gpio: ich: Add output levels cache support
This patch allows GPIO driver to cache GPIO_LVL output registers. The aim is to
support chipsets on which GPIO_LVL value can't be read for output pins.

Caching output levels implies the first output values reading as 0. The driver
so can't be aware of set values GPIOs by bootloader or BIOS.

Signed-off-by: Vincent Donnefort <vdonnefort@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-12 16:12:22 +01:00
Vincent Donnefort
b667cf488a gpio: ich: Add support for multiple register addresses
This patch introduces regs and reglen pointers which allow a chipset to have
register addresses differing from ICH ones.

Signed-off-by: Vincent Donnefort <vdonnefort@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-12 16:09:45 +01:00
Vincent Donnefort
e54674f898 gpio: ich: Add blink capability option
This patch allows gpio_ich driver to be aware of non blink capable chipsets.

Signed-off-by: Vincent Donnefort <vdonnefort@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-12 16:06:35 +01:00
Philipp Zabel
ef70bbe1aa gpio: make gpiod_direction_output take a logical value
The documentation was not clear about whether
gpio_direction_output should take a logical value or the physical
level on the output line, i.e. whether the ACTIVE_LOW status
would be taken into account.

This converts gpiod_direction_output to use the logical level
and adds a new gpiod_direction_output_raw for the raw value.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-07 09:47:02 +01:00
Linus Walleij
25b35da7f4 gpio: generic: clamp retured value to [0,1]
The generic GPIO would return 0 for low generic GPIO, and
something != 0 for high GPIO. Let's make this sane by clamping
the returned value to [0,1].

Reported-by: Evgeny Boger <boger@contactless.ru>
Reviewed-by: Alexandre Courbot <acourbot@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-06 10:33:48 +01:00
Axel Lin
f86b7c70bc gpio: clps711x: Add missing .owner to struct gpio_chip
Add missing .owner of struct gpio_chip. This prevents the
module from being removed from underneath its users.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-06 10:33:48 +01:00
Axel Lin
a5d6d271b3 gpio: pl061: Select IRQ_DOMAIN rather than GENERIC_IRQ_CHIP
commit f1f70479e9 "gpio: pl061: support irqdomain" drops the support of
irq generic chip and use irqdomain instead. Thus fixes the dependency by
selecting IRQ_DOMAIN rather than GENERIC_IRQ_CHIP.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-06 10:33:47 +01:00
Pawel Moll
781f6d710d gpio: generic: Add label to platform data
When registering more than one platform device, it is
useful to set the gpio chip label in the platform data.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-06 10:33:47 +01:00
Markus Mayer
b7ab697369 gpio: bcm281xx: Use "unsigned gpio" consistently throughout the code
This patch removes some inconsistencies caused by the use of "int gpio"
in some parts of the code and "unsigned gpio" in others.

Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-06 10:33:47 +01:00
Sachin Kamat
bea4dbee95 gpio: gpiolib-of: Use PTR_ERR_OR_ZERO
PTR_RET is deprecated. Use PTR_ERR_OR_ZERO instead. While at it
also include missing err.h header.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-06 10:33:46 +01:00
Markus Mayer
bdb93c03c5 gpio: bcm281xx: Centralize register locking
Rather than unlock/re-lock for every write access, unlock a GPIO when
it is requested and re-lock it when it is freed. As a result, the GPIO
helper functions no longer have to deal with unlocking and re-locking
the register.

In addition, only unlock a specific GPIO rather than unlocking the
entire GPIO bank as before.

Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-06 10:33:46 +01:00
Markus Mayer
d762bae45a gpio: bcm281xx: Fix parameter name for GPIO_CONTROL macro
The GPIO_CONTROL macro returns the control register offset when given a
GPIO number.

Update the argument name in the macro to reflect that it takes in a
GPIO number and not a bank.

Signed-off-by: Markus Mayer <markus.mayer@linaro.org>
Reviewed-by: Tim Kryger <tim.kryger@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-06 10:33:45 +01:00
David Cohen
a0bbf03270 gpio: intel-mid: comments cleanup
This is a simple cleanup on gpio-intel-mid.c's header comments.

Signed-off-by: David Cohen <david.a.cohen@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-03 09:11:58 +01:00
Linus Walleij
9ae7e9e38a gpio: pl061: remove confusing naming
Drop the " gpio" suffix after the pl061 irq_chip name:
this is only confusing: an irqchip name should be a single,
short, simple string that looks nice in /proc/interrupts.

Drop the nameing of each individual IRQ to "pl061" - I
think this naming function is for naming the IRQ line,
not for boilerplating them all with the name of the
parent controller, which is already known from the
.name field of the irq_chip.

Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Deepak Sikri <deepak.sikri@st.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-03 09:11:58 +01:00
Linus Walleij
438a2c9a74 gpio: pl061: refactor type setting
Refactor this function so that I can understand it, do one
big read/modify/write operation and have the bitmask in a
variable instead of recalculating it every time it's needed.

Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
Cc: Deepak Sikri <deepak.sikri@st.com>
Acked-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2014-02-03 09:11:58 +01:00