Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
77a53fd2
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
77a53fd2
编写于
8月 25, 2009
作者:
D
Dmitry Torokhov
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Input: matrix-keypad - add function to build device keymap
Signed-off-by:
N
Dmitry Torokhov
<
dtor@mail.ru
>
上级
8fbac18e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
37 addition
and
26 deletion
+37
-26
drivers/input/keyboard/matrix_keypad.c
drivers/input/keyboard/matrix_keypad.c
+3
-12
drivers/input/keyboard/w90p910_keypad.c
drivers/input/keyboard/w90p910_keypad.c
+2
-14
include/linux/input/matrix_keypad.h
include/linux/input/matrix_keypad.h
+32
-0
未找到文件。
drivers/input/keyboard/matrix_keypad.c
浏览文件 @
77a53fd2
...
@@ -319,7 +319,6 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
...
@@ -319,7 +319,6 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
struct
input_dev
*
input_dev
;
struct
input_dev
*
input_dev
;
unsigned
short
*
keycodes
;
unsigned
short
*
keycodes
;
unsigned
int
row_shift
;
unsigned
int
row_shift
;
int
i
;
int
err
;
int
err
;
pdata
=
pdev
->
dev
.
platform_data
;
pdata
=
pdev
->
dev
.
platform_data
;
...
@@ -363,18 +362,10 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
...
@@ -363,18 +362,10 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
input_dev
->
keycode
=
keycodes
;
input_dev
->
keycode
=
keycodes
;
input_dev
->
keycodesize
=
sizeof
(
*
keycodes
);
input_dev
->
keycodesize
=
sizeof
(
*
keycodes
);
input_dev
->
keycodemax
=
pdata
->
num_row_gpios
<<
keypad
->
row_shift
;
input_dev
->
keycodemax
=
pdata
->
num_row_gpios
<<
row_shift
;
for
(
i
=
0
;
i
<
keymap_data
->
keymap_size
;
i
++
)
{
unsigned
int
key
=
keymap_data
->
keymap
[
i
];
unsigned
int
row
=
KEY_ROW
(
key
);
unsigned
int
col
=
KEY_COL
(
key
);
unsigned
short
code
=
KEY_VAL
(
key
);
keycodes
[
MATRIX_SCAN_CODE
(
row
,
col
,
row_shift
)]
=
code
;
matrix_keypad_build_keymap
(
keymap_data
,
row_shift
,
__set_bit
(
code
,
input_dev
->
keybit
);
input_dev
->
keycode
,
input_dev
->
keybit
);
}
__clear_bit
(
KEY_RESERVED
,
input_dev
->
keybit
);
input_set_capability
(
input_dev
,
EV_MSC
,
MSC_SCAN
);
input_set_capability
(
input_dev
,
EV_MSC
,
MSC_SCAN
);
input_set_drvdata
(
input_dev
,
keypad
);
input_set_drvdata
(
input_dev
,
keypad
);
...
...
drivers/input/keyboard/w90p910_keypad.c
浏览文件 @
77a53fd2
...
@@ -126,7 +126,6 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev)
...
@@ -126,7 +126,6 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev)
struct
resource
*
res
;
struct
resource
*
res
;
int
irq
;
int
irq
;
int
error
;
int
error
;
int
i
;
if
(
!
pdata
)
{
if
(
!
pdata
)
{
dev_err
(
&
pdev
->
dev
,
"no platform data defined
\n
"
);
dev_err
(
&
pdev
->
dev
,
"no platform data defined
\n
"
);
...
@@ -197,19 +196,8 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev)
...
@@ -197,19 +196,8 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev)
input_dev
->
evbit
[
0
]
=
BIT_MASK
(
EV_KEY
)
|
BIT_MASK
(
EV_REP
);
input_dev
->
evbit
[
0
]
=
BIT_MASK
(
EV_KEY
)
|
BIT_MASK
(
EV_REP
);
input_set_capability
(
input_dev
,
EV_MSC
,
MSC_SCAN
);
input_set_capability
(
input_dev
,
EV_MSC
,
MSC_SCAN
);
for
(
i
=
0
;
i
<
keymap_data
->
keymap_size
;
i
++
)
{
matrix_keypad_build_keymap
(
keymap_data
,
W90P910_ROW_SHIFT
,
unsigned
int
key
=
keymap_data
->
keymap
[
i
];
input_dev
->
keycode
,
input_dev
->
keybit
);
unsigned
int
row
=
KEY_ROW
(
key
);
unsigned
int
col
=
KEY_COL
(
key
);
unsigned
short
keycode
=
KEY_VAL
(
key
);
unsigned
int
scancode
=
MATRIX_SCAN_CODE
(
row
,
col
,
W90P910_ROW_SHIFT
);
keypad
->
keymap
[
scancode
]
=
keycode
;
__set_bit
(
keycode
,
input_dev
->
keybit
);
}
__clear_bit
(
KEY_RESERVED
,
input_dev
->
keybit
);
error
=
request_irq
(
keypad
->
irq
,
w90p910_keypad_irq_handler
,
error
=
request_irq
(
keypad
->
irq
,
w90p910_keypad_irq_handler
,
IRQF_DISABLED
,
pdev
->
name
,
keypad
);
IRQF_DISABLED
,
pdev
->
name
,
keypad
);
...
...
include/linux/input/matrix_keypad.h
浏览文件 @
77a53fd2
...
@@ -63,4 +63,36 @@ struct matrix_keypad_platform_data {
...
@@ -63,4 +63,36 @@ struct matrix_keypad_platform_data {
bool
wakeup
;
bool
wakeup
;
};
};
/**
* matrix_keypad_build_keymap - convert platform keymap into matrix keymap
* @keymap_data: keymap supplied by the platform code
* @row_shift: number of bits to shift row value by to advance to the next
* line in the keymap
* @keymap: expanded version of keymap that is suitable for use by
* matrix keyboad driver
* @keybit: pointer to bitmap of keys supported by input device
*
* This function converts platform keymap (encoded with KEY() macro) into
* an array of keycodes that is suitable for using in a standard matrix
* keyboard driver that uses row and col as indices.
*/
static
inline
void
matrix_keypad_build_keymap
(
const
struct
matrix_keymap_data
*
keymap_data
,
unsigned
int
row_shift
,
unsigned
short
*
keymap
,
unsigned
long
*
keybit
)
{
int
i
;
for
(
i
=
0
;
i
<
keymap_data
->
keymap_size
;
i
++
)
{
unsigned
int
key
=
keymap_data
->
keymap
[
i
];
unsigned
int
row
=
KEY_ROW
(
key
);
unsigned
int
col
=
KEY_COL
(
key
);
unsigned
short
code
=
KEY_VAL
(
key
);
keymap
[
MATRIX_SCAN_CODE
(
row
,
col
,
row_shift
)]
=
code
;
__set_bit
(
code
,
keybit
);
}
__clear_bit
(
KEY_RESERVED
,
keybit
);
}
#endif
/* _MATRIX_KEYPAD_H */
#endif
/* _MATRIX_KEYPAD_H */
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录