[Letux-kernel] twl gpios / headset detect on gta04a5

H. Nikolaus Schaller hns at goldelico.com
Sun Sep 23 20:13:01 CEST 2018


> Am 23.09.2018 um 19:59 schrieb H. Nikolaus Schaller <hns at goldelico.com>:
> 
> 
>> Am 23.09.2018 um 19:41 schrieb Andreas Kemnade <andreas at kemnade.info>:
>> 
>> On Sun, 23 Sep 2018 19:32:34 +0200
>> "H. Nikolaus Schaller" <hns at goldelico.com> wrote:
>> 
>>> Hi,
>>> 
>>>> Am 23.09.2018 um 18:51 schrieb Andreas Kemnade <andreas at kemnade.info>:
>>>> 
>>>> Hi,
>>>> 
>>>> I am looking at the headset stuff.
>>>> The detection is at gpio492 on gta04a5 if I
>>>> understand everything right.
>>>> I exported that and no reaction there on plugging
>>>> And then I am wondering:
>>>> root at gta04:/sys/class/gpio/gpio492# twl-i2c.sh GPIO r 0x13
>>>> 0x00
>>>> # twl-i2c.sh GPIO r 0x14
>>>> 0x00
>>>> 
>>>> No pullups/downs enabled?!
>>>> Hmm, floating inputs there?!
>>>> 
>>>> twl-i2c.sh GPIO w 0x13 0x20
>>>> 
>>>> does the trick. the exported gpio shows values.
>>> 
>>> Good finding!
>>> 
>>>> But are the pullup/down
>>>> values correct there?
>>> 
>>> According to schematics:
>>> 
>>> 	http://projects.goldelico.com/p/gta04-main/downloads/48/
>>> 
>>> there is a 10k from the gpio to the switch and a 10k pull-down.

It is similar to Figure 14-2 in the document SWCU050D.

>>> 
>>> So there should be a pull-up for the gpio to provide energy.
>> Well, that is one thing. I enabled the pullup using:
>> 
>> twl-i2c.sh GPIO w 0x13 0x20
>> 
>> More interesting are the *other* twl gpio pins. Floating stuff
>> might be there. And therefore unecessary suspend currents.
>> 
>>> 
>>> Then,
>>> - if the headset is connected, the switch is open and the gpio should read "1"
>>> - while a disconnected headset should connect the gpio to gnd through 20k which should be (note, this circuit has never been tested!) read as "0".

From data sheet:

> Each GPIO has a configurable pullup and a pulldown of a 100-kΩ internal resistor. The pulldown is enabled by default to avoid leakage when a GPIO is not connected externally.
> 
> Five 8-bit registers control the pullup and pulldown feature:
> • GPIOPUPDCTR1
> • GPIOPUPDCTR2
> • GPIOPUPDCTR3
> • GPIOPUPDCTR4
> • GPIOPUPDCTR5
> 
> The pullup and pulldown feature can be activated by writing to the GPIOPUPDCTRx (where x = 1 to 5) GPIOyPU or GPIOyPD bit, (where y = 1 to 18).

So 100kOhm pull-up and switched 20k pull-down should
switch between:

100%
16%

of reference voltage (seems to be 1.8V = IO_1P8.

Next, I looked into SWCS032A.

Inpult levels are 35% and 65% of the reference voltage, which means that 20k should clearly be read as "0".

There is a small contradiction. According to Table 2-1. Ball Characteristics, the pull-up for gpio2 is 220k and the pull-down is 100k. If that is true, it should even be better.

BR,
Nikolaus


>>> 
>> That is wrong. It is tested be my now.
> 
> Wrong or not working?
> 
>> 
>> Regards,
>> Andreas
>> 
>> 
>> _______________________________________________
>> http://projects.goldelico.com/p/gta04-kernel/
>> Letux-kernel mailing list
>> Letux-kernel at openphoenux.org
>> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel
> 
> _______________________________________________
> http://projects.goldelico.com/p/gta04-kernel/
> Letux-kernel mailing list
> Letux-kernel at openphoenux.org
> http://lists.goldelico.com/mailman/listinfo.cgi/letux-kernel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://lists.goldelico.com/pipermail/letux-kernel/attachments/20180923/38eb62b4/attachment.asc>


More information about the Letux-kernel mailing list