aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/intel/int3472/discrete.c
diff options
context:
space:
mode:
authorHans de Goede <[email protected]>2023-01-11 20:14:26 +0000
committerHans de Goede <[email protected]>2023-01-12 19:10:31 +0000
commitcf5ac2d45f6e4d11ad78e7b10ae9a4121ba5e995 (patch)
treee7b54653708b56c3e057319d1d1a201f05a5a843 /drivers/platform/x86/intel/int3472/discrete.c
parentplatform/x86/amd: Fix refcount leak in amd_pmc_probe (diff)
downloadkernel-cf5ac2d45f6e4d11ad78e7b10ae9a4121ba5e995.tar.gz
kernel-cf5ac2d45f6e4d11ad78e7b10ae9a4121ba5e995.zip
platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode
acpi_get_and_request_gpiod() does not take a gpio_lookup_flags argument specifying that the pins direction should be initialized to a specific value. This means that in some cases the pins might be left in input mode, causing the gpiod_set() calls made to enable the clk / regulator to not work. One example of this problem is the clk-enable GPIO for the ov01a1s sensor on a Dell Latitude 9420 being left in input mode causing the clk to never get enabled. Explicitly set the direction of the pins to output to fix this. Fixes: 5de691bffe57 ("platform/x86: Add intel_skl_int3472 driver") Signed-off-by: Hans de Goede <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Reviewed-by: Daniel Scally <[email protected]> Reviewed-by: Sakari Ailus <[email protected]> Link: https://lore.kernel.org/r/[email protected]
Diffstat (limited to 'drivers/platform/x86/intel/int3472/discrete.c')
-rw-r--r--drivers/platform/x86/intel/int3472/discrete.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
index 974a132db651..c42c3faa2c32 100644
--- a/drivers/platform/x86/intel/int3472/discrete.c
+++ b/drivers/platform/x86/intel/int3472/discrete.c
@@ -168,6 +168,8 @@ static int skl_int3472_map_gpio_to_clk(struct int3472_discrete_device *int3472,
return (PTR_ERR(gpio));
int3472->clock.ena_gpio = gpio;
+ /* Ensure the pin is in output mode and non-active state */
+ gpiod_direction_output(int3472->clock.ena_gpio, 0);
break;
case INT3472_GPIO_TYPE_PRIVACY_LED:
gpio = acpi_get_and_request_gpiod(path, pin, "int3472,privacy-led");
@@ -175,6 +177,8 @@ static int skl_int3472_map_gpio_to_clk(struct int3472_discrete_device *int3472,
return (PTR_ERR(gpio));
int3472->clock.led_gpio = gpio;
+ /* Ensure the pin is in output mode and non-active state */
+ gpiod_direction_output(int3472->clock.led_gpio, 0);
break;
default:
dev_err(int3472->dev, "Invalid GPIO type 0x%02x for clock\n", type);