[i2c] linux-i2c and smbalert

Hendrik Sattler post at hendrik-sattler.de
Thu Sep 7 14:46:08 CEST 2006


Am Donnerstag 07 September 2006 13:43 schrieb Mark M. Hoffman:
> You'll need i2c_use_client() in there somewhere...
>
> > +	}
> > +	mutex_unlock(&adapter->clist_lock);
> > +	if (item == &adapter->clients)
> > +		return;
> > +	if (client && client->driver->smbus_alert)
> > +		client->driver->smbus_alert(client);
>
> ... and i2c_release_client() here.

Good point.

> > +/* read from the alert-reponse-address (ARA)
> > + * must NOT be called from interrupt context
> > + */
> Assumption: the I2C adapter/driver is going to call this function upon
> receiving the SMBALERT signal?  Unfortunately, it's not going to be that
> simple.  You can't do i2c_smbus_read_byte (or any other transfer) from an
> interrupt context.

Above, I left cited the comment for that function.

> But I think you'll want this function to be callable from interrupt
> context. So, it will need to kick off a workqueue to do the rest.  That
> should be done in i2c-core rather than pushed out to each driver.

Actually not, the adapter driver may have its own work queue for doing stuff 
like this. It should be used in such cases.
You need a wrapper function, anyway, as you need the return value as argument 
for i2c_smbus_alert_notify(). That wrapper function would have to be called 
by the work queue. There are several choices for the place of the work queue 
struct, either the global one, one for all i2c adapters or one per 
i2c_adapter. It would then be used by a default wrapper function that you can 
call in interrupt context. Suggestions? I'd go for the one per adapter.

> I'd like to see a patch with a bus driver implementation as well.

I want to do this with i2c-i801 but I currently do not have time to dig into 
it. Getting this to work is a purely leisure time thing for me.
There is also supposed to be a timer based poll implementation for SMBus host 
adapters without alert line. And some nice way to trigger it on and off 
dependent on the attached clients...

I attach the current version of the patch. It is not a complete solution, yet.

HS
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smbalert.patch
Type: text/x-diff
Size: 3039 bytes
Desc: not available
Url : http://lists.lm-sensors.org/pipermail/i2c/attachments/20060907/2376b82f/attachment.bin 


More information about the i2c mailing list