Merge branch 'i2c/for-4.15' of ssh://gitolite.kernel.org/pub/scm/linux/kernel/git...
[sfrench/cifs-2.6.git] / arch / arm / mach-sa1100 / simpad.c
index e8d25a7bbcb870460cbe97f39256dd6196646dc6..7d4feb8a49ac5abb21dd727e4be140d6320b94a5 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/mtd/partitions.h>
 #include <linux/io.h>
 #include <linux/gpio/driver.h>
+#include <linux/gpio/machine.h>
 
 #include <mach/hardware.h>
 #include <asm/setup.h>
@@ -324,9 +325,17 @@ static struct platform_device simpad_gpio_leds = {
 /*
  * i2c
  */
+static struct gpiod_lookup_table simpad_i2c_gpiod_table = {
+       .dev_id = "i2c-gpio",
+       .table = {
+               GPIO_LOOKUP_IDX("gpio", 21, NULL, 0,
+                               GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
+               GPIO_LOOKUP_IDX("gpio", 25, NULL, 1,
+                               GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN),
+       },
+};
+
 static struct i2c_gpio_platform_data simpad_i2c_data = {
-       .sda_pin = GPIO_GPIO21,
-       .scl_pin = GPIO_GPIO25,
        .udelay = 10,
        .timeout = HZ,
 };
@@ -381,6 +390,7 @@ static int __init simpad_init(void)
                              ARRAY_SIZE(simpad_flash_resources));
        sa11x0_register_mcp(&simpad_mcp_data);
 
+       gpiod_add_lookup_table(&simpad_i2c_gpiod_table);
        ret = platform_add_devices(devices, ARRAY_SIZE(devices));
        if(ret)
                printk(KERN_WARNING "simpad: Unable to register mq200 framebuffer device");