summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
Commit message (Collapse)AuthorAgeFilesLines
* pinctrl: bcm2835: move existing code from gpio.Tomaz Solc2019-02-193-167/+0
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: clps711x: Use coredevice_platform_driver() macroAlexander Shiyan2018-12-201-6/+1
| | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: clps711x: Switch to SPDX identifierAlexander Shiyan2018-12-201-8/+2
| | | | | | | | Adopt the SPDX license identifier headers to ease license compliance management. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: clps711x: Change compatible stringAlexander Shiyan2018-12-201-1/+1
| | | | | | | | This patch changes compatible string for CLPS711X GPIO driver to "cirrus,ep7209-gpio" for conform with linux kernel. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-11-092-14/+2
|\
| * i2c: introduce device_i2c_driver() macroMarco Felsch2018-10-192-14/+2
| | | | | | | | | | | | | | | | | | Add macro and dependency to avoid boilerplate code. Since now simple i2c drivers only have to include the i2c.h header and call the device_i2c_driver() macro to register a i2c device driver. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpiolib: Introduce gpio_find_by_label()Andrey Smirnov2018-10-291-0/+17
| | | | | | | | | | | | | | | | Introduce gpio_find_by_label() in order to allow manipulating GPIOs by the labels assigned to them via DT or board/driver code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpio: VF610: Propagate error code of gpiochip_add() upAndrey Smirnov2018-10-291-2/+1
| | | | | | | | | | | | | | | | | | Propagate error code of gpiochip_add() up the call chain. This won't do any meaningful cleanup, but at least it will make problems noticable. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpio: tree-wide don't probe devices during core_initcallMarco Felsch2018-10-194-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | Since commit 37e6bee7e5 ("gpiolib: Add support for GPIO "hog" nodes") barebox can handle hog-gpios. To work correctly the pinctrl driver must be initialised first. Reorder all core_initcall's so the pinctrl driver can be called first. find drivers/gpio/ -type f -name gpio-*.c -exec sed -i \ 's/core_initcall/postcore_initcall/' "{}" +; Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpiolib: fix of_hog_gpio gpio label assignmentMarco Felsch2018-10-191-1/+4
| | | | | | | | | | | | | | | | | | | | | | Current the label is retrieved by the line-name property but this is a optional property. In case of a missing line-name property the label is NULL. As the binding documentation told, the gpio-label must be set to the device-node name in case of missing line-name property. Fixes: 37e6bee7e5 ("gpiolib: Add support for GPIO "hog" nodes") Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpiolib: fix of_gpio_hog error handlingMarco Felsch2018-10-191-4/+4
|/ | | | | | | | | | Currently the error handling of gpio_get_num() checks the return value of the previous of_property_read_u32_index() which has it's own error check. Fix it by using the correct return value variable. Fixes: 37e6bee7e5 ("gpiolib: Add support for GPIO "hog" nodes") Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: pca953x: add oftree supportOleg.Karfich@wago.com2018-08-311-0/+35
| | | | | Signed-off-by: Oleg Karfich <oleg.karfich@wago.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: i.MX: Add i.MX8mq supportSascha Hauer2018-06-111-0/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sandbox: add gpio support with libftdi1Antony Pavlov2018-01-293-0/+142
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* remove checks for xzalloc() returning NULLUwe Kleine-König2017-09-263-6/+0
| | | | | | | xzalloc() either returns memory or panics, so checking for NULL is useless. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpiolib: check validity for gpio_info in *_active()Uwe Kleine-König2017-09-261-0/+12
| | | | | | | | | | | | gpio_set_active, gpio_is_active and gpio_direction_active are public functions, accordingly there should be error checking. If an invalid gpio number is given to these functions without checking gpio_adjust_value is called with gi == NULL which then dereferences this pointer. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2017-09-081-2/+11
|\
| * gpio: gpio-generic: add dt supportAntony Pavlov2017-09-081-0/+9
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * gpio: gpio-generic: fix bgpio_map()Antony Pavlov2017-09-081-2/+2
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpio: clps711x: clps711x_gpio_dt_ids: add missing sentinel entryAntony Pavlov2017-09-061-0/+1
|/ | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Cc: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpiolib: Simplify code of gpio_request_one()Andrey Smirnov2017-07-301-9/+3
| | | | | | | | | Looks like we can get rid of an 'if' and 'goto', so do it to simplify the code. Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* gpiolib: Fix buggy flag detection codeAndrey Smirnov2017-07-301-9/+16
| | | | | | | | | | | | Both GPIOF_ACTIVE_LOW and GPIOF_INIT_ACTIVE are multi-bit constants so detecting their assertion using simple bit-wise and is incorrect and would lead to false positives. Fixes: bbc499914 ("gpiolib: Add code to support "active low" GPIOs") Acked-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* gpio: fix null pointer exception when there is no oftreeSam Ravnborg2017-07-071-0/+3
| | | | | | | | | | | | | | | | In a system with oftree support enabled but with no oftree the of_gpiochip_scan_hogs() would fail due to device_node equals NULL. Check device_node and return with 0 in this situation, as this mirrors what would have happened before we added support for gpio-hogs. Use IS_ENABLED(CONFIG_OFDEVICE) to teach compiler to leave out the of_* specific functions if not needed. Fixes: 37e6bee7 ("gpiolib: Add support for GPIO "hog" nodes") Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
* gpiolib: Add support for GPIO "hog" nodesAndrey Smirnov2017-06-061-1/+95
| | | | | | | | | | Add code to support 'gpio-hog' nodes used in some .dts files in Linux kernel. Cc: cphealy@gmail.com Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpiolib: Add code to support "active low" GPIOsAndrey Smirnov2017-06-061-4/+46
| | | | | | | | | | | | | So far this particular aspect of various DT-bindings has been handled on a per-driver basis. With this change, hopefully, we'll have a single place to handle necessary logic inversions and eventually would be able to migrate existing users as well as avoiding adding redundant code to new drivers. Cc: cphealy@gmail.com Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio-imx: Do not use gpio_set_value()Andrey Smirnov2017-06-061-1/+1
| | | | | | | | | | | | Do not use gpio_set_value() in imx_gpio_direction_output(). We don't check gpio_set_value's result, so calling imx_gpio_set_value() directly instead should be as good. Cc: cphealy@gmail.com Cc: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Acked-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/vybrid'Sascha Hauer2017-01-123-0/+170
|\
| * gpio: Add GPIO driver for VybridAndrey Smirnov2017-01-113-0/+170
| | | | | | | | | | | | | | | | Add GPIO driver for VF610 Family of SoCs (based on analogous driver from Linux kernel) Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpio: gpio-74164: Add 74lvc594 IDAlexander Shiyan2017-01-101-0/+1
| | | | | | | | | | | | | | | | The latest kernel gpio-74x164 driver supports 74LVC594 IC ID. Patch adds such ID to barebox driver. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpio: Port SX150x driver from LinuxAndrey Smirnov2017-01-103-0/+283
|/ | | | | | | | | | | | | | | Add a very abridged version of SX150x driver from Linux. New, "pinctrl" version of the driver was used as a base. As it was already mentioned this driver supports very limited amount of the original functionality, and the following are the features that were dropped: - Interrupt support - Support for any chip other that SX150x (due to lack of HW to test with) - Any pinctlr-like functions: pull-up/pull-down, open-drain, etc. configuration Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2016-03-111-7/+7
|\
| * Kconfig: avoid tabs in help textAlexander Kurz2016-02-251-7/+7
| | | | | | | | | | | | | | | | Tabs in kconfig help text will create unwanted indention artefacs when the help text is scrolled horizontally. Replacing tabs with spaces. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | driver: replace dev_request_mem_region with dev_request_mem_resourceSascha Hauer2016-03-0712-36/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region doesn't work properly one some SoCs on which PTR_ERR() values clash with valid return values from dev_request_mem_region. Replace them with dev_request_mem_resource where possible. This patch has been generated with the following semantic patch: // <smpl> @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { ... - return PTR_ERR(io); -} + return PTR_ERR(iores); +} +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) - return PTR_ERR(io); -} + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); -if (IS_ERR(io)) { - ret = PTR_ERR(io); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) { + ret = PTR_ERR(iores); ... } +io = IOMEM(iores->start); ...+> } @@ expression d; expression n; expression io; identifier func; @@ func(...) { +struct resource *iores; <+... -io = dev_request_mem_region(d, n); +iores = dev_request_mem_resource(d, n); +if (IS_ERR(iores)) + return PTR_ERR(iores); +io = IOMEM(iores->start); ...+> } @@ identifier func; @@ func(...) { <+... struct resource *iores; -struct resource *iores; ...+> } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | driver: Fix return check of dev_request_mem_regionSascha Hauer2016-02-231-2/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dev_request_mem_region returns an ERR_PTR, fix places which check for a NULL pointer instead. This patch has been generated with this semantic patch, written by me and improved by Andrey Smirnov: // <smpl> @@ expression e; expression e1; @@ e = dev_request_mem_region(...); ... -if (!e) - return e1; +if (IS_ERR(e)) + return PTR_ERR(e); @ rule1 @ expression e; @@ e = dev_request_mem_region(...); @@ expression rule1.e; identifier ret, label; constant errno; @@ if (!e) { ... ( - ret = -errno; + ret = PTR_ERR(e); ... goto label; | - return -errno; + return PTR_ERR(e); ) } @depends on rule1@ expression rule1.e; @@ - if (e == NULL) + if (IS_ERR(e)) { ... } // </smpl> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
* bcm2835: introduce mach-bcm283xAlexander Aring2016-01-042-4/+4
| | | | | | | | | | | | This patch changes the most part of mach-bcm2835 to mach-bcm283x. This prepares to add RPi2 support which is a bcm2836. This patch changes the Kconfig entry namens to BCM283X for drivers only. These drivers should working the same in bcm2836. While updating defconfig I added LED support/trigger option. Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: add ath79-gpio driver for Atheros MIPS SoCsAntony Pavlov2015-09-232-0/+157
| | | | | | | This driver is based on linux-4.2 driver. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: dw: implement new bindingsSteffen Trumtrar2015-08-191-24/+55
| | | | | | | | | The gpio-driver was developed when the bindings where not stable. As these have changed in the meantime, the driver has to be updated to the status quo. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: dw: fix copy&paste variable nameSteffen Trumtrar2015-08-191-2/+2
| | | | | | | This is a DW driver not IMX; fix variable name. Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio-davinci: gpio get should return 0 or 1Jan Luebbe2015-06-011-1/+1
| | | | | | | | Returning other values causes problems for client code which wants to perform calculations with the returned value. Signed-off-by: Jan Luebbe <jluebbe@debian.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/of-device-id'Sascha Hauer2015-05-066-20/+20
|\
| * of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-306-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpio: Add driver for 74x164 compatible shift-registersSebastian Hesselbarth2015-04-273-0/+140
| | | | | | | | | | | | | | | | | | A 74x164 shift register can be seen as a SPI attached GPIO expander. This adds a driver for those poor-man expanders based on the Linux driver. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpio: orion: Convert to platform_driverSebastian Hesselbarth2015-04-201-6/+1
| | | | | | | | | | | | | | | | | | With support for deferred probing, we can now relax driver registration for Marvell Orion GPIO driver from postcore_initcall() to normal platform_driver. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpio: Return -EPROBE_DEFER on gpio_get_num()Sebastian Hesselbarth2015-04-171-1/+4
|/ | | | | | | | | | GPIO drivers can be registered quite late in registration process causing dependant devices to fail probing. If we know gpio_get_num will be called with a non-NULL device, return -EPROBE_DEFER instead of -ENODEV to allow re-probing later. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* ARM: MXS: Make gpio a driverSascha Hauer2015-01-283-0/+190
| | | | | | This turns the MXS gpio support into a driver. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: clps711x: Add missing includeSascha Hauer2014-11-271-1/+1
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let dev_request_mem_region return an error pointerSascha Hauer2014-09-167-13/+23
| | | | | | For all users fix or add the error check. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let request_iomem_region return an error pointerSascha Hauer2014-09-161-2/+3
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* resource: Let dev_get_resource_by_name return an error pointerSascha Hauer2014-09-161-3/+4
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/i2c'Sascha Hauer2014-08-073-0/+502
|\