]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-epos/sitara-epos-kernel.git/commitdiff
arm: omap: am335x: Use hwmod data to register TSC
authorPatil, Rachna <rachna@ti.com>
Fri, 10 Feb 2012 10:43:13 +0000 (16:13 +0530)
committerPatil, Rachna <rachna@ti.com>
Tue, 14 Feb 2012 04:31:29 +0000 (10:01 +0530)
Make changes to register Touchscreen as a platform device
using hwmod data API

Signed-off-by: Patil, Rachna <rachna@ti.com>
arch/arm/mach-omap2/board-am335xevm.c
arch/arm/mach-omap2/devices.c
arch/arm/mach-omap2/devices.h

index 8aa7e1072b6e87ae27878609fe655a73bed2daa1..c5c06179cf2f65487aa9e400f30afb90939ca98e 100644 (file)
@@ -35,6 +35,7 @@
 #include <linux/mfd/tps65910.h>
 #include <linux/mfd/tps65217.h>
 #include <linux/pwm_backlight.h>
+#include <linux/input/ti_tscadc.h>
 
 /* LCD controller is similar to DA850 */
 #include <video/da8xx-fb.h>
@@ -167,38 +168,14 @@ struct da8xx_lcdc_platform_data TFC_S9700RTWV35TR_01B_pdata = {
 
 #include "common.h"
 
-/* TSc controller */
-#include <linux/input/ti_tscadc.h>
 #include <linux/lis3lv02d.h>
 
-static struct resource tsc_resources[]  = {
-       [0] = {
-               .start  = AM33XX_TSC_BASE,
-               .end    = AM33XX_TSC_BASE + SZ_8K - 1,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = AM33XX_IRQ_ADC_GEN,
-               .end    = AM33XX_IRQ_ADC_GEN,
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
+/* TSc controller */
 static struct tsc_data am335x_touchscreen_data  = {
        .wires  = 4,
        .x_plate_resistance = 200,
 };
 
-static struct platform_device tsc_device = {
-       .name   = "tsc",
-       .id     = -1,
-       .dev    = {
-                       .platform_data  = &am335x_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,
@@ -944,7 +921,8 @@ static void tsc_init(int evm_id, int profile)
                pr_info("TSC connected to alpha GP EVM\n");
        }
        setup_pin_mux(tsc_pin_mux);
-       err = platform_device_register(&tsc_device);
+
+       err = am33xx_register_tsc(&am335x_touchscreen_data);
        if (err)
                pr_err("failed to register touchscreen device\n");
 }
index 198df7b477d8de7d2c50704b96ed7e5c6a070ef5..56a8bd43b5f239ffc4f3ac1ac4324d050bac16d4 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/can/platform/d_can.h>
 #include <linux/platform_data/uio_pruss.h>
 #include <linux/pwm/pwm.h>
+#include <linux/input/ti_tscadc.h>
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
@@ -180,6 +181,28 @@ void __init am33xx_register_lcdc(struct da8xx_lcdc_platform_data *pdata)
 
 }
 
+int __init am33xx_register_tsc(struct tsc_data *pdata)
+{
+       int id = -1;
+       struct platform_device *pdev;
+       struct omap_hwmod *oh;
+       char *oh_name = "adc_tsc";
+       char *dev_name = "tsc";
+
+       oh = omap_hwmod_lookup(oh_name);
+       if (!oh) {
+               pr_err("Could not look up TSC%d hwmod\n", id);
+               return -ENODEV;
+       }
+
+       pdev = omap_device_build(dev_name, id, oh, pdata,
+                       sizeof(struct tsc_data), NULL, 0, 0);
+
+       WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s.\n",
+                       dev_name, oh->name);
+       return 0;
+}
+
 #if defined(CONFIG_SND_AM335X_SOC_EVM) || \
                                defined(CONFIG_SND_AM335X_SOC_EVM_MODULE)
 static struct resource am335x_mcasp1_resource[] = {
index e086839b67cb2a3717e62c54b2f1bde5ac370368..f421d6fd0962b0badf8ff0e77285b5b8662fd541 100644 (file)
@@ -17,6 +17,7 @@ struct isp_platform_data;
 int omap3_init_camera(struct isp_platform_data *pdata);
 
 void __init am335x_register_mcasp1(struct snd_platform_data *pdata);
+extern int __init am33xx_register_tsc(struct tsc_data *pdata);
 extern void register_ehrpwm(int max_freq);
 
 #endif