mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephan Gerhold <stephan@gerhold.net>
To: Chanwoo Choi <cw00.choi@samsung.com>
Cc: MyungJoo Ham <myungjoo.ham@samsung.com>, linux-kernel@vger.kernel.org
Subject: Re: extcon: sm5502: USB-HOST (OTG) detection not working
Date: Fri, 14 Feb 2020 14:07:55 +0100	[thread overview]
Message-ID: <20200214130755.GA93507@gerhold.net> (raw)
In-Reply-To: <20191011145015.GA127238@gerhold.net>

Hi Chanwoo,

On Fri, Oct 11, 2019 at 04:50:21PM +0200, Stephan Gerhold wrote:
> Hi Chanwoo,
> 
> after getting interrupts working on my Samsung Galaxy A5 (2015),
> I am now trying to make the extcon device detect USB-HOST=1
> when I plug in an USB OTG adapter.
> 
> At the moment, the driver can sucessfully detect:
>   - USB=1 + SDP=1 when I detect the phone to a PC
>   - DCP=1 when I connect it to an AC charger
> but it does not set USB-HOST=1 when I connect the USB OTG adapter.
> 
> It seems to be a problem in the sm5502 driver, since I do get an
> SM5502_IRQ_INT1_ATTACH interrupt when I plug in the USB OTG adapter.
> 
> In this case, SM5502 reports:
>     SM5502_REG_ADC = 0x00 (SM5502_MUIC_ADC_GROUND)
>     SM5502_REG_DEV_TYPE1 = 0x80 (SM5502_REG_DEV_TYPE1_USB_OTG_MASK)
> 
> However, at the moment the sm5502 driver ignores all attach events with
> SM5502_REG_ADC == SM5502_MUIC_ADC_GROUND:
> 
> 	/*
> 	 * If ADC is SM5502_MUIC_ADC_GROUND(0x0), external cable hasn't
> 	 * connected with to MUIC device.
> 	 */
> 	cable_type = adc & SM5502_REG_ADC_MASK;
> 	if (cable_type == SM5502_MUIC_ADC_GROUND)
> 		return SM5502_MUIC_ADC_GROUND;
> 
> However, I definitely have a cable attached in this case...
> 
> The sm5502 driver seems to expect SM5502_REG_ADC == SM5502_MUIC_ADC_OPEN.
> Any idea why my hardware reports ADC_GROUND for the USB OTG adapter
> instead of ADC_OPEN?
> 
> Confusingly, the driver used in the original downstream kernel of
> the Samsung Galaxy A5 [1] calls ADC = 0x00 "ADC_OTG" instead of
> "ADC_GROUND".
> So getting ADC = 0x00 may not be entirely unexpected here...
> 
> Thanks in advance,
> Stephan
> 
> [1]: https://github.com/msm8916-mainline/android_kernel_qcom_msm8916/blob/SM-A500FU/drivers/misc/sm5502.c#L195

This mail is quite old now but I am still confused by this.
Any idea what could be wrong here?

I was not able to find any datasheet for SM5502 unfortunately...

Thanks,
Stephan

      reply	other threads:[~2020-02-14 13:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 14:50 Stephan Gerhold
2020-02-14 13:07 ` Stephan Gerhold [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=20200214130755.GA93507@gerhold.net \
    --to=stephan@gerhold.net \
    --cc=cw00.choi@samsung.com \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome