summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* gpio: pca953x: fix address calculation for pcal6524H. Nikolaus Schaller2018-05-231-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | The register constants are so far defined in a way that they fit for the pcal9555a when shifted by the number of banks, i.e. are multiplied by 2 in the accessor function. Now, the pcal6524 has 3 banks which means the relative offset is multiplied by 4 for the standard registers. Simply applying the bit shift to the extended registers gives a wrong result, since the base offset is already included in the offset. Therefore, we have to add code to the 24 bit accessor functions that adjusts the register number for these exended registers. The formula finally used was developed and proposed by Andy Shevchenko <andy.shevchenko@gmail.com>. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: define masks for addressing common and extended registersH. Nikolaus Schaller2018-05-231-0/+4
| | | | | | | | | | These mask bits are to be used to map the extended register addresses (which are defined for an unsupported 8-bit pcal chip) to 16 and 24 bit chips (pcal6524). Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: set the PCA_PCAL flag also when matching by DTH. Nikolaus Schaller2018-05-231-2/+3
| | | | | | | | | | | The of_device_table is missing the PCA_PCAL flag so the pcal6524 would be operated in tca6424 compatibility mode which does not handle the new interrupt mask registers. Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: Clear irq trigger type on irq shutdownGrigoryev Denis2018-05-231-0/+10
| | | | | | | | | | | | | The driver stores the result of irq_set_type() in the internal variables irq_trig_raise and irq_trig_fall, which later are used to determine the GPIOs that must be re-configured as input. These variables retain their value between gpiolib's export / unexport, resulting in an incorrect state in some cases. The corresponding bits in the variables irq_trig_raise and irq_trig_fall should be cleared in irq_shutdown(). Signed-off-by: Denis Grigoryev <grigoryev@fastwel.ru> Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: zynq: Setup chip->base based on alias IDMichal Simek2018-05-231-1/+1
| | | | | | | | | | | | | | | | In past Xilinx gpio-zynq driver was setting up gpio chip->base as 0 which was chagned to autodetection when driver was upstreamed. Older systems, which were using this old version, setup SW stack which expects zynq gpio base as 0 and right now there is no way how to set this up. The patch is adding an option to setup chip->base based on aliases which is something what some other drivers are doing too. It means when gpio0 alias is setup then chip->base is 0. When gpio alias is not setup gpiochip_find_base() set it up properly which is current behavior. Signed-off-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: dwapb: Rework support for 1 interrupt per port A GPIOPhil Edworthy2018-05-231-31/+22Star
| | | | | | | | | | | | Treat DT and ACPI the same as much as possible. Note that we can't use platform_get_irq() to get the DT interrupts as they are in the port sub-node and hence do not have an associated platform device. This also fixes a problem introduced with error checking when calling platform_get_irq(). Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: syscon: allow fetching syscon from parent nodeHeiko Stuebner2018-05-231-0/+2
| | | | | | | | | | | | | Syscon nodes can be a simple-mfd and the syscon-users then be declared as children of this node. That way the parent-child structure can be better represented for devices that are fully embedded in the syscon. Therefore allow getting the syscon from the parent if neither a special compatible nor a gpio,syscon-dev property is defined. Signed-off-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Levin Du <djw@t-chip.com.cn> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: rcar: Add DT binding for r8a77990Yoshihiro Shimoda2018-05-231-0/+1
| | | | | | | | Add compatible string for R-Car E3 (r8a77990) in gpio-rcar. Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: zynq: simplifly getting drvdataShubhrajyoti Datta2018-05-231-4/+2Star
| | | | | | | | Get the driver data directly by dev_get_drvdata. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: zynq: Remove call to platform_get_irqShubhrajyoti Datta2018-05-231-4/+2Star
| | | | | | | | | Remove the call to platform_get_irq use the cached one instead. Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Reviewed-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: Convert to use match_string() helperAndy Shevchenko2018-05-161-5/+2Star
| | | | | | | | The new helper returns index of the matching string in an array. We are going to use it here. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* pca953x: add example how to use interrupt-controller and gpio-controllerH. Nikolaus Schaller2018-05-161-0/+33
| | | | | | | | | It is not completely obvious that these are required and how to use them. So we provide a tested example. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* DTS: Bindings: pca953x add an optional vcc-supply propertyH. Nikolaus Schaller2018-05-161-0/+1
| | | | | | | | | Hardware can have a switchable Vcc supply, so let's add it to the bindings (the current Linux driver code already supports it). Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: add more register definitions for pcal6524H. Nikolaus Schaller2018-05-161-0/+6
| | | | | | | | | The pcal6524 has another set of registers to fine control the interrupt handling. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: add more register definitions for pcal953xH. Nikolaus Schaller2018-05-161-0/+4
| | | | | | | | | | PCAL chips ("L" seems to stand for "latched") have additional registers starting at address 0x40 to control the latches, interrupt mask, pull-up and pull down etc. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: convert register constants to hexH. Nikolaus Schaller2018-05-161-16/+16
| | | | | | | | which makes it easier to match them with the data sheets. Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: ge: Fix build warningThierry Reding2018-05-161-1/+1
| | | | | | | | | | | | | | | Casting a pointer to u16 can produce a compiler warning such as this: drivers/gpio/gpio-ge.c: In function 'gef_gpio_probe': drivers/gpio/gpio-ge.c:83:14: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] gc->ngpio = (u16)of_device_get_match_data(&pdev->dev); ^ Cast the pointer through a uintptr_t to avoid the warning. Reported-by: kbuild test robot <lkp@intel.com> Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpiolib: fix gpiochip_machine_hog()Dan Carpenter2018-05-161-1/+1
| | | | | | | | | | There is a shifter vs vanilla mask bug here. We want to test if 1 << 11 is set but we're testing if 0xb is set. Fixes: 9a6c505f7df1 ("gpiolib: add hogs support for machine code") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Reviewed-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: xlp: Use of_device_get_match_data()Thierry Reding2018-05-161-8/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: vf610: Use of_device_get_match_data()Thierry Reding2018-05-161-3/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: ts4900: Use of_device_get_match_data()Thierry Reding2018-05-161-6/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: syscon: Use of_device_get_match_data()Thierry Reding2018-05-161-6/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pxa: Use of_device_get_match_data()Thierry Reding2018-05-161-7/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: pca953x: Use of_device_get_match_data()Thierry Reding2018-05-161-6/+4Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: palmas: Use of_device_get_match_data()Thierry Reding2018-05-161-5/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mxs: Use of_device_get_match_data()Thierry Reding2018-05-161-3/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: ingenic: Use of_device_get_match_data()Thierry Reding2018-05-161-3/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: ge: Use of_device_get_match_data()Thierry Reding2018-05-161-3/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: dwapb: Use of_device_get_match_data()Thierry Reding2018-05-161-7/+1Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: 74xx-mmio: Use of_device_get_match_data()Thierry Reding2018-05-161-7/+2Star
| | | | | | | Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mockup: use the SPDX identifier and remove license boilerplateBartosz Golaszewski2018-05-161-6/+1Star
| | | | | | | | Use the SPDX license identifier for GPLv2.0 or later and remove the license boilerplate. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: dwapb: Add support for 1 interrupt per port A GPIOPhil Edworthy2018-05-164-13/+48
| | | | | | | | | | | | | | | | | | | | | The DesignWare GPIO IP can be configured for either 1 interrupt or 1 per GPIO in port A, but the driver currently only supports 1 interrupt. See the DesignWare DW_apb_gpio Databook description of the 'GPIO_INTR_IO' parameter. This change allows the driver to work with up to 32 interrupts, it will get as many interrupts as specified in the DT 'interrupts' property. It doesn't do anything clever with the different interrupts, it just calls the same handler used for single interrupt hardware. ACPI companion code provided by Hoan Tran <hotran@apm.com>. This was tested on X-Gene by Hoan. Signed-off-by: Phil Edworthy <phil.edworthy@renesas.com> Reviewed-by: Rob Herring <robh@kernel.org> Acked-by: Lee Jones <lee.jones@linaro.org> Acked-by: Hoan Tran <hotran@apm.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: make several const arrays static, shrinks object sizeColin Ian King2018-05-162-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Don't populate the const read-only arrays 'port' on the stack but instead make them static. Makes the object code smaller: Before: text data bss dec hex filename 8542 4088 672 13302 33f6 drivers/gpio/gpio-gpio-mm.o 10959 4952 832 16743 4167 drivers/gpio/gpio-104-dio-48e.o 9022 5064 1408 15494 3c86 drivers/gpio/gpio-104-idi-48.o After: text data bss dec hex filename 8372 4144 672 13188 3384 drivers/gpio/gpio-gpio-mm.o 10790 5008 832 16630 40f6 drivers/gpio/gpio-104-dio-48e.o 8853 5152 1408 15413 3c35 linux/drivers/gpio/gpio-104-idi-48.o (gcc version 7.2.0 x86_64) Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* dt-bindings: gpio: Add support for r8a77965Jacopo Mondi2018-05-161-0/+1
| | | | | | | | | | Add compatible string for R-Car M3-N (r8a77965) in gpio-rcar. Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mxc: Remove reliance on <linux/gpio.h>Linus Walleij2018-05-161-6/+3Star
| | | | | | | | | | | | | | | | | This is a driver so we should only include <linux/gpio/driver.h>. However this driver was using gpio_get_value() to fetch the current value of a GPIO used as IRQ line to determine trigger direction, so we need a better way than looping over the global GPIO numberspace. Fix this by just calling the .get() function in the GPIO chip, as we don't want to end up creating a consumer dependency on ourselves. Cc: Vladimir Zapolskiy <vz@mleia.com> Cc: Fabio Estevam <fabio.estevam@nxp.com> Acked-by: Shawn Guo <shawnguo@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mvebu: Use the proper APIsLinus Walleij2018-05-161-12/+8Star
| | | | | | | | | | | | | | The MVEBU driver is requesting GPIO descriptors from itself, which is fine, but we have proper APIs to do this in a controlled way, so stop calling into the private functions of the GPIO library and use the gpiochip_* functions instead. Only include <linux/gpio/driver.h> and <linux/gpio/consumer.h> since we are both producers and consumers in this case. Cc: Gregory CLEMENT <gregory.clement@free-electrons.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: msic: Include the right headerLinus Walleij2018-05-161-1/+1
| | | | | | This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mm-lantiq: Include the right headerLinus Walleij2018-05-161-1/+1
| | | | | | This is a driver so include only <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: ml_ioh: Include the right headerLinus Walleij2018-05-161-1/+1
| | | | | | This is a driver so include only <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mc9s08dz60: Include the right headerLinus Walleij2018-05-161-1/+1
| | | | | | This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: mc33880: Include the right headerLinus Walleij2018-05-161-1/+1
| | | | | | This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: max730x: Include the right headerLinus Walleij2018-05-161-1/+1
| | | | | | This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: lynxpoint: Include the right headerLinus Walleij2018-05-161-1/+1
| | | | | | This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: lpc32xx: Include the right headerLinus Walleij2018-05-161-2/+1Star
| | | | | | This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: lp873x: Include the right headerLinus Walleij2018-05-161-1/+1
| | | | | | This is a driver so include only <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: lp3943: Include the right headerLinus Walleij2018-05-161-1/+1
| | | | | | This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: loongson: Use BIT() macrosLinus Walleij2018-05-161-14/+11Star
| | | | | | | | | | | | This switches the Loongson driver over to using the bitops BIT() macros and drops some local variables and make the code easier to read (in my opinion). Cc: Keguang Zhang <keguang.zhang@gmail.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Huacai Chen <chenhc@lemote.com> Cc: linux-mips@linux-mips.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: loongson: Create a dynamic platform deviceLinus Walleij2018-05-161-10/+37
| | | | | | | | | | | | | | | It is pretty helpful to create some kind of device for backing the GPIO chips, especially when preparing the driver for using GENERIC_GPIO, so let's create a simple platform device and a simple platform device driver and create the gpiochip in the .probe() routine for the device driver. Keep all at the core initcall so the behaviour is the same as before. Cc: Keguang Zhang <keguang.zhang@gmail.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Huacai Chen <chenhc@lemote.com> Cc: linux-mips@linux-mips.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpio: loongson: Use right includeLinus Walleij2018-05-161-33/+33
| | | | | | | | | | | | | The driver includes <linux/gpio.h> which is wrong, rely on <linux/gpio/driver.h> and remove to call to gpio_set_value() in favor of calling the internal function. Move functions around to avoid forward declarations. Cc: Keguang Zhang <keguang.zhang@gmail.com> Cc: Jiaxun Yang <jiaxun.yang@flygoat.com> Cc: Huacai Chen <chenhc@lemote.com> Cc: linux-mips@linux-mips.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
* gpiolib: add hogs support for machine codeBartosz Golaszewski2018-05-163-0/+114
| | | | | | | | | | | | | Board files constitute a significant part of the users of the legacy GPIO framework. In many cases they only export a line and set its desired value. We could use GPIO hogs for that like we do for DT and ACPI but there's no support for that in machine code. This patch proposes to extend the machine.h API with support for registering hog tables in board files. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>