aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2018-12-21dt-bindings: arm: atmel: describe SECUMOD usage as a GPIO controllerAndrei.Stefanescu@microchip.com1-1/+11
This patch describes the Security Module's usage as a GPIO controller for its PIOBU pins. These pins have the special property of maintaining their voltage during suspend-to-mem. Signed-off-by: Andrei Stefanescu <andrei.stefanescu@microchip.com> Reviewed-by: Rob Herring <robh@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-17gpio/mmc/of: Respect polarity in the device treeLinus Walleij1-33/+16
The device tree bindings for the MMC card detect and write protect lines specify that these should be active low unless "cd-inverted" or "wp-inverted" has been specified. However that is not how the kernel code has worked. It has always respected the flags passed to the phandle in the device tree, but respected the "cd-inverted" and "wp-inverted" flags such that if those are set, the polarity will be the inverse of that specified in the device tree. Switch to behaving like the old code did and fix the regression. Fixes: 81c85ec15a19 ("gpio: OF: Parse MMC-specific CD and WP properties") Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Cc: Guenter Roeck <linux@roeck-us.net> Reported-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-17dt-bindings: gpio: rcar: Add r8a774c0 (RZ/G2E) supportFabrizio Castro1-0/+1
Document Renesas' RZ/G2E (R8A774C0) GPIO blocks compatibility within the relevant dt-bindings. Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-17memory: omap-gpmc: Get the header of the enumLinus Walleij1-0/+1
Commit 21abf103818a ("gpio: Pass a flag to gpiochip_request_own_desc()") started to pass an enum gpiod_flags but this file is not including the header file that defines that enum and the compiler spits: drivers/memory/omap-gpmc.c: In function 'gpmc_probe_generic_child': drivers/memory/omap-gpmc.c:2174:9: error: type of formal parameter 4 is incomplete 0); ^ Cc: Ladislav Michl <ladis@linux-mips.org> Cc: Janusz Krzysztofik <jmkrzyszt@gmail.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Fixes: 21abf103818a ("gpio: Pass a flag to gpiochip_request_own_desc()") Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-17ARM: omap1: Fix new user of gpiochip_request_own_desc()Linus Walleij1-1/+1
This fixes up a new user of gpiochip_request_own_desc() in the AMS Delta board that appeared after the patch that was applied recently. Fixes: 21abf103818a ("gpio: Pass a flag to gpiochip_request_own_desc()") Reviewed-by: Janusz Krzysztofik <jmkrzyszt@gmail.com> Acked-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-17gpio: pca953x: Add regmap dependency for PCA953x driverMarek Vasut1-0/+1
Select REGMAP_I2C in Kconfig, since the driver now depends on regmap and this was missing, thus breaking build on various systems. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Linus Walleij <linus.walleij@linaro.org> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-17gpio: raspberrypi-exp: decrease refcount on firmware dt nodeNicolas Saenz Julienne1-0/+1
We're getting a reference RPi's firmware node in order to be able to communicate with it's driver. We should decrease the reference count on the dt node after being done with it. Fixes: a98d90e7d588 ("gpio: raspberrypi-exp: Driver for RPi3 GPIO expander via mailbox service") Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14Merge branch 'ib-pca953x' into develLinus Walleij1-182/+302
2018-12-14gpiolib: Fix return value of gpio_to_desc() stub if !GPIOLIBKrzysztof Kozlowski1-1/+1
If CONFIG_GPOILIB is not set, the stub of gpio_to_desc() should return the same type of error as regular version: NULL. All the callers compare the return value of gpio_to_desc() against NULL, so returned ERR_PTR would be treated as non-error case leading to dereferencing of error value. Fixes: 79a9becda894 ("gpiolib: export descriptor-based GPIO interface") Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Restore registers after suspend/resume cycleMarek Vasut1-0/+88
It is possible that the PCA953x is powered down during suspend. Use regmap cache to assure the registers in the PCA953x are in line with the driver state after resume. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Zap single use of pca953x_read_single()Marek Vasut1-17/+5
Drop pca953x_write_single() which is used in one place. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Zap ad-hoc reg_output cacheMarek Vasut1-50/+15
Replace the ad-hoc reg_output output register caching with generic regcache cache. Drop pca953x_write_single() which is no longer used. This reduces code duplication. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Zap ad-hoc reg_direction cacheMarek Vasut1-24/+31
Replace the ad-hoc reg_direction direction register caching with generic regcache cache. This reduces code duplication. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Perform basic regmap conversionMarek Vasut1-8/+151
Convert the driver to use regmap to access the chips. Due to the convoluted register mapping scheme, implement read/write/volatile check functions that untangle the mess and perform check accordingly. This patch does not zap the internal register cache of the PCA953x driver, nor does it push the regmap access down into the gpiochip accessors to simplify the review. All that is in subsequent patches. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Extract the register address mangling to single functionMarek Vasut1-30/+29
Instead of having the I2C register calculation function spread across multiple accessor functions, pull it out into a single function which returns the adjusted register address. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Zap ad-hoc I2C block write in multi GPIO setMarek Vasut1-10/+1
The ad-hoc i2c block write can be replaced by standard register accessor function, which correctly handles all the chip details and differences. Do so to simplify the code. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Factor out common code from device_pca95xx_init()Marek Vasut1-23/+12
The PCA957x and PCA953x init functions are almost the same, except for the different register mapping and one extra write to BKEN register in case of PCA957x. Factor out the common code. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Unify pca953x_{read,write}_regs_{8,mul}()Marek Vasut1-46/+8
At this point, the pca953x_{read,write}_regs_mul() can read single bank PCA953x GPIO chips as well. Merge the _8 and _mul functions together to simplify the code a bit. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Unify pca953x_{read,write}_regs_{16,24}()Marek Vasut1-31/+18
At this point, these two functions only differ in whether they do or do not set the address increment bit. The 16 GPIO case does not need to set the AI bit, except for PCA9575 on write, while the 24 GPIO and more case does set the AI bit always. Merge these two functions together to simplify the code a bit. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Unify pca95{3,7}x_write_regs_16()Marek Vasut1-11/+5
At this point, these two functions only differ in whether they do or do not set the address increment bit on PCA9575. Merge these two functions together to simplify the code a bit. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Repair multi-byte IO address increment on PCA9575Marek Vasut1-8/+11
The multi-byte IO on various pca953x chips requires the auto-increment bit, while other chips toggle the LSbit automatically. Note that LSbit toggling only alternates between two registers during the IO, it is not the same as address auto-increment. The driver currently assumes that #gpios > 16 implies auto-increment, while #gpios <= 16 implies LSbit toggling. This is incorrect at there are chips with 16 GPIOs which require the auto-increment bit. The PCA9575, according to NXP datasheet rev. 4.2 from 16 April 2015, section 7.3 Command Register, the bit 7 in command register is the auto-increment bit, which allows programming multiple registers sequentially. Set this bit both in pca953x_gpio_set_multiple(), where it fixes the multi register programming, and in pca957x_write_regs_16(), where is simplifies the function. In fact, the pca957x_write_regs_16() now looks rather similar to pca953x_write_regs_24() and pca953x_write_regs_16(), which is intended for subsequent patches. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Fix AI overflow on PCAL6524Marek Vasut1-1/+1
The PCAL_PINCTRL_MASK is too large. The extended register block on PCAL6524, which is the largest chip with this block, has the block limited to address range 0x40..0x7f. This is because the bit 7 in the command register is used for the Address Increment functionality. Trim the mask to 0x60 to match the datasheet and to prevent accidental overwrite of the AI bit. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Reviewed-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: pca953x: Deduplicate the bank_shiftMarek Vasut1-7/+11
The bank_shift = fls(...) code was duplicated in the driver 5 times, pull it into separate function. Signed-off-by: Marek Vasut <marek.vasut+renesas@gmail.com> Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14gpio: tegra186: Rename flow variable to typeThierry Reding1-3/+3
The IRQ core code refers to the interrupt type by that name, whereas the term flow is almost never used. Some GPIO controllers use the term flow_type, but it is most consistent to just go with the IRQ core terminology. Signed-off-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-14Merge tag 'intel-gpio-v4.21-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy/linux-gpio-intel into develLinus Walleij8-300/+137
intel-gpio for v4.21-1 Use managed resource allocation in pch and sodaville drivers. Switch to use for_each_set_bit() in IRQ handlers. Headers clean up. Sort headers in inclusion block alphabetically for better maintenance. Convert to SPDX identifier and fixing MODULE_LICENSE() when appropriate. Additional format fixes to rectify debug and message printing. There is a commit which had been applied to v4.20-rc4, that's why dup. - c3bc3ff9e8019fba74ce62bfb501d710c2fca9d3 MAINTAINERS: Do maintain Intel GPIO drivers via separate tree The following is an automated git shortlog grouped by driver: ich: - Convert to use SPDX identifier - Sort headers alphabetically - Join string literals back - Convert pr_<level> to dev_<level> - Switch to use struct device instead of platform_device - Simplify error handling in ichx_write_bit() intel-mid: - Convert to use SPDX identifier - Remove linux/module.h and sort headers lynxpoint: - Convert to use SPDX identifier - Remove linux/init.h and sort headers - Use for_each_set_bit() in IRQ handler MAINTAINERS: - Do maintain Intel GPIO drivers via separate tree merrifield: - Convert to use SPDX identifier - Remove linux/init.h pch: - Convert to use SPDX identifier - Sort headers alphabetically - Remove duplicate assignments - Remove redundant __func__ from debug print - Use for_each_set_bit() in IRQ handler - Convert to dev_pm_ops - Convert to use managed functions pcim_* and devm_* sch: - Convert to use SPDX identifier - Remove linux/init.h and sort headers sodaville: - Convert to use SPDX identifier - Sort headers alphabetically - Use for_each_set_bit() in IRQ handler - Convert to use managed functions pcim_* and devm_*
2018-12-14gpio: Pass a flag to gpiochip_request_own_desc()Linus Walleij9-19/+34
Before things go out of hand, make it possible to pass flags when requesting "own" descriptors from a gpio_chip. This is necessary if the chip wants to request a GPIO with active low semantics, for example. Cc: Janusz Krzysztofik <jmkrzyszt@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Jiri Kosina <jkosina@suse.cz> Cc: Roger Quadros <rogerq@ti.com> Reviewed-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-10gpio: lpc18xx: fix GPIO controller driver build as a moduleVladimir Zapolskiy1-2/+0
The problem is reported for allmodconfig build setup: ERROR: "irq_chip_retrigger_hierarchy" [drivers/gpio/gpio-lpc18xx.ko] undefined! make[2]: *** [scripts/Makefile.modpost:92: __modpost] Error 1 make[1]: *** [Makefile:1271: modules] Error 2 My testing in runtime shows that it is sufficient to remove .irq_retrigger callback, which is assigned to unexported irq_chip_retrigger_hierarchy() function, I did't observe any regressions, and thus apparently it is a better fix rather than exporting the function defined in kernel/irq/chip.c (see commit 52b2a05fa7c8 ("genirq: Export IRQ functions for module use")) or sticking the GPIO controller driver build to built-in option only. Reported-by: kbuild test robot <lkp@intel.com> Fixes: 5ddabfe8d3de ("gpio: lpc18xx: add GPIO pin interrupt controller support") Signed-off-by: Vladimir Zapolskiy <vz@mleia.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-12-07gpio: sodaville: Convert to use SPDX identifierAndy Shevchenko1-5/+1
Reduce size of duplicated comments by switching to use SPDX identifier. No functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: sch: Convert to use SPDX identifierAndy Shevchenko1-14/+2
Reduce size of duplicated comments by switching to use SPDX identifier. No functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: pch: Convert to use SPDX identifierAndy Shevchenko1-14/+2
Reduce size of duplicated comments by switching to use SPDX identifier. No functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: merrifield: Convert to use SPDX identifierAndy Shevchenko1-4/+1
Reduce size of duplicated comments by switching to use SPDX identifier. No functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: lynxpoint: Convert to use SPDX identifierAndy Shevchenko1-15/+2
Reduce size of duplicated comments by switching to use SPDX identifier. No functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: intel-mid: Convert to use SPDX identifierAndy Shevchenko1-9/+1
Reduce size of duplicated comments by switching to use SPDX identifier. No functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: ich: Convert to use SPDX identifierAndy Shevchenko1-14/+1
Reduce size of duplicated comments by switching to use SPDX identifier. No functional change. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: sodaville: Sort headers alphabeticallyAndy Shevchenko1-3/+3
Sort header block alphabetically for easy maintenance. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: pch: Sort headers alphabeticallyAndy Shevchenko1-3/+3
Sort header block alphabetically for easy maintenance. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: ich: Sort headers alphabeticallyAndy Shevchenko1-3/+3
Sort header block alphabetically for easy maintenance. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: sch: Remove linux/init.h and sort headersAndy Shevchenko1-6/+5
There is no need to include linux/init.h when at the same time we include linux/module.h. Remove redundant inclusion. While here, sort header block alphabetically for easy maintenance. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: merrifield: Remove linux/init.hAndy Shevchenko1-1/+0
There is no need to include linux/init.h when at the same time we include linux/module.h. Remove redundant inclusion. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: lynxpoint: Remove linux/init.h and sort headersAndy Shevchenko1-8/+7
There is no need to include linux/init.h when at the same time we include linux/module.h. Remove redundant inclusion. While here, sort header block alphabetically for easy maintenance. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: intel-mid: Remove linux/module.h and sort headersAndy Shevchenko1-4/+2
There is no need to include linux/module.h when at the same time we include linux/init.h. Remove redundant inclusion. While here, remove no-op macro and sort header block alphabetically for easy maintenance. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: pch: Remove duplicate assignmentsAndy Shevchenko1-4/+1
There is no need to assign the same values which core does for us anyway. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: pch: Remove redundant __func__ from debug printAndy Shevchenko1-7/+4
dev_dbg includes the function name & line number by default when dynamic debugging is enabled. Hence __func__ is redundant here and removed. Do the same for any messages in ->probe() since it doesn't make sense. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: ich: Join string literals backAndy Shevchenko1-3/+2
For easy grepping on debug purposes join string literals back in the messages. While here, fix spelling typo. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: ich: Convert pr_<level> to dev_<level>Andy Shevchenko1-6/+5
Instead of customized pr_<level> format use unified dev_<level> output. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: ich: Switch to use struct device instead of platform_deviceAndy Shevchenko1-10/+11
There is no need to have a pointer to struct platform_device. Instead, switch to use struct device one. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: ich: Simplify error handling in ichx_write_bit()Andy Shevchenko1-12/+3
Simplify error handling in ichx_write_bit() and propagate its error code to the caller. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: sodaville: Use for_each_set_bit() in IRQ handlerAndy Shevchenko1-6/+3
This simplifies and standardizes the AB IRQ handler by using the for_each_set_bit() library function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: pch: Use for_each_set_bit() in IRQ handlerAndy Shevchenko1-8/+6
This simplifies and standardizes the AB IRQ handler by using the for_each_set_bit() library function. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2018-12-07gpio: uniphier: convert to SPDX License IdentifierMasahiro Yamada1-13/+4
checkpatch.pl suggests to use SPDX license tag. I am happy to follow it. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>