All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] extcon: int3496: Ignore incorrect IoRestriction for ID pin
@ 2018-02-26 19:34 ` Andy Shevchenko
  2018-02-27  3:59   ` Chanwoo Choi
  2018-02-28 15:01   ` Hans de Goede
  0 siblings, 2 replies; 6+ messages in thread
From: Andy Shevchenko @ 2018-02-26 19:34 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, linux-kernel; +Cc: Andy Shevchenko, Hans de Goede

The commit 70216fd937fe introduced a workaround for incorrect
IoRestriction mode in ACPI table.

Now, when GPIO ACPI library does it in generic way, just set
an appropriate quirk flag instead.

Cc: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/extcon/extcon-intel-int3496.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
index 191e99f06a9a..acaccb128fc4 100644
--- a/drivers/extcon/extcon-intel-int3496.c
+++ b/drivers/extcon/extcon-intel-int3496.c
@@ -50,7 +50,11 @@ static const struct acpi_gpio_params vbus_gpios = { INT3496_GPIO_VBUS_EN, 0, fal
 static const struct acpi_gpio_params mux_gpios = { INT3496_GPIO_USB_MUX, 0, false };
 
 static const struct acpi_gpio_mapping acpi_int3496_default_gpios[] = {
-	{ "id-gpios", &id_gpios, 1 },
+	/*
+	 * Some platforms have a bug in ACPI GPIO description making IRQ
+	 * GPIO to be output only. Ask the GPIO core to ignore this limit.
+	 */
+	{ "id-gpios", &id_gpios, 1, ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
 	{ "vbus-gpios", &vbus_gpios, 1 },
 	{ "mux-gpios", &mux_gpios, 1 },
 	{ },
@@ -112,9 +116,6 @@ static int int3496_probe(struct platform_device *pdev)
 		ret = PTR_ERR(data->gpio_usb_id);
 		dev_err(dev, "can't request USB ID GPIO: %d\n", ret);
 		return ret;
-	} else if (gpiod_get_direction(data->gpio_usb_id) != GPIOF_DIR_IN) {
-		dev_warn(dev, FW_BUG "USB ID GPIO not in input mode, fixing\n");
-		gpiod_direction_input(data->gpio_usb_id);
 	}
 
 	data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
-- 
2.16.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] extcon: int3496: Ignore incorrect IoRestriction for ID pin
  2018-02-26 19:34 ` [PATCH v1] extcon: int3496: Ignore incorrect IoRestriction for ID pin Andy Shevchenko
@ 2018-02-27  3:59   ` Chanwoo Choi
  2018-02-28 14:27     ` Andy Shevchenko
  2018-02-28 15:01   ` Hans de Goede
  1 sibling, 1 reply; 6+ messages in thread
From: Chanwoo Choi @ 2018-02-27  3:59 UTC (permalink / raw)
  To: Andy Shevchenko, MyungJoo Ham, linux-kernel; +Cc: Hans de Goede

Hi,

On 2018년 02월 27일 04:34, Andy Shevchenko wrote:
> The commit 70216fd937fe introduced a workaround for incorrect

You better to specify the commit id and patch name as following:
commit 70216fd937fe -> commit 70216fd937fe ("extcon: int3496: Set the id pin to direction-input if necessary")

> IoRestriction mode in ACPI table.

> 
> Now, when GPIO ACPI library does it in generic way, just set

I recommend that you specify clearly which patch you mention
about GPIO ACPI library.

> an appropriate quirk flag instead.
> 
> Cc: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/extcon/extcon-intel-int3496.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
> index 191e99f06a9a..acaccb128fc4 100644
> --- a/drivers/extcon/extcon-intel-int3496.c
> +++ b/drivers/extcon/extcon-intel-int3496.c
> @@ -50,7 +50,11 @@ static const struct acpi_gpio_params vbus_gpios = { INT3496_GPIO_VBUS_EN, 0, fal
>  static const struct acpi_gpio_params mux_gpios = { INT3496_GPIO_USB_MUX, 0, false };
>  
>  static const struct acpi_gpio_mapping acpi_int3496_default_gpios[] = {
> -	{ "id-gpios", &id_gpios, 1 },
> +	/*
> +	 * Some platforms have a bug in ACPI GPIO description making IRQ
> +	 * GPIO to be output only. Ask the GPIO core to ignore this limit.
> +	 */
> +	{ "id-gpios", &id_gpios, 1, ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
>  	{ "vbus-gpios", &vbus_gpios, 1 },
>  	{ "mux-gpios", &mux_gpios, 1 },
>  	{ },
> @@ -112,9 +116,6 @@ static int int3496_probe(struct platform_device *pdev)
>  		ret = PTR_ERR(data->gpio_usb_id);
>  		dev_err(dev, "can't request USB ID GPIO: %d\n", ret);
>  		return ret;
> -	} else if (gpiod_get_direction(data->gpio_usb_id) != GPIOF_DIR_IN) {
> -		dev_warn(dev, FW_BUG "USB ID GPIO not in input mode, fixing\n");
> -		gpiod_direction_input(data->gpio_usb_id);
>  	}
>  
>  	data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
> 


-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] extcon: int3496: Ignore incorrect IoRestriction for ID pin
  2018-02-27  3:59   ` Chanwoo Choi
@ 2018-02-28 14:27     ` Andy Shevchenko
  2018-02-28 14:28       ` Hans de Goede
  0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2018-02-28 14:27 UTC (permalink / raw)
  To: Chanwoo Choi, MyungJoo Ham, linux-kernel; +Cc: Hans de Goede

On Tue, 2018-02-27 at 12:59 +0900, Chanwoo Choi wrote:
> Hi,
> 
> On 2018년 02월 27일 04:34, Andy Shevchenko wrote:
> > The commit 70216fd937fe introduced a workaround for incorrect
> 
> You better to specify the commit id and patch name as following:
> commit 70216fd937fe -> commit 70216fd937fe ("extcon: int3496: Set the
> id pin to direction-input if necessary")

Will fix in v2.

> 
> > IoRestriction mode in ACPI table.
> > 
> > Now, when GPIO ACPI library does it in generic way, just set
> 
> I recommend that you specify clearly which patch you mention
> about GPIO ACPI library.

Do you mean list all of them? It's a bit hard to choose one.

> > an appropriate quirk flag instead.
> > 
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > ---
> >  drivers/extcon/extcon-intel-int3496.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/extcon/extcon-intel-int3496.c
> > b/drivers/extcon/extcon-intel-int3496.c
> > index 191e99f06a9a..acaccb128fc4 100644
> > --- a/drivers/extcon/extcon-intel-int3496.c
> > +++ b/drivers/extcon/extcon-intel-int3496.c
> > @@ -50,7 +50,11 @@ static const struct acpi_gpio_params vbus_gpios =
> > { INT3496_GPIO_VBUS_EN, 0, fal
> >  static const struct acpi_gpio_params mux_gpios = {
> > INT3496_GPIO_USB_MUX, 0, false };
> >  
> >  static const struct acpi_gpio_mapping acpi_int3496_default_gpios[]
> > = {
> > -	{ "id-gpios", &id_gpios, 1 },
> > +	/*
> > +	 * Some platforms have a bug in ACPI GPIO description
> > making IRQ
> > +	 * GPIO to be output only. Ask the GPIO core to ignore this
> > limit.
> > +	 */
> > +	{ "id-gpios", &id_gpios, 1,
> > ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
> >  	{ "vbus-gpios", &vbus_gpios, 1 },
> >  	{ "mux-gpios", &mux_gpios, 1 },
> >  	{ },
> > @@ -112,9 +116,6 @@ static int int3496_probe(struct platform_device
> > *pdev)
> >  		ret = PTR_ERR(data->gpio_usb_id);
> >  		dev_err(dev, "can't request USB ID GPIO: %d\n",
> > ret);
> >  		return ret;
> > -	} else if (gpiod_get_direction(data->gpio_usb_id) !=
> > GPIOF_DIR_IN) {
> > -		dev_warn(dev, FW_BUG "USB ID GPIO not in input
> > mode, fixing\n");
> > -		gpiod_direction_input(data->gpio_usb_id);
> >  	}
> >  
> >  	data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
> > 
> 
> 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] extcon: int3496: Ignore incorrect IoRestriction for ID pin
  2018-02-28 14:27     ` Andy Shevchenko
@ 2018-02-28 14:28       ` Hans de Goede
  0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2018-02-28 14:28 UTC (permalink / raw)
  To: Andy Shevchenko, Chanwoo Choi, MyungJoo Ham, linux-kernel

Hi,

On 28-02-18 15:27, Andy Shevchenko wrote:
> On Tue, 2018-02-27 at 12:59 +0900, Chanwoo Choi wrote:
>> Hi,
>>
>> On 2018년 02월 27일 04:34, Andy Shevchenko wrote:
>>> The commit 70216fd937fe introduced a workaround for incorrect
>>
>> You better to specify the commit id and patch name as following:
>> commit 70216fd937fe -> commit 70216fd937fe ("extcon: int3496: Set the
>> id pin to direction-input if necessary")
> 
> Will fix in v2.

Note I'm currently running some tests with this patch, should be
done in an hour max.

Regards,

Hans


> 
>>
>>> IoRestriction mode in ACPI table.
>>>
>>> Now, when GPIO ACPI library does it in generic way, just set
>>
>> I recommend that you specify clearly which patch you mention
>> about GPIO ACPI library.
> 
> Do you mean list all of them? It's a bit hard to choose one.
> 
>>> an appropriate quirk flag instead.
>>>
>>> Cc: Hans de Goede <hdegoede@redhat.com>
>>> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>>> ---
>>>   drivers/extcon/extcon-intel-int3496.c | 9 +++++----
>>>   1 file changed, 5 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/drivers/extcon/extcon-intel-int3496.c
>>> b/drivers/extcon/extcon-intel-int3496.c
>>> index 191e99f06a9a..acaccb128fc4 100644
>>> --- a/drivers/extcon/extcon-intel-int3496.c
>>> +++ b/drivers/extcon/extcon-intel-int3496.c
>>> @@ -50,7 +50,11 @@ static const struct acpi_gpio_params vbus_gpios =
>>> { INT3496_GPIO_VBUS_EN, 0, fal
>>>   static const struct acpi_gpio_params mux_gpios = {
>>> INT3496_GPIO_USB_MUX, 0, false };
>>>   
>>>   static const struct acpi_gpio_mapping acpi_int3496_default_gpios[]
>>> = {
>>> -	{ "id-gpios", &id_gpios, 1 },
>>> +	/*
>>> +	 * Some platforms have a bug in ACPI GPIO description
>>> making IRQ
>>> +	 * GPIO to be output only. Ask the GPIO core to ignore this
>>> limit.
>>> +	 */
>>> +	{ "id-gpios", &id_gpios, 1,
>>> ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
>>>   	{ "vbus-gpios", &vbus_gpios, 1 },
>>>   	{ "mux-gpios", &mux_gpios, 1 },
>>>   	{ },
>>> @@ -112,9 +116,6 @@ static int int3496_probe(struct platform_device
>>> *pdev)
>>>   		ret = PTR_ERR(data->gpio_usb_id);
>>>   		dev_err(dev, "can't request USB ID GPIO: %d\n",
>>> ret);
>>>   		return ret;
>>> -	} else if (gpiod_get_direction(data->gpio_usb_id) !=
>>> GPIOF_DIR_IN) {
>>> -		dev_warn(dev, FW_BUG "USB ID GPIO not in input
>>> mode, fixing\n");
>>> -		gpiod_direction_input(data->gpio_usb_id);
>>>   	}
>>>   
>>>   	data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
>>>
>>
>>
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] extcon: int3496: Ignore incorrect IoRestriction for ID pin
  2018-02-26 19:34 ` [PATCH v1] extcon: int3496: Ignore incorrect IoRestriction for ID pin Andy Shevchenko
  2018-02-27  3:59   ` Chanwoo Choi
@ 2018-02-28 15:01   ` Hans de Goede
  2018-02-28 16:17     ` Andy Shevchenko
  1 sibling, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2018-02-28 15:01 UTC (permalink / raw)
  To: Andy Shevchenko, Chanwoo Choi, MyungJoo Ham, linux-kernel

Hi,

On 26-02-18 20:34, Andy Shevchenko wrote:
> The commit 70216fd937fe introduced a workaround for incorrect
> IoRestriction mode in ACPI table.
> 
> Now, when GPIO ACPI library does it in generic way, just set
> an appropriate quirk flag instead.
> 
> Cc: Hans de Goede <hdegoede@redhat.com>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Looks good to me and everything still works after this change,
so with the earlier review remarks fixed this is:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>

Regards,

Hans





> ---
>   drivers/extcon/extcon-intel-int3496.c | 9 +++++----
>   1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
> index 191e99f06a9a..acaccb128fc4 100644
> --- a/drivers/extcon/extcon-intel-int3496.c
> +++ b/drivers/extcon/extcon-intel-int3496.c
> @@ -50,7 +50,11 @@ static const struct acpi_gpio_params vbus_gpios = { INT3496_GPIO_VBUS_EN, 0, fal
>   static const struct acpi_gpio_params mux_gpios = { INT3496_GPIO_USB_MUX, 0, false };
>   
>   static const struct acpi_gpio_mapping acpi_int3496_default_gpios[] = {
> -	{ "id-gpios", &id_gpios, 1 },
> +	/*
> +	 * Some platforms have a bug in ACPI GPIO description making IRQ
> +	 * GPIO to be output only. Ask the GPIO core to ignore this limit.
> +	 */
> +	{ "id-gpios", &id_gpios, 1, ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
>   	{ "vbus-gpios", &vbus_gpios, 1 },
>   	{ "mux-gpios", &mux_gpios, 1 },
>   	{ },
> @@ -112,9 +116,6 @@ static int int3496_probe(struct platform_device *pdev)
>   		ret = PTR_ERR(data->gpio_usb_id);
>   		dev_err(dev, "can't request USB ID GPIO: %d\n", ret);
>   		return ret;
> -	} else if (gpiod_get_direction(data->gpio_usb_id) != GPIOF_DIR_IN) {
> -		dev_warn(dev, FW_BUG "USB ID GPIO not in input mode, fixing\n");
> -		gpiod_direction_input(data->gpio_usb_id);
>   	}
>   
>   	data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v1] extcon: int3496: Ignore incorrect IoRestriction for ID pin
  2018-02-28 15:01   ` Hans de Goede
@ 2018-02-28 16:17     ` Andy Shevchenko
  0 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2018-02-28 16:17 UTC (permalink / raw)
  To: Hans de Goede, Chanwoo Choi, MyungJoo Ham, linux-kernel

On Wed, 2018-02-28 at 16:01 +0100, Hans de Goede wrote:
> Hi,
> 
> On 26-02-18 20:34, Andy Shevchenko wrote:
> > The commit 70216fd937fe introduced a workaround for incorrect
> > IoRestriction mode in ACPI table.
> > 
> > Now, when GPIO ACPI library does it in generic way, just set
> > an appropriate quirk flag instead.
> > 
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Looks good to me and everything still works after this change,
> so with the earlier review remarks fixed this is:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Tested-by: Hans de Goede <hdegoede@redhat.com>

Thanks!
I will send a v2 soon.

> 
> Regards,
> 
> Hans
> 
> 
> 
> 
> 
> > ---
> >   drivers/extcon/extcon-intel-int3496.c | 9 +++++----
> >   1 file changed, 5 insertions(+), 4 deletions(-)
> > 
> > diff --git a/drivers/extcon/extcon-intel-int3496.c
> > b/drivers/extcon/extcon-intel-int3496.c
> > index 191e99f06a9a..acaccb128fc4 100644
> > --- a/drivers/extcon/extcon-intel-int3496.c
> > +++ b/drivers/extcon/extcon-intel-int3496.c
> > @@ -50,7 +50,11 @@ static const struct acpi_gpio_params vbus_gpios =
> > { INT3496_GPIO_VBUS_EN, 0, fal
> >   static const struct acpi_gpio_params mux_gpios = {
> > INT3496_GPIO_USB_MUX, 0, false };
> >   
> >   static const struct acpi_gpio_mapping acpi_int3496_default_gpios[]
> > = {
> > -	{ "id-gpios", &id_gpios, 1 },
> > +	/*
> > +	 * Some platforms have a bug in ACPI GPIO description
> > making IRQ
> > +	 * GPIO to be output only. Ask the GPIO core to ignore this
> > limit.
> > +	 */
> > +	{ "id-gpios", &id_gpios, 1,
> > ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
> >   	{ "vbus-gpios", &vbus_gpios, 1 },
> >   	{ "mux-gpios", &mux_gpios, 1 },
> >   	{ },
> > @@ -112,9 +116,6 @@ static int int3496_probe(struct platform_device
> > *pdev)
> >   		ret = PTR_ERR(data->gpio_usb_id);
> >   		dev_err(dev, "can't request USB ID GPIO: %d\n",
> > ret);
> >   		return ret;
> > -	} else if (gpiod_get_direction(data->gpio_usb_id) !=
> > GPIOF_DIR_IN) {
> > -		dev_warn(dev, FW_BUG "USB ID GPIO not in input
> > mode, fixing\n");
> > -		gpiod_direction_input(data->gpio_usb_id);
> >   	}
> >   
> >   	data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
> > 

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-02-28 16:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20180226193456epcas3p39565d818a6a57db386bd5e81aed20674@epcas3p3.samsung.com>
2018-02-26 19:34 ` [PATCH v1] extcon: int3496: Ignore incorrect IoRestriction for ID pin Andy Shevchenko
2018-02-27  3:59   ` Chanwoo Choi
2018-02-28 14:27     ` Andy Shevchenko
2018-02-28 14:28       ` Hans de Goede
2018-02-28 15:01   ` Hans de Goede
2018-02-28 16:17     ` Andy Shevchenko

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.