summaryrefslogtreecommitdiffstats
path: root/drivers/gpio
Commit message (Collapse)AuthorAgeFilesLines
* 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
|\
| * gpio: add driver for PCA95[357]x, PCA9698, TCA64xx, and MAX7310 SMBus I/O ↵Antony Pavlov2014-07-143-0/+502
| | | | | | | | | | | | | | expanders Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | gpio: add driver for Canon DIGICAntony Pavlov2014-07-293-0/+185
|/ | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: add jz4740-gpio driver for Ingenic MIPS SoCsAntony Pavlov2014-06-273-0/+147
| | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: add Malta CBUS FPGA I2C driverAntony Pavlov2014-06-243-0/+197
| | | | | | | | | | | This driver provides common support for accessing the CBUS FPGA I2C lines through the gpio library. Additional i2c bitbang driver must be enabled in order to use the functionality of the i2c controller. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: rename "gpiolib" -> "gpioinfo"Holger Schurig2014-05-151-5/+3
| | | | | Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: harmonize in-barebox documentationHolger Schurig2014-05-141-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch does probably too much, but it's hard (and very cumbersome/time consuming) to break it out. What is does is this: * each command has one short description, e.g. "list MUX configuration" * made sure the short descriptions start lowercase * each command has one usage. That string contains just the options, e.g. "[-npn]". It's not part of the long help text. * that is, it doesn't say "[OPTIONS]" anymore, every usable option is listed by character in this (short) option string (the long description is in the long help text, as before) * help texts have been reworked, to make them - sometimes smaller - sometimes describe the options better - more often present themselves in a nicer format * all long help texts are now created with BUSYBOX_CMD_HELP_ macros, no more 'static const __maybe_unused char cmd_foobar_help[]' * made sure the long help texts starts uppercase * because cmdtp->name and cmdtp->opts together provide the new usage, all "Usage: foobar" texts have been removed from the long help texts * BUSYBOX_CMD_HELP_TEXT() provides the trailing newline by itself, this is nicer in the source code * BUSYBOX_CMD_HELP_OPT() provides the trailing newline by itself * made sure no line gets longer than 77 characters * delibertely renamed cmdtp->usage, so that we can get compile-time errors (e.g. in out-of-tree modules that use register_command() * the 'help' command can now always emit the usage, even without compiled long help texts * 'help -v' gives a list of commands with their short description, this is similar like the old "help" command before my patchset * 'help -a' gives out help of all commands Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: group 'help' outputHolger Schurig2014-05-141-0/+1
| | | | | | | | | | | | | | | | | | | The old output of "help" was just producing a long list, that usually scrolled of the screen (even on a X11 terminal). This list is more compact, and also sorted by groups. The old output format (plus grouping) is now available with 'help -v'. Example: Information commands: ?, devinfo, help, iomem, meminfo, version Boot commands: boot, bootm, go, loadb, loads, loadx, loady, saves, uimage ... Signed-off-by: Holger Schurig <holgerschurig@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/tegra'Sascha Hauer2014-05-051-13/+7
|\ | | | | | | | | | | | | | | Conflicts: arch/arm/dts/tegra20-colibri.dtsi arch/arm/dts/tegra20-paz00.dts arch/arm/dts/tegra20.dtsi drivers/clk/tegra/clk-periph.c
| * gpio: tegra: add Tegra3 setupLucas Stach2014-04-231-0/+9
| | | | | | | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * gpio: tegra: remove dead codeLucas Stach2014-04-231-15/+0
| | | | | | | | | | | | | | | | Tegra is DT only, so remove platform code. While at it remove unused struct. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/ioresource'Sascha Hauer2014-05-051-2/+2
|\ \
| * | common: Allow for I/O mapped I/OMichel Stam2014-04-081-2/+2
| |/ | | | | | | | | | | | | | | Rework the current framework so that I/O mapped I/O resources are also possible. Signed-off-by: Michel Stam <michel@reverze.net> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / GPIO: i.MX: Implement get_direction()Alexander Shiyan2014-04-081-0/+10
|/ | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: add driver for TI DaVinci SoCsAntony Pavlov2014-03-183-0/+219
| | | | | | | This driver is dts-only version of driver from Linux v3.14-rc5. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/gpio'Sascha Hauer2014-02-031-7/+19
|\
| * gpiolib: gpiolib command: show label only for requested pinsAntony Pavlov2014-01-101-1/+1
| | | | | | | | | | Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>