From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roger Quadros Subject: Re: [PATCH v2 1/2] extcon: palmas: Support GPIO based USB ID detection Date: Fri, 31 Jul 2015 12:05:02 +0300 Message-ID: <55BB3A3E.7040606@ti.com> References: <1438002617-15152-1-git-send-email-rogerq@ti.com> <1438002617-15152-2-git-send-email-rogerq@ti.com> <55BB27D3.8040209@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <55BB27D3.8040209@samsung.com> Sender: linux-kernel-owner@vger.kernel.org To: Chanwoo Choi Cc: myungjoo.ham@samsung.com, tony@atomide.com, nm@ti.com, balbi@ti.com, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: linux-omap@vger.kernel.org Hi Chanwoo, On 31/07/15 10:46, Chanwoo Choi wrote: > Hi Roger, > > When I apply it for build test, merge conflict happen. > So, I recommend that you rebase this patchset on extcon-next branch. Alright. > > On 07/27/2015 10:10 PM, Roger Quadros wrote: >> Some palmas based chip variants do not have OTG based ID logic. >> For these variants we rely on GPIO based USB ID detection. >> >> These chips do have VBUS comparator for VBUS detection so we >> continue to use the old way of detecting VBUS. >> >> Signed-off-by: Roger Quadros >> --- >> .../devicetree/bindings/extcon/extcon-palmas.txt | 5 +- >> drivers/extcon/extcon-palmas.c | 114 ++++++++++++++++++--- >> include/linux/mfd/palmas.h | 6 ++ >> 3 files changed, 109 insertions(+), 16 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt >> index 45414bb..f61d5af 100644 >> --- a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt >> +++ b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt >> @@ -10,8 +10,11 @@ Required Properties: >> >> Optional Properties: >> - ti,wakeup : To enable the wakeup comparator in probe >> - - ti,enable-id-detection: Perform ID detection. >> + - ti,enable-id-detection: Perform ID detection. If id-gpio is specified >> + it performs id-detection using GPIO else using OTG core. >> - ti,enable-vbus-detection: Perform VBUS detection. >> + - id-gpio: gpio for GPIO ID detection. See gpio binding. >> + - debounce-delay-ms: debounce delay for GPIO ID pin in milliseconds. >> >> palmas-usb { >> compatible = "ti,twl6035-usb", "ti,palmas-usb"; >> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c >> index 080d5cc..d0ed764 100644 >> --- a/drivers/extcon/extcon-palmas.c >> +++ b/drivers/extcon/extcon-palmas.c >> @@ -28,6 +28,9 @@ >> #include >> #include >> #include >> +#include >> + >> +#define USB_GPIO_DEBOUNCE_MS 20 /* ms */ >> >> static const unsigned int palmas_extcon_cable[] = { >> EXTCON_USB, >> @@ -120,19 +123,52 @@ static irqreturn_t palmas_id_irq_handler(int irq, void *_palmas_usb) >> return IRQ_HANDLED; >> } >> >> +static void palmas_gpio_id_detect(struct palmas_usb *palmas_usb) >> +{ >> + int id; >> + >> + if (!palmas_usb->id_gpiod) >> + return; >> + >> + id = gpiod_get_value_cansleep(palmas_usb->id_gpiod); >> + >> + if (id) { >> + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", false); > > Use the extcon_set_cable_state_() because extcon_set_cable_state() with cable name > is deprecated. OK. cheers, -roger > >> + dev_info(palmas_usb->dev, "USB-HOST cable is detached\n"); >> + } else { >> + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", true); > > ditto. Use the extcon_set_cable_state_() with extcon id. > > [snip] > > Thanks, > Chanwoo Choi > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752510AbbGaJFN (ORCPT ); Fri, 31 Jul 2015 05:05:13 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:52380 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750977AbbGaJFL (ORCPT ); Fri, 31 Jul 2015 05:05:11 -0400 Message-ID: <55BB3A3E.7040606@ti.com> Date: Fri, 31 Jul 2015 12:05:02 +0300 From: Roger Quadros User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: Chanwoo Choi CC: , , , , , Subject: Re: [PATCH v2 1/2] extcon: palmas: Support GPIO based USB ID detection References: <1438002617-15152-1-git-send-email-rogerq@ti.com> <1438002617-15152-2-git-send-email-rogerq@ti.com> <55BB27D3.8040209@samsung.com> In-Reply-To: <55BB27D3.8040209@samsung.com> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chanwoo, On 31/07/15 10:46, Chanwoo Choi wrote: > Hi Roger, > > When I apply it for build test, merge conflict happen. > So, I recommend that you rebase this patchset on extcon-next branch. Alright. > > On 07/27/2015 10:10 PM, Roger Quadros wrote: >> Some palmas based chip variants do not have OTG based ID logic. >> For these variants we rely on GPIO based USB ID detection. >> >> These chips do have VBUS comparator for VBUS detection so we >> continue to use the old way of detecting VBUS. >> >> Signed-off-by: Roger Quadros >> --- >> .../devicetree/bindings/extcon/extcon-palmas.txt | 5 +- >> drivers/extcon/extcon-palmas.c | 114 ++++++++++++++++++--- >> include/linux/mfd/palmas.h | 6 ++ >> 3 files changed, 109 insertions(+), 16 deletions(-) >> >> diff --git a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt >> index 45414bb..f61d5af 100644 >> --- a/Documentation/devicetree/bindings/extcon/extcon-palmas.txt >> +++ b/Documentation/devicetree/bindings/extcon/extcon-palmas.txt >> @@ -10,8 +10,11 @@ Required Properties: >> >> Optional Properties: >> - ti,wakeup : To enable the wakeup comparator in probe >> - - ti,enable-id-detection: Perform ID detection. >> + - ti,enable-id-detection: Perform ID detection. If id-gpio is specified >> + it performs id-detection using GPIO else using OTG core. >> - ti,enable-vbus-detection: Perform VBUS detection. >> + - id-gpio: gpio for GPIO ID detection. See gpio binding. >> + - debounce-delay-ms: debounce delay for GPIO ID pin in milliseconds. >> >> palmas-usb { >> compatible = "ti,twl6035-usb", "ti,palmas-usb"; >> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c >> index 080d5cc..d0ed764 100644 >> --- a/drivers/extcon/extcon-palmas.c >> +++ b/drivers/extcon/extcon-palmas.c >> @@ -28,6 +28,9 @@ >> #include >> #include >> #include >> +#include >> + >> +#define USB_GPIO_DEBOUNCE_MS 20 /* ms */ >> >> static const unsigned int palmas_extcon_cable[] = { >> EXTCON_USB, >> @@ -120,19 +123,52 @@ static irqreturn_t palmas_id_irq_handler(int irq, void *_palmas_usb) >> return IRQ_HANDLED; >> } >> >> +static void palmas_gpio_id_detect(struct palmas_usb *palmas_usb) >> +{ >> + int id; >> + >> + if (!palmas_usb->id_gpiod) >> + return; >> + >> + id = gpiod_get_value_cansleep(palmas_usb->id_gpiod); >> + >> + if (id) { >> + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", false); > > Use the extcon_set_cable_state_() because extcon_set_cable_state() with cable name > is deprecated. OK. cheers, -roger > >> + dev_info(palmas_usb->dev, "USB-HOST cable is detached\n"); >> + } else { >> + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", true); > > ditto. Use the extcon_set_cable_state_() with extcon id. > > [snip] > > Thanks, > Chanwoo Choi >