* [PATCH] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode
@ 2023-01-11 20:14 Hans de Goede
2023-01-12 12:06 ` Andy Shevchenko
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Hans de Goede @ 2023-01-11 20:14 UTC (permalink / raw
To: Mark Gross, Andy Shevchenko, Daniel Scally, Laurent Pinchart,
Sakari Ailus
Cc: Hans de Goede, platform-driver-x86, Kate Hsuan, Mark Pearson,
Andy Yeh, linux-media
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>
---
Changes in v4:
- Split out of the "int3472/media privacy LED support" series, so
that this can be applied separately as it really is a bug-fix
---
drivers/platform/x86/intel/int3472/clk_and_regulator.c | 3 +++
drivers/platform/x86/intel/int3472/discrete.c | 4 ++++
2 files changed, 7 insertions(+)
diff --git a/drivers/platform/x86/intel/int3472/clk_and_regulator.c b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
index b2342b3d78c7..74dc2cff799e 100644
--- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c
+++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
@@ -181,6 +181,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
return PTR_ERR(int3472->regulator.gpio);
}
+ /* Ensure the pin is in output mode and non-active state */
+ gpiod_direction_output(int3472->regulator.gpio, 0);
+
cfg.dev = &int3472->adev->dev;
cfg.init_data = &init_data;
cfg.ena_gpiod = int3472->regulator.gpio;
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);
--
2.39.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode
2023-01-11 20:14 [PATCH] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode Hans de Goede
@ 2023-01-12 12:06 ` Andy Shevchenko
2023-01-12 12:08 ` Daniel Scally
2023-01-12 12:28 ` Sakari Ailus
2023-01-12 19:11 ` Hans de Goede
2 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2023-01-12 12:06 UTC (permalink / raw
To: Hans de Goede
Cc: Mark Gross, Daniel Scally, Laurent Pinchart, Sakari Ailus,
platform-driver-x86, Kate Hsuan, Mark Pearson, Andy Yeh,
linux-media
On Wed, Jan 11, 2023 at 09:14:26PM +0100, Hans de Goede wrote:
> 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.
LGTM,
Reviewed-by: Andy Shevchenko <andy@kernel.org>
thanks!
> Fixes: 5de691bffe57 ("platform/x86: Add intel_skl_int3472 driver")
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> Changes in v4:
> - Split out of the "int3472/media privacy LED support" series, so
> that this can be applied separately as it really is a bug-fix
> ---
> drivers/platform/x86/intel/int3472/clk_and_regulator.c | 3 +++
> drivers/platform/x86/intel/int3472/discrete.c | 4 ++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/platform/x86/intel/int3472/clk_and_regulator.c b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> index b2342b3d78c7..74dc2cff799e 100644
> --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> @@ -181,6 +181,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
> return PTR_ERR(int3472->regulator.gpio);
> }
>
> + /* Ensure the pin is in output mode and non-active state */
> + gpiod_direction_output(int3472->regulator.gpio, 0);
> +
> cfg.dev = &int3472->adev->dev;
> cfg.init_data = &init_data;
> cfg.ena_gpiod = int3472->regulator.gpio;
> 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);
> --
> 2.39.0
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode
2023-01-12 12:06 ` Andy Shevchenko
@ 2023-01-12 12:08 ` Daniel Scally
0 siblings, 0 replies; 5+ messages in thread
From: Daniel Scally @ 2023-01-12 12:08 UTC (permalink / raw
To: Andy Shevchenko, Hans de Goede
Cc: Mark Gross, Laurent Pinchart, Sakari Ailus, platform-driver-x86,
Kate Hsuan, Mark Pearson, Andy Yeh, linux-media
Hi Hans
On 12/01/2023 12:06, Andy Shevchenko wrote:
> On Wed, Jan 11, 2023 at 09:14:26PM +0100, Hans de Goede wrote:
>> 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.
> LGTM,
> Reviewed-by: Andy Shevchenko <andy@kernel.org>
> thanks!
And to me:
Reviewed-by: Daniel Scally <djrscally@gmail.com>
>
>> Fixes: 5de691bffe57 ("platform/x86: Add intel_skl_int3472 driver")
>> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
>> ---
>> Changes in v4:
>> - Split out of the "int3472/media privacy LED support" series, so
>> that this can be applied separately as it really is a bug-fix
>> ---
>> drivers/platform/x86/intel/int3472/clk_and_regulator.c | 3 +++
>> drivers/platform/x86/intel/int3472/discrete.c | 4 ++++
>> 2 files changed, 7 insertions(+)
>>
>> diff --git a/drivers/platform/x86/intel/int3472/clk_and_regulator.c b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
>> index b2342b3d78c7..74dc2cff799e 100644
>> --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c
>> +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
>> @@ -181,6 +181,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
>> return PTR_ERR(int3472->regulator.gpio);
>> }
>>
>> + /* Ensure the pin is in output mode and non-active state */
>> + gpiod_direction_output(int3472->regulator.gpio, 0);
>> +
>> cfg.dev = &int3472->adev->dev;
>> cfg.init_data = &init_data;
>> cfg.ena_gpiod = int3472->regulator.gpio;
>> 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);
>> --
>> 2.39.0
>>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode
2023-01-11 20:14 [PATCH] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode Hans de Goede
2023-01-12 12:06 ` Andy Shevchenko
@ 2023-01-12 12:28 ` Sakari Ailus
2023-01-12 19:11 ` Hans de Goede
2 siblings, 0 replies; 5+ messages in thread
From: Sakari Ailus @ 2023-01-12 12:28 UTC (permalink / raw
To: Hans de Goede
Cc: Mark Gross, Andy Shevchenko, Daniel Scally, Laurent Pinchart,
platform-driver-x86, Kate Hsuan, Mark Pearson, Andy Yeh,
linux-media
On Wed, Jan 11, 2023 at 09:14:26PM +0100, Hans de Goede wrote:
> 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: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode
2023-01-11 20:14 [PATCH] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode Hans de Goede
2023-01-12 12:06 ` Andy Shevchenko
2023-01-12 12:28 ` Sakari Ailus
@ 2023-01-12 19:11 ` Hans de Goede
2 siblings, 0 replies; 5+ messages in thread
From: Hans de Goede @ 2023-01-12 19:11 UTC (permalink / raw
To: Mark Gross, Andy Shevchenko, Daniel Scally, Laurent Pinchart,
Sakari Ailus
Cc: platform-driver-x86, Kate Hsuan, Mark Pearson, Andy Yeh,
linux-media
Hi,
On 1/11/23 21:14, Hans de Goede wrote:
> 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>
I've added this to my review-hans (soon to be fixes) branch now.
Thank you all for the reviews.
Regards,
Hans
> ---
> Changes in v4:
> - Split out of the "int3472/media privacy LED support" series, so
> that this can be applied separately as it really is a bug-fix
> ---
> drivers/platform/x86/intel/int3472/clk_and_regulator.c | 3 +++
> drivers/platform/x86/intel/int3472/discrete.c | 4 ++++
> 2 files changed, 7 insertions(+)
>
> diff --git a/drivers/platform/x86/intel/int3472/clk_and_regulator.c b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> index b2342b3d78c7..74dc2cff799e 100644
> --- a/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> +++ b/drivers/platform/x86/intel/int3472/clk_and_regulator.c
> @@ -181,6 +181,9 @@ int skl_int3472_register_regulator(struct int3472_discrete_device *int3472,
> return PTR_ERR(int3472->regulator.gpio);
> }
>
> + /* Ensure the pin is in output mode and non-active state */
> + gpiod_direction_output(int3472->regulator.gpio, 0);
> +
> cfg.dev = &int3472->adev->dev;
> cfg.init_data = &init_data;
> cfg.ena_gpiod = int3472->regulator.gpio;
> 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);
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-01-12 19:23 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-11 20:14 [PATCH] platform/x86: int3472/discrete: Ensure the clk/power enable pins are in output mode Hans de Goede
2023-01-12 12:06 ` Andy Shevchenko
2023-01-12 12:08 ` Daniel Scally
2023-01-12 12:28 ` Sakari Ailus
2023-01-12 19:11 ` Hans de Goede
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.