Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I2C write acknowledge polling in Linux Kernel

Tags:

linux

arm

i2c

The lackluster response here made me wonder this.

I've been saddled with a device (Analog Devices 525x) that (from the data sheet, pg 16):

disables the I2C interface during the internal [EEPROM] write cycle.

That doesn't seem fair, as in "I'm getting off the couch now, so don't use it for a while because I let one rip in the seat cushion". Honestly, why should that be my problem?

Anyway, the data sheet suggests that acknowledge polling is the answer - enter the Linux kernel... does the Linux GPIO bit bashed I2C driver provide a mechanism for doing this? Essentially send a address with the write bit set and keep doing so until an ACK appears.

I'm using 2.6.14 on an ARM with back ported GPIO bit bashing driver (from 2.6.19 I think).

like image 218
Jamie Avatar asked Jul 28 '09 17:07

Jamie


People also ask

How does I2C work in Linux?

I2C is a multi-master bus; open drain signaling is used to arbitrate between masters, as well as to handshake and to synchronize clocks from slower clients. The Linux I2C programming interfaces support the master side of bus interactions and the slave side.

What is I2C driver?

An I2C “Adapter Driver” abstracts the controller hardware; it binds to a physical device (perhaps a PCI device or platform_device) and exposes a struct i2c_adapter representing each I2C bus segment it manages. On each I2C bus segment will be I2C devices represented by a struct i2c_client .


1 Answers

It doesn't seem too off the shelf, but

You probably will need to look at having a protocol modification flag like Flag I2C_M_NOSTART only different, in your patches. At least there is a way to do it (admittedly a messy way)

I hope for your sake you don't need to put a normal i2c device on the same bus.

Honestly, hardware vendors do stuff like this all the time. They consider the problem "solved" as long as it becomes yours.

I see lots of broken I2C out there and you could make life nicer for other people.

like image 164
Tim Williscroft Avatar answered Sep 17 '22 16:09

Tim Williscroft