summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpio-pca953x.c
Commit message (Collapse)AuthorAgeFilesLines
* gpio: pca953x: Use correct u16 value for register word writeYong Li2016-04-081-1/+2
| | | | | | | | | | | The current implementation only uses the first byte in val, the second byte is always 0. Change it to use cpu_to_le16 to write the two bytes into the register Cc: stable@vger.kernel.org Signed-off-by: Yong Li <sdliyong@gmail.com> Reviewed-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: Fix pca953x_gpio_set_multiple() on 64-bitGeert Uytterhoeven2016-03-161-2/+4
| | | | | | | | | | | | pca953x_gpio_set_multiple() divides by 4 to convert from longs to bytes, which assumes a 32-bit platform, and is not correct on 64-bit platforms. Use "sizeof(...)" instead to fix this. Cc: stable@vger.kernel.org Fixes: b4818afeacbd8182 ("gpio: pca953x: Add set_multiple to allow multiple bits to be set in one write.") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Acked-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: Use devm_gpiochip_add_data() for gpio registrationLaxman Dewangan2016-02-231-3/+1
| | | | | | Use devm_gpiochip_add_data() for GPIO registration. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
* gpio: pca953x: use gpiochip data pointerLinus Walleij2016-01-051-16/+11
| | | | | | | | | | | 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: Grygorii Strashko <grygorii.strashko@ti.com> Cc: Markus Pargmann <mpa@pengutronix.de> Cc: Toby Smith <toby@tismith.id.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: Add set_multiple to allow multiple bits to be set in one write.Phil Reid2015-12-101-0/+38
| | | | | | | Tested with TCA6408 / TCA6416 devices. Signed-off-by: Phil Reid <preid@electromag.com.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: make inclusion of <linux/of_platform.h> unconditionalLinus Walleij2015-12-091-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | After adding the DT matching in commit 6f29c9afbe636fc0e35c82a11eaf45c3b85eb07a "gpio: pca935x: fix of-only probed devices" compilation fails like this: CC [M] drivers/gpio/gpio-pca953x.o gpio-pca953x.c: In function ‘pca953x_probe’: gpio-pca953x.c:693:11: error: implicit declaration of function ‘of_match_device’ [-Werror=implicit-function-declaration] match = of_match_device(pca953x_dt_ids, &client->dev); ^ gpio-pca953x.c:693:9: warning: assignment makes pointer from integer without a cast [-Wint-conversion] match = of_match_device(pca953x_dt_ids, &client->dev); ^ cc1: some warnings being treated as errors ../scripts/Makefile.build:264: recipe for target 'drivers/gpio/gpio-pca953x.o' failed After removing the conditional inclusion guards compilation works fine again. Might be a module problem so that fix. Cc: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca935x: fix of-only probed devicesBen Dooks2015-12-091-32/+44
| | | | | | | | | | | | | | | | | | | | | If the pca953x device is probed from OF using the proper OF probing then the i2c-client will be NULL and the device probe will fail as id is NULL and it isn't an ACPI device (previous drivers would simply OOPS out). Add support for the of_device_id table having the same data as the others so that the correct paths will be taken when registering a device. An example of current valid of node which did not work: gpio@38 { compatible = "onsemi,pca9654", "nxp,pca9534"; reg = <0x38>; interrupt-parent = <&gpio5>; interrupts = <25 IRQ_TYPE_LEVEL_LOW>; }; Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: add onsemi,pca9654 idBen Dooks2015-12-091-0/+2
| | | | | | | | Add onsemi,pca9654 which is also compatible with the nxp,pca9524 as it is an 8bit expander with an interrupt output. Signed-off-by: Ben Dooks <ben.dooks@codethink.co.uk> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: change member .dev to .parentLinus Walleij2015-11-191-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The name .dev in a struct is normally reserved for a struct device that is let us say a superclass to the thing described by the struct. struct gpio_chip stands out by confusingly using a struct device *dev to point to the parent device (such as a platform_device) that represents the hardware. As we want to give gpio_chip:s real devices, this is not working. We need to rename this member to parent. This was done by two coccinelle scripts, I guess it is possible to combine them into one, but I don't know such stuff. They look like this: @@ struct gpio_chip *var; @@ -var->dev +var->parent and: @@ struct gpio_chip var; @@ -var.dev +var.parent and: @@ struct bgpio_chip *var; @@ -var->gc.dev +var->gc.parent Plus a few instances of bgpio that I couldn't figure out how to teach Coccinelle to rewrite. This patch hits all over the place, but I *strongly* prefer this solution to any piecemal approaches that just exercise patch mechanics all over the place. It mainly hits drivers/gpio and drivers/pinctrl which is my own backyard anyway. Cc: Haavard Skinnemoen <hskinnemoen@gmail.com> Cc: Rafał Miłecki <zajec5@gmail.com> Cc: Richard Purdie <rpurdie@rpsys.net> Cc: Mauro Carvalho Chehab <mchehab@osg.samsung.com> Cc: Alek Du <alek.du@intel.com> Cc: Jaroslav Kysela <perex@perex.cz> Cc: Takashi Iwai <tiwai@suse.com> Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Jiri Kosina <jkosina@suse.cz> Acked-by: Hans-Christian Egtvedt <egtvedt@samfundet.no> Acked-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: support ACPI devices found on Galileo Gen2Andy Shevchenko2015-10-051-1/+20
| | | | | | | | This patch adds a support of the expandes found on Intel Galileo Gen2 board. The platform information comes from ACPI. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: store driver_data for future useAndy Shevchenko2015-10-051-7/+10
| | | | | | | | Instead of using id->driver_data directly we copied it to the internal structure. This will help to adapt driver for ACPI use. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: Add TI TCA9539 supportThierry Reding2015-10-021-0/+1
| | | | | | | | | The TCA9539 is almost identical to the PCA9555 and software-compatible with this driver. It exposes 16 general purpose I/O pins in two 8-bit configurations. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: Fix error checking in the function device_pca957x_initNicholas Krause2015-10-021-2/+6
| | | | | | | | | | | | This fixes error checking in the function device_pca957x_init to properly check and return error code values from the calls to the function pca953x_write_regs if they fail as to properly signal callers when a error occurs due a failure when writing registers for this gpio based device. Signed-off-by: Nicholas Krause <xerofoify@gmail.com> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: fix nested irqs reschedulingGrygorii Strashko2015-07-161-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pca953x interrupt controller functionality is implemented using nested threaded IRQs which require parent_irq to be configured properly otherwise below warning can be seen if IRQ core will try re-schedule nested IRQ: ------------[ cut here ]------------ WARNING: CPU: 1 PID: 12 at kernel/irq/manage.c:696 irq_nested_primary_handler+0x30/0x38() Primary handler called for nested irq 301 Modules linked in: uinput ipv6 smsc95xx usbnet mii imx2_wdt etnaviv(C) matrix_keypad matrix_keymap ar1021_i2c CPU: 1 PID: 12 Comm: ksoftirqd/1 Tainted: G WC 4.1.1 #9 Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree) Backtrace: [<c0013298>] (dump_backtrace) from [<c0013488>] (show_stack+0x20/0x24) [<c0013468>] (show_stack) from [<c05743c4>] (dump_stack+0x70/0xc0) [<c0574354>] (dump_stack) from [<c002b7b8>] (warn_slowpath_common+0x88/0xc0) [<c002b730>] (warn_slowpath_common) from [<c002b8ac>] (warn_slowpath_fmt+0x40/0x48) [<c002b870>] (warn_slowpath_fmt) from [<c0075798>] (irq_nested_primary_handler+0x30/0x38) [<c0075768>] (irq_nested_primary_handler) from [<c0075200>] (handle_irq_event_percpu+0x70/0x2d0) [<c0075190>] (handle_irq_event_percpu) from [<c00754ac>] (handle_irq_event+0x4c/0x6c) [<c0075460>] (handle_irq_event) from [<c0078204>] (handle_simple_irq+0xa4/0xc8) [<c0078160>] (handle_simple_irq) from [<c0077cd4>] (resend_irqs+0x50/0x7c) [<c0077c84>] (resend_irqs) from [<c002f99c>] (tasklet_action+0x94/0x140) [<c002f908>] (tasklet_action) from [<c002eea8>] (__do_softirq+0xa0/0x3c8) [<c002ee08>] (__do_softirq) from [<c002f208>] (run_ksoftirqd+0x38/0x54) [<c002f1d0>] (run_ksoftirqd) from [<c004b1e4>] (smpboot_thread_fn+0x1f8/0x2f0) [<c004afec>] (smpboot_thread_fn) from [<c0047744>] (kthread+0xe8/0x104) [<c004765c>] (kthread) from [<c000fac8>] (ret_from_fork+0x14/0x2c) ---[ end trace 96052cda48865769 ]--- The issue was reported and described in details by Lothar Waßmann and Christian Gmeiner in https://lkml.org/lkml/2014/9/9/123. Fix it by adding missed call of gpiochip_set_chained_irqchip() so GPIO IRQ chip helpers will set parent_irq for nested IRQs properly. Reported-by: Lothar Waßmann <LW@KARO-electronics.de> Tested-by: Christian Gmeiner <christian.gmeiner@gmail.com> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: Prevent an integer overflow in the pca953x driverJoshua Scott2015-06-011-9/+12
| | | | | | | | | | | | Interrupts were missed if an 8-bit integer overflow occurred. This was observed when bank0,pin7 and bank1,pin7 changed simultaniously. As the 8-bit totals were only checked against zero, replace them with booleans. Name the booleans so that their purpose is clear. Signed-off-by: Joshua Scott <joshua.scott@alliedtelesis.co.nz> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* Drivers: gpio: Fix spelling errorsColin Cronin2015-05-191-1/+1
| | | | | | | | Fixed several spelling errors in gpio-lynxpoint, gpio-pca953x, gpio-tegra, gpio-zynq, gpiolib-of, gpiolib. Signed-off-by: Colin Cronin <colinpatrickcronin@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: Drop deprecated DT bindingsMarkus Pargmann2014-08-281-51/+3
| | | | | | | | Drop deprecated DT bindings and use automaticly assigned gpio and irq bases. Signed-off-by: Markus Pargmann <mpa@pengutronix.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: remove all usage of gpio_remove retval in driver/gpioabdoulaye berthe2014-07-221-6/+1
| | | | | Signed-off-by: abdoulaye berthe <berthe.ab@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: use gpiolib irqchip helpersLinus Walleij2014-05-281-61/+32
| | | | | | | | This switches the PCA953x driver over to using the gpiolib irqchip helpers to handle the threaded interrups cascaded off this GPIO chip. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: request a shared interruptToby Smith2014-05-091-1/+2
| | | | | | | Request a shared interrupt when requesting a pca953x GPIO interrupt Signed-off-by: Toby Smith <toby@tismith.id.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: return IRQ_NONE when appropriateToby Smith2014-05-091-2/+4
| | | | | | | | The irq handler should return IRQ_NONE or IRQ_HANDLED to report if we have handled the interrupt. Signed-off-by: Toby Smith <toby@tismith.id.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: Fix gpio_base may not default to -1Aaron Sierra2014-02-131-1/+2
| | | | | | | | 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>
* gpio: pca953x: Add Exar XRA1202Aaron Sierra2014-02-131-0/+3
| | | | | | | | 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>
* gpio: pca953x: Add NXP PCA9698Aaron Sierra2014-02-131-0/+2
| | | | | | | | | | 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>
* gpio: pca953x: Add devices to Kconfig helpAaron Sierra2014-02-131-1/+1
| | | | | | | | | | 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>
* gpio/pinctrl: make gpio_chip members typed booleanLinus Walleij2013-12-041-1/+1
| | | | | | | | | | | This switches the two members of struct gpio_chip that were defined as unsigned foo:1 to bool, because that is indeed what they are. Switch all users in the gpio and pinctrl subsystems to assign these values with true/false instead of 0/1. The users outside these subsystems will survive since true/false is 1/0, atleast we set some kind of more strict typing example. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: Don't flip bits on PCA957x GPIO expanders when probing them.Graeme Smecher2013-09-231-11/+0
| | | | | | | | | | | | | | | | | | | | The pca957x driver supports a handful of I2C GPIO expanders from NXP, Maxim, and TI. For the PCA9574 and PCA9575 devices only, the driver resets the GPIO level and direction in the pca957x_probe function. This seems like the wrong thing to do, since it can cause hardware bit twiddles during warm reboots when the chip state and reset values don't match. This kind of initialization is best left upstream (in a bootloader) or downstream (in userspace). It's also an inconsistency across devices supported by this driver. This patch is NOT boot-tested: the SoC I'm using is stuck on 2.6.37, and the patch doesn't apply trivially. Signed-off-by: Graeme Smecher <gsmecher@threespeedlogic.com> Acked-by: Haojian Zhuang <haojian.zhuang@gmail.com> Tested-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* Merge tag 'gpio-v3.12-1' of ↵Linus Torvalds2013-09-071-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v3.12 series: - A new driver for the TZ1090 PDC which is used on the metag architecture. - A new driver for the Kontron ETX or COMexpress GPIO block. This is found on some ETX x86 devices. - A new driver for the Fintek Super-I/O chips, used on some x86 boards. - Added device tree probing on a few select GPIO blocks. - Drop the Exynos support from the Samsung GPIO driver. The Samsung maintainers have moved over to use the modernized pin control driver to provide GPIO for the modern platforms instead. - The usual bunch of non-critical fixes and cleanups" * tag 'gpio-v3.12-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (36 commits) gpio: return -ENOTSUPP if debounce cannot be set gpio: improve error path in gpiolib gpio: add GPIO support for F71882FG and F71889F of: add vendor prefix for Microchip Technology Inc gpio: mcp23s08: rename the device tree property gpio: samsung: Drop support for Exynos SoCs gpio: pcf857x: Remove pdata argument to pcf857x_irq_domain_init() gpio: pcf857x: Sort headers alphabetically gpio: max7301: Reverting "Do not force SPI speed when using OF Platform" gpio: Fix bit masking in Kontron PLD GPIO driver gpio: pca953x: fix gpio input on gpio offsets >= 8 drivers/gpio: simplify use of devm_ioremap_resource drivers/gpio/gpio-omap.c: convert comma to semicolon gpio-lynxpoint: Fix warning about unbalanced pm_runtime_enable gpio: Fix platform driver name in Kontron PLD GPIO driver gpio: adnp: Fix segfault if request_threaded_irq fails gpio: msm: Staticize local variable 'msm_gpio' gpio: gpiolib-of.c: make error message more meaningful by adding the node name and index gpio: use dev_get_platdata() gpio/mxc: add chained_irq_enter/exit() to mx2_gpio_irq_handler ...
| * gpio: pca953x: fix gpio input on gpio offsets >= 8Andrew Ruder2013-08-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This change fixes a regression introduced by commit f5f0b7aa8 (gpio: pca953x: make the register access by GPIO bank) When the pca953x driver was converted to using 8-bit reads/writes the bitmask in pca953x_gpio_get_value wasn't adjusted with a modulus BANK_SZ and consequently looks at the wrong bits in the input register. Signed-off-by: Andrew Ruder <andrew.ruder@elecsyscorp.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
| * gpio: use dev_get_platdata()Jingoo Han2013-08-161-2/+2
| | | | | | | | | | | | | | | | Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: (gpio-pca953x) move header to linux/platform_data/Vivien Didelot2013-08-291-1/+1
|/ | | | | | | | | | This patch moves the pca953x.h header from include/linux/i2c to include/linux/platform_data and updates existing support accordingly. Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com> Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Olof Johansson <olof@lixom.net>
* Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linuxLinus Torvalds2013-05-061-2/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull GPIO changes from Grant Likely: "The usual selection of bug fixes and driver updates for GPIO. Nothing really stands out except the addition of the GRGPIO driver and some enhacements to ACPI support" I'm pulling this despite the earlier mess. Let's hope it compiles these days. * tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux: (46 commits) gpio: grgpio: Add irq support gpio: grgpio: Add device driver for GRGPIO cores gpiolib-acpi: introduce acpi_get_gpio_by_index() helper GPIO: gpio-generic: remove kfree() from bgpio_remove call gpio / ACPI: Handle ACPI events in accordance with the spec gpio: lpc32xx: Fix off-by-one valid range checking for bank gpio: mcp23s08: convert driver to DT gpio/omap: force restore if context loss is not detectable gpio/omap: optimise interrupt service routine gpio/omap: remove extra context restores in *_runtime_resume() gpio/omap: free irq domain in probe() failure paths gpio: gpio-generic: Add 16 and 32 bit big endian byte order support gpio: samsung: Add terminating entry for exynos_pinctrl_ids gpio: mvebu: add dbg_show function MAX7301 GPIO: Do not force SPI speed when using OF Platform gpio: gpio-tps65910.c: fix checkpatch error gpio: gpio-timberdale.c: fix checkpatch error gpio: gpio-tc3589x.c: fix checkpatch errors gpio: gpio-stp-xway.c: fix checkpatch error gpio: gpio-sch.c: fix checkpatch error ...
| * gpio: gpio-pca953x.c: fix checkpatch errorLaurent Navet2013-03-271-2/+1
| | | | | | | | | | | | | | | | Fix : gpio/gpio-pca953x.c:150: ERROR: else should follow close brace '}' Signed-off-by: Laurent Navet <laurent.navet@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: pca953x: fix irq_domain_add_simple usageAlexandre Belloni2013-04-111-1/+1
|/ | | | | | | | | | | | | | | | | We actually have to pass chip as the host_data parameter of irq_domain_add_simple() as later on, it is used to initialize chip_data in pca953x_gpio_irq_map(). Failing to do so is leading to a NULL pointer dereference after calling irq_data_get_irq_chip_data() in pca953x_irq_mask(), pca953x_irq_unmask(), pca953x_irq_bus_lock(), pca953x_irq_bus_sync_unlock() and pca953x_irq_set_type(). Fixes regression introduced by commit 0e8f2fdacf1d44651aa7e57063c76142d1f4988b (gpio: pca953x: use simple irqdomain) Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com> Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: use managed resourcesLinus Walleij2013-01-281-24/+8
| | | | | | | | | | | | Using the devm_* managed resources the pca driver can be simplified and cut down on boilerplate code. [gcl: fixed a inccorect reference to a removed label, "goto fail_out" became "return ret"] Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: use simple irqdomainGregory CLEMENT2013-01-281-37/+28
| | | | | | | | | | | | | This switches the legacy irqdomain to the simple one, which will auto-allocate descriptors, and also make sure that we use irq_create_mapping() in the to_irq function. Also use the map function of irq_domain_ops to setup the irq configuration on demand and no more statically during the initialization of the driver. Based on a initial patch from Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: add support for pca9505Gregory CLEMENT2013-01-251-0/+2
| | | | | | | | | Now that pca953x driver can handle GPIO expanders with more than 32 bits this patch adds the support for the pca9505 which cam with 40 GPIOs. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: make the register access by GPIO bankGregory CLEMENT2013-01-251-106/+175
| | | | | | | | | | | | | | | | Until now the pca953x driver accessed all the bank of a given register in a single command using only a 32 bits variable. New expanders from the pca53x family come with 40 GPIOs which no more fit in a 32 variable. This patch make access to the registers more generic by relying on an array of u8 variables. This fits exactly the way the registers are represented in the hardware. It also adds helpers to access to a single register of a bank instead of reading or writing all the banks for a given register. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Tested-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* Merge tag 'driver-core-3.8-rc1' of ↵Linus Torvalds2012-12-111-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core Pull driver core updates from Greg Kroah-Hartman: "Here's the large driver core updates for 3.8-rc1. The biggest thing here is the various __dev* marking removals. This is going to be a pain for the merge with different subsystem trees, I know, but all of the patches included here have been ACKed by their various subsystem maintainers, as they wanted them to go through here. If this is too much of a pain, I can pull all of them out of this tree and just send you one with the other fixes/updates and then, after 3.8-rc1 is out, do the rest of the removals to ensure we catch them all, it's up to you. The merges should all be trivial, and Stephen has been doing them all in linux-next for a few weeks now quite easily. Other than the __dev* marking removals, there's nothing major here, some firmware loading updates and other minor things in the driver core. All of these have (much to Stephen's annoyance), been in linux-next for a while. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" Fixed up trivial conflicts in drivers/gpio/gpio-{em,stmpe}.c due to gpio update. * tag 'driver-core-3.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (93 commits) modpost.c: Stop checking __dev* section mismatches init.h: Remove __dev* sections from the kernel acpi: remove use of __devinit PCI: Remove __dev* markings PCI: Always build setup-bus when PCI is enabled PCI: Move pci_uevent into pci-driver.c PCI: Remove CONFIG_HOTPLUG ifdefs unicore32/PCI: Remove CONFIG_HOTPLUG ifdefs sh/PCI: Remove CONFIG_HOTPLUG ifdefs powerpc/PCI: Remove CONFIG_HOTPLUG ifdefs mips/PCI: Remove CONFIG_HOTPLUG ifdefs microblaze/PCI: Remove CONFIG_HOTPLUG ifdefs dma: remove use of __devinit dma: remove use of __devexit_p firewire: remove use of __devinitdata firewire: remove use of __devinit leds: remove use of __devexit leds: remove use of __devinit leds: remove use of __devexit_p mmc: remove use of __devexit ...
| * gpio: remove use of __devinitBill Pemberton2012-11-281-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Grant Likely <grant.likely@secretlab.ca> Cc: Peter Tyser <ptyser@xes-inc.com> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com> Cc: Kevin Hilman <khilman@ti.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | gpio: pca953x: Add compatible strings to gpio-pca953x driverMaxime Ripard2012-11-171-0/+29
| | | | | | | | | | | | | | | | Even though the device tree binding code was already written, the compatible strings were not yet in the driver. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* | gpio: pca953x: Register an IRQ domainMaxime Ripard2012-11-171-6/+20
|/ | | | | | | | The PCA953x used to register no IRQ domain, which made it impossible to use it as an interrupt-parent from the device tree. Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio/pca953x: increase variables size to support 24 bit of dataLeed Aguilar2012-07-171-14/+14
| | | | | | | | | Increase variable size from u16 to u32 to allocate 24 bit of data required for the TCA6424 I/O expander device type. Signed-off-by: Leed Aguilar <leed.aguilar@ti.com> Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* GPIO: PCA953X: Increase size of invert variable to support 24 bitChandrabhanu Mahapatra2012-07-171-5/+6
| | | | | | | | | | | | | | | TCA6424 is a low voltage 24 bit I2C and SMBus I/O expander of pca953x family similar to its 16 bit predecessor TCA6416. It comes with three 8-bit active Input, Output, Polarity Inversion and Configuration registers each. The polarity of Input ports can be reversed by setting the appropiate bit in Polarity Inversion registers. The variables corresponding to Input, Output and Configuration registers have already been updated to support 24 bit values. This patch thus updates the invert variable of PCA953X platform data to support 24 bit. Signed-off-by: Chandrabhanu Mahapatra <cmahapatra@ti.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio/tca6424: merge I2C transactions, remove castAndreas Schallenberg2012-05-251-12/+16
| | | | | | | | | | | This is a follow-up to ae79c1904 "[PATCH v2] Add support for TCA6424" merged in the v3.5 merge window. It fixes comments made when the patch was merged. - Use 3 byte transfers instead of two separate transfers (2+1 byte) - An unnecessary cast removed Signed-off-by: Andreas Schallenberg <Andreas.Schallenberg@3alitytechnica.com> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* Add support for TCA6424AAndreas Schallenberg2012-05-181-13/+30
| | | | | | | | | | | | | | | This patch extends the PCA953x driver to support TI's TCA6424A 24 bit I2C I/O expander. The patch is based on code by Michele Bevilacqua. Changes in v2: - Compare ngpio against 24 in both places, not >16 - Larger datatype now u32 instead of uint. Bit fields not used for struct members since their address is taken. - Be precise: TCA6424A (untested for older TCA6424) Signed-off-by: Andreas Schallenberg<Andreas.Schallenberg@3alitytechnica.com> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
* gpio: pca953x: Staticise pca953x_get_altdata()Mark Brown2011-11-211-2/+2
| | | | | | | It's not used outside of the driver so doesn't need to be exported, and sparse notices this and complains about it. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
* Merge branch 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6Linus Torvalds2011-11-151-7/+4
|\ | | | | | | | | | | | | | | * 'gpio/merge' of git://git.secretlab.ca/git/linux-2.6: gpio: pca953x: propagate the errno from the chip_init functions gpio: pca953x: remove unneeded check for chip type gpio/omap: check return value from irq_alloc_generic_chip gpio/omap: replace MOD_REG_BIT macro with static inline
| * gpio: pca953x: propagate the errno from the chip_init functionsWolfram Sang2011-10-291-6/+5
| | | | | | | | | | | | | | | | | | | | Initializing the chips may return with an error, but this error gets dropped in probe(). Propagate this further to the driver core. Also, simplify returning the error in one of the init functions. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
| * gpio: pca953x: remove unneeded check for chip typeWolfram Sang2011-10-291-3/+1
| | | | | | | | | | | | | | | | | | | | | | We can assume our own device_id table is correct, so remove checking if the chip type is valid. (The check was bogus anyway: If it found an invalid entry, it returned with 0!) This is in preparation for further cleanups. Signed-off-by: Wolfram Sang <w.sang@pengutronix.de> Cc: Grant Likely <grant.likely@secretlab.ca> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
OpenPOWER on IntegriCloud