From: Chanwoo Choi <cw00.choi@samsung.com>
To: George Cherian <george.cherian@ti.com>
Cc: myungjoo.ham@samsung.com, kishon@ti.com, ldewangan@nvidia.com,
linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] extcon: palmas: Handle ID interrupt properly using USB_ID_INT_SRC
Date: Tue, 22 Oct 2013 07:55:03 +0900 [thread overview]
Message-ID: <5265B0C7.7040808@samsung.com> (raw)
In-Reply-To: <525CC725.7060508@ti.com>
Hi George,
On 10/15/2013 01:40 PM, George Cherian wrote:
> Laxman/Chanwoo/Kishon,
>
> Any comments on this!!
> Regards
> -George
> On 10/11/2013 12:18 AM, George Cherian wrote:
>> Always cross check with the ID state and the source of interrupt.
>> Also add a case in which ID Source is ID_GND but LATCH state is set
>> wrongly. This uses the previous Link stat to determine the new state.
>>
>> Signed-off-by: George Cherian <george.cherian@ti.com>
>> ---
>> drivers/extcon/extcon-palmas.c | 15 ++++++++++++---
>> 1 file changed, 12 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c
>> index 6e83e9a..2aea4bc 100644
>> --- a/drivers/extcon/extcon-palmas.c
>> +++ b/drivers/extcon/extcon-palmas.c
>> @@ -78,20 +78,24 @@ static irqreturn_t palmas_vbus_irq_handler(int irq, void *_palmas_usb)
>> static irqreturn_t palmas_id_irq_handler(int irq, void *_palmas_usb)
>> {
>> - unsigned int set;
>> + unsigned int set, id_src;
>> struct palmas_usb *palmas_usb = _palmas_usb;
>> palmas_read(palmas_usb->palmas, PALMAS_USB_OTG_BASE,
>> PALMAS_USB_ID_INT_LATCH_SET, &set);
>> + palmas_read(palmas_usb->palmas, PALMAS_USB_OTG_BASE,
>> + PALMAS_USB_ID_INT_SRC, &id_src);
>> - if (set & PALMAS_USB_ID_INT_SRC_ID_GND) {
>> + if ((set & PALMAS_USB_ID_INT_SRC_ID_GND) &&
>> + (id_src & PALMAS_USB_ID_INT_SRC_ID_GND)) {
>> palmas_write(palmas_usb->palmas, PALMAS_USB_OTG_BASE,
>> PALMAS_USB_ID_INT_LATCH_CLR,
>> PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND);
>> palmas_usb->linkstat = PALMAS_USB_STATE_ID;
>> extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", true);
>> dev_info(palmas_usb->dev, "USB-HOST cable is attached\n");
>> - } else if (set & PALMAS_USB_ID_INT_SRC_ID_FLOAT) {
>> + } else if ((set & PALMAS_USB_ID_INT_SRC_ID_FLOAT) &&
>> + (id_src & PALMAS_USB_ID_INT_SRC_ID_FLOAT)) {
>> palmas_write(palmas_usb->palmas, PALMAS_USB_OTG_BASE,
>> PALMAS_USB_ID_INT_LATCH_CLR,
>> PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT);
>> @@ -103,6 +107,11 @@ static irqreturn_t palmas_id_irq_handler(int irq, void *_palmas_usb)
>> palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT;
>> extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", false);
>> dev_info(palmas_usb->dev, "USB-HOST cable is detached\n");
>> + } else if ((palmas_usb->linkstat == PALMAS_USB_STATE_DISCONNECT) &&
>> + (id_src & PALMAS_USB_ID_INT_SRC_ID_GND)) {
>> + palmas_usb->linkstat = PALMAS_USB_STATE_ID;
>> + extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", true);
>> + dev_info(palmas_usb->dev, " USB-HOST cable is attached\n");
>> }
>> return IRQ_HANDLED;
>
>
Applied it on next branch.
Thanks.
Chanwoo Choi
prev parent reply other threads:[~2013-10-21 22:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-10 18:48 [PATCH] extcon: palmas: Handle ID interrupt properly using USB_ID_INT_SRC George Cherian
2013-10-15 4:40 ` George Cherian
2013-10-21 11:21 ` Laxman Dewangan
2013-10-21 22:55 ` Chanwoo Choi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5265B0C7.7040808@samsung.com \
--to=cw00.choi@samsung.com \
--cc=george.cherian@ti.com \
--cc=kishon@ti.com \
--cc=ldewangan@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=myungjoo.ham@samsung.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.