OpenCloudOS-Kernel/drivers/pinctrl/intel
Hans de Goede 156abe2961 pinctrl: baytrail: Fix pin being driven low for a while on gpiod_get(..., GPIOD_OUT_HIGH)
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>
2020-06-22 13:55:36 +03:00
..
Kconfig pinctrl: intel: Add Intel Jasper Lake pin controller support 2020-04-14 16:17:13 +03:00
Makefile pinctrl: intel: Add Intel Jasper Lake pin controller support 2020-04-14 16:17:13 +03:00
pinctrl-baytrail.c pinctrl: baytrail: Fix pin being driven low for a while on gpiod_get(..., GPIOD_OUT_HIGH) 2020-06-22 13:55:36 +03:00
pinctrl-broxton.c pinctrl: broxton: Provide Interrupt Status register offset 2019-08-07 16:45:41 +03:00
pinctrl-cannonlake.c pinctrl: cannonlake: Use generic flag for special GPIO base treatment 2020-04-14 16:17:13 +03:00
pinctrl-cedarfork.c pinctrl: cedarfork: Update pin names according to v1.13c 2019-04-03 14:49:47 +03:00
pinctrl-cherryview.c pinctrl: cherryview: Re-use data structures from pinctrl-intel.h (part 3) 2020-06-22 10:58:51 +03:00
pinctrl-denverton.c pinctrl: denverton: Update pin names according to v1.08 2019-08-08 12:57:01 +03:00
pinctrl-geminilake.c pinctrl: geminilake: Provide Interrupt Status register offset 2019-08-07 16:45:41 +03:00
pinctrl-icelake.c pinctrl: icelake: Use generic flag for special GPIO base treatment 2020-04-14 16:17:13 +03:00
pinctrl-intel.c pinctrl: intel: Make use of for_each_requested_gpio_in_range() 2020-06-22 11:01:59 +03:00
pinctrl-intel.h pinctrl: intel: Allow drivers to define ACPI address space ID 2020-06-22 10:58:51 +03:00
pinctrl-jasperlake.c pinctrl: intel: Add Intel Jasper Lake pin controller support 2020-04-14 16:17:13 +03:00
pinctrl-lewisburg.c pinctrl: lewisburg: Update pin list according to v1.1v6 2019-11-21 15:04:16 +01:00
pinctrl-lynxpoint.c pinctrl: lynxpoint: Drop no-op ACPI_PTR() call 2020-06-22 13:55:36 +03:00
pinctrl-merrifield.c pinctrl: merrifield: Use devm_platform_ioremap_resource() 2019-07-23 16:13:14 +03:00
pinctrl-sunrisepoint.c pinctrl: sunrisepoint: Fix PAD lock register offset for SPT-H 2020-04-13 13:14:35 +03:00
pinctrl-tigerlake.c pinctrl: tigerlake: Use generic flag for special GPIO base treatment 2020-04-14 16:17:13 +03:00