On 12/13/05, Robert Love <[email protected]> wrote:
> On Tue, 2005-12-13 at 16:35 +0200, Shem Multinymous wrote:
> Alan's response is the correct course of action here,
Ideally, but I'm not sure we understand the interface sufficiently
well to abstract it beyond a mere mutex. Compare your hdaps.c code to
the following relevant code from tp_smapi.c (stripped down a bit for
simplicty):
----------------------------------------
#define APS_ROW_LEN 16
static int read_aps_row(u8 arg1610, u8 arg161F, u8* buf) {
int retries, i;
int ret = -EIO;
for (retries=APS_MAX_RETRIES; retries>0; --retries) {
if (inb(0x1604)&0x40) { /* readout pending? */
inb(0x161F); /* discard it */
udelay(10);
} else {
outb(arg1610, 0x1610);
if (inb(0x1604)&0x20)
goto wrote1610;
}
}
goto out;
wrote1610:
outb(arg161F, 0x161F);
for (retries=APS_MAX_RETRIES; retries>0; --retries) {
if (inb(0x1604)&0x40) /* readout pending? */
goto gotdata;
udelay(10);
}
goto out;
gotdata:
for (i=0; i<APS_ROW_LEN; ++i) {
buf[i] = inb(0x1610+i);
}
ret = 0;
out:
return ret;
}
----------------------------------------
(Yes, the loop/goto structure should be cleanup up a bit.)
Not to mention the HDAPS init code, which is voodoo.
> question: What other data in 0x1604-0x161F is there?
I looked only at the readout "rows" given by arg1610=1,..,18 and
arg161F=0,1. In that range, I didn't see anything obviously
interesting in the "rows" not already used by the battery readout and
HDAPS. I don't think any of the Windows driver reads other "rows". But
for all we know, this could be a window into the embedded controller's
memory or something of the sorts. Also, some of these "rows" are
actually commands given during HDAPS init, so the "read_row"
abstraction is obviously not accurate.
Shem
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]