* [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index
@ 2017-03-10 20:52 ` Hans de Goede
2017-03-10 20:52 ` [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input Hans de Goede
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Hans de Goede @ 2017-03-10 20:52 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi; +Cc: linux-kernel, Hans de Goede, Andy Shevchenko
Now that we've an acpi mapping table we should be using gpiod_get
instead of gpiod_get_index.
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/extcon/extcon-intel-int3496.c | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
index 43ba84ea..b8ac947 100644
--- a/drivers/extcon/extcon-intel-int3496.c
+++ b/drivers/extcon/extcon-intel-int3496.c
@@ -107,9 +107,7 @@ static int int3496_probe(struct platform_device *pdev)
data->dev = dev;
INIT_DELAYED_WORK(&data->work, int3496_do_usb_id);
- data->gpio_usb_id = devm_gpiod_get_index(dev, "id",
- INT3496_GPIO_USB_ID,
- GPIOD_IN);
+ data->gpio_usb_id = devm_gpiod_get(dev, "id", GPIOD_IN);
if (IS_ERR(data->gpio_usb_id)) {
ret = PTR_ERR(data->gpio_usb_id);
dev_err(dev, "can't request USB ID GPIO: %d\n", ret);
@@ -122,15 +120,11 @@ static int int3496_probe(struct platform_device *pdev)
return data->usb_id_irq;
}
- data->gpio_vbus_en = devm_gpiod_get_index(dev, "vbus",
- INT3496_GPIO_VBUS_EN,
- GPIOD_ASIS);
+ data->gpio_vbus_en = devm_gpiod_get(dev, "vbus", GPIOD_ASIS);
if (IS_ERR(data->gpio_vbus_en))
dev_info(dev, "can't request VBUS EN GPIO\n");
- data->gpio_usb_mux = devm_gpiod_get_index(dev, "mux",
- INT3496_GPIO_USB_MUX,
- GPIOD_ASIS);
+ data->gpio_usb_mux = devm_gpiod_get(dev, "mux", GPIOD_ASIS);
if (IS_ERR(data->gpio_usb_mux))
dev_info(dev, "can't request USB MUX GPIO\n");
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input
2017-03-10 20:52 ` [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index Hans de Goede
@ 2017-03-10 20:52 ` Hans de Goede
2017-03-10 22:11 ` Andy Shevchenko
2017-03-10 22:09 ` [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index Andy Shevchenko
2017-03-13 5:03 ` Chanwoo Choi
2 siblings, 1 reply; 6+ messages in thread
From: Hans de Goede @ 2017-03-10 20:52 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi; +Cc: linux-kernel, Hans de Goede, Andy Shevchenko
With the new more strict ACPI gpio code the dsdt's IoRestriction
flags are honored on gpiod_get, but in some dsdt's it is wrong,
so explicitly call gpiod_direction_input on the id gpio.
This fixes the following errors when the int3496 code is used
together with the new more strict ACPI gpio code:
[ 2382.484415] gpio gpiochip1: (INT33FF:01): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
[ 2382.484425] gpio gpiochip1: (INT33FF:01): unable to lock HW IRQ 3 for IRQ
[ 2382.484429] genirq: Failed to request resources for INT3496:00 (irq 174) on irqchip chv-gpio
[ 2382.484518] intel-int3496 INT3496:00: can't request IRQ for USB ID GPIO: -22
[ 2382.500359] intel-int3496: probe of INT3496:00 failed with error -22
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/extcon/extcon-intel-int3496.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
index b8ac947..b4539d4 100644
--- a/drivers/extcon/extcon-intel-int3496.c
+++ b/drivers/extcon/extcon-intel-int3496.c
@@ -113,6 +113,7 @@ static int int3496_probe(struct platform_device *pdev)
dev_err(dev, "can't request USB ID GPIO: %d\n", ret);
return ret;
}
+ gpiod_direction_input(data->gpio_usb_id);
data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
if (data->usb_id_irq < 0) {
--
2.9.3
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index
2017-03-10 20:52 ` [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index Hans de Goede
2017-03-10 20:52 ` [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input Hans de Goede
@ 2017-03-10 22:09 ` Andy Shevchenko
2017-03-13 5:03 ` Chanwoo Choi
2 siblings, 0 replies; 6+ messages in thread
From: Andy Shevchenko @ 2017-03-10 22:09 UTC (permalink / raw)
To: Hans de Goede; +Cc: MyungJoo Ham, Chanwoo Choi, linux-kernel, Andy Shevchenko
On Fri, Mar 10, 2017 at 10:52 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> Now that we've an acpi mapping table we should be using gpiod_get
> instead of gpiod_get_index.
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Chanwoo, this patch is essentially needed since I missed the change in
my latest patch in extcon.
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/extcon/extcon-intel-int3496.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
> index 43ba84ea..b8ac947 100644
> --- a/drivers/extcon/extcon-intel-int3496.c
> +++ b/drivers/extcon/extcon-intel-int3496.c
> @@ -107,9 +107,7 @@ static int int3496_probe(struct platform_device *pdev)
> data->dev = dev;
> INIT_DELAYED_WORK(&data->work, int3496_do_usb_id);
>
> - data->gpio_usb_id = devm_gpiod_get_index(dev, "id",
> - INT3496_GPIO_USB_ID,
> - GPIOD_IN);
> + data->gpio_usb_id = devm_gpiod_get(dev, "id", GPIOD_IN);
> if (IS_ERR(data->gpio_usb_id)) {
> ret = PTR_ERR(data->gpio_usb_id);
> dev_err(dev, "can't request USB ID GPIO: %d\n", ret);
> @@ -122,15 +120,11 @@ static int int3496_probe(struct platform_device *pdev)
> return data->usb_id_irq;
> }
>
> - data->gpio_vbus_en = devm_gpiod_get_index(dev, "vbus",
> - INT3496_GPIO_VBUS_EN,
> - GPIOD_ASIS);
> + data->gpio_vbus_en = devm_gpiod_get(dev, "vbus", GPIOD_ASIS);
> if (IS_ERR(data->gpio_vbus_en))
> dev_info(dev, "can't request VBUS EN GPIO\n");
>
> - data->gpio_usb_mux = devm_gpiod_get_index(dev, "mux",
> - INT3496_GPIO_USB_MUX,
> - GPIOD_ASIS);
> + data->gpio_usb_mux = devm_gpiod_get(dev, "mux", GPIOD_ASIS);
> if (IS_ERR(data->gpio_usb_mux))
> dev_info(dev, "can't request USB MUX GPIO\n");
>
> --
> 2.9.3
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input
2017-03-10 20:52 ` [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input Hans de Goede
@ 2017-03-10 22:11 ` Andy Shevchenko
2017-03-13 7:27 ` Hans de Goede
0 siblings, 1 reply; 6+ messages in thread
From: Andy Shevchenko @ 2017-03-10 22:11 UTC (permalink / raw)
To: Hans de Goede; +Cc: MyungJoo Ham, Chanwoo Choi, linux-kernel, Andy Shevchenko
On Fri, Mar 10, 2017 at 10:52 PM, Hans de Goede <hdegoede@redhat.com> wrote:
> With the new more strict ACPI gpio code the dsdt's IoRestriction
> flags are honored on gpiod_get, but in some dsdt's it is wrong,
> so explicitly call gpiod_direction_input on the id gpio.
>
> This fixes the following errors when the int3496 code is used
> together with the new more strict ACPI gpio code:
>
> [ 2382.484415] gpio gpiochip1: (INT33FF:01): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
> [ 2382.484425] gpio gpiochip1: (INT33FF:01): unable to lock HW IRQ 3 for IRQ
> [ 2382.484429] genirq: Failed to request resources for INT3496:00 (irq 174) on irqchip chv-gpio
> [ 2382.484518] intel-int3496 INT3496:00: can't request IRQ for USB ID GPIO: -22
> [ 2382.500359] intel-int3496: probe of INT3496:00 failed with error -22
Because my patches are not yet upstreamed I think this would be postponed.
I can take it into my branch and send together with the rest. What do you think?
> --- a/drivers/extcon/extcon-intel-int3496.c
> +++ b/drivers/extcon/extcon-intel-int3496.c
> @@ -113,6 +113,7 @@ static int int3496_probe(struct platform_device *pdev)
> dev_err(dev, "can't request USB ID GPIO: %d\n", ret);
> return ret;
> }
It would be nice to check the direction here and complain to the user
loudly the firmware has a bug.
> + gpiod_direction_input(data->gpio_usb_id);
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index
2017-03-10 20:52 ` [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index Hans de Goede
2017-03-10 20:52 ` [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input Hans de Goede
2017-03-10 22:09 ` [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index Andy Shevchenko
@ 2017-03-13 5:03 ` Chanwoo Choi
2 siblings, 0 replies; 6+ messages in thread
From: Chanwoo Choi @ 2017-03-13 5:03 UTC (permalink / raw)
To: Hans de Goede, MyungJoo Ham; +Cc: linux-kernel, Andy Shevchenko
Hi,
On 2017년 03월 11일 05:52, Hans de Goede wrote:
> Now that we've an acpi mapping table we should be using gpiod_get
> instead of gpiod_get_index.
>
> Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
> drivers/extcon/extcon-intel-int3496.c | 12 +++---------
> 1 file changed, 3 insertions(+), 9 deletions(-)
Applied it.
--
Best Regards,
Chanwoo Choi
Samsung Electronics
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input
2017-03-10 22:11 ` Andy Shevchenko
@ 2017-03-13 7:27 ` Hans de Goede
0 siblings, 0 replies; 6+ messages in thread
From: Hans de Goede @ 2017-03-13 7:27 UTC (permalink / raw)
To: Andy Shevchenko; +Cc: MyungJoo Ham, Chanwoo Choi, linux-kernel, Andy Shevchenko
Hi,
On 10-03-17 23:11, Andy Shevchenko wrote:
> On Fri, Mar 10, 2017 at 10:52 PM, Hans de Goede <hdegoede@redhat.com> wrote:
>> With the new more strict ACPI gpio code the dsdt's IoRestriction
>> flags are honored on gpiod_get, but in some dsdt's it is wrong,
>> so explicitly call gpiod_direction_input on the id gpio.
>>
>> This fixes the following errors when the int3496 code is used
>> together with the new more strict ACPI gpio code:
>>
>> [ 2382.484415] gpio gpiochip1: (INT33FF:01): gpiochip_lock_as_irq: tried to flag a GPIO set as output for IRQ
>> [ 2382.484425] gpio gpiochip1: (INT33FF:01): unable to lock HW IRQ 3 for IRQ
>> [ 2382.484429] genirq: Failed to request resources for INT3496:00 (irq 174) on irqchip chv-gpio
>> [ 2382.484518] intel-int3496 INT3496:00: can't request IRQ for USB ID GPIO: -22
>> [ 2382.500359] intel-int3496: probe of INT3496:00 failed with error -22
>
> Because my patches are not yet upstreamed I think this would be postponed.
> I can take it into my branch and send together with the rest. What do you think?
It does not hurt to get it upstream already and merging patch-sets generally
is a lot easier if they do not span multiple subsystems. So I think it would
be better to get it upstream already as preparation for your series.
>
>> --- a/drivers/extcon/extcon-intel-int3496.c
>> +++ b/drivers/extcon/extcon-intel-int3496.c
>> @@ -113,6 +113,7 @@ static int int3496_probe(struct platform_device *pdev)
>> dev_err(dev, "can't request USB ID GPIO: %d\n", ret);
>> return ret;
>> }
>
> It would be nice to check the direction here and complain to the user
> loudly the firmware has a bug.
Ok, I will send a v2 doing this.
>
>> + gpiod_direction_input(data->gpio_usb_id);
>
Regards,
Hans
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-03-13 7:27 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20170310205217epcas2p43f76d99969d753701b9911e601ba6232@epcas2p4.samsung.com>
2017-03-10 20:52 ` [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index Hans de Goede
2017-03-10 20:52 ` [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input Hans de Goede
2017-03-10 22:11 ` Andy Shevchenko
2017-03-13 7:27 ` Hans de Goede
2017-03-10 22:09 ` [PATCH 1/2] extcon: int3496: Use gpiod_get instead of gpiod_get_index Andy Shevchenko
2017-03-13 5:03 ` Chanwoo Choi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).