Skip to contentSkip to conversation

extcon: int3496: Ignore incorrect IoRestriction for ID pin

PATCH Superseded Andy Shevchenko 3 participants 6 messages Feb 26, 2018 – Feb 28, 2018 External connector subsystem (extcon)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 extcon: int3496: Ignore incorrect IoRestriction for ID pin

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.

---
 drivers/extcon/extcon-intel-int3496.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-intel-int3496.c +5 -4
index 191e99f06a9a..acaccb128fc4 100644
@@ -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);
Signature · 1 line
2.16.1
maintainer
#1 lore raw

Hi,

Quoted 1 line · Andy Shevchenko

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

Quoted 4 lines

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.

Quoted 36 lines

an appropriate quirk flag instead.

---
 drivers/extcon/extcon-intel-int3496.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-intel-int3496.c +5 -4
index 191e99f06a9a..acaccb128fc4 100644
@@ -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);
Signature · 3 lines
Best Regards,
Chanwoo Choi
Samsung Electronics
#2 lore raw
Quoted 8 lines · Chanwoo Choi

Hi,

Quoted 1 line · Andy Shevchenko

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.

Quoted 7 lines
Quoted 4 lines

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.

Quoted 49 lines
Quoted 47 lines

an appropriate quirk flag instead.

---
 drivers/extcon/extcon-intel-int3496.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-intel-int3496.c +0 -0
index 191e99f06a9a..acaccb128fc4 100644
@@ -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[]
= {

drivers/extcon/extcon-intel-int3496.c +2 -1
-	{ "id-gpios", &id_gpios, 1 },
+	/*
+	 * Some platforms have a bug in ACPI GPIO description

making IRQ

drivers/extcon/extcon-intel-int3496.c +1 -0
+	 * GPIO to be output only. Ask the GPIO core to ignore this

limit.

drivers/extcon/extcon-intel-int3496.c +2 -0
+	 */
+	{ "id-gpios", &id_gpios, 1,

ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },

drivers/extcon/extcon-intel-int3496.c +0 -2
 	{ "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");

drivers/extcon/extcon-intel-int3496.c +0 -1
-		gpiod_direction_input(data->gpio_usb_id);
 	}
 
 	data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#3 lore raw

Hi,

Quoted 11 lines · Andy Shevchenko
Quoted 8 lines · Chanwoo Choi

Hi,

Quoted 1 line · Andy Shevchenko

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

Quoted 61 lines
Quoted 8 lines
Quoted 5 lines

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.

Quoted 49 lines
Quoted 47 lines

an appropriate quirk flag instead.

---
  drivers/extcon/extcon-intel-int3496.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-intel-int3496.c +0 -0
index 191e99f06a9a..acaccb128fc4 100644
@@ -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[]
= {

drivers/extcon/extcon-intel-int3496.c +2 -1
-	{ "id-gpios", &id_gpios, 1 },
+	/*
+	 * Some platforms have a bug in ACPI GPIO description

making IRQ

drivers/extcon/extcon-intel-int3496.c +1 -0
+	 * GPIO to be output only. Ask the GPIO core to ignore this

limit.

drivers/extcon/extcon-intel-int3496.c +2 -0
+	 */
+	{ "id-gpios", &id_gpios, 1,

ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
{ "vbus-gpios", &vbus_gpios, 1 },
{ "mux-gpios", &mux_gpios, 1 },
{ },

drivers/extcon/extcon-intel-int3496.c +0 -2
@@ -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");

drivers/extcon/extcon-intel-int3496.c +0 -1
-		gpiod_direction_input(data->gpio_usb_id);
  	}
 
  	data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
Reviewed-by Tested-by on v1 1/1
#4 lore raw
In reply to Andy Shevchenko

Hi,

Quoted 8 lines · Andy Shevchenko

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.

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

Regards,

Hans

Quoted 32 lines
---
  drivers/extcon/extcon-intel-int3496.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-intel-int3496.c +5 -4
index 191e99f06a9a..acaccb128fc4 100644
@@ -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);
#5 lore raw
Quoted 9 lines · Hans de Goede

Hi,

Quoted 6 lines · Andy Shevchenko

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.

Quoted 8 lines
Quoted 2 lines

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

Thanks!
I will send a v2 soon.

Quoted 52 lines

Regards,

Hans

Quoted 43 lines
---
  drivers/extcon/extcon-intel-int3496.c | 9 +++++----
  1 file changed, 5 insertions(+), 4 deletions(-)
drivers/extcon/extcon-intel-int3496.c +0 -0
index 191e99f06a9a..acaccb128fc4 100644
@@ -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[]
= {

drivers/extcon/extcon-intel-int3496.c +2 -1
-	{ "id-gpios", &id_gpios, 1 },
+	/*
+	 * Some platforms have a bug in ACPI GPIO description

making IRQ

drivers/extcon/extcon-intel-int3496.c +1 -0
+	 * GPIO to be output only. Ask the GPIO core to ignore this

limit.

drivers/extcon/extcon-intel-int3496.c +2 -0
+	 */
+	{ "id-gpios", &id_gpios, 1,

ACPI_GPIO_QUIRK_NO_IO_RESTRICTION },
{ "vbus-gpios", &vbus_gpios, 1 },
{ "mux-gpios", &mux_gpios, 1 },
{ },

drivers/extcon/extcon-intel-int3496.c +0 -2
@@ -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");

drivers/extcon/extcon-intel-int3496.c +0 -1
-		gpiod_direction_input(data->gpio_usb_id);
  	}
 
  	data->usb_id_irq = gpiod_to_irq(data->gpio_usb_id);
Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy