Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy@kernel.org>
Reviewed-by: Daniel Scally <djrscally@gmail.com>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Link: https://lore.kernel.org/r/20230111201426.947853-1-hdegoede@redhat.com

+7
+3
drivers/platform/x86/intel/int3472/clk_and_regulator.c
··· 181 181 return PTR_ERR(int3472->regulator.gpio); 182 182 } 183 183 184 + /* Ensure the pin is in output mode and non-active state */ 185 + gpiod_direction_output(int3472->regulator.gpio, 0); 186 + 184 187 cfg.dev = &int3472->adev->dev; 185 188 cfg.init_data = &init_data; 186 189 cfg.ena_gpiod = int3472->regulator.gpio;
+4
drivers/platform/x86/intel/int3472/discrete.c
··· 168 168 return (PTR_ERR(gpio)); 169 169 170 170 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); 171 173 break; 172 174 case INT3472_GPIO_TYPE_PRIVACY_LED: 173 175 gpio = acpi_get_and_request_gpiod(path, pin, "int3472,privacy-led"); ··· 177 175 return (PTR_ERR(gpio)); 178 176 179 177 int3472->clock.led_gpio = gpio; 178 + /* Ensure the pin is in output mode and non-active state */ 179 + gpiod_direction_output(int3472->clock.led_gpio, 0); 180 180 break; 181 181 default: 182 182 dev_err(int3472->dev, "Invalid GPIO type 0x%02x for clock\n", type);