tonka: input: synaptics_d2x_i2c: Convert dt touchscreen driver to non-dt

Minor modifications to the synaptics_d2x_i2c driver to grab arguments
from platform data and still initialize things correctly.
diff --git a/drivers/input/touchscreen/synaptics_dsx_i2c.c b/drivers/input/touchscreen/synaptics_dsx_i2c.c
index 592d824..1795e2c 100644
--- a/drivers/input/touchscreen/synaptics_dsx_i2c.c
+++ b/drivers/input/touchscreen/synaptics_dsx_i2c.c
@@ -527,7 +527,7 @@
 	return retval;
 }
 
-#ifdef CONFIG_OF
+#if 0
 static struct synaptics_dsx_platform_data *
 		synaptics_dsx_of_init(struct i2c_client *client,
 				struct synaptics_rmi4_data *rmi4_data)
@@ -626,12 +626,45 @@
 	}
 
 	return pdata;
-} 
+}
 #else
 static inline struct synaptics_dsx_platform_data *
 		synaptics_dsx_of_init(struct i2c_client *client)
 {
-	return NULL;
+        int ii;
+        unsigned char *button_codes;
+	unsigned key_codes[SYN_MAX_BUTTONS];
+	struct synaptics_dsx_platform_data *pdata = client->dev.platform_data;
+	struct synaptics_dsx_cap_button_map *button_map = NULL;
+
+        memset(key_codes, 0, sizeof(key_codes));
+
+        button_map = kzalloc(sizeof(*button_map), GFP_KERNEL);
+        if (IS_ERR_OR_NULL(button_map)) {
+                dev_err(&client->dev, "button allocation failure\n");
+                return NULL;
+        }
+
+        for (ii = 0; ii < SYN_MAX_BUTTONS; ii++)
+                if (key_codes[ii])
+                        button_map->nbuttons++;
+
+        button_codes = kzalloc(button_map->nbuttons, GFP_KERNEL);
+        if (IS_ERR_OR_NULL(button_codes)) {
+                dev_err(&client->dev, "button allocation failure\n");
+                kfree(button_map);
+                return NULL;
+        }
+
+        for (ii = 0; ii < button_map->nbuttons; ii++)
+                *(button_codes + ii) = (unsigned char)key_codes[ii];
+
+        button_map->map = button_codes;
+
+        pdata->irq_flags = IRQF_TRIGGER_LOW | IRQF_ONESHOT;
+        pdata->cap_button_map = button_map;
+
+	return pdata;
 }
 #endif
 
@@ -3106,18 +3139,8 @@
 		return -ENOMEM;
 	}
 
-	if (client->dev.of_node)
-		platform_data = synaptics_dsx_of_init(client, rmi4_data);
-	else {
-		platform_data = client->dev.platform_data;
-		rmi4_data->purge_enabled =  platform_data->purge_enabled;
-		rmi4_data->reset_on_resume = platform_data->reset_on_resume;
-		rmi4_data->one_touch_enabled = platform_data->one_touch_enabled;
-		rmi4_data->normal_mode = platform_data->normal_mode;
-		rmi4_data->hw_reset = platform_data->hw_reset;
-	}
-
-	if (!platform_data) {
+        platform_data = synaptics_dsx_of_init(client);
+        if (!platform_data) {
 		dev_err(&client->dev,
 				"%s: No platform data found\n",
 				__func__);
@@ -3125,6 +3148,12 @@
 		return -EINVAL;
 	}
 
+        rmi4_data->purge_enabled =  platform_data->purge_enabled;
+        rmi4_data->reset_on_resume = platform_data->reset_on_resume;
+        rmi4_data->one_touch_enabled = platform_data->one_touch_enabled;
+        rmi4_data->normal_mode = platform_data->normal_mode;
+        rmi4_data->hw_reset = platform_data->hw_reset;
+
 	rmi = &(rmi4_data->rmi4_mod_info);
 
 	rmi4_data->i2c_client = client;