본문 바로가기

학부_대학원/임베디드 리눅스

Platform Device Driver Built In[플랫폼 디바이스 드라이버 빌트인]

SMALL
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
[step7 : Keybutton Driver (LDM platform_driver)  ]
 
 
[1] ~/arch/arm/mach-s5pv210/mach-elv210.c
          //cpu//board//
/*        tip
 *        보드는 누군가의 보드를 보고 만듬, 그래서 참고한 부분이 꼭 존재함
 */
 
 
/*
 *      1단계
 */
 
line 322 :
                              [변경 하는 부분]
static struct platform_device elv210keybtn_device = {
    .name           = "elv210-keybutton",  //파일이름과 같아야함 코드
    .id             =  -1//운영체제에서 자동 할당
};
 
 
 
/*
 *      2단계
 */
 
line 362 :
//__initdata 역할은 초기화 하고 소멸하고 없어지라는 의미 메모리를 차지하지 말고 free해라
static struct platform_device *elv210_devices[] __initdata = {
    &s3c_device_adc,
    &s3c_device_cfcon,
        ...
    &elv210_lcd_lte480wv,
    &device_smsc911x, //Added
    &hx8526_ts_device, // Added..
    &s5pv210_device_nand, // Added
    &elv210keybtn_device,  //--> 추가된 부분
};
 
 
/*
 *       일반 디바이스 드라이버 빌트 인과 같음
* 3단계  : 코드 옮김
 */
 
[2] copy  elv210_keybutton.c  to ~/drivers/input/keyboard/
 
 
/*
 *      4단계 : Kconfig 수정
 */
 
[3] ~/drivers/input/keyboard/Kconfig
 
line 506:
 
config KEYBOARD_ELV210
    tristate "ELV210 keybutton support"
    help
      GPIO keybutton driver for ELV210 Board...
 
 
    /*
     *      5단계 : Makefile 수정
     */
 
 
[4] ~/drivers/input/keyboard/Makefile
 
line 50 :
   ...
obj-$(CONFIG_KEYBOARD_QT2160)        += qt2160.o
obj-$(CONFIG_KEYBOARD_SAMSUNG)        += samsung-keypad.o
obj-$(CONFIG_KEYBOARD_ELV210)        += elv210_keybutton.o
obj-$(CONFIG_KEYBOARD_SH_KEYSC)        += sh_keysc.o
   ...
 
 
[5]
- make menuconfig 실행 후 Device drivers->Input device support->[*] Keyboards 를
선택하고 하위메뉴로 들어가서
 <*>  ELV210 keybutton support 를 선택해준다
 
 
[6] make clean && make zImage
 
 
[7] reboot
 
[    1.799607] smsc911x smsc911x.0 eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=smsc911x-0:01, irq=-1)
[    1.804355] smsc911x smsc911x.0 eth0: MAC Address: fa:c1:6d:76:79:bc
[    1.810944] mousedev: PS/2 mouse device common for all mice
[    1.816354] eLV210 external key button probe!!
[    1.820558] HX8526 Multi-touchscreen driver 2012
[    1.842542] input: hx8526_ts_input as /devices/virtual/input/input0
[    1.971966] (null): dev id = 0x260x00x0
 
 
 
/*
 *      옳바르게 등록되어 있는지 확인하는 방법
 */
 
# ls /sys/bus/platform/devices/
alarmtimer        s3c-sdhci.2       s5p-mfc-l         s5pv210-uart.3
arm-pmu           s3c-sdhci.3       s5p-mfc-r         samsung-ac97
dm9000            s3c2410-wdt       s5pv210-fb        samsung-adc-v3
elv210-keybutton  s3c2440-i2c.0     s5pv210-fimc.0    samsung-i2s.0
hx8526-ts.0       s3c2440-i2c.1     s5pv210-fimc.1    samsung-idma
i2c-gpio.3        s3c2440-i2c.2     s5pv210-fimc.2    samsung-pwm
...
 
# ls /sys/bus/platform/drivers
alarmtimer        platform-lcd      s3c-i2c           samsung-pwm
arm-pmu           pwm-backlight     s3c-rtc           samsung-uart
elv210-keybutton  s3c-adc           s3c-sdhci         smsc911x
i2c-gpio          s3c-fb            s3c2410-wdt
 
cs


LIST