* [PATCH 1/5] extcon: gpio: Minor cleanups
2014-09-09 4:14 ` George Cherian
@ 2014-09-09 4:14 ` George Cherian
-1 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-09 4:14 UTC (permalink / raw)
To: cw00.choi-Sze3O3UU22JBDgjK7y7TUQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
galak-sgV2jX0FEOL9JmXXK+q4OQ, myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
grant.likely-QSEj5FYQhm4dnm+yROfE0A, rongjun.ying-kQvG35nSl+M,
linux-0h96xk9xTtrk1uMJSBkQmQ
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, George Cherian
Minor Cleanups
- Order the include files in alphabetical order.
- Fix description of state_off in extcon_gpio.h
- Add a descrition for check_on_resume in extcon_gpio.h
Signed-off-by: George Cherian <george.cherian-l0cyMroinI0@public.gmane.org>
---
drivers/extcon/extcon-gpio.c | 10 +++++-----
include/linux/extcon/extcon-gpio.h | 4 +++-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 5b7ec27..72f19a3 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -20,16 +20,16 @@
*
*/
-#include <linux/module.h>
-#include <linux/kernel.h>
+#include <linux/extcon.h>
+#include <linux/extcon/extcon-gpio.h>
+#include <linux/gpio.h>
#include <linux/init.h>
#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
-#include <linux/gpio.h>
-#include <linux/extcon.h>
-#include <linux/extcon/extcon-gpio.h>
struct gpio_extcon_data {
struct extcon_dev *edev;
diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 8900fdf..0b17ad4 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -34,8 +34,10 @@
* @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
* @state_on: print_state is overriden with state_on if attached.
* If NULL, default method of extcon class is used.
- * @state_off: print_state is overriden with state_on if detached.
+ * @state_off: print_state is overriden with state_off if detached.
* If NUll, default method of extcon class is used.
+ * @check_on_resume: Boolean describing whether to check the state of gpio
+ * while resuming from sleep.
*
* Note that in order for state_on or state_off to be valid, both state_on
* and state_off should be not NULL. If at least one of them is NULL,
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 1/5] extcon: gpio: Minor cleanups
@ 2014-09-09 4:14 ` George Cherian
0 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-09 4:14 UTC (permalink / raw)
To: cw00.choi, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
galak, myungjoo.ham, grant.likely, rongjun.ying, linux
Cc: devicetree, linux-kernel, George Cherian
Minor Cleanups
- Order the include files in alphabetical order.
- Fix description of state_off in extcon_gpio.h
- Add a descrition for check_on_resume in extcon_gpio.h
Signed-off-by: George Cherian <george.cherian@ti.com>
---
drivers/extcon/extcon-gpio.c | 10 +++++-----
include/linux/extcon/extcon-gpio.h | 4 +++-
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 5b7ec27..72f19a3 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -20,16 +20,16 @@
*
*/
-#include <linux/module.h>
-#include <linux/kernel.h>
+#include <linux/extcon.h>
+#include <linux/extcon/extcon-gpio.h>
+#include <linux/gpio.h>
#include <linux/init.h>
#include <linux/interrupt.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/workqueue.h>
-#include <linux/gpio.h>
-#include <linux/extcon.h>
-#include <linux/extcon/extcon-gpio.h>
struct gpio_extcon_data {
struct extcon_dev *edev;
diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
index 8900fdf..0b17ad4 100644
--- a/include/linux/extcon/extcon-gpio.h
+++ b/include/linux/extcon/extcon-gpio.h
@@ -34,8 +34,10 @@
* @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
* @state_on: print_state is overriden with state_on if attached.
* If NULL, default method of extcon class is used.
- * @state_off: print_state is overriden with state_on if detached.
+ * @state_off: print_state is overriden with state_off if detached.
* If NUll, default method of extcon class is used.
+ * @check_on_resume: Boolean describing whether to check the state of gpio
+ * while resuming from sleep.
*
* Note that in order for state_on or state_off to be valid, both state_on
* and state_off should be not NULL. If at least one of them is NULL,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread[parent not found: <1410236078-11713-2-git-send-email-george.cherian-l0cyMroinI0@public.gmane.org>]
* Re: [PATCH 1/5] extcon: gpio: Minor cleanups
2014-09-09 4:14 ` George Cherian
@ 2014-09-22 7:54 ` Chanwoo Choi
-1 siblings, 0 replies; 23+ messages in thread
From: Chanwoo Choi @ 2014-09-22 7:54 UTC (permalink / raw)
To: George Cherian
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
galak-sgV2jX0FEOL9JmXXK+q4OQ, myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
grant.likely-QSEj5FYQhm4dnm+yROfE0A, rongjun.ying-kQvG35nSl+M,
linux-0h96xk9xTtrk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi George,
On 09/09/2014 01:14 PM, George Cherian wrote:
> Minor Cleanups
> - Order the include files in alphabetical order.
> - Fix description of state_off in extcon_gpio.h
> - Add a descrition for check_on_resume in extcon_gpio.h
>
> Signed-off-by: George Cherian <george.cherian-l0cyMroinI0@public.gmane.org>
I modify the name/description of patch to keep standary coding style
and applied it.
Thanks,
Chanwoo Choi
> ---
> drivers/extcon/extcon-gpio.c | 10 +++++-----
> include/linux/extcon/extcon-gpio.h | 4 +++-
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
> index 5b7ec27..72f19a3 100644
> --- a/drivers/extcon/extcon-gpio.c
> +++ b/drivers/extcon/extcon-gpio.c
> @@ -20,16 +20,16 @@
> *
> */
>
> -#include <linux/module.h>
> -#include <linux/kernel.h>
> +#include <linux/extcon.h>
> +#include <linux/extcon/extcon-gpio.h>
> +#include <linux/gpio.h>
> #include <linux/init.h>
> #include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/workqueue.h>
> -#include <linux/gpio.h>
> -#include <linux/extcon.h>
> -#include <linux/extcon/extcon-gpio.h>
>
> struct gpio_extcon_data {
> struct extcon_dev *edev;
> diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
> index 8900fdf..0b17ad4 100644
> --- a/include/linux/extcon/extcon-gpio.h
> +++ b/include/linux/extcon/extcon-gpio.h
> @@ -34,8 +34,10 @@
> * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
> * @state_on: print_state is overriden with state_on if attached.
> * If NULL, default method of extcon class is used.
> - * @state_off: print_state is overriden with state_on if detached.
> + * @state_off: print_state is overriden with state_off if detached.
> * If NUll, default method of extcon class is used.
> + * @check_on_resume: Boolean describing whether to check the state of gpio
> + * while resuming from sleep.
> *
> * Note that in order for state_on or state_off to be valid, both state_on
> * and state_off should be not NULL. If at least one of them is NULL,
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 1/5] extcon: gpio: Minor cleanups
@ 2014-09-22 7:54 ` Chanwoo Choi
0 siblings, 0 replies; 23+ messages in thread
From: Chanwoo Choi @ 2014-09-22 7:54 UTC (permalink / raw)
To: George Cherian
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak,
myungjoo.ham, grant.likely, rongjun.ying, linux, devicetree,
linux-kernel
Hi George,
On 09/09/2014 01:14 PM, George Cherian wrote:
> Minor Cleanups
> - Order the include files in alphabetical order.
> - Fix description of state_off in extcon_gpio.h
> - Add a descrition for check_on_resume in extcon_gpio.h
>
> Signed-off-by: George Cherian <george.cherian@ti.com>
I modify the name/description of patch to keep standary coding style
and applied it.
Thanks,
Chanwoo Choi
> ---
> drivers/extcon/extcon-gpio.c | 10 +++++-----
> include/linux/extcon/extcon-gpio.h | 4 +++-
> 2 files changed, 8 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
> index 5b7ec27..72f19a3 100644
> --- a/drivers/extcon/extcon-gpio.c
> +++ b/drivers/extcon/extcon-gpio.c
> @@ -20,16 +20,16 @@
> *
> */
>
> -#include <linux/module.h>
> -#include <linux/kernel.h>
> +#include <linux/extcon.h>
> +#include <linux/extcon/extcon-gpio.h>
> +#include <linux/gpio.h>
> #include <linux/init.h>
> #include <linux/interrupt.h>
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> #include <linux/platform_device.h>
> #include <linux/slab.h>
> #include <linux/workqueue.h>
> -#include <linux/gpio.h>
> -#include <linux/extcon.h>
> -#include <linux/extcon/extcon-gpio.h>
>
> struct gpio_extcon_data {
> struct extcon_dev *edev;
> diff --git a/include/linux/extcon/extcon-gpio.h b/include/linux/extcon/extcon-gpio.h
> index 8900fdf..0b17ad4 100644
> --- a/include/linux/extcon/extcon-gpio.h
> +++ b/include/linux/extcon/extcon-gpio.h
> @@ -34,8 +34,10 @@
> * @irq_flags: IRQ Flags (e.g., IRQF_TRIGGER_LOW).
> * @state_on: print_state is overriden with state_on if attached.
> * If NULL, default method of extcon class is used.
> - * @state_off: print_state is overriden with state_on if detached.
> + * @state_off: print_state is overriden with state_off if detached.
> * If NUll, default method of extcon class is used.
> + * @check_on_resume: Boolean describing whether to check the state of gpio
> + * while resuming from sleep.
> *
> * Note that in order for state_on or state_off to be valid, both state_on
> * and state_off should be not NULL. If at least one of them is NULL,
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 2/5] extcon: gpio: Convert the driver to use gpio desc API's
2014-09-09 4:14 ` George Cherian
@ 2014-09-09 4:14 ` George Cherian
-1 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-09 4:14 UTC (permalink / raw)
To: cw00.choi-Sze3O3UU22JBDgjK7y7TUQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
galak-sgV2jX0FEOL9JmXXK+q4OQ, myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
grant.likely-QSEj5FYQhm4dnm+yROfE0A, rongjun.ying-kQvG35nSl+M,
linux-0h96xk9xTtrk1uMJSBkQmQ
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, George Cherian
Convert the driver to use gpiod_* API's.
Signed-off-by: George Cherian <george.cherian-l0cyMroinI0@public.gmane.org>
---
drivers/extcon/extcon-gpio.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 72f19a3..25269f6 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -33,8 +33,7 @@
struct gpio_extcon_data {
struct extcon_dev *edev;
- unsigned gpio;
- bool gpio_active_low;
+ struct gpio_desc *gpiod;
const char *state_on;
const char *state_off;
int irq;
@@ -50,9 +49,7 @@ static void gpio_extcon_work(struct work_struct *work)
container_of(to_delayed_work(work), struct gpio_extcon_data,
work);
- state = gpio_get_value(data->gpio);
- if (data->gpio_active_low)
- state = !state;
+ state = gpiod_get_value(data->gpiod);
extcon_set_state(data->edev, state);
}
@@ -106,22 +103,21 @@ static int gpio_extcon_probe(struct platform_device *pdev)
}
extcon_data->edev->name = pdata->name;
- extcon_data->gpio = pdata->gpio;
- extcon_data->gpio_active_low = pdata->gpio_active_low;
+ extcon_data->gpiod = gpio_to_desc(pdata->gpio);
extcon_data->state_on = pdata->state_on;
extcon_data->state_off = pdata->state_off;
extcon_data->check_on_resume = pdata->check_on_resume;
if (pdata->state_on && pdata->state_off)
extcon_data->edev->print_state = extcon_gpio_print_state;
- ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
+ ret = devm_gpio_request_one(&pdev->dev, pdata->gpio, GPIOF_DIR_IN,
pdev->name);
if (ret < 0)
return ret;
if (pdata->debounce) {
- ret = gpio_set_debounce(extcon_data->gpio,
- pdata->debounce * 1000);
+ ret = gpiod_set_debounce(extcon_data->gpiod,
+ pdata->debounce * 1000);
if (ret < 0)
extcon_data->debounce_jiffies =
msecs_to_jiffies(pdata->debounce);
@@ -133,7 +129,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);
- extcon_data->irq = gpio_to_irq(extcon_data->gpio);
+ extcon_data->irq = gpiod_to_irq(extcon_data->gpiod);
if (extcon_data->irq < 0)
return extcon_data->irq;
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 2/5] extcon: gpio: Convert the driver to use gpio desc API's
@ 2014-09-09 4:14 ` George Cherian
0 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-09 4:14 UTC (permalink / raw)
To: cw00.choi, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
galak, myungjoo.ham, grant.likely, rongjun.ying, linux
Cc: devicetree, linux-kernel, George Cherian
Convert the driver to use gpiod_* API's.
Signed-off-by: George Cherian <george.cherian@ti.com>
---
drivers/extcon/extcon-gpio.c | 18 +++++++-----------
1 file changed, 7 insertions(+), 11 deletions(-)
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 72f19a3..25269f6 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -33,8 +33,7 @@
struct gpio_extcon_data {
struct extcon_dev *edev;
- unsigned gpio;
- bool gpio_active_low;
+ struct gpio_desc *gpiod;
const char *state_on;
const char *state_off;
int irq;
@@ -50,9 +49,7 @@ static void gpio_extcon_work(struct work_struct *work)
container_of(to_delayed_work(work), struct gpio_extcon_data,
work);
- state = gpio_get_value(data->gpio);
- if (data->gpio_active_low)
- state = !state;
+ state = gpiod_get_value(data->gpiod);
extcon_set_state(data->edev, state);
}
@@ -106,22 +103,21 @@ static int gpio_extcon_probe(struct platform_device *pdev)
}
extcon_data->edev->name = pdata->name;
- extcon_data->gpio = pdata->gpio;
- extcon_data->gpio_active_low = pdata->gpio_active_low;
+ extcon_data->gpiod = gpio_to_desc(pdata->gpio);
extcon_data->state_on = pdata->state_on;
extcon_data->state_off = pdata->state_off;
extcon_data->check_on_resume = pdata->check_on_resume;
if (pdata->state_on && pdata->state_off)
extcon_data->edev->print_state = extcon_gpio_print_state;
- ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
+ ret = devm_gpio_request_one(&pdev->dev, pdata->gpio, GPIOF_DIR_IN,
pdev->name);
if (ret < 0)
return ret;
if (pdata->debounce) {
- ret = gpio_set_debounce(extcon_data->gpio,
- pdata->debounce * 1000);
+ ret = gpiod_set_debounce(extcon_data->gpiod,
+ pdata->debounce * 1000);
if (ret < 0)
extcon_data->debounce_jiffies =
msecs_to_jiffies(pdata->debounce);
@@ -133,7 +129,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);
- extcon_data->irq = gpio_to_irq(extcon_data->gpio);
+ extcon_data->irq = gpiod_to_irq(extcon_data->gpiod);
if (extcon_data->irq < 0)
return extcon_data->irq;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread[parent not found: <1410236078-11713-3-git-send-email-george.cherian-l0cyMroinI0@public.gmane.org>]
* Re: [PATCH 2/5] extcon: gpio: Convert the driver to use gpio desc API's
2014-09-09 4:14 ` George Cherian
@ 2014-09-22 8:07 ` Chanwoo Choi
-1 siblings, 0 replies; 23+ messages in thread
From: Chanwoo Choi @ 2014-09-22 8:07 UTC (permalink / raw)
To: George Cherian
Cc: robh+dt-DgEjT+Ai2ygdnm+yROfE0A, pawel.moll-5wv7dgnIgG8,
mark.rutland-5wv7dgnIgG8, ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
galak-sgV2jX0FEOL9JmXXK+q4OQ, myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
grant.likely-QSEj5FYQhm4dnm+yROfE0A, rongjun.ying-kQvG35nSl+M,
linux-0h96xk9xTtrk1uMJSBkQmQ, devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi George,
This patch removes 'gpio_active_low' field of struct gpio_extcon_data.
But, include/linux/extcon-gpio.h has the description of 'gpio_active_low' field.
Also,
This patch has not included the any description/comment of removing 'gpio_active_low'.
Also,
How to set 'FLAG_ACTIVE_LOW' bit for gpio when using platform data?
This patch don't call 'set_bit()' function to set FLAG_ACTIVE_LOW flag.
Thanks,
Chanwoo Choi
On 09/09/2014 01:14 PM, George Cherian wrote:
> Convert the driver to use gpiod_* API's.
>
> Signed-off-by: George Cherian <george.cherian-l0cyMroinI0@public.gmane.org>
> ---
> drivers/extcon/extcon-gpio.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
> index 72f19a3..25269f6 100644
> --- a/drivers/extcon/extcon-gpio.c
> +++ b/drivers/extcon/extcon-gpio.c
> @@ -33,8 +33,7 @@
>
> struct gpio_extcon_data {
> struct extcon_dev *edev;
> - unsigned gpio;
> - bool gpio_active_low;
> + struct gpio_desc *gpiod;
> const char *state_on;
> const char *state_off;
> int irq;
> @@ -50,9 +49,7 @@ static void gpio_extcon_work(struct work_struct *work)
> container_of(to_delayed_work(work), struct gpio_extcon_data,
> work);
>
> - state = gpio_get_value(data->gpio);
> - if (data->gpio_active_low)
> - state = !state;
> + state = gpiod_get_value(data->gpiod);
> extcon_set_state(data->edev, state);
> }
>
> @@ -106,22 +103,21 @@ static int gpio_extcon_probe(struct platform_device *pdev)
> }
> extcon_data->edev->name = pdata->name;
>
> - extcon_data->gpio = pdata->gpio;
> - extcon_data->gpio_active_low = pdata->gpio_active_low;
> + extcon_data->gpiod = gpio_to_desc(pdata->gpio);
> extcon_data->state_on = pdata->state_on;
> extcon_data->state_off = pdata->state_off;
> extcon_data->check_on_resume = pdata->check_on_resume;
> if (pdata->state_on && pdata->state_off)
> extcon_data->edev->print_state = extcon_gpio_print_state;
>
> - ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
> + ret = devm_gpio_request_one(&pdev->dev, pdata->gpio, GPIOF_DIR_IN,
> pdev->name);
> if (ret < 0)
> return ret;
>
> if (pdata->debounce) {
> - ret = gpio_set_debounce(extcon_data->gpio,
> - pdata->debounce * 1000);
> + ret = gpiod_set_debounce(extcon_data->gpiod,
> + pdata->debounce * 1000);
> if (ret < 0)
> extcon_data->debounce_jiffies =
> msecs_to_jiffies(pdata->debounce);
> @@ -133,7 +129,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
>
> INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);
>
> - extcon_data->irq = gpio_to_irq(extcon_data->gpio);
> + extcon_data->irq = gpiod_to_irq(extcon_data->gpiod);
> if (extcon_data->irq < 0)
> return extcon_data->irq;
>
>
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 2/5] extcon: gpio: Convert the driver to use gpio desc API's
@ 2014-09-22 8:07 ` Chanwoo Choi
0 siblings, 0 replies; 23+ messages in thread
From: Chanwoo Choi @ 2014-09-22 8:07 UTC (permalink / raw)
To: George Cherian
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak,
myungjoo.ham, grant.likely, rongjun.ying, linux, devicetree,
linux-kernel
Hi George,
This patch removes 'gpio_active_low' field of struct gpio_extcon_data.
But, include/linux/extcon-gpio.h has the description of 'gpio_active_low' field.
Also,
This patch has not included the any description/comment of removing 'gpio_active_low'.
Also,
How to set 'FLAG_ACTIVE_LOW' bit for gpio when using platform data?
This patch don't call 'set_bit()' function to set FLAG_ACTIVE_LOW flag.
Thanks,
Chanwoo Choi
On 09/09/2014 01:14 PM, George Cherian wrote:
> Convert the driver to use gpiod_* API's.
>
> Signed-off-by: George Cherian <george.cherian@ti.com>
> ---
> drivers/extcon/extcon-gpio.c | 18 +++++++-----------
> 1 file changed, 7 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
> index 72f19a3..25269f6 100644
> --- a/drivers/extcon/extcon-gpio.c
> +++ b/drivers/extcon/extcon-gpio.c
> @@ -33,8 +33,7 @@
>
> struct gpio_extcon_data {
> struct extcon_dev *edev;
> - unsigned gpio;
> - bool gpio_active_low;
> + struct gpio_desc *gpiod;
> const char *state_on;
> const char *state_off;
> int irq;
> @@ -50,9 +49,7 @@ static void gpio_extcon_work(struct work_struct *work)
> container_of(to_delayed_work(work), struct gpio_extcon_data,
> work);
>
> - state = gpio_get_value(data->gpio);
> - if (data->gpio_active_low)
> - state = !state;
> + state = gpiod_get_value(data->gpiod);
> extcon_set_state(data->edev, state);
> }
>
> @@ -106,22 +103,21 @@ static int gpio_extcon_probe(struct platform_device *pdev)
> }
> extcon_data->edev->name = pdata->name;
>
> - extcon_data->gpio = pdata->gpio;
> - extcon_data->gpio_active_low = pdata->gpio_active_low;
> + extcon_data->gpiod = gpio_to_desc(pdata->gpio);
> extcon_data->state_on = pdata->state_on;
> extcon_data->state_off = pdata->state_off;
> extcon_data->check_on_resume = pdata->check_on_resume;
> if (pdata->state_on && pdata->state_off)
> extcon_data->edev->print_state = extcon_gpio_print_state;
>
> - ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
> + ret = devm_gpio_request_one(&pdev->dev, pdata->gpio, GPIOF_DIR_IN,
> pdev->name);
> if (ret < 0)
> return ret;
>
> if (pdata->debounce) {
> - ret = gpio_set_debounce(extcon_data->gpio,
> - pdata->debounce * 1000);
> + ret = gpiod_set_debounce(extcon_data->gpiod,
> + pdata->debounce * 1000);
> if (ret < 0)
> extcon_data->debounce_jiffies =
> msecs_to_jiffies(pdata->debounce);
> @@ -133,7 +129,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
>
> INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);
>
> - extcon_data->irq = gpio_to_irq(extcon_data->gpio);
> + extcon_data->irq = gpiod_to_irq(extcon_data->gpiod);
> if (extcon_data->irq < 0)
> return extcon_data->irq;
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 2/5] extcon: gpio: Convert the driver to use gpio desc API's
2014-09-22 8:07 ` Chanwoo Choi
@ 2014-09-22 9:51 ` George Cherian
-1 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-22 9:51 UTC (permalink / raw)
To: Chanwoo Choi
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak,
myungjoo.ham, grant.likely, rongjun.ying, linux, devicetree,
linux-kernel
On 09/22/2014 01:37 PM, Chanwoo Choi wrote:
> Hi George,
>
> This patch removes 'gpio_active_low' field of struct gpio_extcon_data.
> But, include/linux/extcon-gpio.h has the description of 'gpio_active_low' field.
Yes didn't want the platform data users to break.
Actually I couldn't find any platform users for this driver. Could you
please point me to
one if in case I missed it. If non present then why cant we get rid of
platform data altogether.
>
> Also,
> This patch has not included the any description/comment of removing 'gpio_active_low'.
>
> Also,
> How to set 'FLAG_ACTIVE_LOW' bit for gpio when using platform data?
Now that we are using gpiod_* API's we need not check for
gpio_active_low from this driver.
> This patch don't call 'set_bit()' function to set FLAG_ACTIVE_LOW flag.
>
> Thanks,
> Chanwoo Choi
>
> On 09/09/2014 01:14 PM, George Cherian wrote:
>> Convert the driver to use gpiod_* API's.
>>
>> Signed-off-by: George Cherian <george.cherian@ti.com>
>> ---
>> drivers/extcon/extcon-gpio.c | 18 +++++++-----------
>> 1 file changed, 7 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
>> index 72f19a3..25269f6 100644
>> --- a/drivers/extcon/extcon-gpio.c
>> +++ b/drivers/extcon/extcon-gpio.c
>> @@ -33,8 +33,7 @@
>>
>> struct gpio_extcon_data {
>> struct extcon_dev *edev;
>> - unsigned gpio;
>> - bool gpio_active_low;
>> + struct gpio_desc *gpiod;
>> const char *state_on;
>> const char *state_off;
>> int irq;
>> @@ -50,9 +49,7 @@ static void gpio_extcon_work(struct work_struct *work)
>> container_of(to_delayed_work(work), struct gpio_extcon_data,
>> work);
>>
>> - state = gpio_get_value(data->gpio);
>> - if (data->gpio_active_low)
>> - state = !state;
>> + state = gpiod_get_value(data->gpiod);
>> extcon_set_state(data->edev, state);
>> }
>>
>> @@ -106,22 +103,21 @@ static int gpio_extcon_probe(struct platform_device *pdev)
>> }
>> extcon_data->edev->name = pdata->name;
>>
>> - extcon_data->gpio = pdata->gpio;
>> - extcon_data->gpio_active_low = pdata->gpio_active_low;
>> + extcon_data->gpiod = gpio_to_desc(pdata->gpio);
>> extcon_data->state_on = pdata->state_on;
>> extcon_data->state_off = pdata->state_off;
>> extcon_data->check_on_resume = pdata->check_on_resume;
>> if (pdata->state_on && pdata->state_off)
>> extcon_data->edev->print_state = extcon_gpio_print_state;
>>
>> - ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
>> + ret = devm_gpio_request_one(&pdev->dev, pdata->gpio, GPIOF_DIR_IN,
>> pdev->name);
>> if (ret < 0)
>> return ret;
>>
>> if (pdata->debounce) {
>> - ret = gpio_set_debounce(extcon_data->gpio,
>> - pdata->debounce * 1000);
>> + ret = gpiod_set_debounce(extcon_data->gpiod,
>> + pdata->debounce * 1000);
>> if (ret < 0)
>> extcon_data->debounce_jiffies =
>> msecs_to_jiffies(pdata->debounce);
>> @@ -133,7 +129,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
>>
>> INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);
>>
>> - extcon_data->irq = gpio_to_irq(extcon_data->gpio);
>> + extcon_data->irq = gpiod_to_irq(extcon_data->gpiod);
>> if (extcon_data->irq < 0)
>> return extcon_data->irq;
>>
>>
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 2/5] extcon: gpio: Convert the driver to use gpio desc API's
@ 2014-09-22 9:51 ` George Cherian
0 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-22 9:51 UTC (permalink / raw)
To: Chanwoo Choi
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak,
myungjoo.ham, grant.likely, rongjun.ying, linux, devicetree,
linux-kernel
On 09/22/2014 01:37 PM, Chanwoo Choi wrote:
> Hi George,
>
> This patch removes 'gpio_active_low' field of struct gpio_extcon_data.
> But, include/linux/extcon-gpio.h has the description of 'gpio_active_low' field.
Yes didn't want the platform data users to break.
Actually I couldn't find any platform users for this driver. Could you
please point me to
one if in case I missed it. If non present then why cant we get rid of
platform data altogether.
>
> Also,
> This patch has not included the any description/comment of removing 'gpio_active_low'.
>
> Also,
> How to set 'FLAG_ACTIVE_LOW' bit for gpio when using platform data?
Now that we are using gpiod_* API's we need not check for
gpio_active_low from this driver.
> This patch don't call 'set_bit()' function to set FLAG_ACTIVE_LOW flag.
>
> Thanks,
> Chanwoo Choi
>
> On 09/09/2014 01:14 PM, George Cherian wrote:
>> Convert the driver to use gpiod_* API's.
>>
>> Signed-off-by: George Cherian <george.cherian@ti.com>
>> ---
>> drivers/extcon/extcon-gpio.c | 18 +++++++-----------
>> 1 file changed, 7 insertions(+), 11 deletions(-)
>>
>> diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
>> index 72f19a3..25269f6 100644
>> --- a/drivers/extcon/extcon-gpio.c
>> +++ b/drivers/extcon/extcon-gpio.c
>> @@ -33,8 +33,7 @@
>>
>> struct gpio_extcon_data {
>> struct extcon_dev *edev;
>> - unsigned gpio;
>> - bool gpio_active_low;
>> + struct gpio_desc *gpiod;
>> const char *state_on;
>> const char *state_off;
>> int irq;
>> @@ -50,9 +49,7 @@ static void gpio_extcon_work(struct work_struct *work)
>> container_of(to_delayed_work(work), struct gpio_extcon_data,
>> work);
>>
>> - state = gpio_get_value(data->gpio);
>> - if (data->gpio_active_low)
>> - state = !state;
>> + state = gpiod_get_value(data->gpiod);
>> extcon_set_state(data->edev, state);
>> }
>>
>> @@ -106,22 +103,21 @@ static int gpio_extcon_probe(struct platform_device *pdev)
>> }
>> extcon_data->edev->name = pdata->name;
>>
>> - extcon_data->gpio = pdata->gpio;
>> - extcon_data->gpio_active_low = pdata->gpio_active_low;
>> + extcon_data->gpiod = gpio_to_desc(pdata->gpio);
>> extcon_data->state_on = pdata->state_on;
>> extcon_data->state_off = pdata->state_off;
>> extcon_data->check_on_resume = pdata->check_on_resume;
>> if (pdata->state_on && pdata->state_off)
>> extcon_data->edev->print_state = extcon_gpio_print_state;
>>
>> - ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
>> + ret = devm_gpio_request_one(&pdev->dev, pdata->gpio, GPIOF_DIR_IN,
>> pdev->name);
>> if (ret < 0)
>> return ret;
>>
>> if (pdata->debounce) {
>> - ret = gpio_set_debounce(extcon_data->gpio,
>> - pdata->debounce * 1000);
>> + ret = gpiod_set_debounce(extcon_data->gpiod,
>> + pdata->debounce * 1000);
>> if (ret < 0)
>> extcon_data->debounce_jiffies =
>> msecs_to_jiffies(pdata->debounce);
>> @@ -133,7 +129,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
>>
>> INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);
>>
>> - extcon_data->irq = gpio_to_irq(extcon_data->gpio);
>> + extcon_data->irq = gpiod_to_irq(extcon_data->gpiod);
>> if (extcon_data->irq < 0)
>> return extcon_data->irq;
>>
>>
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH 2/5] extcon: gpio: Convert the driver to use gpio desc API's
2014-09-22 9:51 ` George Cherian
(?)
@ 2014-09-22 23:14 ` Chanwoo Choi
[not found] ` <5420AD3B.2080306-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
-1 siblings, 1 reply; 23+ messages in thread
From: Chanwoo Choi @ 2014-09-22 23:14 UTC (permalink / raw)
To: George Cherian
Cc: robh+dt, pawel.moll, mark.rutland, ijc+devicetree, galak,
myungjoo.ham, grant.likely, rongjun.ying, linux, devicetree,
linux-kernel
On 09/22/2014 06:51 PM, George Cherian wrote:
>
> On 09/22/2014 01:37 PM, Chanwoo Choi wrote:
>> Hi George,
>>
>> This patch removes 'gpio_active_low' field of struct gpio_extcon_data.
>> But, include/linux/extcon-gpio.h has the description of 'gpio_active_low' field.
> Yes didn't want the platform data users to break.
> Actually I couldn't find any platform users for this driver. Could you please point me to
> one if in case I missed it. If non present then why cant we get rid of platform data altogether.
Right,
But, Why do you support platform data on as following your patch?
- [PATCH 3/5] extcon: gpio: Add dt support for the driver.
According to your comment, you had to remove the support for platform data.
IMO,
I think this patchset must need to reorder the sequence of patchset.
Also, this patchset is more detailed description.
>>
>> Also,
>> This patch has not included the any description/comment of removing 'gpio_active_low'.
>>
>> Also,
>> How to set 'FLAG_ACTIVE_LOW' bit for gpio when using platform data?
> Now that we are using gpiod_* API's we need not check for gpio_active_low from this driver.
This patch just use gpiod API instead of legacy gpio API.
I think that if extcon-gpio don't need to check gpio_activ_low field,
you have to implement dt support patch before this patch.
>
>> This patch don't call 'set_bit()' function to set FLAG_ACTIVE_LOW flag.
>>
>> Thanks,
>> Chanwoo Choi
>>
>> On 09/09/2014 01:14 PM, George Cherian wrote:
>>> Convert the driver to use gpiod_* API's.
>>>
>>> Signed-off-by: George Cherian <george.cherian@ti.com>
>>> ---
>>> drivers/extcon/extcon-gpio.c | 18 +++++++-----------
>>> 1 file changed, 7 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
>>> index 72f19a3..25269f6 100644
>>> --- a/drivers/extcon/extcon-gpio.c
>>> +++ b/drivers/extcon/extcon-gpio.c
>>> @@ -33,8 +33,7 @@
>>> struct gpio_extcon_data {
>>> struct extcon_dev *edev;
>>> - unsigned gpio;
>>> - bool gpio_active_low;
>>> + struct gpio_desc *gpiod;
>>> const char *state_on;
>>> const char *state_off;
>>> int irq;
>>> @@ -50,9 +49,7 @@ static void gpio_extcon_work(struct work_struct *work)
>>> container_of(to_delayed_work(work), struct gpio_extcon_data,
>>> work);
>>> - state = gpio_get_value(data->gpio);
>>> - if (data->gpio_active_low)
>>> - state = !state;
>>> + state = gpiod_get_value(data->gpiod);
>>> extcon_set_state(data->edev, state);
>>> }
>>> @@ -106,22 +103,21 @@ static int gpio_extcon_probe(struct platform_device *pdev)
>>> }
>>> extcon_data->edev->name = pdata->name;
>>> - extcon_data->gpio = pdata->gpio;
>>> - extcon_data->gpio_active_low = pdata->gpio_active_low;
>>> + extcon_data->gpiod = gpio_to_desc(pdata->gpio);
>>> extcon_data->state_on = pdata->state_on;
>>> extcon_data->state_off = pdata->state_off;
>>> extcon_data->check_on_resume = pdata->check_on_resume;
>>> if (pdata->state_on && pdata->state_off)
>>> extcon_data->edev->print_state = extcon_gpio_print_state;
>>> - ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN,
>>> + ret = devm_gpio_request_one(&pdev->dev, pdata->gpio, GPIOF_DIR_IN,
>>> pdev->name);
>>> if (ret < 0)
>>> return ret;
>>> if (pdata->debounce) {
>>> - ret = gpio_set_debounce(extcon_data->gpio,
>>> - pdata->debounce * 1000);
>>> + ret = gpiod_set_debounce(extcon_data->gpiod,
>>> + pdata->debounce * 1000);
>>> if (ret < 0)
>>> extcon_data->debounce_jiffies =
>>> msecs_to_jiffies(pdata->debounce);
>>> @@ -133,7 +129,7 @@ static int gpio_extcon_probe(struct platform_device *pdev)
>>> INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work);
>>> - extcon_data->irq = gpio_to_irq(extcon_data->gpio);
>>> + extcon_data->irq = gpiod_to_irq(extcon_data->gpiod);
>>> if (extcon_data->irq < 0)
>>> return extcon_data->irq;
>>>
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH 4/5] extcon: gpio: Always use gpio_get_value_cansleep
2014-09-09 4:14 ` George Cherian
@ 2014-09-09 4:14 ` George Cherian
-1 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-09 4:14 UTC (permalink / raw)
To: cw00.choi-Sze3O3UU22JBDgjK7y7TUQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
galak-sgV2jX0FEOL9JmXXK+q4OQ, myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
grant.likely-QSEj5FYQhm4dnm+yROfE0A, rongjun.ying-kQvG35nSl+M,
linux-0h96xk9xTtrk1uMJSBkQmQ
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, George Cherian
Some gpio's can sleep while reading, so always use gpio_get_value_cansleep
to get data. This fixes warning from gpiolib due to wrong API usage.
Signed-off-by: George Cherian <george.cherian-l0cyMroinI0@public.gmane.org>
---
drivers/extcon/extcon-gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 2bfbd2e..3839749 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -51,7 +51,7 @@ static void gpio_extcon_work(struct work_struct *work)
container_of(to_delayed_work(work), struct gpio_extcon_data,
work);
- state = gpiod_get_value(data->gpiod);
+ state = gpiod_get_value_cansleep(data->gpiod);
extcon_set_state(data->edev, state);
}
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 4/5] extcon: gpio: Always use gpio_get_value_cansleep
@ 2014-09-09 4:14 ` George Cherian
0 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-09 4:14 UTC (permalink / raw)
To: cw00.choi, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
galak, myungjoo.ham, grant.likely, rongjun.ying, linux
Cc: devicetree, linux-kernel, George Cherian
Some gpio's can sleep while reading, so always use gpio_get_value_cansleep
to get data. This fixes warning from gpiolib due to wrong API usage.
Signed-off-by: George Cherian <george.cherian@ti.com>
---
drivers/extcon/extcon-gpio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 2bfbd2e..3839749 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -51,7 +51,7 @@ static void gpio_extcon_work(struct work_struct *work)
container_of(to_delayed_work(work), struct gpio_extcon_data,
work);
- state = gpiod_get_value(data->gpiod);
+ state = gpiod_get_value_cansleep(data->gpiod);
extcon_set_state(data->edev, state);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH 5/5] extcon: gpio: Add support for using cable names
2014-09-09 4:14 ` George Cherian
@ 2014-09-09 4:14 ` George Cherian
-1 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-09 4:14 UTC (permalink / raw)
To: cw00.choi-Sze3O3UU22JBDgjK7y7TUQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
galak-sgV2jX0FEOL9JmXXK+q4OQ, myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
grant.likely-QSEj5FYQhm4dnm+yROfE0A, rongjun.ying-kQvG35nSl+M,
linux-0h96xk9xTtrk1uMJSBkQmQ
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA, George Cherian
Add support for using cable names. Enables other drivers to register interest
and get notified using extcon provided notifier call backs.
Signed-off-by: George Cherian <george.cherian-l0cyMroinI0@public.gmane.org>
---
Documentation/devicetree/bindings/extcon/extcon-gpio.txt | 2 ++
drivers/extcon/extcon-gpio.c | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/extcon/extcon-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-gpio.txt
index 30aa2e1..2c9d29f 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-gpio.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-gpio.txt
@@ -7,6 +7,7 @@ Required Properties:
- compatible: should be:
* "linux,extcon-gpio"
- gpios: specifies the gpio pin used.
+ - cable-name: Name of the cable used.
Optional Properties:
- debounce: Debounce time for GPIO IRQ in ms
@@ -18,4 +19,5 @@ Eg:
compatible = "linux,extcon-gpio";
gpios = <&gpio3 12 GPIO_ACTIVE_HIGH>;
debounce = <20>;
+ cable-name = "USB-HOST";
};
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 3839749..c0ab8e7 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -42,6 +42,7 @@ struct gpio_extcon_data {
struct delayed_work work;
unsigned long debounce_jiffies;
bool check_on_resume;
+ const char *cable_name[1];
};
static void gpio_extcon_work(struct work_struct *work)
@@ -111,6 +112,9 @@ static int gpio_extcon_probe(struct platform_device *pdev)
of_property_read_u32(np, "debounce", &debounce);
irq = gpiod_to_irq(extcon_data->gpiod);
irq_flags = irq_get_trigger_type(irq);
+ of_property_read_string_index(np, "cable-name", 0,
+ extcon_data->cable_name);
+ extcon_data->edev->supported_cable = extcon_data->cable_name;
} else {
if (!pdata)
return -EBUSY;
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH 5/5] extcon: gpio: Add support for using cable names
@ 2014-09-09 4:14 ` George Cherian
0 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-09 4:14 UTC (permalink / raw)
To: cw00.choi, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
galak, myungjoo.ham, grant.likely, rongjun.ying, linux
Cc: devicetree, linux-kernel, George Cherian
Add support for using cable names. Enables other drivers to register interest
and get notified using extcon provided notifier call backs.
Signed-off-by: George Cherian <george.cherian@ti.com>
---
Documentation/devicetree/bindings/extcon/extcon-gpio.txt | 2 ++
drivers/extcon/extcon-gpio.c | 4 ++++
2 files changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/extcon/extcon-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-gpio.txt
index 30aa2e1..2c9d29f 100644
--- a/Documentation/devicetree/bindings/extcon/extcon-gpio.txt
+++ b/Documentation/devicetree/bindings/extcon/extcon-gpio.txt
@@ -7,6 +7,7 @@ Required Properties:
- compatible: should be:
* "linux,extcon-gpio"
- gpios: specifies the gpio pin used.
+ - cable-name: Name of the cable used.
Optional Properties:
- debounce: Debounce time for GPIO IRQ in ms
@@ -18,4 +19,5 @@ Eg:
compatible = "linux,extcon-gpio";
gpios = <&gpio3 12 GPIO_ACTIVE_HIGH>;
debounce = <20>;
+ cable-name = "USB-HOST";
};
diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c
index 3839749..c0ab8e7 100644
--- a/drivers/extcon/extcon-gpio.c
+++ b/drivers/extcon/extcon-gpio.c
@@ -42,6 +42,7 @@ struct gpio_extcon_data {
struct delayed_work work;
unsigned long debounce_jiffies;
bool check_on_resume;
+ const char *cable_name[1];
};
static void gpio_extcon_work(struct work_struct *work)
@@ -111,6 +112,9 @@ static int gpio_extcon_probe(struct platform_device *pdev)
of_property_read_u32(np, "debounce", &debounce);
irq = gpiod_to_irq(extcon_data->gpiod);
irq_flags = irq_get_trigger_type(irq);
+ of_property_read_string_index(np, "cable-name", 0,
+ extcon_data->cable_name);
+ extcon_data->edev->supported_cable = extcon_data->cable_name;
} else {
if (!pdata)
return -EBUSY;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH 0/5] Add dt support for extcon gpio driver
2014-09-09 4:14 ` George Cherian
@ 2014-09-16 6:41 ` George Cherian
-1 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-16 6:41 UTC (permalink / raw)
To: cw00.choi-Sze3O3UU22JBDgjK7y7TUQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
pawel.moll-5wv7dgnIgG8, mark.rutland-5wv7dgnIgG8,
ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg,
galak-sgV2jX0FEOL9JmXXK+q4OQ, myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ,
grant.likely-QSEj5FYQhm4dnm+yROfE0A, rongjun.ying-kQvG35nSl+M,
linux-0h96xk9xTtrk1uMJSBkQmQ
Cc: devicetree-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Hi Chanwoo,
Could you please look into this series?
On 09/09/2014 09:44 AM, George Cherian wrote:
> This series
> - Convert extcon-gpio driver to use gpiod_* API's
> - Adds dt support to extcon-gpio driver.
> - Add cable name support in case of dt.
>
> George Cherian (5):
> extcon: gpio: Minor cleanups
> extcon: gpio: Convert the driver to use gpio desc API's
> extcon: gpio: Add dt support for the driver.
> extcon: gpio: Always use gpio_get_value_cansleep
> extcon: gpio: Add support for using cable names
>
> .../devicetree/bindings/extcon/extcon-gpio.txt | 23 +++++
> drivers/extcon/extcon-gpio.c | 100 +++++++++++++--------
> include/linux/extcon/extcon-gpio.h | 4 +-
> 3 files changed, 89 insertions(+), 38 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/extcon/extcon-gpio.txt
>
Regards
-George
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH 0/5] Add dt support for extcon gpio driver
@ 2014-09-16 6:41 ` George Cherian
0 siblings, 0 replies; 23+ messages in thread
From: George Cherian @ 2014-09-16 6:41 UTC (permalink / raw)
To: cw00.choi, robh+dt, pawel.moll, mark.rutland, ijc+devicetree,
galak, myungjoo.ham, grant.likely, rongjun.ying, linux
Cc: devicetree, linux-kernel
Hi Chanwoo,
Could you please look into this series?
On 09/09/2014 09:44 AM, George Cherian wrote:
> This series
> - Convert extcon-gpio driver to use gpiod_* API's
> - Adds dt support to extcon-gpio driver.
> - Add cable name support in case of dt.
>
> George Cherian (5):
> extcon: gpio: Minor cleanups
> extcon: gpio: Convert the driver to use gpio desc API's
> extcon: gpio: Add dt support for the driver.
> extcon: gpio: Always use gpio_get_value_cansleep
> extcon: gpio: Add support for using cable names
>
> .../devicetree/bindings/extcon/extcon-gpio.txt | 23 +++++
> drivers/extcon/extcon-gpio.c | 100 +++++++++++++--------
> include/linux/extcon/extcon-gpio.h | 4 +-
> 3 files changed, 89 insertions(+), 38 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/extcon/extcon-gpio.txt
>
Regards
-George
^ permalink raw reply [flat|nested] 23+ messages in thread