天嵌 ARM开发社区

 找回密码
 注册
查看: 1726|回复: 0

在linux2.6.34 加触摸屏驱动 出现的问题

[复制链接]
ArmFans123 发表于 2012-8-14 16:50:27 | 显示全部楼层 |阅读模式
在linux2.6.34 中原来没有加触摸屏驱动在linux2.6.34 中原来没有加触摸屏驱动,
想用linux2.3.34 内核自带的触摸驱动(在目录/driver/input/s3c2440_ts.c),
通过注册总线设备添加到平台总线驱动

首先在arch/arm/mach-2440/mach-smdk2440.c中 :

在 static struct platform_device *smdk2440_devices[] __initdata =    {
        &s3c_device_ohci,
        &smdk2440_device_eth,
        &s3c_device_lcd,
        &s3c_device_wdt,
        &s3c_device_i2c0,
        &s3c_device_iis,
         &s3c_device_ts, //添加语句
  };
中添加一行 &s3c_device_ts, 把内核带的触摸屏加入平台设备。

然后在同文件中添加:
static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
        .delay                        = 10000,
        .presc                        = 49,
        .oversampling_shift        = 2,
};
在头文件里添加#include <mach/ts.h>

最后在同文件中smdk2440_machine_init添加:
static void __init smdk2440_machine_init(void)
{
        s3c24xx_fb_set_platdata(&smdk2440_fb_info);
        s3c_i2c0_set_platdata(NULL);

        s3c24xx_ts_set_platdata(&s3c_ts_platform); //添加语句

        platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
        smdk_machine_init();
}

编译通过了 ,可启动后内核出错:

CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
------------[ cut here ]------------
WARNING: at lib/kref.c:44 kref_get+0x1c/0x40()
Modules linked in:
[<c002f7a8>] (unwind_backtrace+0x0/0xf0) from [<c003d0dc>] (warn_slowpath_common
+0x44/0x5c)
[<c003d0dc>] (warn_slowpath_common+0x44/0x5c) from [<c0179ce8>] (kref_get+0x1c/0
x40)
[<c0179ce8>] (kref_get+0x1c/0x40) from [<c0179028>] (kobject_get+0x10/0x18)
[<c0179028>] (kobject_get+0x10/0x18) from [<c01ba39c>] (get_device+0x14/0x1c)
[<c01ba39c>] (get_device+0x14/0x1c) from [<c01bb264>] (device_add+0x68/0x478)
[<c01bb264>] (device_add+0x68/0x478) from [<c01be7d4>] (platform_device_add+0xf0
/0x148)
[<c01be7d4>] (platform_device_add+0xf0/0x148) from [<c01beaf4>] (platform_add_de
vices+0x1c/0x60)
[<c01beaf4>] (platform_add_devices+0x1c/0x60) from [<c000d7f4>] (smdk2440_machin
e_init+0x2c/0x38)
[<c000d7f4>] (smdk2440_machine_init+0x2c/0x38) from [<c000b390>] (customize_mach
ine+0x18/0x24)
[<c000b390>] (customize_machine+0x18/0x24) from [<c0029384>] (do_one_initcall+0x
5c/0x1bc)
[<c0029384>] (do_one_initcall+0x5c/0x1bc) from [<c00083fc>] (kernel_init+0xa0/0x
14c)
[<c00083fc>] (kernel_init+0xa0/0x14c) from [<c002ae48>] (kernel_thread_exit+0x0/
0x8)
---[ end trace 1b75b31a2719ed1c ]---
Unable to handle kernel NULL pointer dereference at virtual address 00000018
pgd = c0004000
[00000018] *pgd=00000000
Internal error: Oops: 5 [#1]
last sysfs file:
Modules linked in:
CPU: 0    Tainted: G        W   (2.6.34.12 #28)
PC is at sysfs_find_dirent+0x8/0x38
LR is at __sysfs_add_one+0x18/0xac
pc : [<c00d9500>]    lr : [<c00d9860>]    psr: 60000013
sp : c3c23e98  ip : 00000002  fp : 00000000
r10: 00000000  r9 : 00000000  r8 : 00000000
r7 : c3c23ed8  r6 : c3c40480  r5 : c3c51860  r4 : 00000000
r3 : 00000001  r2 : 00000000  r1 : c3c51860  r0 : 00000000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: c000717f  Table: 30004000  DAC: 00000017
Process swapper (pid: 1, stack limit = 0xc3c22270)
Stack: (0xc3c23e98 to 0xc3c24000)
3e80:                                                       00000000 c3c23ed8
3ea0: c3c40480 c00d9860 c3c23ed8 c3c40480 00000000 c03d9088 c3c40480 c00d9944
3ec0: 00000000 c03d9088 c3c23efc c3c40480 00000000 c00da2a0 00000000 00000000
3ee0: c03d9088 c03d9088 c03d9600 00000000 00000000 c00da324 c03d9088 c03d908c
3f00: c03d9080 c0179144 c03d9080 c03d9088 c03d95f8 00000000 00000000 c01793c0
3f20: c03d9088 c3c23f34 00000000 c01bb290 00000000 00000000 c03d9088 00000000
3f40: 00000021 c01792ec c03d9078 00000006 00000000 c03d9078 00000002 00000038
3f60: 00000007 00000000 00000000 00000000 00000000 c01be7d4 c0025080 00000006
3f80: 00000000 00000007 00000000 c01beaf4 c0025044 c0022f88 00000000 00000000
3fa0: 00000000 c000d7f4 c000b378 c000b390 c000b378 c0029384 c000b378 c3c396b8
3fc0: c03fd1c0 c03fd1c0 c0022b7c c0022f88 00000000 00000000 00000000 00000000
3fe0: 00000000 c00083fc 00000000 00000000 00000000 c002ae48 fbdefbfe cafe9bf7
[<c00d9500>] (sysfs_find_dirent+0x8/0x38) from [<c00d9860>] (__sysfs_add_one+0x1
8/0xac)
[<c00d9860>] (__sysfs_add_one+0x18/0xac) from [<c00d9944>] (sysfs_add_one+0x10/0
x8c)
[<c00d9944>] (sysfs_add_one+0x10/0x8c) from [<c00da2a0>] (create_dir+0x48/0x98)
[<c00da2a0>] (create_dir+0x48/0x98) from [<c00da324>] (sysfs_create_dir+0x34/0x4
c)
[<c00da324>] (sysfs_create_dir+0x34/0x4c) from [<c0179144>] (kobject_add_interna
l+0xb8/0x1bc)
[<c0179144>] (kobject_add_internal+0xb8/0x1bc) from [<c01793c0>] (kobject_add+0x
4c/0x5c)
[<c01793c0>] (kobject_add+0x4c/0x5c) from [<c01bb290>] (device_add+0x94/0x478)
[<c01bb290>] (device_add+0x94/0x478) from [<c01be7d4>] (platform_device_add+0xf0
/0x148)
[<c01be7d4>] (platform_device_add+0xf0/0x148) from [<c01beaf4>] (platform_add_de
vices+0x1c/0x60)
[<c01beaf4>] (platform_add_devices+0x1c/0x60) from [<c000d7f4>] (smdk2440_machin
e_init+0x2c/0x38)
[<c000d7f4>] (smdk2440_machine_init+0x2c/0x38) from [<c000b390>] (customize_mach
ine+0x18/0x24)
[<c000b390>] (customize_machine+0x18/0x24) from [<c0029384>] (do_one_initcall+0x
5c/0x1bc)
[<c0029384>] (do_one_initcall+0x5c/0x1bc) from [<c00083fc>] (kernel_init+0xa0/0x
14c)
[<c00083fc>] (kernel_init+0xa0/0x14c) from [<c002ae48>] (kernel_thread_exit+0x0/
0x8)
Code: e3a00000 e12fff1e e92d4070 e1a05001 (e5904018)
---[ end trace 1b75b31a2719ed1d ]---
Kernel panic - not syncing: Attempted to kill init!
[<c002f7a8>] (unwind_backtrace+0x0/0xf0) from [<c02e19f8>] (panic+0x40/0xc8)
[<c02e19f8>] (panic+0x40/0xc8) from [<c00400c4>] (do_exit+0x64/0x5c8)
[<c00400c4>] (do_exit+0x64/0x5c8) from [<c002d9f0>] (die+0x1b4/0x1e0)
[<c002d9f0>] (die+0x1b4/0x1e0) from [<c0030394>] (__do_kernel_fault+0x64/0x84)
[<c0030394>] (__do_kernel_fault+0x64/0x84) from [<c0030564>] (do_page_fault+0x1b
0/0x1c4)
[<c0030564>] (do_page_fault+0x1b0/0x1c4) from [<c00292c4>] (do_DataAbort+0x34/0x
94)
[<c00292c4>] (do_DataAbort+0x34/0x94) from [<c0029a00>] (__dabt_svc+0x40/0x60)
Exception stack(0xc3c23e50 to 0xc3c23e98)
3e40:                                     00000000 c3c51860 00000000 00000001
3e60: 00000000 c3c51860 c3c40480 c3c23ed8 00000000 00000000 00000000 00000000
3e80: 00000002 c3c23e98 c00d9860 c00d9500 60000013 ffffffff
[<c0029a00>] (__dabt_svc+0x40/0x60) from [<c00d9500>] (sysfs_find_dirent+0x8/0x3
8)
[<c00d9500>] (sysfs_find_dirent+0x8/0x38) from [<c00d9860>] (__sysfs_add_one+0x1
8/0xac)
[<c00d9860>] (__sysfs_add_one+0x18/0xac) from [<c00d9944>] (sysfs_add_one+0x10/0
。。。。。。。。。。。。。。。。。。。。。。。。。,
想用linux2.3.34 内核自带的触摸驱动(在目录/driver/input/s3c2440_ts.c),
通过注册总线设备添加到平台总线驱动

首先在arch/arm/mach-2440/mach-smdk2440.c中 :

在 static struct platform_device *smdk2440_devices[] __initdata =    {
        &s3c_device_ohci,
        &smdk2440_device_eth,
        &s3c_device_lcd,
        &s3c_device_wdt,
        &s3c_device_i2c0,
        &s3c_device_iis,
         &s3c_device_ts, //添加语句
  };
中添加一行 &s3c_device_ts, 把内核带的触摸屏加入平台设备。

然后在同文件中添加:
static struct s3c2410_ts_mach_info s3c_ts_platform __initdata = {
        .delay                        = 10000,
        .presc                        = 49,
        .oversampling_shift        = 2,
};
在头文件里添加#include <mach/ts.h>

最后在同文件中smdk2440_machine_init添加:
static void __init smdk2440_machine_init(void)
{
        s3c24xx_fb_set_platdata(&smdk2440_fb_info);
        s3c_i2c0_set_platdata(NULL);

        s3c24xx_ts_set_platdata(&s3c_ts_platform); //添加语句

        platform_add_devices(smdk2440_devices, ARRAY_SIZE(smdk2440_devices));
        smdk_machine_init();
}

编译通过了 ,可启动后内核出错:

CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
------------[ cut here ]------------
WARNING: at lib/kref.c:44 kref_get+0x1c/0x40()
Modules linked in:
[<c002f7a8>] (unwind_backtrace+0x0/0xf0) from [<c003d0dc>] (warn_slowpath_common
+0x44/0x5c)
[<c003d0dc>] (warn_slowpath_common+0x44/0x5c) from [<c0179ce8>] (kref_get+0x1c/0
x40)
[<c0179ce8>] (kref_get+0x1c/0x40) from [<c0179028>] (kobject_get+0x10/0x18)
[<c0179028>] (kobject_get+0x10/0x18) from [<c01ba39c>] (get_device+0x14/0x1c)
[<c01ba39c>] (get_device+0x14/0x1c) from [<c01bb264>] (device_add+0x68/0x478)
[<c01bb264>] (device_add+0x68/0x478) from [<c01be7d4>] (platform_device_add+0xf0
/0x148)
[<c01be7d4>] (platform_device_add+0xf0/0x148) from [<c01beaf4>] (platform_add_de
vices+0x1c/0x60)
[<c01beaf4>] (platform_add_devices+0x1c/0x60) from [<c000d7f4>] (smdk2440_machin
e_init+0x2c/0x38)
[<c000d7f4>] (smdk2440_machine_init+0x2c/0x38) from [<c000b390>] (customize_mach
ine+0x18/0x24)
[<c000b390>] (customize_machine+0x18/0x24) from [<c0029384>] (do_one_initcall+0x
5c/0x1bc)
[<c0029384>] (do_one_initcall+0x5c/0x1bc) from [<c00083fc>] (kernel_init+0xa0/0x
14c)
[<c00083fc>] (kernel_init+0xa0/0x14c) from [<c002ae48>] (kernel_thread_exit+0x0/
0x8)
---[ end trace 1b75b31a2719ed1c ]---
Unable to handle kernel NULL pointer dereference at virtual address 00000018
pgd = c0004000
[00000018] *pgd=00000000
Internal error: Oops: 5 [#1]
last sysfs file:
Modules linked in:
CPU: 0    Tainted: G        W   (2.6.34.12 #28)
PC is at sysfs_find_dirent+0x8/0x38
LR is at __sysfs_add_one+0x18/0xac
pc : [<c00d9500>]    lr : [<c00d9860>]    psr: 60000013
sp : c3c23e98  ip : 00000002  fp : 00000000
r10: 00000000  r9 : 00000000  r8 : 00000000
r7 : c3c23ed8  r6 : c3c40480  r5 : c3c51860  r4 : 00000000
r3 : 00000001  r2 : 00000000  r1 : c3c51860  r0 : 00000000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment kernel
Control: c000717f  Table: 30004000  DAC: 00000017
Process swapper (pid: 1, stack limit = 0xc3c22270)
Stack: (0xc3c23e98 to 0xc3c24000)
。。。。。。。。。。。。。。。。。。。。。。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

i.MX8系列ARM cortex A53 M4 工控板上一条 /1 下一条

Archiver|手机版|小黑屋|天嵌 嵌入式开发社区 ( 粤ICP备11094220号 )

GMT+8, 2024-5-19 02:57 , Processed in 1.046875 second(s), 18 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表