* [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-03-20 7:59 ` Baolin Wang 0 siblings, 0 replies; 12+ messages in thread From: Baolin Wang @ 2017-03-20 7:59 UTC (permalink / raw) To: myungjoo.ham, cw00.choi, robh+dt, mark.rutland Cc: broonie, baolin.wang, linaro-kernel, linux-kernel, devicetree Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID gpios' detection can be triggered by the level trigger on some platforms. Thus intoduce one property 'extcon-gpio,level-trigger' to identify this situation. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> --- .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt index dfc14f7..191504b 100644 --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt @@ -9,6 +9,9 @@ Required properties: Either one of id-gpio or vbus-gpio must be present. Both can be present as well. - id-gpio: gpio for USB ID pin. See gpio binding. - vbus-gpio: gpio for USB VBUS pin. +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to +level trigger. If not specified defaults to false, gpio's interrupt flag +defaults to edge trigger. Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below: extcon_usb1 { -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-03-20 7:59 ` Baolin Wang 0 siblings, 0 replies; 12+ messages in thread From: Baolin Wang @ 2017-03-20 7:59 UTC (permalink / raw) To: myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ, cw00.choi-Sze3O3UU22JBDgjK7y7TUQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8 Cc: broonie-DgEjT+Ai2ygdnm+yROfE0A, baolin.wang-QSEj5FYQhm4dnm+yROfE0A, linaro-kernel-cunTk1MwBs8s++Sfvej+rw, linux-kernel-u79uwXL29TY76Z2rM5mHXA, devicetree-u79uwXL29TY76Z2rM5mHXA Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID gpios' detection can be triggered by the level trigger on some platforms. Thus intoduce one property 'extcon-gpio,level-trigger' to identify this situation. Signed-off-by: Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> --- .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt index dfc14f7..191504b 100644 --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt @@ -9,6 +9,9 @@ Required properties: Either one of id-gpio or vbus-gpio must be present. Both can be present as well. - id-gpio: gpio for USB ID pin. See gpio binding. - vbus-gpio: gpio for USB VBUS pin. +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to +level trigger. If not specified defaults to false, gpio's interrupt flag +defaults to edge trigger. Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below: extcon_usb1 { -- 1.7.9.5 -- 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] 12+ messages in thread
* [PATCH 2/2] extcon: usb-gpio: Add the GPIO level trigger support 2017-03-20 7:59 ` Baolin Wang (?) @ 2017-03-20 7:59 ` Baolin Wang -1 siblings, 0 replies; 12+ messages in thread From: Baolin Wang @ 2017-03-20 7:59 UTC (permalink / raw) To: myungjoo.ham, cw00.choi, robh+dt, mark.rutland Cc: broonie, baolin.wang, linaro-kernel, linux-kernel, devicetree GPIOs may need level trigger to detect VBUS/ID on some platforms, thus we should add GPIO level trigger to support this situation. Signed-off-by: Baolin Wang <baolin.wang@linaro.org> --- drivers/extcon/extcon-usb-gpio.c | 81 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 77 insertions(+), 4 deletions(-) diff --git a/drivers/extcon/extcon-usb-gpio.c b/drivers/extcon/extcon-usb-gpio.c index a5e1882..cc89e25 100644 --- a/drivers/extcon/extcon-usb-gpio.c +++ b/drivers/extcon/extcon-usb-gpio.c @@ -39,6 +39,8 @@ struct usb_extcon_info { struct gpio_desc *vbus_gpiod; int id_irq; int vbus_irq; + int level_trigger; + int trigger_irq; unsigned long debounce_jiffies; struct delayed_work wq_detcable; @@ -70,6 +72,7 @@ struct usb_extcon_info { static void usb_extcon_detect_cable(struct work_struct *work) { int id, vbus; + unsigned int trigger; struct usb_extcon_info *info = container_of(to_delayed_work(work), struct usb_extcon_info, wq_detcable); @@ -80,6 +83,53 @@ static void usb_extcon_detect_cable(struct work_struct *work) vbus = info->vbus_gpiod ? gpiod_get_value_cansleep(info->vbus_gpiod) : id; + if (info->level_trigger) { + if (info->trigger_irq == info->id_irq && info->id_gpiod) { + trigger = irqd_get_trigger_type( + irq_get_irq_data(info->id_irq)); + + /* Ignore incorrect ID trigger */ + if (((trigger & IRQF_TRIGGER_LOW) && (id > 0)) || + ((trigger & IRQF_TRIGGER_HIGH) && (id == 0))) { + enable_irq(info->id_irq); + return; + } + + if (id) { + trigger &= ~IRQF_TRIGGER_HIGH; + trigger |= IRQF_TRIGGER_LOW; + } else { + trigger &= ~IRQF_TRIGGER_LOW; + trigger |= IRQF_TRIGGER_HIGH; + } + + irq_set_irq_type(info->id_irq, trigger); + enable_irq(info->id_irq); + } else if (info->trigger_irq == info->vbus_irq && + info->vbus_gpiod) { + trigger = irqd_get_trigger_type( + irq_get_irq_data(info->vbus_irq)); + + /* Ignore incorrect VBUS trigger */ + if (((trigger & IRQF_TRIGGER_LOW) && (vbus > 0)) || + ((trigger & IRQF_TRIGGER_HIGH) && (vbus == 0))) { + enable_irq(info->vbus_irq); + return; + } + + if (vbus) { + trigger &= ~IRQF_TRIGGER_HIGH; + trigger |= IRQF_TRIGGER_LOW; + } else { + trigger &= ~IRQF_TRIGGER_LOW; + trigger |= IRQF_TRIGGER_HIGH; + } + + irq_set_irq_type(info->vbus_irq, trigger); + enable_irq(info->vbus_irq); + } + } + /* at first we clean states which are no longer active */ if (id) extcon_set_state_sync(info->edev, EXTCON_USB_HOST, false); @@ -98,6 +148,11 @@ static irqreturn_t usb_irq_handler(int irq, void *dev_id) { struct usb_extcon_info *info = dev_id; + if (info->level_trigger) { + info->trigger_irq = irq; + disable_irq_nosync(irq); + } + queue_delayed_work(system_power_efficient_wq, &info->wq_detcable, info->debounce_jiffies); @@ -109,7 +164,9 @@ static int usb_extcon_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; struct usb_extcon_info *info; + unsigned long id_irqflags, vbus_irqflags; int ret; + int id_active_low, vbus_active_low; if (!np && !ACPI_HANDLE(dev)) return -EINVAL; @@ -134,6 +191,14 @@ static int usb_extcon_probe(struct platform_device *pdev) if (IS_ERR(info->vbus_gpiod)) return PTR_ERR(info->vbus_gpiod); + info->level_trigger = of_property_read_bool(np, + "extcon-gpio,level-trigger"); + info->trigger_irq = -1; + id_active_low = info->id_gpiod ? + gpiod_is_active_low(info->id_gpiod) : 0; + vbus_active_low = info->vbus_gpiod ? + gpiod_is_active_low(info->vbus_gpiod) : 0; + info->edev = devm_extcon_dev_allocate(dev, usb_extcon_cable); if (IS_ERR(info->edev)) { dev_err(dev, "failed to allocate extcon device\n"); @@ -158,6 +223,16 @@ static int usb_extcon_probe(struct platform_device *pdev) INIT_DELAYED_WORK(&info->wq_detcable, usb_extcon_detect_cable); + if (info->level_trigger) { + id_irqflags = id_active_low ? + IRQF_TRIGGER_HIGH : IRQF_TRIGGER_LOW; + vbus_irqflags = vbus_active_low ? + IRQF_TRIGGER_LOW : IRQF_TRIGGER_HIGH; + } else { + id_irqflags = vbus_irqflags = IRQF_TRIGGER_RISING | + IRQF_TRIGGER_FALLING; + } + if (info->id_gpiod) { info->id_irq = gpiod_to_irq(info->id_gpiod); if (info->id_irq < 0) { @@ -167,8 +242,7 @@ static int usb_extcon_probe(struct platform_device *pdev) ret = devm_request_threaded_irq(dev, info->id_irq, NULL, usb_irq_handler, - IRQF_TRIGGER_RISING | - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + id_irqflags | IRQF_ONESHOT, pdev->name, info); if (ret < 0) { dev_err(dev, "failed to request handler for ID IRQ\n"); @@ -185,8 +259,7 @@ static int usb_extcon_probe(struct platform_device *pdev) ret = devm_request_threaded_irq(dev, info->vbus_irq, NULL, usb_irq_handler, - IRQF_TRIGGER_RISING | - IRQF_TRIGGER_FALLING | IRQF_ONESHOT, + vbus_irqflags | IRQF_ONESHOT, pdev->name, info); if (ret < 0) { dev_err(dev, "failed to request handler for VBUS IRQ\n"); -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] extcon: usb-gpio: Add level trigger support 2017-03-20 7:59 ` Baolin Wang (?) (?) @ 2017-03-24 11:08 ` Chanwoo Choi 2017-03-24 11:56 ` Baolin Wang -1 siblings, 1 reply; 12+ messages in thread From: Chanwoo Choi @ 2017-03-24 11:08 UTC (permalink / raw) To: Baolin Wang, myungjoo.ham, robh+dt, mark.rutland Cc: broonie, linaro-kernel, linux-kernel, devicetree Hi, On 2017년 03월 20일 16:59, Baolin Wang wrote: > Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID > gpios' detection can be triggered by the level trigger on some platforms. > Thus intoduce one property 'extcon-gpio,level-trigger' to identify this > situation. > > Signed-off-by: Baolin Wang <baolin.wang@linaro.org> > --- > .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt > index dfc14f7..191504b 100644 > --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt > +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt > @@ -9,6 +9,9 @@ Required properties: > Either one of id-gpio or vbus-gpio must be present. Both can be present as well. > - id-gpio: gpio for USB ID pin. See gpio binding. > - vbus-gpio: gpio for USB VBUS pin. > +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to It is 'extcon-usb-gpio' instead of 'extcon-gpio'. > +level trigger. If not specified defaults to false, gpio's interrupt flag > +defaults to edge trigger. I understand why you need the new flag. But, I'm not sure it is right way to add the new flag for interrupt flag. IMHO, I think that we need to find the more proper way to get the interrupt flag or maybe, we may need to implement the new helper api to get the interrupt flag for gpio pin when we use the gpio as the interrupt source, > > Example: Examples of extcon-usb-gpio node in dra7-evm.dts as listed below: > extcon_usb1 { > -- Best Regards, Chanwoo Choi Samsung Electronics ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-03-24 11:56 ` Baolin Wang 0 siblings, 0 replies; 12+ messages in thread From: Baolin Wang @ 2017-03-24 11:56 UTC (permalink / raw) To: Chanwoo Choi Cc: myungjoo.ham, robh+dt, Mark Rutland, Mark Brown, Linaro Kernel Mailman List, LKML, devicetree Hi, On 24 March 2017 at 19:08, Chanwoo Choi <cw00.choi@samsung.com> wrote: > Hi, > > On 2017년 03월 20일 16:59, Baolin Wang wrote: >> Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID >> gpios' detection can be triggered by the level trigger on some platforms. >> Thus intoduce one property 'extcon-gpio,level-trigger' to identify this >> situation. >> >> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> >> --- >> .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >> index dfc14f7..191504b 100644 >> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >> @@ -9,6 +9,9 @@ Required properties: >> Either one of id-gpio or vbus-gpio must be present. Both can be present as well. >> - id-gpio: gpio for USB ID pin. See gpio binding. >> - vbus-gpio: gpio for USB VBUS pin. >> +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to > > It is 'extcon-usb-gpio' instead of 'extcon-gpio'. Sure. > >> +level trigger. If not specified defaults to false, gpio's interrupt flag >> +defaults to edge trigger. > > I understand why you need the new flag. > But, I'm not sure it is right way to add the new flag for interrupt flag. > > IMHO, I think that we need to find the more proper way to get the interrupt flag > or maybe, we may need to implement the new helper api to get the interrupt > flag for gpio pin when we use the gpio as the interrupt source, Yes, I agree with you. We already have helper functions to get interrupt flag from device tree, but we can not get the irq number of GPIO to configure in device tree, then I introduce one new flag to indicate the trigger type. But I like to change the patch if there are any good suggestion. Thanks. -- Baolin.wang Best Regards ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-03-24 11:56 ` Baolin Wang 0 siblings, 0 replies; 12+ messages in thread From: Baolin Wang @ 2017-03-24 11:56 UTC (permalink / raw) To: Chanwoo Choi Cc: myungjoo.ham-Sze3O3UU22JBDgjK7y7TUQ, robh+dt-DgEjT+Ai2ygdnm+yROfE0A, Mark Rutland, Mark Brown, Linaro Kernel Mailman List, LKML, devicetree-u79uwXL29TY76Z2rM5mHXA Hi, On 24 March 2017 at 19:08, Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: > Hi, > > On 2017년 03월 20일 16:59, Baolin Wang wrote: >> Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID >> gpios' detection can be triggered by the level trigger on some platforms. >> Thus intoduce one property 'extcon-gpio,level-trigger' to identify this >> situation. >> >> Signed-off-by: Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> >> --- >> .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >> index dfc14f7..191504b 100644 >> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >> @@ -9,6 +9,9 @@ Required properties: >> Either one of id-gpio or vbus-gpio must be present. Both can be present as well. >> - id-gpio: gpio for USB ID pin. See gpio binding. >> - vbus-gpio: gpio for USB VBUS pin. >> +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to > > It is 'extcon-usb-gpio' instead of 'extcon-gpio'. Sure. > >> +level trigger. If not specified defaults to false, gpio's interrupt flag >> +defaults to edge trigger. > > I understand why you need the new flag. > But, I'm not sure it is right way to add the new flag for interrupt flag. > > IMHO, I think that we need to find the more proper way to get the interrupt flag > or maybe, we may need to implement the new helper api to get the interrupt > flag for gpio pin when we use the gpio as the interrupt source, Yes, I agree with you. We already have helper functions to get interrupt flag from device tree, but we can not get the irq number of GPIO to configure in device tree, then I introduce one new flag to indicate the trigger type. But I like to change the patch if there are any good suggestion. Thanks. -- Baolin.wang Best Regards -- 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] 12+ messages in thread
* Re: [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-03-24 12:41 ` Rob Herring 0 siblings, 0 replies; 12+ messages in thread From: Rob Herring @ 2017-03-24 12:41 UTC (permalink / raw) To: Baolin Wang Cc: Chanwoo Choi, MyungJoo Ham, Mark Rutland, Mark Brown, Linaro Kernel Mailman List, LKML, devicetree On Fri, Mar 24, 2017 at 6:56 AM, Baolin Wang <baolin.wang@linaro.org> wrote: > Hi, > > On 24 March 2017 at 19:08, Chanwoo Choi <cw00.choi@samsung.com> wrote: >> Hi, >> >> On 2017년 03월 20일 16:59, Baolin Wang wrote: >>> Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID >>> gpios' detection can be triggered by the level trigger on some platforms. >>> Thus intoduce one property 'extcon-gpio,level-trigger' to identify this >>> situation. >>> >>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> >>> --- >>> .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>> index dfc14f7..191504b 100644 >>> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>> @@ -9,6 +9,9 @@ Required properties: >>> Either one of id-gpio or vbus-gpio must be present. Both can be present as well. >>> - id-gpio: gpio for USB ID pin. See gpio binding. >>> - vbus-gpio: gpio for USB VBUS pin. >>> +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to >> >> It is 'extcon-usb-gpio' instead of 'extcon-gpio'. > > Sure. "extcon-gpio" is not a vendor, so don't make it a vendor prefix. >>> +level trigger. If not specified defaults to false, gpio's interrupt flag >>> +defaults to edge trigger. >> >> I understand why you need the new flag. >> But, I'm not sure it is right way to add the new flag for interrupt flag. >> >> IMHO, I think that we need to find the more proper way to get the interrupt flag >> or maybe, we may need to implement the new helper api to get the interrupt >> flag for gpio pin when we use the gpio as the interrupt source, > > Yes, I agree with you. We already have helper functions to get > interrupt flag from device tree, but we can not get the irq number of > GPIO to configure in device tree, then I introduce one new flag to > indicate the trigger type. But I like to change the patch if there are > any good suggestion. Thanks. The extcon binding needs an overhaul in general. I'm not going to take extensions to a broken binding. What's needed is a USB connector binding like we have for HDMI and other video connectors. And for USB-C, those need to be combined. Rob ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-03-24 12:41 ` Rob Herring 0 siblings, 0 replies; 12+ messages in thread From: Rob Herring @ 2017-03-24 12:41 UTC (permalink / raw) To: Baolin Wang Cc: Chanwoo Choi, MyungJoo Ham, Mark Rutland, Mark Brown, Linaro Kernel Mailman List, LKML, devicetree-u79uwXL29TY76Z2rM5mHXA On Fri, Mar 24, 2017 at 6:56 AM, Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote: > Hi, > > On 24 March 2017 at 19:08, Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: >> Hi, >> >> On 2017년 03월 20일 16:59, Baolin Wang wrote: >>> Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID >>> gpios' detection can be triggered by the level trigger on some platforms. >>> Thus intoduce one property 'extcon-gpio,level-trigger' to identify this >>> situation. >>> >>> Signed-off-by: Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> >>> --- >>> .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>> index dfc14f7..191504b 100644 >>> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>> @@ -9,6 +9,9 @@ Required properties: >>> Either one of id-gpio or vbus-gpio must be present. Both can be present as well. >>> - id-gpio: gpio for USB ID pin. See gpio binding. >>> - vbus-gpio: gpio for USB VBUS pin. >>> +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to >> >> It is 'extcon-usb-gpio' instead of 'extcon-gpio'. > > Sure. "extcon-gpio" is not a vendor, so don't make it a vendor prefix. >>> +level trigger. If not specified defaults to false, gpio's interrupt flag >>> +defaults to edge trigger. >> >> I understand why you need the new flag. >> But, I'm not sure it is right way to add the new flag for interrupt flag. >> >> IMHO, I think that we need to find the more proper way to get the interrupt flag >> or maybe, we may need to implement the new helper api to get the interrupt >> flag for gpio pin when we use the gpio as the interrupt source, > > Yes, I agree with you. We already have helper functions to get > interrupt flag from device tree, but we can not get the irq number of > GPIO to configure in device tree, then I introduce one new flag to > indicate the trigger type. But I like to change the patch if there are > any good suggestion. Thanks. The extcon binding needs an overhaul in general. I'm not going to take extensions to a broken binding. What's needed is a USB connector binding like we have for HDMI and other video connectors. And for USB-C, those need to be combined. Rob -- 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] 12+ messages in thread
* Re: [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-03-29 6:08 ` Baolin Wang 0 siblings, 0 replies; 12+ messages in thread From: Baolin Wang @ 2017-03-29 6:08 UTC (permalink / raw) To: Rob Herring Cc: Chanwoo Choi, MyungJoo Ham, Mark Rutland, Mark Brown, Linaro Kernel Mailman List, LKML, devicetree Hi, On 24 March 2017 at 20:41, Rob Herring <robh+dt@kernel.org> wrote: > On Fri, Mar 24, 2017 at 6:56 AM, Baolin Wang <baolin.wang@linaro.org> wrote: >> Hi, >> >> On 24 March 2017 at 19:08, Chanwoo Choi <cw00.choi@samsung.com> wrote: >>> Hi, >>> >>> On 2017년 03월 20일 16:59, Baolin Wang wrote: >>>> Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID >>>> gpios' detection can be triggered by the level trigger on some platforms. >>>> Thus intoduce one property 'extcon-gpio,level-trigger' to identify this >>>> situation. >>>> >>>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> >>>> --- >>>> .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ >>>> 1 file changed, 3 insertions(+) >>>> >>>> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>> index dfc14f7..191504b 100644 >>>> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>> @@ -9,6 +9,9 @@ Required properties: >>>> Either one of id-gpio or vbus-gpio must be present. Both can be present as well. >>>> - id-gpio: gpio for USB ID pin. See gpio binding. >>>> - vbus-gpio: gpio for USB VBUS pin. >>>> +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to >>> >>> It is 'extcon-usb-gpio' instead of 'extcon-gpio'. >> >> Sure. > > "extcon-gpio" is not a vendor, so don't make it a vendor prefix. OK. > >>>> +level trigger. If not specified defaults to false, gpio's interrupt flag >>>> +defaults to edge trigger. >>> >>> I understand why you need the new flag. >>> But, I'm not sure it is right way to add the new flag for interrupt flag. >>> >>> IMHO, I think that we need to find the more proper way to get the interrupt flag >>> or maybe, we may need to implement the new helper api to get the interrupt >>> flag for gpio pin when we use the gpio as the interrupt source, >> >> Yes, I agree with you. We already have helper functions to get >> interrupt flag from device tree, but we can not get the irq number of >> GPIO to configure in device tree, then I introduce one new flag to >> indicate the trigger type. But I like to change the patch if there are >> any good suggestion. Thanks. > > The extcon binding needs an overhaul in general. I'm not going to take > extensions to a broken binding. What's needed is a USB connector > binding like we have for HDMI and other video connectors. And for > USB-C, those need to be combined. I am not sure I understand your points correctly, could you elaborate on how to modify for extcon? Thanks. -- Baolin.wang Best Regards ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-03-29 6:08 ` Baolin Wang 0 siblings, 0 replies; 12+ messages in thread From: Baolin Wang @ 2017-03-29 6:08 UTC (permalink / raw) To: Rob Herring Cc: Chanwoo Choi, MyungJoo Ham, Mark Rutland, Mark Brown, Linaro Kernel Mailman List, LKML, devicetree-u79uwXL29TY76Z2rM5mHXA Hi, On 24 March 2017 at 20:41, Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: > On Fri, Mar 24, 2017 at 6:56 AM, Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote: >> Hi, >> >> On 24 March 2017 at 19:08, Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: >>> Hi, >>> >>> On 2017년 03월 20일 16:59, Baolin Wang wrote: >>>> Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID >>>> gpios' detection can be triggered by the level trigger on some platforms. >>>> Thus intoduce one property 'extcon-gpio,level-trigger' to identify this >>>> situation. >>>> >>>> Signed-off-by: Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> >>>> --- >>>> .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ >>>> 1 file changed, 3 insertions(+) >>>> >>>> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>> index dfc14f7..191504b 100644 >>>> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>> @@ -9,6 +9,9 @@ Required properties: >>>> Either one of id-gpio or vbus-gpio must be present. Both can be present as well. >>>> - id-gpio: gpio for USB ID pin. See gpio binding. >>>> - vbus-gpio: gpio for USB VBUS pin. >>>> +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to >>> >>> It is 'extcon-usb-gpio' instead of 'extcon-gpio'. >> >> Sure. > > "extcon-gpio" is not a vendor, so don't make it a vendor prefix. OK. > >>>> +level trigger. If not specified defaults to false, gpio's interrupt flag >>>> +defaults to edge trigger. >>> >>> I understand why you need the new flag. >>> But, I'm not sure it is right way to add the new flag for interrupt flag. >>> >>> IMHO, I think that we need to find the more proper way to get the interrupt flag >>> or maybe, we may need to implement the new helper api to get the interrupt >>> flag for gpio pin when we use the gpio as the interrupt source, >> >> Yes, I agree with you. We already have helper functions to get >> interrupt flag from device tree, but we can not get the irq number of >> GPIO to configure in device tree, then I introduce one new flag to >> indicate the trigger type. But I like to change the patch if there are >> any good suggestion. Thanks. > > The extcon binding needs an overhaul in general. I'm not going to take > extensions to a broken binding. What's needed is a USB connector > binding like we have for HDMI and other video connectors. And for > USB-C, those need to be combined. I am not sure I understand your points correctly, could you elaborate on how to modify for extcon? Thanks. -- Baolin.wang Best Regards -- 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] 12+ messages in thread
* Re: [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-05-03 10:56 ` Baolin Wang 0 siblings, 0 replies; 12+ messages in thread From: Baolin Wang @ 2017-05-03 10:56 UTC (permalink / raw) To: Rob Herring Cc: Chanwoo Choi, MyungJoo Ham, Mark Rutland, Mark Brown, Linaro Kernel Mailman List, LKML, devicetree Hi Rob, On 29 March 2017 at 14:08, Baolin Wang <baolin.wang@linaro.org> wrote: > Hi, > > On 24 March 2017 at 20:41, Rob Herring <robh+dt@kernel.org> wrote: >> On Fri, Mar 24, 2017 at 6:56 AM, Baolin Wang <baolin.wang@linaro.org> wrote: >>> Hi, >>> >>> On 24 March 2017 at 19:08, Chanwoo Choi <cw00.choi@samsung.com> wrote: >>>> Hi, >>>> >>>> On 2017년 03월 20일 16:59, Baolin Wang wrote: >>>>> Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID >>>>> gpios' detection can be triggered by the level trigger on some platforms. >>>>> Thus intoduce one property 'extcon-gpio,level-trigger' to identify this >>>>> situation. >>>>> >>>>> Signed-off-by: Baolin Wang <baolin.wang@linaro.org> >>>>> --- >>>>> .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ >>>>> 1 file changed, 3 insertions(+) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>>> index dfc14f7..191504b 100644 >>>>> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>>> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>>> @@ -9,6 +9,9 @@ Required properties: >>>>> Either one of id-gpio or vbus-gpio must be present. Both can be present as well. >>>>> - id-gpio: gpio for USB ID pin. See gpio binding. >>>>> - vbus-gpio: gpio for USB VBUS pin. >>>>> +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to >>>> >>>> It is 'extcon-usb-gpio' instead of 'extcon-gpio'. >>> >>> Sure. >> >> "extcon-gpio" is not a vendor, so don't make it a vendor prefix. > > OK. > >> >>>>> +level trigger. If not specified defaults to false, gpio's interrupt flag >>>>> +defaults to edge trigger. >>>> >>>> I understand why you need the new flag. >>>> But, I'm not sure it is right way to add the new flag for interrupt flag. >>>> >>>> IMHO, I think that we need to find the more proper way to get the interrupt flag >>>> or maybe, we may need to implement the new helper api to get the interrupt >>>> flag for gpio pin when we use the gpio as the interrupt source, >>> >>> Yes, I agree with you. We already have helper functions to get >>> interrupt flag from device tree, but we can not get the irq number of >>> GPIO to configure in device tree, then I introduce one new flag to >>> indicate the trigger type. But I like to change the patch if there are >>> any good suggestion. Thanks. >> >> The extcon binding needs an overhaul in general. I'm not going to take >> extensions to a broken binding. What's needed is a USB connector >> binding like we have for HDMI and other video connectors. And for >> USB-C, those need to be combined. Could you elaborate on how to make an overhaul for the extcon binding? I can help to do that and then we can consider to modify my patch. Thanks. > > I am not sure I understand your points correctly, could you elaborate > on how to modify for extcon? Thanks. > > -- > Baolin.wang > Best Regards -- Baolin.wang Best Regards ^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH 1/2] extcon: usb-gpio: Add level trigger support @ 2017-05-03 10:56 ` Baolin Wang 0 siblings, 0 replies; 12+ messages in thread From: Baolin Wang @ 2017-05-03 10:56 UTC (permalink / raw) To: Rob Herring Cc: Chanwoo Choi, MyungJoo Ham, Mark Rutland, Mark Brown, Linaro Kernel Mailman List, LKML, devicetree-u79uwXL29TY76Z2rM5mHXA Hi Rob, On 29 March 2017 at 14:08, Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote: > Hi, > > On 24 March 2017 at 20:41, Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> wrote: >> On Fri, Mar 24, 2017 at 6:56 AM, Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote: >>> Hi, >>> >>> On 24 March 2017 at 19:08, Chanwoo Choi <cw00.choi-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> wrote: >>>> Hi, >>>> >>>> On 2017년 03월 20일 16:59, Baolin Wang wrote: >>>>> Now extcon-usb-gpio only supports for GPIO egdge trigger, but VBUS/ID >>>>> gpios' detection can be triggered by the level trigger on some platforms. >>>>> Thus intoduce one property 'extcon-gpio,level-trigger' to identify this >>>>> situation. >>>>> >>>>> Signed-off-by: Baolin Wang <baolin.wang-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> >>>>> --- >>>>> .../devicetree/bindings/extcon/extcon-usb-gpio.txt | 3 +++ >>>>> 1 file changed, 3 insertions(+) >>>>> >>>>> diff --git a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>>> index dfc14f7..191504b 100644 >>>>> --- a/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>>> +++ b/Documentation/devicetree/bindings/extcon/extcon-usb-gpio.txt >>>>> @@ -9,6 +9,9 @@ Required properties: >>>>> Either one of id-gpio or vbus-gpio must be present. Both can be present as well. >>>>> - id-gpio: gpio for USB ID pin. See gpio binding. >>>>> - vbus-gpio: gpio for USB VBUS pin. >>>>> +- extcon-gpio,level-trigger: Boolean, set this gpio's interrupt flag to >>>> >>>> It is 'extcon-usb-gpio' instead of 'extcon-gpio'. >>> >>> Sure. >> >> "extcon-gpio" is not a vendor, so don't make it a vendor prefix. > > OK. > >> >>>>> +level trigger. If not specified defaults to false, gpio's interrupt flag >>>>> +defaults to edge trigger. >>>> >>>> I understand why you need the new flag. >>>> But, I'm not sure it is right way to add the new flag for interrupt flag. >>>> >>>> IMHO, I think that we need to find the more proper way to get the interrupt flag >>>> or maybe, we may need to implement the new helper api to get the interrupt >>>> flag for gpio pin when we use the gpio as the interrupt source, >>> >>> Yes, I agree with you. We already have helper functions to get >>> interrupt flag from device tree, but we can not get the irq number of >>> GPIO to configure in device tree, then I introduce one new flag to >>> indicate the trigger type. But I like to change the patch if there are >>> any good suggestion. Thanks. >> >> The extcon binding needs an overhaul in general. I'm not going to take >> extensions to a broken binding. What's needed is a USB connector >> binding like we have for HDMI and other video connectors. And for >> USB-C, those need to be combined. Could you elaborate on how to make an overhaul for the extcon binding? I can help to do that and then we can consider to modify my patch. Thanks. > > I am not sure I understand your points correctly, could you elaborate > on how to modify for extcon? Thanks. > > -- > Baolin.wang > Best Regards -- Baolin.wang Best Regards -- 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] 12+ messages in thread
end of thread, other threads:[~2017-05-03 10:56 UTC | newest] Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <CGME20170320080127epcas1p120786738dd2e3cd371bf6410d5f2b3a6@epcas1p1.samsung.com> 2017-03-20 7:59 ` [PATCH 1/2] extcon: usb-gpio: Add level trigger support Baolin Wang 2017-03-20 7:59 ` Baolin Wang 2017-03-20 7:59 ` [PATCH 2/2] extcon: usb-gpio: Add the GPIO " Baolin Wang 2017-03-24 11:08 ` [PATCH 1/2] extcon: usb-gpio: Add " Chanwoo Choi 2017-03-24 11:56 ` Baolin Wang 2017-03-24 11:56 ` Baolin Wang 2017-03-24 12:41 ` Rob Herring 2017-03-24 12:41 ` Rob Herring 2017-03-29 6:08 ` Baolin Wang 2017-03-29 6:08 ` Baolin Wang 2017-05-03 10:56 ` Baolin Wang 2017-05-03 10:56 ` Baolin Wang
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.