How is gta01 charger ID resistor detected?

Andy Poling andy at realbig.com
Tue Jan 26 19:55:42 CET 2010


On Tue, 26 Jan 2010, Ben Wilson wrote:
> I could be wrong, but I thought the 47K resistor cable ID feature was
> one of the things they added into GTA02.
> I assumed GTA01 didn't have it.

It's there in the hardware, according to the schematics.  :-)

I've spent some quality time today with the gta01 schematics and pcf50606
docs, and I understand a little better now how this is supposed to work.  The
USB ID pin is connected to the ACD (accessory detection) pin on the pcf50606,
and the 47k (48K in the schematic) resistor will pull the pin down to approx.
1.5V.

Something is setting the ACD threshold (probably u-boot), but nothing is
handling the ACDINS (insert) or ACDREM (remove) interrupts.  I found that
pcf50606-charger.c is not setting up those interrupts to be handled.
Additionally, I found this in arch/arm/mach-gta01.c:

 	/* TODO */
 	static void gta01_pmu_event_callback(struct pcf50606 *pcf, int irq)
 	{
 	        /*TODO : Handle ACD here */
 	}

OK - that answers that question.  It hasn't been handled, at least since the
new split set of pcf50606 drivers were introduced.  Looking at the original
monolithic pcf50606 driver, it was handled there.  It looks to me like none of
the other MBC-related interrupts are currently being handled either for the
same reason.

By adding ACDINS and ACDREM to the list of IRQs to handle in
pcf50606-charger.c and by adding 6 lines of code in gta01_pmu_event_callback()
to handle them by setting/unsetting AUTOFST, I can now see AUTOFST being
enabled and disabled when I plug and unplug my charger cable with the ID
resistor.  It's a quick hack, but it shows it can work.

I guess I know what my next project will be.  :-) I'll take that to the kernel
list.

-Andy

It ain't what you don't know that gets you into trouble.
It's what you know for sure that just ain't so. - Mark Twain



More information about the community mailing list