Skip to content

Commit cf5ac2d

Browse files
committed
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: 5de691b ("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]
1 parent ccb32e2 commit cf5ac2d

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

drivers/platform/x86/intel/int3472/clk_and_regulator.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
181181
return PTR_ERR(int3472->regulator.gpio);
182182
}
183183

184+
/* Ensure the pin is in output mode and non-active state */
185+
gpiod_direction_output(int3472->regulator.gpio, 0);
186+
184187
cfg.dev = &int3472->adev->dev;
185188
cfg.init_data = &init_data;
186189
cfg.ena_gpiod = int3472->regulator.gpio;

drivers/platform/x86/intel/int3472/discrete.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,17 @@ static int skl_int3472_map_gpio_to_clk(struct int3472_discrete_device *int3472,
168168
return (PTR_ERR(gpio));
169169

170170
int3472->clock.ena_gpio = gpio;
171+
/* Ensure the pin is in output mode and non-active state */
172+
gpiod_direction_output(int3472->clock.ena_gpio, 0);
171173
break;
172174
case INT3472_GPIO_TYPE_PRIVACY_LED:
173175
gpio = acpi_get_and_request_gpiod(path, pin, "int3472,privacy-led");
174176
if (IS_ERR(gpio))
175177
return (PTR_ERR(gpio));
176178

177179
int3472->clock.led_gpio = gpio;
180+
/* Ensure the pin is in output mode and non-active state */
181+
gpiod_direction_output(int3472->clock.led_gpio, 0);
178182
break;
179183
default:
180184
dev_err(int3472->dev, "Invalid GPIO type 0x%02x for clock\n", type);

0 commit comments

Comments
 (0)