Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1599229 > unrolled thread

[PATCH v3] extcon: int3496: Set the id pin to direction-input if necessary

Started byHans de Goede <hdegoede@redhat.com>
First post2017-03-13 12:30 +0100
Last post2017-03-14 00:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH v3] extcon: int3496: Set the id pin to direction-input if necessary Hans de Goede <hdegoede@redhat.com> - 2017-03-13 12:30 +0100
    Re: [PATCH v3] extcon: int3496: Set the id pin to direction-input if necessary Andy Shevchenko <andy.shevchenko@gmail.com> - 2017-03-13 12:50 +0100
    Re: [PATCH v3] extcon: int3496: Set the id pin to direction-input if  necessary Chanwoo Choi <cw00.choi@samsung.com> - 2017-03-14 00:30 +0100

#1599229 — [PATCH v3] extcon: int3496: Set the id pin to direction-input if necessary

FromHans de Goede <hdegoede@redhat.com>
Date2017-03-13 12:30 +0100
Subject[PATCH v3] extcon: int3496: Set the id pin to direction-input if necessary
Message-ID<tkwkN-8ew-5@gated-at.bofh.it>
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 if
necessary.

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>
---
Changes in v2:
-Warn about firmware bug when the dsdt's IoRestriction does not allow input
Changes in v3:
-Use FW_BUG macro
-Group check together with gpiodesc error check
-Keep lines within 80 chars limit
---
 drivers/extcon/extcon-intel-int3496.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
index b8ac947..d9f9afe 100644
--- a/drivers/extcon/extcon-intel-int3496.c
+++ b/drivers/extcon/extcon-intel-int3496.c
@@ -112,6 +112,9 @@ 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.9.3

[toc] | [next] | [standalone]


#1599239

FromAndy Shevchenko <andy.shevchenko@gmail.com>
Date2017-03-13 12:50 +0100
Message-ID<tkwE9-8nq-1@gated-at.bofh.it>
In reply to#1599229
On Mon, Mar 13, 2017 at 1:28 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 if
> necessary.
>
> This fixes the following errors when the int3496 code is used
> together with the new more strict ACPI gpio code:

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
One nit below.

> [ 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

>                 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) {

It's obvious useless use of else. It doesn't harm, it doesn't bring
any value either.

> +               dev_warn(dev, FW_BUG "USB ID GPIO not in input mode, fixing\n");
> +               gpiod_direction_input(data->gpio_usb_id);


-- 
With Best Regards,
Andy Shevchenko

[toc] | [prev] | [next] | [standalone]


#1599919 — Re: [PATCH v3] extcon: int3496: Set the id pin to direction-input if necessary

FromChanwoo Choi <cw00.choi@samsung.com>
Date2017-03-14 00:30 +0100
SubjectRe: [PATCH v3] extcon: int3496: Set the id pin to direction-input if necessary
Message-ID<tkHzz-8bx-1@gated-at.bofh.it>
In reply to#1599229
Hi,

On 2017년 03월 13일 20:28, Hans de Goede 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 if
> necessary.
> 
> 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>
> ---
> Changes in v2:
> -Warn about firmware bug when the dsdt's IoRestriction does not allow input
> Changes in v3:
> -Use FW_BUG macro
> -Group check together with gpiodesc error check
> -Keep lines within 80 chars limit
> ---
>  drivers/extcon/extcon-intel-int3496.c | 3 +++
>  1 file changed, 3 insertions(+)

Applied it. Thanks.

-- 
Best Regards,
Chanwoo Choi
Samsung Electronics

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web