Граф коммитов

573590 Коммитов

Автор SHA1 Сообщение Дата
Andreas Werner f436bc2726 gpio: add driver for MEN 16Z127 GPIO controller
The 16Z127 is a 32bit GPIO controller on a MCB FPGA.
Every single line can be configured as input and output.

Push pull and open drain are supported as well as setting
a debounce value for the input lines.

Signed-off-by: Andreas Werner <andy@wernerandy.de>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-03-09 09:44:52 +07:00
Axel Lin 3fab91ea28 gpio: lp3943: Drop pin_used and lp3943_gpio_request/lp3943_gpio_free
The implementation of lp3943_gpio_request/lp3943_gpio_free test pin_used
for tracing the pin usage. However, gpiolib already checks FLAG_REQUESTED
flag for the same purpose. So remove the redundant implementation.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-03-09 09:17:55 +07:00
Amitoj Kaur Chawla fa283db76f gpio: timberdale: Switch to devm_ioremap_resource()
Replace calls to devm_request_mem_region and devm_ioremap with a
direct call to devm_ioremap_resource instead and modify error
handling.

Move the call to platform_get_resource adjacent to the call to
devm_ioremap_resource to make the connection between them more
clear.

A simplified version of the Coccinelle semantic patch that is used to
make this change is as follows:
//<smpl>
@nm@
expression myname;
identifier i;
@@

struct platform_driver i = { .driver = { .name = myname } };

@@
expression dev,res,size,e1,e;
expression nm.myname;
@@

-if (!devm_request_mem_region(dev, res->start, size,
-                              \(res->name\|dev_name(dev)\|myname\)))
                               {
-   ...
-   return ...;
-}
... when != res->start = e1
e =
-devm_ioremap(dev,res->start,size);
+devm_ioremap_resource(dev,res);

if
-(e == NULL)
+(IS_ERR(e))
{
 ...
-return ...;
+return PTR_ERR(e);
}
//</smpl>

Further, updated error handling by hand as devm_ioremap_resource
gives appropriate error messages, so remove unnecessary error
messages.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-03-08 15:56:33 +07:00
Julien Grossholtz 6dcfd7291b gpio: ts4800: Add IMX51 dependency
The TS-4800 is an i.MX515 board. Its GPIO driver should only be compiled
for this CPU or for test builds.

Signed-off-by: Julien Grossholtz <julien.grossholtz@savoirfairelinux.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-03-08 15:28:08 +07:00
Linus Walleij 016bf20829 Merge branch 'devm-gpiochip-add-data' into devel 2016-03-08 14:41:41 +07:00
Bamvor Jian Zhang a961f9b472 gpiolib: rewrite gpiodev_add_to_list
The original code of gpiodev_add_to_list is not very clear which
lead to bugs or compiling warning, reference the following patches:
Bugs:
1.  Commit ef7c755303 ("gpiolib: improve overlap check of range of
    gpio").
2.  Commit 96098df125 ("gpiolib: fix chip order in gpio list")

Warning:
1.  Commit e28ecca6ea ("gpio: fix warning about iterator").
of gpio").

There is a off-list discussion about how to improve it consequently.
This commit try to follow this by rewriting the whole functions.

Tested pass with my gpio mockup driver and test scripts[1].

[1] http://www.spinics.net/lists/linux-gpio/msg09598.html

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-03-07 12:02:46 +07:00
Axel Lin 24030d9d95 gpio: moxart: Allow compile test build
There is no build dependency for this driver, so enable COMPILE_TEST to get
better build coverage.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-03-07 11:38:34 +07:00
Axel Lin 0c271658aa gpio: moxart: Drop redundant code to set already initialized gpio_chip fields
These fields are initialized by bgpio_init() with exactly the same settings
so remove the redundant code.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-03-07 11:37:11 +07:00
Linus Walleij 214338e372 gpio: present the consumer of a line to userspace
I named the field representing the current user of GPIO line as
"label" but this is too vague and ambiguous. Before anyone gets
confused, rename it to "consumer" and indicate clearly in the
documentation that this is a string set by the user of the line.

Also clean up leftovers in the documentation.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 21:07:23 +01:00
Bamvor Jian Zhang d27c17285e gpio: fix abi regression in sysfs
We started to assign the gpio_device as parent for the sysfs
but this changes the expected layout of sysfs. Restore the
previous behaviour.

Signed-off-by: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 16:08:45 +01:00
Gabor Juhos cfb7428c3d gpio: documenatation: fix GPIO_LOOKUP{,_IDX} documentation
The 'dev_id' parameter of the GPIO_LOOKUP{,_IDX} macros were removed by
commit ad824783fb ("gpio: better lookup method for platform GPIOs").

Update the documentation to reflect that.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 16:01:51 +01:00
Axel Lin 4fccbbde11 gpio: mb86s7x: Allow compile test build
There is no build dependency for this driver, so enable COMPILE_TEST to get
better build coverage.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 16:00:25 +01:00
Axel Lin ea04a7cae3 gpio: pisosr: Use gpiod_set_value_cansleep in pisosr_gpio_refresh()
This driver has .can_sleep flag set.
So the pisosr_gpio_get() can be called from contexts that can sleep.
Thus use the cansleep() variant in pisosr_gpio_refresh().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 15:20:46 +01:00
Axel Lin 21d08ab9c9 gpio: pisosr: Use devm_gpiod_get_optional for gpio->load_gpio
gpio->load_gpio is optional, so use devm_gpiod_get_optional instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 15:20:46 +01:00
Andrzej Hajda d34607d11d gpio: xgene: fix type of variable containing error codes
ret variable can contain error values and is compared with zero.
Its type must be signed.

The problem has been detected using coccinelle script
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 15:20:45 +01:00
Simon Horman 2af66e1dec gpio: rcar: Use ARCH_RENESAS
Make use of ARCH_RENESAS in place of ARCH_SHMOBILE.

This is part of an ongoing process to migrate from ARCH_SHMOBILE to
ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 15:20:45 +01:00
Axel Lin 22d4ca3522 gpio: ts4800: Drop redundant code to set already initialized gpio_chip fields
Both chip->base and chip->label are correctly set by bgpio_init().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Julien Grossholtz <julien.grossholtz@savoirfairelinux.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 15:20:44 +01:00
Axel Lin b178e7ead0 gpio: brcmstb: Use list_for_each_entry at appropriate places
Use list_for_each_entry to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 15:20:43 +01:00
Axel Lin f0d3c72ccb gpio: ath79: Check valid gpio count for both DT and non-DT cases
Move the code checking valid gpio count to cover both DT and non-DT cases.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Alban Bedel <albeu@free.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 15:20:43 +01:00
Linus Walleij 725e3b7d40 Merge branch 'devm_gpiochip' of https://github.com/ldewangan/linux-upstream into devm-gpiochip-add-data 2016-02-25 14:22:10 +01:00
Axel Lin ea1361fd5f gpio: pisosr: Use devm_gpiod_get_optional for gpio->load_gpio
gpio->load_gpio is optional, so use devm_gpiod_get_optional instead.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Andrew F. Davis <afd@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 14:16:57 +01:00
Andrzej Hajda 67ebb742b9 gpio: xgene: fix type of variable containing error codes
ret variable can contain error values and is compared with zero.
Its type must be signed.

The problem has been detected using coccinelle script
scripts/coccinelle/tests/unsigned_lesser_than_zero.cocci

Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 11:00:03 +01:00
Simon Horman 68999a4f1a gpio: rcar: Use ARCH_RENESAS
Make use of ARCH_RENESAS in place of ARCH_SHMOBILE.

This is part of an ongoing process to migrate from ARCH_SHMOBILE to
ARCH_RENESAS the motivation for which being that RENESAS seems to be a more
appropriate name than SHMOBILE for the majority of Renesas ARM based SoCs.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 10:54:30 +01:00
Axel Lin dd06d41621 gpio: ts4800: Drop redundant code to set already initialized gpio_chip fields
Both chip->base and chip->label are correctly set by bgpio_init().

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Tested-by: Julien Grossholtz <julien.grossholtz@savoirfairelinux.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 10:51:42 +01:00
Axel Lin 21c4a0c852 gpio: brcmstb: Use list_for_each_entry at appropriate places
Use list_for_each_entry to simplify the code a bit.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Gregory Fong <gregory.0xf0@gmail.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 10:28:49 +01:00
Axel Lin 2b99d32790 gpio: ath79: Check valid gpio count for both DT and non-DT cases
Move the code checking valid gpio count to cover both DT and non-DT cases.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Alban Bedel <albeu@free.fr>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 10:09:59 +01:00
Geert Uytterhoeven 29821c2c61 gpio: rcar: Add Runtime PM handling for interrupts
The R-Car GPIO driver handles Runtime PM for requested GPIOs only.

When using a GPIO purely as an interrupt source, no Runtime PM handling
is done, and the GPIO module's clock may not be enabled.

To fix this:
  - Add .irq_request_resources() and .irq_release_resources() callbacks
    to handle Runtime PM when an interrupt is requested,
  - Add irq_bus_lock() and sync_unlock() callbacks to handle Runtime PM
    when e.g. disabling/enabling an interrupt, or configuring the
    interrupt type.

Fixes: d5c3d84657 "net: phy: Avoid polling PHY with PHY_IGNORE_INTERRUPTS"
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 10:06:01 +01:00
Geert Uytterhoeven 40c8eabac4 gpio: Propagate all errors in devm_get_gpiod_from_child()
devm_get_gpiod_from_child() tries several property suffixes to find a
GPIO descriptor. If all suffixes fail and no probe deferral has been
detected, it returns the error of the last try.

However, if any but the last try fails with a real error (e.g. -EBUSY),
this error is not propagated, and -ENOENT will be returned.
This confuses drivers that e.g. want to detect if a GPIO is already in
use.

To fix this, change the loop logic to continue on -ENOENT, which
indicates the property was not found and the next suffix should be
tried, and propagate all other detected errors.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2016-02-25 10:04:25 +01:00
Laxman Dewangan 9d113c696f gpio: xgene: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:54 +05:30
Laxman Dewangan 29862059a5 gpio: xgene-sb: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:53 +05:30
Laxman Dewangan c87dc4e46e gpio: wm8994: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: patches@opensource.wolfsonmicro.com
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
2016-02-23 20:35:53 +05:30
Laxman Dewangan 4a4925cf2b gpio: wm8350: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: patches@opensource.wolfsonmicro.com
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
2016-02-23 20:35:52 +05:30
Laxman Dewangan 61da4848a1 gpio: wm8350: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: patches@opensource.wolfsonmicro.com
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
2016-02-23 20:35:52 +05:30
Laxman Dewangan 55e3e1a75d gpio: vx855: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:51 +05:30
Laxman Dewangan 45338c3aa1 gpio: viperboard: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:51 +05:30
Laxman Dewangan 5d61a9e0ac gpio: ucb1400: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:50 +05:30
Laxman Dewangan fc0292a238 gpio: twl6040: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:50 +05:30
Laxman Dewangan 973eff01c5 gpio: ts5500: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and clean the
error path.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:49 +05:30
Laxman Dewangan 33ba54ee47 gpio: ts4800: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:48 +05:30
Laxman Dewangan 0964ac703e gpio: tps65912: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:48 +05:30
Laxman Dewangan bf6e855a4e gpio: tps65910: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:47 +05:30
Laxman Dewangan 79c676f808 gpio: tps6586x: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:47 +05:30
Laxman Dewangan 43fad8322a gpio: timberdale Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:46 +05:30
Laxman Dewangan 8b4acf3a9b gpio: tegra: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: Thierry Reding <thierry.reding@gmail.com>
2016-02-23 20:35:46 +05:30
Laxman Dewangan f3378b6a26 gpio: tc3589x: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:45 +05:30
Laxman Dewangan ad7b550ad7 gpio: tb10x: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and clean the
error path.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:44 +05:30
Laxman Dewangan 94c683ab8d gpio: syscon: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:44 +05:30
Laxman Dewangan c7c8a8fc1e gpio: sx150x: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration and remove the
need of driver callback .remove.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:43 +05:30
Laxman Dewangan 1a20cb2d7d gpio: stp-xway: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:43 +05:30
Laxman Dewangan 5fa734ccf0 gpio: sta2x11: Use devm_gpiochip_add_data() for gpio registration
Use devm_gpiochip_add_data() for GPIO registration.

Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
2016-02-23 20:35:42 +05:30