summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorStefan Agner <stefan.agner@toradex.com>2014-01-24 17:29:43 +0100
committerStefan Agner <stefan.agner@toradex.com>2014-01-29 15:41:41 +0100
commitcb82730b70f31af3b43041ac4e47de69c18016c9 (patch)
tree1954436f8af740f658bc0f3aeb98a86e68c210ae /drivers
parente95019a4f20b8cdfbe03658e4f73b69cdcf97540 (diff)
input: touchscreen: added platform data for Fusion touchscreen
Added platform data struct to define interrupt and reset GPIO. This allows to initialize the touchscreen controller inside the driver rather then in each platform and use the driver as a module.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/input/touchscreen/fusion_F0710A.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/input/touchscreen/fusion_F0710A.c b/drivers/input/touchscreen/fusion_F0710A.c
index 2cd2096c3b98..1546e6a18512 100644
--- a/drivers/input/touchscreen/fusion_F0710A.c
+++ b/drivers/input/touchscreen/fusion_F0710A.c
@@ -16,6 +16,7 @@
#include <linux/delay.h>
#include <asm/irq.h>
#include <linux/gpio.h>
+#include <linux/input/fusion_F0710A.h>
#include "fusion_F0710A.h"
@@ -286,10 +287,52 @@ const static u8* g_ver_product[4] = {
static int fusion_F0710A_probe(struct i2c_client *i2c, const struct i2c_device_id *id)
{
+ struct fusion_f0710a_init_data *pdata = i2c->dev.platform_data;
int ret;
u8 ver_product, ver_id;
u32 version;
+ if (pdata == NULL)
+ {
+ dev_err(&i2c->dev, "No platform data for Fusion driver\n");
+ return -ENODEV;
+ }
+
+ /* Request pinmuxing, if necessary */
+ if (pdata->pinmux_fusion_pins != NULL)
+ {
+ ret = pdata->pinmux_fusion_pins();
+ if (ret < 0) {
+ dev_err(&i2c->dev, "muxing GPIOs failed\n");
+ return -ENODEV;
+ }
+ }
+
+ if ((gpio_request(pdata->gpio_int, "SO-DIMM 28 (Iris X16-38 Pen)") == 0) &&
+ (gpio_direction_input(pdata->gpio_int) == 0)) {
+ gpio_export(pdata->gpio_int, 0);
+ } else {
+ printk(KERN_WARNING "Could not obtain GPIO for Fusion pen down\n");
+ return -ENODEV;
+ }
+
+ if ((gpio_request(pdata->gpio_reset, "SO-DIMM 30 (Iris X16-39 RST)") == 0) &&
+ (gpio_direction_output(pdata->gpio_reset, 1) == 0)) {
+
+ /* Generate a 0 => 1 edge explicitly... */
+ gpio_set_value(pdata->gpio_reset, 0);
+ mdelay(10);
+ gpio_set_value(pdata->gpio_reset, 1);
+
+ gpio_export(pdata->gpio_reset, 0);
+ } else {
+ printk(KERN_WARNING "Could not obtain GPIO for Fusion reset\n");
+ return -ENODEV;
+ }
+
+ /* Use Pen Down GPIO as sampling interrupt */
+ i2c->irq = gpio_to_irq(pdata->gpio_int);
+
if(!i2c->irq)
{
dev_err(&i2c->dev, "fusion_F0710A irq < 0 \n");
@@ -412,6 +455,10 @@ static int fusion_F0710A_resume(struct i2c_client *i2c)
static int fusion_F0710A_remove(struct i2c_client *i2c)
{
+ struct fusion_f0710a_init_data *pdata = i2c->dev.platform_data;
+
+ gpio_free(pdata->gpio_int);
+ gpio_free(pdata->gpio_reset);
destroy_workqueue(fusion_F0710A.workq);
free_irq(i2c->irq, &fusion_F0710A);
input_unregister_device(fusion_F0710A.input);