linux/drivers/gpio
Linus Walleij 81c85ec15a gpio: OF: Parse MMC-specific CD and WP properties
When retrieveing CD (card detect) and WP (write protect)
GPIO handles from the device tree, make sure to assign
them active low by default unless the "cd-inverted" or
"wp-inverted" properties are set. These properties mean
that respective signal is active HIGH since the SDHCI
specification stipulates that this kind of signals
should be treated as active LOW.

If the twocell GPIO flag is also specified as active
low, well that's nice and we will silently ignore the
tautological specification.

If however the GPIO line is specified as active low
in the GPIO flasg cell and "cd-inverted" or "wp-inverted"
is also specified, the latter takes precedence and we
print a warning.

The current effect on the MMC slot-gpio core are as
follows:

For CD GPIOs: no effect. The current code in
mmc/core/host.c calls mmc_gpiod_request_cd() with
the "override_active_level" argument set to true,
which means that whatever the GPIO descriptor
thinks about active low/high will be ignored, the
core will use the MMC_CAP2_CD_ACTIVE_HIGH to keep
track of this and reads the raw value from the
GPIO descriptor, totally bypassing gpiolibs inversion
semantics. I plan to clean this up at a later point
passing the handling of inversion semantics over
to gpiolib, so this patch prepares the ground for
that.

Fow WP GPIOs: this is probably fixing a bug, because
the code in mmc/core/host.c calls mmc_gpiod_request_ro()
with the "override_active_level" argument set to false,
which means it will respect the inversion semantics of
the gpiolib and ignore the MMC_CAP2_RO_ACTIVE_HIGH
flag for everyone using this through device tree.
However the code in host.c confusingly goes to great
lengths setting up the MMC_CAP2_RO_ACTIVE_HIGH flag
from the GPIO descriptor and by reading the "wp-inverted"
property of the node. As far as I can tell this is all
in vain and the inversion is broken: device trees that
use "wp-inverted" do not work as intended, instead the
only way to actually get inversion on a line is by
setting the second cell flag to GPIO_ACTIVE_HIGH (which
will be the default) or GPIO_ACTIVE_LOW if they want
the proper MMC semantics. Presumably all device trees do
this right but we need to parse and handle this properly.

Cc: linux-mmc@vger.kernel.org
Cc: linux-gpio@vger.kernel.org
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
2018-11-29 15:40:21 +01:00
..
Kconfig gpio: fix SNPS_CREG kconfig dependency warning 2018-10-15 16:23:44 +02:00
Makefile GPIO: add single-register GPIO via CREG driver 2018-10-10 09:21:06 +02:00
TODO gpio: Add global TODO file for GPIO 2018-11-05 08:54:40 +01:00
gpio-74x164.c The is the bulk of GPIO changes for the v4.16 kernel cycle. 2018-01-31 12:25:27 -08:00
gpio-74xx-mmio.c gpio: 74xx-mmio: Use of_device_get_match_data() 2018-05-16 14:35:24 +02:00
gpio-104-dio-48e.c gpio: 104-dio-48e: Mask read inputs for get_multiple 2018-11-05 08:54:41 +01:00
gpio-104-idi-48.c gpio: 104-idi-48e: Mask the read inputs for get_multiple 2018-11-05 08:54:41 +01:00
gpio-104-idio-16.c gpio: 104-idio-16: Implement get_multiple callback 2018-03-26 10:10:18 +02:00
gpio-adnp.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
gpio-adp5520.c drivers: gpio: Update MODULE AUTHOR email address 2018-08-29 13:30:25 +02:00
gpio-adp5588.c This is the bulk of GPIO changes for the v4.20 series: 2018-10-23 08:45:05 +01:00
gpio-altera-a10sr.c gpio: altera-a10sr: constify gpio_chip structure 2017-08-14 15:01:12 +02:00
gpio-altera.c gpio: altera: Include GPIO driver header 2018-01-13 22:18:34 +01:00
gpio-amd8111.c gpio: amd8111: Include proper header 2018-01-13 22:22:49 +01:00
gpio-amdpt.c
gpio-arizona.c gpio: arizona: Include proper header 2018-01-13 22:47:48 +01:00
gpio-aspeed.c gpio: aspeed: fix compile testing warning 2018-07-13 09:05:06 +02:00
gpio-ath79.c gpio: fix meaningless return expression 2018-07-29 23:34:54 +02:00
gpio-bcm-kona.c gpio-bcm-kona: use new req/relres and dis/enable_irq funcs 2018-09-10 08:57:36 +02:00
gpio-bd9571mwv.c
gpio-brcmstb.c gpio: brcmstb: allow 0 width GPIO banks 2018-08-30 11:04:50 +02:00
gpio-bt8xx.c gpio: bt8xx: Include proper header 2018-01-13 22:56:52 +01:00
gpio-clps711x.c
gpio-creg-snps.c GPIO: add single-register GPIO via CREG driver 2018-10-10 09:21:06 +02:00
gpio-crystalcove.c gpio: crystalcove: Include proper header 2018-01-14 01:48:48 +01:00
gpio-cs5535.c gpio: cs5535: Include proper header 2018-01-14 01:56:24 +01:00
gpio-da9052.c gpio: da905x: Include proper header 2018-01-14 02:00:10 +01:00
gpio-da9055.c gpio: da905x: Include proper header 2018-01-14 02:00:10 +01:00
gpio-davinci.c gpio: davinci: Move driver local definitions to driver 2018-09-20 08:36:19 -07:00
gpio-dln2.c gpio: dln2: Include proper header 2018-03-19 01:50:07 +01:00
gpio-dwapb.c gpio: gpio-dwapb: simplify getting .driver_data 2018-11-05 08:54:41 +01:00
gpio-eic-sprd.c gpio: eic: Add edge trigger emulation for EIC 2018-05-16 14:35:24 +02:00
gpio-em.c gpio: em: Don't shadow error code of gpiochip_lock_as_irq() 2018-08-06 23:46:55 +02:00
gpio-ep93xx.c gpio: ep93xx: fix test for end of loop 2018-09-10 08:48:24 +02:00
gpio-exar.c gpio: exar: Use correct property prefix and document bindings 2017-08-01 13:43:55 +02:00
gpio-f7188x.c
gpio-ftgpio010.c gpio: ftgpio: Support debounce timer 2018-08-30 09:14:54 +02:00
gpio-ge.c gpio: ge: Fix build warning 2018-05-16 14:35:24 +02:00
gpio-gpio-mm.c gpio: gpio-mm: Mask read inputs for get_multiple 2018-11-05 08:54:41 +01:00
gpio-grgpio.c drivers/gpio/gpio-grgpio.c: Remove duplicate header 2018-11-19 15:09:22 +01:00
gpio-hlwd.c gpio: Add GPIO driver for Nintendo Wii 2018-02-22 13:54:35 +01:00
gpio-htc-egpio.c gpio: htc-egpio: Remove set but not used variable 'bit' 2018-10-01 12:27:19 +02:00
gpio-ich.c gpio: ich: Use BIT() macro 2018-03-19 01:50:29 +01:00
gpio-intel-mid.c gpio-intel-mid: Delete an error message 2018-02-22 15:29:05 +01:00
gpio-iop.c gpio: iop: add missing MODULE_DESCRIPTION/AUTHOR/LICENSE 2017-12-02 22:42:21 +01:00
gpio-it87.c gpio: it87: Add support for IT8613 2018-08-10 23:19:17 +02:00
gpio-janz-ttl.c gpio: janz-ttl: Use BIT() macro 2018-03-19 01:50:30 +01:00
gpio-kempld.c gpio: kempld: Include the right header 2018-03-19 01:50:31 +01:00
gpio-ks8695.c gpio: ks8695: Include the right header 2018-03-19 01:50:31 +01:00
gpio-loongson.c gpio: loongson: Use BIT() macros 2018-05-16 14:35:24 +02:00
gpio-loongson1.c gpio: loongson1: fix bgpio usage 2017-10-25 11:25:38 +02:00
gpio-lp873x.c gpio: lp873x: Include the right header 2018-05-16 14:35:24 +02:00
gpio-lp3943.c gpio: lp3943: Include the right header 2018-05-16 14:35:24 +02:00
gpio-lp87565.c gpio: lp87565: Set proper output level and direction for direction_output 2017-07-31 15:26:57 +02:00
gpio-lpc18xx.c
gpio-lpc32xx.c gpio: lpc32xx: Include the right header 2018-05-16 14:35:24 +02:00
gpio-lynxpoint.c gpio: gpio-lynxpoint: simplify getting .driver_data 2018-11-05 08:54:41 +01:00
gpio-madera.c gpio: madera: Support Cirrus Logic Madera class codecs 2018-06-05 11:15:30 +01:00
gpio-max730x.c gpio: max730x: Include the right header 2018-05-16 14:35:24 +02:00
gpio-max732x.c gpio: max732x: add error handling for i2c_new_dummy 2018-06-18 07:55:30 +02:00
gpio-max3191x.c gpiolib: Pass array info to get/set array functions 2018-09-13 11:16:54 +02:00
gpio-max7300.c
gpio-max7301.c
gpio-max77620.c gpio: max77620: Make regmap_irq_chip const 2017-08-14 16:06:24 +02:00
gpio-mb86s7x.c gpio: mb86s70: Revert "Return error if requesting an already assigned gpio" 2017-10-31 13:13:34 +01:00
gpio-mc9s08dz60.c gpio: mc9s08dz60: Include the right header 2018-05-16 14:35:24 +02:00
gpio-mc33880.c gpio: mc33880: Include the right header 2018-05-16 14:35:24 +02:00
gpio-menz127.c gpio: Fix wrong rounding in gpio-menz127 2018-06-18 07:55:30 +02:00
gpio-merrifield.c gpio: merrifield: Delete an error message 2018-02-22 15:25:40 +01:00
gpio-ml-ioh.c gpio: ml-ioh: Fix buffer underwrite on probe error path 2018-07-29 23:13:09 +02:00
gpio-mm-lantiq.c gpio: mm-lantiq: Include the right header 2018-05-16 14:35:24 +02:00
gpio-mmio.c gpio: Use SPDX header for core library 2018-09-25 09:08:48 +02:00
gpio-mockup.c gpio: mockup: use device properties instead of platform_data 2018-10-03 09:53:16 +02:00
gpio-mpc8xxx.c gpio: mpc8xxx: Do not reverse bits using bgpio 2017-10-25 11:25:40 +02:00
gpio-mpc5200.c
gpio-msic.c gpio: msic: Include the right header 2018-05-16 14:35:24 +02:00
gpio-mt7621.c gpio: mt7621: Edit to preferred syntax 2018-07-09 13:51:57 +02:00
gpio-mvebu.c gpio: mvebu: Use the proper APIs 2018-05-16 14:35:24 +02:00
gpio-mxc.c gpio: mxc: move gpio noirq suspend/resume to syscore phase 2018-11-16 22:56:54 +01:00
gpio-mxs.c gpio: mxs: Get rid of external API call 2018-09-04 08:22:47 +02:00
gpio-octeon.c gpio: octeon: Include the right header 2018-05-24 14:22:04 +02:00
gpio-omap.c gpio: gpio-omap: simplify getting .driver_data 2018-11-05 08:54:41 +01:00
gpio-palmas.c gpio: palmas: Include the right header 2018-05-24 14:25:13 +02:00
gpio-pca953x.c gpio: pca953x: suppress interrupts warning when not applicable 2018-07-02 16:00:49 +02:00
gpio-pcf857x.c gpio: pcf857x: Include the right header 2018-05-24 17:09:41 +02:00
gpio-pch.c gpio: pch: Include the right header 2018-05-24 17:09:41 +02:00
gpio-pci-idio-16.c gpio: pci-idio-16: Mask read inputs for get_multiple 2018-11-05 08:54:42 +01:00
gpio-pcie-idio-24.c gpio: pcie-idio-24: Mask read inputs for get_multiple 2018-11-05 08:54:42 +01:00
gpio-pisosr.c gpio-pisosr: add support for get_multiple 2018-07-29 21:55:33 +02:00
gpio-pl061.c gpio: pl061: Move irq_chip definition inside struct pl061 2018-11-05 08:54:42 +01:00
gpio-pmic-eic-sprd.c gpio: pmic_eic: Add edge trigger emulation for PMIC EIC 2018-05-16 14:35:24 +02:00
gpio-pxa.c gpio: pxa: handle corner case of unprobed device 2018-08-29 13:56:46 +02:00
gpio-raspberrypi-exp.c gpio: raspberrypi-exp: Driver for RPi3 GPIO expander via mailbox service 2018-02-22 13:49:59 +01:00
gpio-rc5t583.c gpio: rc5t583: Include the right header 2018-07-02 16:00:49 +02:00
gpio-rcar.c gpio: rcar: convert to SPDX identifiers 2018-11-15 11:46:50 +01:00
gpio-rdc321x.c gpio: rdc321x: Include the right header 2018-07-02 16:00:49 +02:00
gpio-reg.c gpio: gpio-reg: fix build 2017-12-22 15:24:31 +01:00
gpio-sa1100.c gpio: sa1100: Include the right header 2018-07-02 16:00:49 +02:00
gpio-sch.c gpio: sch: Implement .get_direction() 2018-07-02 16:00:49 +02:00
gpio-sch311x.c gpio: sch311x: clean an indentation issue, remove extraneous space 2018-11-05 08:54:42 +01:00
gpio-siox.c gpio: new driver to work with a 8x12 siox 2018-09-28 09:30:42 +02:00
gpio-sodaville.c
gpio-spear-spics.c gpio: spear-spics: Include the right header 2018-07-02 16:00:49 +02:00
gpio-sprd.c gpio: Add GPIO driver for Spreadtrum SC9860 platform 2018-03-02 11:00:43 +01:00
gpio-sta2x11.c gpio: sta2x11: Inline regs macro 2018-07-02 16:00:49 +02:00
gpio-stmpe.c gpio: stmpe: Include the right header 2018-07-02 16:00:49 +02:00
gpio-stp-xway.c gpio: stp-xway: Include the right header 2018-07-02 16:00:49 +02:00
gpio-syscon.c gpio: syscon: Fix possible NULL ptr usage 2018-10-10 10:33:11 +02:00
gpio-tb10x.c gpio: tb10x: Use GENERIC_GPIO 2018-08-29 08:53:37 +02:00
gpio-tc3589x.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-tegra.c gpio: gpio-tegra: simplify getting .driver_data 2018-11-05 08:54:41 +01:00
gpio-tegra186.c gpio: tegra186: Add support for Tegra194 2018-07-02 16:01:02 +02:00
gpio-thunderx.c treewide: devm_kzalloc() -> devm_kcalloc() 2018-06-12 16:19:22 -07:00
gpio-timberdale.c gpio: timberdale: Include the right header 2018-08-10 23:04:27 +02:00
gpio-tpic2810.c
gpio-tps6586x.c gpio: tps65xxx: Use SPDX license tag 2018-09-04 08:22:47 +02:00
gpio-tps65086.c gpio: tps65xxx: Use SPDX license tag 2018-09-04 08:22:47 +02:00
gpio-tps65218.c
gpio-tps65910.c gpio: tps65xxx: Use SPDX license tag 2018-09-04 08:22:47 +02:00
gpio-tps65912.c gpio: tps65xxx: Use SPDX license tag 2018-09-04 08:22:47 +02:00
gpio-tps68470.c gpio: tps68470: Update to SPDX license identifier 2018-02-23 15:26:42 +01:00
gpio-ts4800.c
gpio-ts4900.c gpio: ts4900: Use of_device_get_match_data() 2018-05-16 14:35:24 +02:00
gpio-ts5500.c gpio: ts5500: Delete platform data handling 2018-09-04 08:22:47 +02:00
gpio-twl4030.c gpio: twl4030: Implement .get_direction() 2018-09-10 08:48:51 +02:00
gpio-twl6040.c gpio: twl6040: Implement .get_direction() 2018-09-10 08:49:22 +02:00
gpio-ucb1400.c
gpio-uniphier.c gpio: uniphier: include <linux/bits.h> instead of <linux/bitops.h> 2018-10-16 10:02:46 +02:00
gpio-vf610.c gpio: vf610: add optional clock support 2018-11-16 23:09:39 +01:00
gpio-viperboard.c gpio: viperboard: Cut down on boilerplate 2018-09-17 10:55:24 -07:00
gpio-vr41xx.c gpio: vr41xx: Delete vr41xx_gpio_pullupdown() callback 2018-09-17 10:55:24 -07:00
gpio-vx855.c gpio: vx855: Cut down on boilerplate 2018-09-17 10:55:24 -07:00
gpio-wcove.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-winbond.c gpio: winbond: Add driver 2018-01-09 14:51:00 +01:00
gpio-wm831x.c gpio: wm8xxx: Cut down on boilerplate 2018-09-17 10:55:24 -07:00
gpio-wm8350.c gpio: wm8xxx: Cut down on boilerplate 2018-09-17 10:55:24 -07:00
gpio-wm8994.c gpio: wm8xxx: Cut down on boilerplate 2018-09-17 10:55:24 -07:00
gpio-ws16c48.c gpio: ws16c48: Mask read inputs for get_multiple 2018-11-05 08:54:42 +01:00
gpio-xgene-sb.c gpio: xgene-sb: Don't shadow error code of gpiochip_lock_as_irq() 2018-08-06 23:46:55 +02:00
gpio-xgene.c
gpio-xilinx.c gpio: xilinx: Use the right include 2018-08-10 23:19:17 +02:00
gpio-xlp.c gpio: xlp: Cut down on boilerplate 2018-09-17 10:55:24 -07:00
gpio-xra1403.c gpio: xra1403: Switch to a fixed upper bound for registers 2018-04-27 01:06:21 +02:00
gpio-xtensa.c gpio: xtensa: Cut down on boilerplate 2018-09-17 10:55:24 -07:00
gpio-zevio.c gpio: zevio: Include the right header 2018-09-04 08:22:47 +02:00
gpio-zx.c gpio: Move irqdomain into struct gpio_irq_chip 2017-11-08 14:06:21 +01:00
gpio-zynq.c gpio: gpio-zynq: simplify getting .driver_data 2018-11-05 08:54:41 +01:00
gpiolib-acpi.c pci-v4.20-changes 2018-10-25 06:50:48 -07:00
gpiolib-devprop.c Accept partial 'gpio-line-names' property. 2018-10-01 13:15:06 +02:00
gpiolib-devres.c gpio: Rename devres implementation file 2018-09-25 09:11:50 +02:00
gpiolib-legacy.c gpio: Use SPDX header for core library 2018-09-25 09:08:48 +02:00
gpiolib-of.c gpio: OF: Parse MMC-specific CD and WP properties 2018-11-29 15:40:21 +01:00
gpiolib-sysfs.c gpio: Use SPDX header for core library 2018-09-25 09:08:48 +02:00
gpiolib.c gpio: drop devm_gpio_chip_match() 2018-11-15 09:58:15 +01:00
gpiolib.h gpio: Restore indentation of continued lines 2018-10-01 12:22:41 +02:00