1
0
Fork 0
alistair23-linux/drivers/pinctrl
Hans de Goede 512b18eec5 pinctrl: baytrail: Fix pin being driven low for a while on gpiod_get(..., GPIOD_OUT_HIGH)
commit 156abe2961 upstream

The pins on the Bay Trail SoC have separate input-buffer and output-buffer
enable bits and a read of the level bit of the value register will always
return the value from the input-buffer.

The BIOS of a device may configure a pin in output-only mode, only enabling
the output buffer, and write 1 to the level bit to drive the pin high.
This 1 written to the level bit will be stored inside the data-latch of the
output buffer.

But a subsequent read of the value register will return 0 for the level bit
because the input-buffer is disabled. This causes a read-modify-write as
done by byt_gpio_set_direction() to write 0 to the level bit, driving the
pin low!

Before this commit byt_gpio_direction_output() relied on
pinctrl_gpio_direction_output() to set the direction, followed by a call
to byt_gpio_set() to apply the selected value. This causes the pin to
go low between the pinctrl_gpio_direction_output() and byt_gpio_set()
calls.

Change byt_gpio_direction_output() to directly make the register
modifications itself instead. Replacing the 2 subsequent writes to the
value register with a single write.

Note that the pinctrl code does not keep track internally of the direction,
so not going through pinctrl_gpio_direction_output() is not an issue.

This issue was noticed on a Trekstor SurfTab Twin 10.1. When the panel is
already on at boot (no external monitor connected), then the i915 driver
does a gpiod_get(..., GPIOD_OUT_HIGH) for the panel-enable GPIO. The
temporarily going low of that GPIO was causing the panel to reset itself
after which it would not show an image until it was turned off and back on
again (until a full modeset was done on it). This commit fixes this.

This commit also updates the byt_gpio_direction_input() to use direct
register accesses instead of going through pinctrl_gpio_direction_input(),
to keep it consistent with byt_gpio_direction_output().

Note for backporting, this commit depends on:
commit e2b74419e5 ("pinctrl: baytrail: Replace WARN with dev_info_once
when setting direct-irq pin to output")

Cc: stable@vger.kernel.org
Fixes: 86e3ef812f ("pinctrl: baytrail: Update gpio chip operations")
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[sudip: use byt_gpio and vg->pdev->dev for dev_info()]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-12-11 13:23:27 +01:00
..
actions treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
aspeed pinctrl: aspeed: Fix GPI only function problem. 2020-11-18 19:20:26 +01:00
bcm pinctrl: bcm: fix kconfig dependency warning when !GPIOLIB 2020-10-29 09:57:34 +01:00
berlin pinctrl: berlin: as370: fix a typo s/spififib/spdifib 2019-10-16 14:12:55 +02:00
cirrus pinctrl: lochnagar: select GPIOLIB 2020-01-17 19:48:18 +01:00
freescale pinctrl: freescale: imx: Fix an error handling path in 'imx_pinctrl_probe()' 2020-06-24 17:50:38 +02:00
intel pinctrl: baytrail: Fix pin being driven low for a while on gpiod_get(..., GPIOD_OUT_HIGH) 2020-12-11 13:23:27 +01:00
mediatek This is the bulk of pin control changes for the v5.3 kernel 2019-07-13 15:02:27 -07:00
meson pinctrl: meson-gxl: fix GPIOX sdio pins 2020-03-18 07:17:55 +01:00
mvebu pinctrl: mvebu: Fix i2c sda definition for 98DX3236 2020-10-07 08:01:28 +02:00
nomadik pinctrl: nomadik: abx500: Add of_node_put() before return 2019-08-06 14:51:59 +02:00
nuvoton treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
pxa treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 441 2019-06-05 17:37:17 +02:00
qcom pinctrl: qcom: spmi-gpio: fix warning about irq chip reusage 2020-06-30 15:37:04 -04:00
samsung pinctrl: samsung: Save/restore eint_mask over suspend for EINT_TYPE GPIOs 2020-06-22 09:31:20 +02:00
sh-pfc pinctrl: sh-pfc: sh7269: Fix CAN function GPIOs 2020-02-24 08:36:41 +01:00
sirf treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 4 2019-05-21 11:28:40 +02:00
spear pinctrl: spear: spear: Add of_node_put() before return 2019-08-06 16:18:49 +02:00
sprd pinctrl: sprd: Add of_node_put() before return to prevent memory leak 2019-08-10 10:22:50 +02:00
stm32 pinctrl: stm32: stm32: Add of_node_put() before return 2019-08-10 10:21:51 +02:00
sunxi pinctrl: sunxi: v3s: introduce support for V3 2019-08-05 12:35:29 +02:00
tegra pinctrl: tegra: Use noirq suspend/resume callbacks 2020-06-30 15:37:04 -04:00
ti pinctl: ti: iodelay: fix error checking on pinctrl_count_index_with_args call 2020-01-17 19:48:50 +01:00
uniphier pinctrl: uniphier: Fix Pro5 SD pin-mux setting 2019-08-05 13:21:31 +02:00
vt8500 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
zte treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
Kconfig Pin control fixes for v5.2: 2019-05-28 09:35:04 -07:00
Makefile - Core Frameworks 2019-05-14 10:39:08 -07:00
core.c pinctrl: core: Remove extra kref_get which blocks hogs being freed 2020-03-18 07:17:55 +01:00
core.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
devicetree.c pinctrl: devicetree: Avoid taking direct reference to device name string 2019-12-31 16:43:29 +01:00
devicetree.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 201 2019-05-30 11:29:52 -07:00
pinconf-generic.c This is the bulk of pin control changes for the v5.3 kernel 2019-07-13 15:02:27 -07:00
pinconf.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pinconf.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 194 2019-05-30 11:29:22 -07:00
pinctrl-amd.c pinctrl: amd: fix incorrect way to disable debounce filter 2020-11-18 19:20:32 +01:00
pinctrl-amd.h pinctrl: amd: fix npins for uart0 in kerncz_groups 2020-07-29 10:18:26 +02:00
pinctrl-artpec6.c pinctrl: artpec6: Drop unused function and rename 2019-04-11 15:41:20 +02:00
pinctrl-as3722.c pinctrl: Include <linux/gpio/driver.h> nothing else 2018-09-14 15:10:57 +02:00
pinctrl-at91-pio4.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 282 2019-06-05 17:36:37 +02:00
pinctrl-at91.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 434 2019-06-05 17:37:16 +02:00
pinctrl-at91.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pinctrl-axp209.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pinctrl-bm1880.c pinctrl: Add drive strength support for BM1880 SoC 2019-06-08 01:29:42 +02:00
pinctrl-coh901.c pinctrl: Minimize SPDX hamming distance 2019-06-20 10:54:55 +02:00
pinctrl-coh901.h
pinctrl-da850-pupd.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 285 2019-06-05 17:36:37 +02:00
pinctrl-digicolor.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
pinctrl-falcon.c pinctrl: falcon: fix syntax error 2020-03-18 07:17:51 +01:00
pinctrl-gemini.c pinctrl: gemini: Fix up TVC clock group 2018-10-10 21:05:35 +02:00
pinctrl-ingenic.c pinctrl: ingenic: Properly detect GPIO direction when configured for IRQ 2020-08-21 13:05:29 +02:00
pinctrl-lantiq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 332 2019-06-05 17:37:06 +02:00
pinctrl-lantiq.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 332 2019-06-05 17:37:06 +02:00
pinctrl-lpc18xx.c pinctrl: lpc18xx: Use define directive for PIN_CONFIG_GPIO_PIN_INT 2018-11-09 10:23:58 +01:00
pinctrl-max77620.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
pinctrl-mcp23s08.c pinctrl: mcp23s08: Fix mcp23x17 precious range 2020-10-29 09:57:39 +01:00
pinctrl-ocelot.c pinctrl: ocelot: Fix GPIO interrupt decoding on Jaguar2 2020-06-24 17:50:14 +02:00
pinctrl-oxnas.c pinctrl: Remove dev_err() usage after platform_get_irq() 2019-08-05 13:24:06 +02:00
pinctrl-palmas.c
pinctrl-pic32.c pinctrl: Remove dev_err() usage after platform_get_irq() 2019-08-05 13:24:06 +02:00
pinctrl-pic32.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 445 2019-06-05 17:37:18 +02:00
pinctrl-pistachio.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 422 2019-06-05 17:37:15 +02:00
pinctrl-rk805.c pinctrl: rk805: Make structures constant 2019-08-21 09:00:16 +02:00
pinctrl-rockchip.c pinctrl: rockchip: enable gpio pclk for rockchip_gpio_to_irq 2020-11-24 13:29:00 +01:00
pinctrl-rza1.c pinctrl: rza1: Fix wrong array assignment of rza1l_swio_entries 2020-06-24 17:50:21 +02:00
pinctrl-rza2.c pinctrl: rza2: Fix gpio name typos 2019-12-17 19:56:36 +01:00
pinctrl-rzn1.c pinctrl: rzn1: Add of_node_put() before return 2019-08-05 09:23:57 +02:00
pinctrl-single.c pinctrl-single: fix pcs_parse_pinconf() return value 2020-08-19 08:16:21 +02:00
pinctrl-st.c pinctrl: st: Add of_node_put() before return 2019-08-21 12:04:35 +02:00
pinctrl-stmfx.c pinctrl: stmfx: fix valid_mask init sequence 2019-11-07 10:06:46 +01:00
pinctrl-sx150x.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284 2019-06-05 17:36:37 +02:00
pinctrl-tb10x.c This is the bulk of pin control changes for the v5.3 kernel 2019-07-13 15:02:27 -07:00
pinctrl-u300.c pinctrl: Minimize SPDX hamming distance 2019-06-20 10:54:55 +02:00
pinctrl-utils.c
pinctrl-utils.h
pinctrl-xway.c pinctrl: xway: Use devm_kasprintf() instead of fixed buffer formatting 2019-08-05 13:31:17 +02:00
pinctrl-zynq.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 13 2019-05-21 11:28:45 +02:00
pinmux.c pinctrl: pinmux: fix a possible null pointer in pinmux_can_be_used_for_gpio 2020-01-12 12:21:28 +01:00
pinmux.h pinctrl/gpio: Take MUX usage into account 2019-08-23 11:09:41 +02:00