extcon: int3496: Use gpiod_get instead of gpiod_get_index
PATCH 1/2 extcon: int3496: Use gpiod_get instead of gpiod_get_index
Now that we've an acpi mapping table we should be using gpiod_get instead of gpiod_get_index.
--- drivers/extcon/extcon-intel-int3496.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/extcon/extcon-intel-int3496.c +3 -9
@@ -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" );
Signature · 1 line
2.9.3
PATCH 2/2 extcon: int3496: Explicitly set the id pin to direction-input
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
--- drivers/extcon/extcon-intel-int3496.c | 1 + 1 file changed, 1 insertion(+)
drivers/extcon/extcon-intel-int3496.c +1 -0
@@ -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 ) {
Signature · 1 line
2.9.3
Re: [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input
Quoted 4 lines · Hans de Goede
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 callgpiod_direction_inputon the id gpio.
Quoted 8 lines
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?
drivers/extcon/extcon-intel-int3496.c static int int3496_probe(struct platform_device *pdev) · line 115
Quoted 6 lines
drivers/extcon/extcon-intel-int3496.c +0
-0@@ -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.
Quoted 1 line
drivers/extcon/extcon-intel-int3496.c +1
-0+gpiod_direction_input (data->gpio_usb_id);
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 2/2] extcon: int3496: Explicitly set the id pin to direction-input
Hi,
Quoted 8 lines · Andy Shevchenko
Quoted 7 lines · Hans de Goede
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 callgpiod_direction_inputon the id gpio.This fixes the following errors when the int3496 code is used together with the new more strict ACPI gpio code:
Quoted 8 lines
Quoted 5 lines
[ 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 -22Because 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.
Quoted 10 lines
drivers/extcon/extcon-intel-int3496.c static int int3496_probe(struct platform_device *pdev) · line 115
Quoted 7 lines
drivers/extcon/extcon-intel-int3496.c +0
-0@@ -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.
Quoted 3 lines
drivers/extcon/extcon-intel-int3496.c static int int3496_probe(struct platform_device *pdev) · line 116
Quoted 2 lines
drivers/extcon/extcon-intel-int3496.c +1
-0+gpiod_direction_input (data->gpio_usb_id);
Regards,
Hans
Quoted 2 lines · Hans de Goede
Now that we've an acpi mapping table we should be using
gpiod_getinstead ofgpiod_get_index.
Chanwoo, this patch is essentially needed since I missed the change in my latest patch in extcon.
Quoted 42 lines
Cc Andy Shevchenko <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- drivers/extcon/extcon-intel-int3496.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)drivers/extcon/extcon-intel-int3496.c +3
-10@@ -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
Signature · 2 lines
With Best Regards, Andy Shevchenko
Chanwoo Choi
maintainerHi,
Quoted 8 lines · Hans de Goede
Now that we've an acpi mapping table we should be using
gpiod_getinstead ofgpiod_get_index.Cc Andy Shevchenko <[email protected]>Signed-off-by Hans de Goede <[email protected]>--- drivers/extcon/extcon-intel-int3496.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
Applied it.
Signature · 3 lines
Best Regards, Chanwoo Choi Samsung Electronics