* [PATCH v2 1/2] extcon: int3496: Rename GPIO pins in accordance with binding
@ 2017-02-24 12:35 ` Andy Shevchenko
2017-02-24 12:35 ` [PATCH v2 2/2] extcon: int3496: Add GPIO ACPI mapping table Andy Shevchenko
2017-02-27 3:45 ` [PATCH v2 1/2] extcon: int3496: Rename GPIO pins in accordance with binding Chanwoo Choi
0 siblings, 2 replies; 3+ messages in thread
From: Andy Shevchenko @ 2017-02-24 12:35 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi, linux-kernel, David Cohen, Felipe Balbi
Cc: Andy Shevchenko
Update GPIO pin names in extcon-intel-int3496.c driver to follow
the existing extcon binding.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/extcon/extcon-intel-int3496.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
index 38eb6cab938f..81713bf7487e 100644
--- a/drivers/extcon/extcon-intel-int3496.c
+++ b/drivers/extcon/extcon-intel-int3496.c
@@ -105,13 +105,13 @@ static int int3496_probe(struct platform_device *pdev)
return data->usb_id_irq;
}
- data->gpio_vbus_en = devm_gpiod_get_index(dev, "vbus en",
+ data->gpio_vbus_en = devm_gpiod_get_index(dev, "vbus",
INT3496_GPIO_VBUS_EN,
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, "usb mux",
+ data->gpio_usb_mux = devm_gpiod_get_index(dev, "mux",
INT3496_GPIO_USB_MUX,
GPIOD_ASIS);
if (IS_ERR(data->gpio_usb_mux))
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 2/2] extcon: int3496: Add GPIO ACPI mapping table
2017-02-24 12:35 ` [PATCH v2 1/2] extcon: int3496: Rename GPIO pins in accordance with binding Andy Shevchenko
@ 2017-02-24 12:35 ` Andy Shevchenko
2017-02-27 3:45 ` [PATCH v2 1/2] extcon: int3496: Rename GPIO pins in accordance with binding Chanwoo Choi
1 sibling, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2017-02-24 12:35 UTC (permalink / raw)
To: MyungJoo Ham, Chanwoo Choi, linux-kernel, David Cohen, Felipe Balbi
Cc: Andy Shevchenko
In order to make GPIO ACPI library stricter prepare users of
gpiod_get_index() to correctly behave when there no mapping is
provided by firmware.
Here we add explicit mapping between _CRS GpioIo() resources and
their names used in the driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
Documentation/extcon/intel-int3496.txt | 5 +++++
drivers/extcon/extcon-intel-int3496.c | 20 ++++++++++++++++++++
2 files changed, 25 insertions(+)
diff --git a/Documentation/extcon/intel-int3496.txt b/Documentation/extcon/intel-int3496.txt
index af0b366c25b7..8155dbc7fad3 100644
--- a/Documentation/extcon/intel-int3496.txt
+++ b/Documentation/extcon/intel-int3496.txt
@@ -20,3 +20,8 @@ Index 1: The output gpio for enabling Vbus output from the device to the otg
Index 2: The output gpio for muxing of the data pins between the USB host and
the USB peripheral controller, write 1 to mux to the peripheral
controller
+
+There is a mapping between indices and GPIO connection IDs as follows
+ id index 0
+ vbus index 1
+ mux index 2
diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
index 81713bf7487e..22a529eb1b1a 100644
--- a/drivers/extcon/extcon-intel-int3496.c
+++ b/drivers/extcon/extcon-intel-int3496.c
@@ -45,6 +45,17 @@ static const unsigned int int3496_cable[] = {
EXTCON_NONE,
};
+static const struct acpi_gpio_params id_gpios = { INT3496_GPIO_USB_ID, 0, false };
+static const struct acpi_gpio_params vbus_gpios = { INT3496_GPIO_VBUS_EN, 0, false };
+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 },
+ { "vbus-gpios", &vbus_gpios, 1 },
+ { "mux-gpios", &mux_gpios, 1 },
+ { },
+};
+
static void int3496_do_usb_id(struct work_struct *work)
{
struct int3496_data *data =
@@ -83,6 +94,13 @@ static int int3496_probe(struct platform_device *pdev)
struct int3496_data *data;
int ret;
+ ret = acpi_dev_add_driver_gpios(ACPI_COMPANION(dev),
+ acpi_int3496_default_gpios);
+ if (ret) {
+ dev_err(dev, "can't add GPIO ACPI mapping\n");
+ return ret;
+ }
+
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
@@ -154,6 +172,8 @@ static int int3496_remove(struct platform_device *pdev)
devm_free_irq(&pdev->dev, data->usb_id_irq, data);
cancel_delayed_work_sync(&data->work);
+ acpi_dev_remove_driver_gpios(ACPI_COMPANION(&pdev->dev));
+
return 0;
}
--
2.11.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2 1/2] extcon: int3496: Rename GPIO pins in accordance with binding
2017-02-24 12:35 ` [PATCH v2 1/2] extcon: int3496: Rename GPIO pins in accordance with binding Andy Shevchenko
2017-02-24 12:35 ` [PATCH v2 2/2] extcon: int3496: Add GPIO ACPI mapping table Andy Shevchenko
@ 2017-02-27 3:45 ` Chanwoo Choi
1 sibling, 0 replies; 3+ messages in thread
From: Chanwoo Choi @ 2017-02-27 3:45 UTC (permalink / raw)
To: Andy Shevchenko, MyungJoo Ham, linux-kernel, David Cohen, Felipe Balbi
Hi,
On 2017년 02월 24일 21:35, Andy Shevchenko wrote:
> Update GPIO pin names in extcon-intel-int3496.c driver to follow
> the existing extcon binding.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/extcon/extcon-intel-int3496.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/extcon/extcon-intel-int3496.c b/drivers/extcon/extcon-intel-int3496.c
> index 38eb6cab938f..81713bf7487e 100644
> --- a/drivers/extcon/extcon-intel-int3496.c
> +++ b/drivers/extcon/extcon-intel-int3496.c
> @@ -105,13 +105,13 @@ static int int3496_probe(struct platform_device *pdev)
> return data->usb_id_irq;
> }
>
> - data->gpio_vbus_en = devm_gpiod_get_index(dev, "vbus en",
> + data->gpio_vbus_en = devm_gpiod_get_index(dev, "vbus",
> INT3496_GPIO_VBUS_EN,
> 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, "usb mux",
> + data->gpio_usb_mux = devm_gpiod_get_index(dev, "mux",
> INT3496_GPIO_USB_MUX,
> GPIOD_ASIS);
> if (IS_ERR(data->gpio_usb_mux))
>
Applied them(patch1/2). Thanks.
--
Best Regards,
Chanwoo Choi
Samsung Electronics
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-27 3:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <CGME20170224123601epcas3p3586d1a837b5b2f93dceb7a059f7fc660@epcas3p3.samsung.com>
2017-02-24 12:35 ` [PATCH v2 1/2] extcon: int3496: Rename GPIO pins in accordance with binding Andy Shevchenko
2017-02-24 12:35 ` [PATCH v2 2/2] extcon: int3496: Add GPIO ACPI mapping table Andy Shevchenko
2017-02-27 3:45 ` [PATCH v2 1/2] extcon: int3496: Rename GPIO pins in accordance with binding 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).