[i2c] [PATCH] Lifebook apanel driver

Stephen Hemminger shemminger at osdl.org
Wed Jan 10 23:44:47 CET 2007


On Wed, 10 Jan 2007 22:18:21 +0100
Vojtech Pavlik <vojtech at suse.cz> wrote:

> On Wed, Jan 10, 2007 at 11:50:59AM -0800, Stephen Hemminger wrote:
> > On Wed, 10 Jan 2007 09:22:09 +0100
> > Jean Delvare <khali at linux-fr.org> wrote:
> > 
> > > > +static void apanel_poll(struct work_struct *work)
> > > > +{
> > > > +	struct apanel *ap = container_of(work, struct apanel, poll_timer.work);
> > > > +	u8 cmd = device_chip[APANEL_DEV_APPBTN] == CHIP_OZ992C ? 0 : 8;
> > > > +	const struct keymap *key;
> > > > +	s32 data;
> > > > +
> > > > +	data = i2c_smbus_read_word_data(&ap->client, cmd);
> > > > +	if (data < 0) {
> > > > +		/* too many errors stop polling */
> > > > +		printk(KERN_ERR "apanel: SMBus read error\n");
> > > > +		return;
> > > > +	}
> > > 
> > > "Too many"? It looks to me like you stop polling after the very first
> > > read error. I don't expect read errors, ideally they shouldn't happen,
> > > but if they do, it seems a bit harsh to stop right after only one error.
> > 
> > 
> > I do see errors occurring (I think it is related to some power saving).
> > So new version doesn't stop until errors occur for 2 seconds of polling.
> 
> Most likely ACPI is also accessing SMBus and there is no locking to
> prevent collisions. 
> 
> I would expect there would be an ACPI interface to access these buttons
> (or at least the SMBus through the ACPI EC abstraction), too, which
> would eliminate this problem: Most other notebook brands have one.
> 
> 

Although those buttons probably share an interface that ACPI uses,
it doesn't look like ACPI exposes them.  I tried loading the generic
hotkey driver and listening for ACPI events, and nothing happens.


-- 
Stephen Hemminger <shemminger at osdl.org>



More information about the i2c mailing list