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 <linux/platform_data/pinctrl-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 /* I2C0 connected to the STw4811 power management chip */
16 static struct i2c_gpio_platform_data nhk8815_i2c_data0
= {
17 /* keep defaults for timeouts; pins are push-pull bidirectional */
22 /* I2C1 connected to various sensors */
23 static struct i2c_gpio_platform_data nhk8815_i2c_data1
= {
24 /* keep defaults for timeouts; pins are push-pull bidirectional */
29 /* I2C2 connected to the USB portions of the STw4811 only */
30 static struct i2c_gpio_platform_data nhk8815_i2c_data2
= {
31 /* keep defaults for timeouts; pins are push-pull bidirectional */
36 static struct platform_device nhk8815_i2c_dev0
= {
40 .platform_data
= &nhk8815_i2c_data0
,
44 static struct platform_device nhk8815_i2c_dev1
= {
48 .platform_data
= &nhk8815_i2c_data1
,
52 static struct platform_device nhk8815_i2c_dev2
= {
56 .platform_data
= &nhk8815_i2c_data2
,
60 static pin_cfg_t cpu8815_pins_i2c
[] = {
61 PIN_CFG_INPUT(62, GPIO
, PULLUP
),
62 PIN_CFG_INPUT(63, GPIO
, PULLUP
),
63 PIN_CFG_INPUT(53, GPIO
, PULLUP
),
64 PIN_CFG_INPUT(54, GPIO
, PULLUP
),
65 PIN_CFG_INPUT(73, GPIO
, PULLUP
),
66 PIN_CFG_INPUT(74, GPIO
, PULLUP
),
69 static int __init
nhk8815_i2c_init(void)
71 nmk_config_pins(cpu8815_pins_i2c
, ARRAY_SIZE(cpu8815_pins_i2c
));
72 platform_device_register(&nhk8815_i2c_dev0
);
73 platform_device_register(&nhk8815_i2c_dev1
);
74 platform_device_register(&nhk8815_i2c_dev2
);
79 static void __exit
nhk8815_i2c_exit(void)
81 platform_device_unregister(&nhk8815_i2c_dev0
);
82 platform_device_unregister(&nhk8815_i2c_dev1
);
83 platform_device_unregister(&nhk8815_i2c_dev2
);
87 module_init(nhk8815_i2c_init
);
88 module_exit(nhk8815_i2c_exit
);