[media] rc-core: improve ir-kbd-i2c get_key functions

The arguments used for ir-kbd-i2c's get_key() functions are not
really suited for rc-core and the ir_raw/ir_key distinction is
just confusing.

Convert all of them to return a protocol/scancode/toggle triple instead.

Signed-off-by: David Härdeman <david@hardeman.nu>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
这个提交包含在:
David Härdeman
2014-04-03 20:31:25 -03:00
提交者 Mauro Carvalho Chehab
父节点 2886f013c3
当前提交 4dd9bb91bb
修改 8 个文件,包含 127 行新增100 行删除

查看文件

@@ -21,11 +21,12 @@
#include "cx231xx.h"
#include <linux/usb.h>
#include <linux/slab.h>
#include <linux/bitrev.h>
#define MODULE_NAME "cx231xx-input"
static int get_key_isdbt(struct IR_i2c *ir, u32 *ir_key,
u32 *ir_raw)
static int get_key_isdbt(struct IR_i2c *ir, enum rc_type *protocol,
u32 *pscancode, u8 *toggle)
{
int rc;
u8 cmd, scancode;
@@ -46,21 +47,14 @@ static int get_key_isdbt(struct IR_i2c *ir, u32 *ir_key,
if (cmd == 0xff)
return 0;
scancode =
((cmd & 0x01) ? 0x80 : 0) |
((cmd & 0x02) ? 0x40 : 0) |
((cmd & 0x04) ? 0x20 : 0) |
((cmd & 0x08) ? 0x10 : 0) |
((cmd & 0x10) ? 0x08 : 0) |
((cmd & 0x20) ? 0x04 : 0) |
((cmd & 0x40) ? 0x02 : 0) |
((cmd & 0x80) ? 0x01 : 0);
scancode = bitrev8(cmd);
dev_dbg(&ir->rc->input_dev->dev, "cmd %02x, scan = %02x\n",
cmd, scancode);
*ir_key = scancode;
*ir_raw = scancode;
*protocol = RC_TYPE_OTHER;
*pscancode = scancode;
*toggle = 0;
return 1;
}