Skip to contentSkip to conversation

Implementing a new driver

DISCUSSION Alessio Sangalli 2 participants 6 messages Jan 23, 2009 – Jan 24, 2009 5 messages not in the archive I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

Hi, I would like to implement a driver for an I2C interface we are implementing in a chip.

This interface will be used to read DDC/EDID data from monitors.

I have never worked with the I2C subsystem (only lm-sensors as a user, without deepening my knowledge on the actual drivers).

Can you give me a checklist of things to do for this task so that I can get started for implementation?

Thanks
Alessio

#2 lore raw
In reply to a message not in the archive

Hi Alessio,

Quoted 10 lines · Alessio Sangalli

Hi, I would like to implement a driver for an I2C interface we are implementing in a chip.

This interface will be used to read DDC/EDID data from monitors.

I have never worked with the I2C subsystem (only lm-sensors as a user, without deepening my knowledge on the actual drivers).

Can you give me a checklist of things to do for this task so that I can get started for implementation?

As a quick starting point I recommend this FAQ item:
http://i2c.wiki.kernel.org/index.php/Linux_2.6_I2C_development_FAQ#New_I2C_bus_drivers

If you have more detailed questions while writing the code, post them on the list and we'll try to help.

Signature · 1 line
Jean Delvare
#4 lore raw
In reply to a message not in the archive
Quoted 2 lines · Jean Delvare

As a quick starting point I recommend this FAQ item:
http://i2c.wiki.kernel.org/index.php/Linux_2.6_I2C_development_FAQ#New_I2C_bus_drivers

Thanks, this will be useful to get started; anyway, it implies a knowledge of what is a "bus driver" or a "chip driver". I've read other articles but I'm still a bit confused. Could you give me a very very quick description of all kind of i2c-related drivers?

What is the preferred way to actually test the driver, I am quite comfortable with a solder iron if I have to connect a simple device to try a connection

bye!
as

#6 lore raw
In reply to a message not in the archive

Hi Alessio,

Quoted 9 lines · Alessio Sangalli
Quoted 2 lines · Jean Delvare

As a quick starting point I recommend this FAQ item:
http://i2c.wiki.kernel.org/index.php/Linux_2.6_I2C_development_FAQ#New_I2C_bus_drivers

Thanks, this will be useful to get started; anyway, it implies a knowledge of what is a "bus driver" or a "chip driver". I've read other articles but I'm still a bit confused. Could you give me a very very quick description of all kind of i2c-related drivers?

Basically, the bus drivers give you access to the I2C bus, while the chip drivers are specific to devices which are connected to the bus. This is essentially similar to USB, where you need a driver for the host controller, and then a driver for devices connected to the USB ports.

You may want to read this page on the wiki:
http://i2c.wiki.kernel.org/index.php/Driver_Architecture
and the document linked at the bottom of the page.

Examples of I2C bus drivers can be found under drivers/i2c/busses. Examples of I2C chip drivers can be found under drivers/rtc (for RTC chips), drivers/hwmon (for hardware monitoring chips) or drivers/gpio (for I/O expanders.)

Quoted 3 lines

What is the preferred way to actually test the driver, I am quite comfortable with a solder iron if I have to connect a simple device to try a connection

If you have an AT24C02 EEPROM at hand or similar, you'll be able to test most of the transaction types. But actually, any I2C or SMBus chip you can connect to the bus should be good enough to test the basics of your i2c bus driver.

Signature · 1 line
Jean Delvare
#8 lore raw
In reply to a message not in the archive
Quoted 1 line · Jean Delvare

Examples of I2C chip drivers can be found under drivers/rtc (for RTC

Thanks. I guess there is already a driver for DDC/EDID monitor parameters right? Should be a fairly common feature for graphic cards

bye!
as

#10 lore raw
In reply to a message not in the archive

Hi Alessio,

Quoted 7 lines · Alessio Sangalli
Quoted 1 line · Jean Delvare

Examples of I2C chip drivers can be found under drivers/rtc (for RTC

Thanks. I guess there is already a driver for DDC/EDID monitor parameters right? Should be a fairly common feature for graphic cards

See drivers/video/fb_ddc.c and drivers/video/edid.h, presumably this is what you want for a framebuffer driver. For an X driver, the code handling DDC is in X itself.

Or, for testing purpose, you can use the legacy "eeprom" driver together with the ddcmon and decode-edid scripts from i2c-tools [1].

[1] http://www.lm-sensors.org/wiki/I2CTools

Signature · 1 line
Jean Delvare