Skip to contentSkip to conversation

wm97xx_read_aux_adc() for battery & pen down?

DISCUSSION Wolfram Sang 2 participants 4 messages Jun 24, 2011 – Jun 26, 2011 HID

lore
Share & tools
lore
#0 lore raw

Hi,

I have one question I got while hacking on this cheap tablet thingie I don't have schematics or documentation for. It uses a WM9715 for (at least) touch and battery-status, but I need the following dirty hack for 3.0-rc4 in wm97xx_read_aux_adc():

...

-       if (!(*sample & WM97XX_PEN_DOWN)) {
+       /* HACK! Disable check for battery channel on Jaytech PID7901 */
+       if ((adcsel != 0x6000) && !(*sample & WM97XX_PEN_DOWN)) {
                wm->pen_probably_down = 0;
                return RC_PENUP;
        }

        return RC_VALID;
}

So, it uses WM97XX_AUX_ID3 as the battery channel which never sets PEN_DOWN. As a result, I always see timeouts when reading the current voltage (without the patch). My question is: How to avoid this hack? Did I forget to configure something somewhere? I read through the wm9715-docs and the driver source, yet I think I missed something (or the current implementation cannot work?).

Thanks,

Wolfram

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#1 lore raw

Review

Quoted 10 lines · Wolfram Sang

battery-status, but I need the following dirty hack for 3.0-rc4 in wm97xx_read_aux_adc():

...

(quoted diff) +2 -1
-       if (!(*sample & WM97XX_PEN_DOWN)) {
+       /* HACK! Disable check for battery channel on Jaytech PID7901 */
+       if ((adcsel != 0x6000) && !(*sample & WM97XX_PEN_DOWN)) {
                wm->pen_probably_down = 0;
                return RC_PENUP;
        }

I don't see this code in that function?

#2 lore raw
Quoted 13 lines · Mark Brown

Review

Quoted 10 lines · Wolfram Sang

battery-status, but I need the following dirty hack for 3.0-rc4 in wm97xx_read_aux_adc():

...

(quoted diff) +2 -1
-       if (!(*sample & WM97XX_PEN_DOWN)) {
+       /* HACK! Disable check for battery channel on Jaytech PID7901 */
+       if ((adcsel != 0x6000) && !(*sample & WM97XX_PEN_DOWN)) {
                wm->pen_probably_down = 0;
                return RC_PENUP;
        }
Quoted 1 line

I don't see this code in that function?

Ahem, sorry, I mixed the function names. wm97xx_read_aux_adc() uses the poll_sample-pointer which points to wm9712_poll_sample() in my case. There I need the above code.

Signature · 2 lines
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#3 lore raw
Quoted 3 lines · Wolfram Sang

Ahem, sorry, I mixed the function names. wm97xx_read_aux_adc() uses the poll_sample-pointer which points to wm9712_poll_sample() in my case. There I need the above code.

It looks like poll_sample() needs to be passed a flag to disable the pen down checking.