extcon: gpio: add DT support
Subsystems (2)
PATCH 2/4 extcon: gpio: Add dt support for the driver.
In reply to Felipe BalbiFrom: George Cherian <[email protected]>
Add device tree support to extcon-gpio driver.
Add devicetree binding documentation
--- .../devicetree/bindings/extcon/extcon-gpio.txt | 21 ++++++ drivers/extcon/extcon-gpio.c | 75 +++++++++++++++------- 2 files changed, 73 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-gpio.txt
Documentation/devicetree/bindings/extcon/extcon-gpio.txt new file +21 -0
@@ -0,0 +1,21 @@ +GPIO based EXTCON + +EXTCON GPIO +----------- + +Required Properties: + - compatible: should be: + * "linux,extcon-gpio" + - gpios: specifies the gpio pin used. + +Optional Properties: + - debounce: Debounce time for GPIO IRQ in ms + + +Eg: + + extcon1: am43_usbid_extcon1 { + compatible = "linux,extcon-gpio"; + gpios = <&gpio3 12 GPIO_ACTIVE_HIGH>; + debounce = <20>; + };
drivers/extcon/extcon-gpio.c +52 -23
121 lines not on this page · raw message
Signature · 6 lines
2.1.0.GIT -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/4 extcon: gpio: Always use gpio_get_value_cansleep
In reply to Felipe BalbiFrom: George Cherian <[email protected]>
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.
--- drivers/extcon/extcon-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/extcon/extcon-gpio.c +1 -1
@@ -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); }
Signature · 1 line
2.1.0.GIT
cover extcon: gpio: add DT support
Hi,
this series has been tested with v3.18-rc2 with a yet-to-be-released board (called X15). That board is DT-only and we use extcon-gpio to decide which USB mode should be used (host or peripheral).
George Cherian (4):
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 | 93 ++++++++++++++-------- 2 files changed, 84 insertions(+), 32 deletions(-) create mode 100644 Documentation/devicetree/bindings/extcon/extcon-gpio.txt
Signature · 1 line
2.1.0.GIT
PATCH 1/4 extcon: gpio: Convert the driver to use gpio desc API's
From: George Cherian <[email protected]>
Convert the driver to use gpiod_* API's.
--- drivers/extcon/extcon-gpio.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-)
drivers/extcon/extcon-gpio.c +6 -10
@@ -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,21 +103,20 @@ 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, + ret =gpiod_set_debounce (extcon_data->gpiod, pdata->debounce *1000 );if (ret <0 ) extcon_data->debounce_jiffies =
@@ -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;
Signature · 1 line
2.1.0.GIT
PATCH 4/4 extcon: gpio: Add support for using cable names
In reply to Felipe BalbiFrom: George Cherian <[email protected]>
Add support for using cable names. Enables other drivers to register interest and get notified using extcon provided notifier call backs.
--- Documentation/devicetree/bindings/extcon/extcon-gpio.txt | 2 ++ drivers/extcon/extcon-gpio.c | 4 ++++ 2 files changed, 6 insertions(+)
Documentation/devicetree/bindings/extcon/extcon-gpio.txt +2 -0
@@ -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"; };
drivers/extcon/extcon-gpio.c +4 -0
@@ -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)
@@ -112,6 +113,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 ;
Signature · 1 line
2.1.0.GIT
Re: [PATCH 4/4] extcon: gpio: Add support for using cable names
Quoted 7 lines · Felipe Balbi
From: George Cherian <[email protected]>
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 <[email protected]>Signed-off-by Sekhar Nori <[email protected]>
Quoted 53 lines
--- Documentation/devicetree/bindings/extcon/extcon-gpio.txt | 2 ++ drivers/extcon/extcon-gpio.c | 4 ++++ 2 files changed, 6 insertions(+)Documentation/devicetree/bindings/extcon/extcon-gpio.txt +2
-0@@ -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"; };drivers/extcon/extcon-gpio.c +4
-0@@ -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)@@ -112,6 +113,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 ;Signature · 7 lines
2.1.0.GIT -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Signature · 1 line
balbi
Re: [PATCH 1/4] extcon: gpio: Convert the driver to use gpio desc API's
In reply to Felipe BalbiQuoted 9 lines · Felipe Balbi
From: George Cherian <[email protected]>
Convert the driver to use gpiod_* API's.
Reviewed-by Roger Quadros <[email protected]>Signed-off-by George Cherian <[email protected]>Signed-off-by Sekhar Nori <[email protected]>Signed-off-by Felipe Balbi <[email protected]>---
I think it might be useful and appropriate to explain that and why you remove support for active-low pins, instead of hiding it in a seemingly unrelated patch.
Also, since you don't use the platform data flag anymore, you might as well remove it to give out-of-tree users a fair warning. Overall, it might be easier to just revert the patch introducing it (5bfbdc9caa7) before converting extcon to gpiod.
I am just glad that we stopped using extcon for other reasons ;-)
Guenter
Re: [PATCH 1/4] extcon: gpio: Convert the driver to use gpio desc API's
Quoted 11 lines · Guenter Roeck
Quoted 9 lines · Felipe Balbi
From: George Cherian <[email protected]>
Convert the driver to use gpiod_* API's.
Reviewed-by Roger Quadros <[email protected]>Signed-off-by George Cherian <[email protected]>Signed-off-by Sekhar Nori <[email protected]>Signed-off-by Felipe Balbi <[email protected]>---
Quoted 3 lines
I think it might be useful and appropriate to explain that and why you remove support for active-low pins, instead of hiding it in a seemingly unrelated patch.
removed ? why removed ? gpio descs handle that for you, read the source code.
Signature · 1 line
balbi
Re: [PATCH 1/4] extcon: gpio: Convert the driver to use gpio desc API's
Quoted 12 lines · Felipe Balbi
Quoted 11 lines · Guenter Roeck
Quoted 9 lines · Felipe Balbi
From: George Cherian <[email protected]>
Convert the driver to use gpiod_* API's.
Reviewed-by Roger Quadros <[email protected]>Signed-off-by George Cherian <[email protected]>Signed-off-by Sekhar Nori <[email protected]>Signed-off-by Felipe Balbi <[email protected]>---
Quoted 7 lines
Quoted 3 lines
I think it might be useful and appropriate to explain that and why you remove support for active-low pins, instead of hiding it in a seemingly unrelated patch.
removed ? why removed ? gpio descs handle that for you, read the source code.
Well, it for sure looks like it. Care to explain that in the patch, as well as how the platform data flag is used ?
Thanks,
Guenter
Re: [PATCH 1/4] extcon: gpio: Convert the driver to use gpio desc API's
Hi,
Quoted 17 lines · Guenter Roeck
Quoted 16 lines · Felipe Balbi
Quoted 14 lines · Guenter Roeck
Quoted 9 lines · Felipe Balbi
From: George Cherian <[email protected]>
Convert the driver to use gpiod_* API's.
Reviewed-by Roger Quadros <[email protected]>Signed-off-by George Cherian <[email protected]>Signed-off-by Sekhar Nori <[email protected]>Signed-off-by Felipe Balbi <[email protected]>---
I think it might be useful and appropriate to explain that and why you remove support for active-low pins, instead of hiding it in a seemingly unrelated patch.
Quoted 5 lines
Quoted 3 lines
removed ? why removed ? gpio descs handle that for you, read the source code.
Well, it for sure looks like it. Care to explain that in the patch, as well as how the platform data flag is used ?
I'll leave that to $author, I just cherry-picked and tested them. Certainly that commit log needs some love.
Signature · 1 line
balbi
Hi Felipe et al.
Another series was posted by removing the platform support.
https://lkml.org/lkml/2014/10/14/244
I guess I forgot to copy linux-omap.
Quoted 18 lines · Felipe Balbi
Hi,
this series has been tested with v3.18-rc2 with a yet-to-be-released board (called X15). That board is DT-only and we use extcon-gpio to decide which USB mode should be used (host or peripheral).
George Cherian (4):
extcon: gpio: Convert the driver to use gpio desc API's
extcon: gpio: Add dt support for the driver.
extcon: gpio: Always usegpio_get_value_cansleep
extcon: gpio: Add support for using cable names.../devicetree/bindings/extcon/extcon-gpio.txt | 23 ++++++ drivers/extcon/extcon-gpio.c | 93 ++++++++++++++-------- 2 files changed, 84 insertions(+), 32 deletions(-)create mode 100644
Documentation/devicetree/bindings/extcon/extcon-gpio.txt
Quoted 6 lines · George Cherian
Hi Felipe et al.
Another series was posted by removing the platform support.
https://lkml.org/lkml/2014/10/14/244I guess I forgot to copy linux-omap.
you do too many things in patch one. I wonder why you decided to combine three patches in one for that series.
Signature · 1 line
balbi
Quoted 9 lines · Felipe Balbi
Quoted 6 lines · George Cherian
Hi Felipe et al.
Another series was posted by removing the platform support.
https://lkml.org/lkml/2014/10/14/244I guess I forgot to copy linux-omap.
you do too many things in patch one. I wonder why you decided to combine three patches in one for that series.
Since there are no platform users for this driver. I am basically removing the whole platform data part from the driver. That is the reason i squashed 1 to 3 of the previous series.
I will resend the new series copying linux-omap now.
Quoted 8 lines · George Cherian
Quoted 6 lines · Felipe Balbi
Quoted 5 lines · George Cherian
Hi Felipe et al.
Another series was posted by removing the platform support.
https://lkml.org/lkml/2014/10/14/244
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
I guess I forgot to copy linux-omap.
you do too many things in patch one. I wonder why you decided to combine three patches in one for that series.
Since there are no platform users for this driver. I am basically removing the whole platform data part
from the driver. That is the reason i squashed 1 to 3 of the previous series.
I will resend the new series copying linux-omap now.
It doesn't make sense, however, to switch over to gpio descs, remove platform_data and add DT support all in one go.
Signature · 1 line
balbi