From 0d765160ef94e0ab6f30725b01e5102ca119449f Mon Sep 17 00:00:00 2001
From: Joel A Fernandes <joelagnel@ti.com>
Date: Wed, 30 Nov 2011 15:02:17 +0100
Subject: [PATCH 5/9] tscadc: Add board file mfd support, fix warning

Signed-off-by: Joel A Fernandes <joelagnel@ti.com>
---
 arch/arm/mach-omap2/board-am335xevm.c |   27 ++++++++++++++++++++++++++-
 drivers/input/touchscreen/ti_tscadc.c |    2 +-
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/arch/arm/mach-omap2/board-am335xevm.c b/arch/arm/mach-omap2/board-am335xevm.c
index 8221ba9..30f23d7 100644
--- a/arch/arm/mach-omap2/board-am335xevm.c
+++ b/arch/arm/mach-omap2/board-am335xevm.c
@@ -195,6 +195,11 @@ static struct resource tsc_resources[]  = {
 static struct tsc_data am335x_touchscreen_data  = {
 	.wires  = 4,
 	.x_plate_resistance = 200,
+	.mode = TI_TSCADC_TSCMODE,
+};
+
+static struct tsc_data bone_touchscreen_data  = {
+	.mode = TI_TSCADC_GENMODE,
 };
 
 static struct platform_device tsc_device = {
@@ -207,6 +212,16 @@ static struct platform_device tsc_device = {
 	.resource       = tsc_resources,
 };
 
+static struct platform_device bone_tsc_device = {
+	.name   = "tsc",
+	.id     = -1,
+	.dev    = {
+			.platform_data  = &bone_touchscreen_data,
+	},
+	.num_resources  = ARRAY_SIZE(tsc_resources),
+	.resource       = tsc_resources,
+};
+
 static u8 am335x_iis_serializer_direction1[] = {
 	INACTIVE_MODE,	INACTIVE_MODE,	TX_MODE,	RX_MODE,
 	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,	INACTIVE_MODE,
@@ -927,6 +942,16 @@ static void tsc_init(int evm_id, int profile)
 		pr_err("failed to register touchscreen device\n");
 }
 
+static void bone_tsc_init(int evm_id, int profile)
+{
+	int err;
+	setup_pin_mux(tsc_pin_mux);
+	err = platform_device_register(&bone_tsc_device);
+	if (err)
+		pr_err("failed to register touchscreen device\n");
+}
+
+
 static void boneleds_init(int evm_id, int profile )
 {
 	int err;
@@ -1541,7 +1566,7 @@ static struct evm_dev_cfg beaglebone_old_dev_cfg[] = {
 	{i2c2_init,	DEV_ON_BASEBOARD, PROFILE_NONE},
 	{mmc0_init,	DEV_ON_BASEBOARD, PROFILE_NONE},
 	{boneleds_init,	DEV_ON_BASEBOARD, PROFILE_ALL},
-	{tsc_init, 	DEV_ON_BASEBOARD, PROFILE_ALL},
+	{bone_tsc_init, 	DEV_ON_BASEBOARD, PROFILE_ALL},
 	{NULL, 0, 0},
 };
 
diff --git a/drivers/input/touchscreen/ti_tscadc.c b/drivers/input/touchscreen/ti_tscadc.c
index 76fc7b6..49a5a70 100644
--- a/drivers/input/touchscreen/ti_tscadc.c
+++ b/drivers/input/touchscreen/ti_tscadc.c
@@ -462,7 +462,7 @@ static irqreturn_t tsc_interrupt(int irq, void *dev)
 static	int __devinit tscadc_probe(struct platform_device *pdev)
 {
 	struct tscadc			*ts_dev;
-	struct input_dev		*input_dev;
+	struct input_dev		*input_dev = NULL;
 	int				err;
 	int				clk_value;
 	int				clock_rate, irqenable, ctrl;
-- 
1.7.2.5

