1 #include <linux/module.h>
2 #include <linux/init.h>
4 #include <linux/i2c-algo-bit.h>
5 #include <linux/i2c-gpio.h>
6 #include <linux/platform_device.h>
7 #include <plat/gpio-nomadik.h>
10 * There are two busses in the 8815NHK.
11 * They could, in theory, be driven by the hardware component, but we
12 * use bit-bang through GPIO by now, to keep things simple
15 static struct i2c_gpio_platform_data nhk8815_i2c_data0
= {
16 /* keep defaults for timeouts; pins are push-pull bidirectional */
21 static struct i2c_gpio_platform_data nhk8815_i2c_data1
= {
22 /* keep defaults for timeouts; pins are push-pull bidirectional */
27 /* first bus: GPIO XX and YY */
28 static struct platform_device nhk8815_i2c_dev0
= {
32 .platform_data
= &nhk8815_i2c_data0
,
35 /* second bus: GPIO XX and YY */
36 static struct platform_device nhk8815_i2c_dev1
= {
40 .platform_data
= &nhk8815_i2c_data1
,
44 static int __init
nhk8815_i2c_init(void)
46 nmk_gpio_set_mode(nhk8815_i2c_data0
.scl_pin
, NMK_GPIO_ALT_GPIO
);
47 nmk_gpio_set_mode(nhk8815_i2c_data0
.sda_pin
, NMK_GPIO_ALT_GPIO
);
48 platform_device_register(&nhk8815_i2c_dev0
);
50 nmk_gpio_set_mode(nhk8815_i2c_data1
.scl_pin
, NMK_GPIO_ALT_GPIO
);
51 nmk_gpio_set_mode(nhk8815_i2c_data1
.sda_pin
, NMK_GPIO_ALT_GPIO
);
52 platform_device_register(&nhk8815_i2c_dev1
);
57 static void __exit
nhk8815_i2c_exit(void)
59 platform_device_unregister(&nhk8815_i2c_dev0
);
60 platform_device_unregister(&nhk8815_i2c_dev1
);
64 module_init(nhk8815_i2c_init
);
65 module_exit(nhk8815_i2c_exit
);