]> git.baikalelectronics.ru Git - kernel.git/commit
i2c: Bitbanging I2C bus driver using the GPIO API
authorHaavard Skinnemoen <hskinnemoen@atmel.com>
Tue, 1 May 2007 21:26:34 +0000 (23:26 +0200)
committerJean Delvare <khali@hyperion.delvare>
Tue, 1 May 2007 21:26:34 +0000 (23:26 +0200)
commita7caa08fe2514442b5422f2ed973336cf260e3a3
tree184dc150ca69a9dfbc00996e35659ef41beb202c
parentf7b7d108c697b69a86431d5ff98b65de7c0f2d58
i2c: Bitbanging I2C bus driver using the GPIO API

This is a very simple bitbanging I2C bus driver utilizing the new
arch-neutral GPIO API. Useful for chips that don't have a built-in
I2C controller, additional I2C busses, or testing purposes.

To use, include something similar to the following in the
board-specific setup code:

  #include <linux/i2c-gpio.h>

  static struct i2c_gpio_platform_data i2c_gpio_data = {
.sda_pin = GPIO_PIN_FOO,
.scl_pin = GPIO_PIN_BAR,
  };
  static struct platform_device i2c_gpio_device = {
.name = "i2c-gpio",
.id = 0,
.dev = {
.platform_data = &i2c_gpio_data,
},
  };

Register this platform_device, set up the I2C pins as GPIO if
required and you're ready to go. This will use default values for
udelay and timeout, and will work with GPIO hardware that does not
support open drain mode, but allows sensing of the SDA and SCL lines
even when they are being driven.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
MAINTAINERS
drivers/i2c/busses/Kconfig
drivers/i2c/busses/Makefile
drivers/i2c/busses/i2c-gpio.c [new file with mode: 0644]
include/linux/i2c-gpio.h [new file with mode: 0644]