* extcon: sm5502: USB-HOST (OTG) detection not working
@ 2019-10-11 14:50 Stephan Gerhold
2020-02-14 13:07 ` Stephan Gerhold
0 siblings, 1 reply; 2+ messages in thread
From: Stephan Gerhold @ 2019-10-11 14:50 UTC (permalink / raw)
To: Chanwoo Choi; +Cc: MyungJoo Ham, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: extcon: sm5502: USB-HOST (OTG) detection not working
2019-10-11 14:50 extcon: sm5502: USB-HOST (OTG) detection not working Stephan Gerhold
@ 2020-02-14 13:07 ` Stephan Gerhold
0 siblings, 0 replies; 2+ messages in thread
From: Stephan Gerhold @ 2020-02-14 13:07 UTC (permalink / raw)
To: Chanwoo Choi; +Cc: MyungJoo Ham, linux-kernel
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
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-14 13:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-11 14:50 extcon: sm5502: USB-HOST (OTG) detection not working Stephan Gerhold
2020-02-14 13:07 ` Stephan Gerhold
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.