基于linux-2.6.33的液晶驱动之触摸屏

这是我们共同努力地结果!!

 

1、将s3c2410_ts.c复制到drivers/input/touchscreen/目录下

   里头有的直接替换。

2、修改/root/linux-2.6.33/arch/arm/plat-s3c24xx/devs.c

1)在文件里加上头文件

     #include </root/linux-2.6.33/arch/arm/mach-s3c2410/include/mach/ts.h>

  (2) /arch/arm/mach-s3c2410/mach/ts.h

ts.h的内容修改如下:

      #ifndef __ASM_ARM_TS_H

      #define __ASM_ARM_TS_H

                                                                                                              

     struct s3c2410_ts_mach_info {

           int             delay;

           int             presc;

           int             oversampling_shift;

     };

                                                                                                              

  void set_s3c2410ts_info(struct s3c2410_ts_mach_info *hard_s3c2410ts_info);

  void __init s3c24xx_ts_set_platdata(struct s3c2410ts_mach_info *pd);

 

 

  #endif /* __ASM_ARM_TS_H */

3)在devs.c用如下替换

    /* Touchscreen */

struct platform_device s3c_device_ts = {

          .name = "s3c2410-ts",

          .id = -1,

     };

    EXPORT_SYMBOL(s3c_device_ts);

    static struct s3c2410_ts_mach_info s3c2410ts_info;

    void __init set_s3c2410ts_info(struct s3c2410_ts_mach_info *hard_s3c2410ts_info)

   {

         memcpy(&s3c2410ts_info,hard_s3c2410ts_info,sizeof(struct s3c2410_ts_mach_info));

         s3c_device_ts.dev.platform_data = &s3c2410ts_info;

    }

    EXPORT_SYMBOL(set_s3c2410ts_info);

4.修改/arch/arm/plat-s3c/include/plat/devs.h在文件里加上

   extern struct platform_device s3c_device_ts;

5.修改arch/arm/mach-s3c2410/mach-smdk2410.c

1)加上头文件

#include </root/linux-2.6.33/arch/arm/mach-s3c2410/include/mach/ts.h>

2)在合适的地方加上

     /*Config for TouchScreen*/

     static struct s3c2410_ts_mach_info MY2410_ts_cfg __initdata = {

          .delay = 10000,

          .presc = 49,

          .oversampling_shift = 2,

     };

 

(3)static struct platform_device *smdk2410_devices[] __initdata结构体里

代码如下: 

   static struct platform_device *smdk2410_devices[] __initdata = {

        &s3c_device_usb,

        &s3c_device_lcd,

        &s3c_device_ts,

        &s3c_device_wdt,

        &s3c_device_i2c,

        &s3c_device_iis,

     };

4)在static void __init smdk2410_init(void)函数里加上

set_s3c2410ts_info(&MY2410_ts_cfg);

6:arch/arm/mach-s3c2410/mach-h1940.c

加上

#include </root/linux-2.6.33/arch/arm/mach-s3c2410/include/mach/ts.h>

7:在drivers/input/touchscreen/s3c2410_ts.c

加上

#include <mach/gpio-fns.h>

#include </root/linux-2.6.33/arch/arm/mach-s3c2410/include/mach/regs-gpio.h>

#include </root/linux-2.6.33/arch/arm/mach-s3c2410/include/mach/ts.h>

#define S3C2410_GPG12        

S3C2410_GPIONO(S3C2410_GPIO_BANKG, 12)

#define S3C2410_GPG13        

S3C2410_GPIONO(S3C2410_GPIO_BANKG, 13)

#define S3C2410_GPG14        

S3C2410_GPIONO(S3C2410_GPIO_BANKG, 14)

#define S3C2410_GPG15        

S3C2410_GPIONO(S3C2410_GPIO_BANKG, 15)

 

 

©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页