aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpio
AgeCommit message (Collapse)AuthorFilesLines
2018-05-23gpio: zynq: Remove call to platform_get_irqShubhrajyoti Datta1-4/+2
Remove the call to platform_get_irq use the cached one instead. Signed-off-by: Shubhrajyoti Datta <[email protected]> Reviewed-by: Michal Simek <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: Convert to use match_string() helperAndy Shevchenko1-5/+2
The new helper returns index of the matching string in an array. We are going to use it here. Signed-off-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: pca953x: add more register definitions for pcal6524H. Nikolaus Schaller1-0/+6
The pcal6524 has another set of registers to fine control the interrupt handling. Signed-off-by: H. Nikolaus Schaller <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: pca953x: add more register definitions for pcal953xH. Nikolaus Schaller1-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 <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: pca953x: convert register constants to hexH. Nikolaus Schaller1-16/+16
which makes it easier to match them with the data sheets. Signed-off-by: H. Nikolaus Schaller <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: ge: Fix build warningThierry Reding1-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 <[email protected]> Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpiolib: fix gpiochip_machine_hog()Dan Carpenter1-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 <[email protected]> Reviewed-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: xlp: Use of_device_get_match_data()Thierry Reding1-8/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: vf610: Use of_device_get_match_data()Thierry Reding1-3/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: ts4900: Use of_device_get_match_data()Thierry Reding1-6/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: syscon: Use of_device_get_match_data()Thierry Reding1-6/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: pxa: Use of_device_get_match_data()Thierry Reding1-7/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: pca953x: Use of_device_get_match_data()Thierry Reding1-6/+4
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: palmas: Use of_device_get_match_data()Thierry Reding1-5/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: mxs: Use of_device_get_match_data()Thierry Reding1-3/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: ingenic: Use of_device_get_match_data()Thierry Reding1-3/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: ge: Use of_device_get_match_data()Thierry Reding1-3/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: dwapb: Use of_device_get_match_data()Thierry Reding1-7/+1
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: 74xx-mmio: Use of_device_get_match_data()Thierry Reding1-7/+2
Use of_device_get_match_data() instead of open-coding it. Signed-off-by: Thierry Reding <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: mockup: use the SPDX identifier and remove license boilerplateBartosz Golaszewski1-6/+1
Use the SPDX license identifier for GPLv2.0 or later and remove the license boilerplate. Signed-off-by: Bartosz Golaszewski <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: dwapb: Add support for 1 interrupt per port A GPIOPhil Edworthy1-9/+37
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 <[email protected]>. This was tested on X-Gene by Hoan. Signed-off-by: Phil Edworthy <[email protected]> Reviewed-by: Rob Herring <[email protected]> Acked-by: Lee Jones <[email protected]> Acked-by: Hoan Tran <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: make several const arrays static, shrinks object sizeColin Ian King2-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 <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: mxc: Remove reliance on <linux/gpio.h>Linus Walleij1-6/+3
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 <[email protected]> Cc: Fabio Estevam <[email protected]> Acked-by: Shawn Guo <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: mvebu: Use the proper APIsLinus Walleij1-12/+8
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 <[email protected]> Cc: Thomas Petazzoni <[email protected]> Cc: Jason Cooper <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: msic: Include the right headerLinus Walleij1-1/+1
This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: mm-lantiq: Include the right headerLinus Walleij1-1/+1
This is a driver so include only <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: ml_ioh: Include the right headerLinus Walleij1-1/+1
This is a driver so include only <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: mc9s08dz60: Include the right headerLinus Walleij1-1/+1
This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: mc33880: Include the right headerLinus Walleij1-1/+1
This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: max730x: Include the right headerLinus Walleij1-1/+1
This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: lynxpoint: Include the right headerLinus Walleij1-1/+1
This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: lpc32xx: Include the right headerLinus Walleij1-2/+1
This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: lp873x: Include the right headerLinus Walleij1-1/+1
This is a driver so include only <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: lp3943: Include the right headerLinus Walleij1-1/+1
This is a driver so only include <linux/gpio/driver.h>. Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: loongson: Use BIT() macrosLinus Walleij1-14/+11
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 <[email protected]> Cc: Jiaxun Yang <[email protected]> Cc: Huacai Chen <[email protected]> Cc: [email protected] Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: loongson: Create a dynamic platform deviceLinus Walleij1-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 <[email protected]> Cc: Jiaxun Yang <[email protected]> Cc: Huacai Chen <[email protected]> Cc: [email protected] Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: loongson: Use right includeLinus Walleij1-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 <[email protected]> Cc: Jiaxun Yang <[email protected]> Cc: Huacai Chen <[email protected]> Cc: [email protected] Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpiolib: add hogs support for machine codeBartosz Golaszewski1-0/+67
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 <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: 104-dio-48e: make array 'ports' static, shrinks object sizeColin Ian King1-1/+1
Don't populate the const read-only array 'ports' on the stack but instead make it static. Makes the object code smaller by over 100 buytes: Before: text data bss dec hex filename 10959 4952 832 16743 4167 drivers/gpio/gpio-104-dio-48e.o After: text data bss dec hex filename 10790 5008 832 16630 40f6 drivers/gpio/gpio-104-dio-48e.o (gcc version 7.2.0 x86_64) Signed-off-by: Colin Ian King <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: pmic_eic: Add edge trigger emulation for PMIC EICBaolin Wang1-2/+56
This patch will toggle the EIC level to emulate the edge trigger to support PMIC EIC egdge trigger function, which is required by gpio-keys driver. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-05-16gpio: eic: Add edge trigger emulation for EICBaolin Wang1-0/+73
The Spreadtrum debounce EIC and latch EIC can not support edge trigger, but most GPIO users (like gpio-key driver) only use the edge trigger, thus the EIC driver need add some support to emulate the edge trigger to satisfy this requirement. Signed-off-by: Baolin Wang <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-04-30gpio: pcie-idio-24: Fix off-by-one error in get_multiple loopWilliam Breathitt Gray1-1/+1
The PCIe-IDIO-24 features 8 bits of TTL GPIO which may be configured for output or input. This patch fixes an off-by-one error in the loop conditional for the get_multiple callback so that the TTL GPIO are handled. Fixes: ca37081595a2 ("gpio: pcie-idio-24: Implement get_multiple/set_multiple callbacks") Signed-off-by: William Breathitt Gray <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-04-27gpio: xra1403: Switch to a fixed upper bound for registersLaura Abbott1-10/+5
Geert Uytterhoeven pointed out that the number of register was a fixed upper bound so there's no need to use a dynamically allocated array in place of a VLA. Use the defined upper bound. Suggested-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Laura Abbott <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-04-27gpio: pcie-idio-24: Fix port memory offset for get_multiple/set_multiple ↵William Breathitt Gray1-10/+10
callbacks The ioread8/iowrite8 functions expect a memory offset argument. This patch fixes the ports array to provide the memory addresses of the respective device I/O registers. Fixes: ca37081595a2 ("gpio: pcie-idio-24: Implement get_multiple/set_multiple callbacks") Signed-off-by: William Breathitt Gray <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-04-27gpio: pci-idio-16: Fix port memory offset for get_multiple callbackWilliam Breathitt Gray1-4/+4
The ioread8 function expects a memory offset argument. This patch fixes the ports array to provide the memory addresses of the respective device I/O registers. Fixes: 810ebfc5efca ("gpio: pci-idio-16: Implement get_multiple callback") Signed-off-by: William Breathitt Gray <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-04-27gpio: fix error path in lineevent_createUwe Kleine-König1-1/+1
If gpiod_request() fails the cleanup must not call gpiod_free(). Cc: [email protected] Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events") Signed-off-by: Uwe Kleine-König <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-04-26gpioib: do not free unrequested descriptorsTimur Tabi1-2/+3
If the main loop in linehandle_create() encounters an error, it unwinds completely by freeing all previously requested GPIO descriptors. However, if the error occurs in the beginning of the loop before that GPIO is requested, then the exit code attempts to free a null descriptor. If extrachecks is enabled, gpiod_free() triggers a WARN_ON. Instead, keep a separate count of legitimate GPIOs so that only those are freed. Cc: [email protected] Fixes: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines") Reviewed-by: Bjorn Andersson <[email protected]> Signed-off-by: Timur Tabi <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-04-26gpio: fix aspeed_gpio unmask irqGovert Overgaauw1-1/+1
The unmask function disables all interrupts in a bank when unmasking an interrupt. Only disable the given interrupt. Cc: [email protected] Signed-off-by: Govert Overgaauw <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2018-04-05Merge tag 'devicetree-for-4.17' of ↵Linus Torvalds1-2/+2
git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux Pull DeviceTree updates from Rob Herring: - Sync dtc to upstream version v1.4.6-9-gaadd0b65c987. This adds a bunch more warnings (hidden behind W=1). - Build dtc lexer and parser files instead of using shipped versions. - Rework overlay apply API to take an FDT as input and apply overlays in a single step. - Add a phandle lookup cache. This improves boot time by hundreds of msec on systems with large DT. - Add trivial mcp4017/18/19 potentiometers bindings. - Remove VLA stack usage in DT code. * tag 'devicetree-for-4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/robh/linux: (26 commits) of: unittest: fix an error code in of_unittest_apply_overlay() of: unittest: move misplaced function declaration of: unittest: Remove VLA stack usage of: overlay: Fix forgotten reference to of_overlay_apply() of: Documentation: Fix forgotten reference to of_overlay_apply() of: unittest: local return value variable related cleanups of: unittest: remove unneeded local return value variables dt-bindings: trivial: add various mcp4017/18/19 potentiometers of: unittest: fix an error test in of_unittest_overlay_8() of: cache phandle nodes to reduce cost of of_find_node_by_phandle() dt-bindings: rockchip-dw-mshc: use consistent clock names MAINTAINERS: Add linux/of_*.h headers to appropriate subsystems scripts: turn off some new dtc warnings by default scripts/dtc: Update to upstream version v1.4.6-9-gaadd0b65c987 scripts/dtc: generate lexer and parser during build instead of shipping powerpc: boot: add strrchr function of: overlay: do not include path in full_name of added nodes of: unittest: clean up changeset test arm64/efi: Make strrchr() available to the EFI namespace ARM: boot: add strrchr function ...
2018-04-05Merge tag 'gpio-v4.17-1' of ↵Linus Torvalds46-959/+2300
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio Pull GPIO updates from Linus Walleij: "This is the bulk of GPIO changes for the v4.17 kernel cycle: New drivers: - Nintendo Wii GameCube GPIO, known as "Hollywood" - Raspberry Pi mailbox service GPIO expander - Spreadtrum main SC9860 SoC and IEC GPIO controllers. Improvements: - Implemented .get_multiple() callback for most of the high-performance industrial GPIO cards for the ISA bus. - ISA GPIO drivers now select the ISA_BUS_API instead of depending on it. This is merged with the same pattern for all the ISA drivers and some other Kconfig cleanups related to this. Cleanup: - Delete the TZ1090 GPIO drivers following the deletion of this SoC from the ARM tree. - Move the documentation over to driver-api to conform with the rest of the kernel documentation build. - Continue to make the GPIO drivers include only <linux/gpio/driver.h> and not the too broad <linux/gpio.h> that we want to get rid of. - Managed to remove VLA allocation from two drivers pending more fixes in this area for the next merge window. - Misc janitorial fixes" * tag 'gpio-v4.17-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (77 commits) gpio: Add Spreadtrum PMIC EIC driver support gpio: Add Spreadtrum EIC driver support dt-bindings: gpio: Add Spreadtrum EIC controller documentation gpio: ath79: Fix potential NULL dereference in ath79_gpio_probe() pinctrl: qcom: Don't allow protected pins to be requested gpiolib: Support 'gpio-reserved-ranges' property gpiolib: Change bitmap allocation to kmalloc_array gpiolib: Extract mask allocation into subroutine dt-bindings: gpio: Add a gpio-reserved-ranges property gpio: mockup: fix a potential crash when creating debugfs entries gpio: pca953x: add compatibility for pcal6524 and pcal9555a gpio: dwapb: Add support for a bus clock gpio: Remove VLA from xra1403 driver gpio: Remove VLA from MAX3191X driver gpio: ws16c48: Implement get_multiple callback gpio: gpio-mm: Implement get_multiple callback gpio: 104-idi-48: Implement get_multiple callback gpio: 104-dio-48e: Implement get_multiple callback gpio: pcie-idio-24: Implement get_multiple/set_multiple callbacks gpio: pci-idio-16: Implement get_multiple callback ...