[PATCH] v4l: (935) Moved common IR stuff to ir-common.c

- The pinnacle handler & remote are common to saa7134 PCI boards and em28xx
  USB boards, so the keymap was moved to ir-common and the keyhandler is back
  to ir-kbd-i2c

- request_module("ir-kbd-i2c") is no longer necessary at saa7134-core since
  saa7134.ko now depends on ir-kbd-i2c.ko to get the keyhandler

Signed-off-by: Ricardo Cerqueira <v4l@cerqueira.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Ricardo Cerqueira 2005-11-13 16:07:49 -08:00 committed by Linus Torvalds
parent 800d3c6f90
commit 8069695c9e
6 changed files with 115 additions and 111 deletions

View file

@ -126,6 +126,66 @@ IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = {
};
EXPORT_SYMBOL_GPL(ir_codes_winfast);
IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = {
[ 0x59 ] = KEY_MUTE,
[ 0x4a ] = KEY_POWER,
[ 0x18 ] = KEY_TEXT,
[ 0x26 ] = KEY_TV,
[ 0x3d ] = KEY_PRINT,
[ 0x48 ] = KEY_RED,
[ 0x04 ] = KEY_GREEN,
[ 0x11 ] = KEY_YELLOW,
[ 0x00 ] = KEY_BLUE,
[ 0x2d ] = KEY_VOLUMEUP,
[ 0x1e ] = KEY_VOLUMEDOWN,
[ 0x49 ] = KEY_MENU,
[ 0x16 ] = KEY_CHANNELUP,
[ 0x17 ] = KEY_CHANNELDOWN,
[ 0x20 ] = KEY_UP,
[ 0x21 ] = KEY_DOWN,
[ 0x22 ] = KEY_LEFT,
[ 0x23 ] = KEY_RIGHT,
[ 0x0d ] = KEY_SELECT,
[ 0x08 ] = KEY_BACK,
[ 0x07 ] = KEY_REFRESH,
[ 0x2f ] = KEY_ZOOM,
[ 0x29 ] = KEY_RECORD,
[ 0x4b ] = KEY_PAUSE,
[ 0x4d ] = KEY_REWIND,
[ 0x2e ] = KEY_PLAY,
[ 0x4e ] = KEY_FORWARD,
[ 0x53 ] = KEY_PREVIOUS,
[ 0x4c ] = KEY_STOP,
[ 0x54 ] = KEY_NEXT,
[ 0x69 ] = KEY_KP0,
[ 0x6a ] = KEY_KP1,
[ 0x6b ] = KEY_KP2,
[ 0x6c ] = KEY_KP3,
[ 0x6d ] = KEY_KP4,
[ 0x6e ] = KEY_KP5,
[ 0x6f ] = KEY_KP6,
[ 0x70 ] = KEY_KP7,
[ 0x71 ] = KEY_KP8,
[ 0x72 ] = KEY_KP9,
[ 0x74 ] = KEY_CHANNEL,
[ 0x0a ] = KEY_BACKSPACE,
};
EXPORT_SYMBOL_GPL(ir_codes_pinnacle);
/* empty keytable, can be used as placeholder for not-yet created keytables */
IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE] = {
[ 42 ] = KEY_COFFEE,

View file

@ -183,6 +183,58 @@ static int get_key_knc1(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
return 1;
}
/* The new pinnacle PCTV remote (with the colored buttons)
*
* Ricardo Cerqueira <v4l@cerqueira.org>
*/
int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
{
unsigned char b[4];
unsigned int start = 0,parity = 0,code = 0;
/* poll IR chip */
if (4 != i2c_master_recv(&ir->c,b,4)) {
dprintk(2,"read error\n");
return -EIO;
}
for (start = 0; start<4; start++) {
if (b[start] == 0x80) {
code=b[(start+3)%4];
parity=b[(start+2)%4];
}
}
/* Empty Request */
if (parity==0)
return 0;
/* Repeating... */
if (ir->old == parity)
return 0;
ir->old = parity;
/* Reduce code value to fit inside IR_KEYTAB_SIZE
*
* this is the only value that results in 42 unique
* codes < 128
*/
code %= 0x88;
*ir_raw = code;
*ir_key = code;
dprintk(1,"Pinnacle PCTV key %02x\n", code);
return 1;
}
EXPORT_SYMBOL_GPL(get_key_pinnacle);
/* ----------------------------------------------------------------------- */
static void ir_key_poll(struct IR_i2c *ir)

View file

@ -728,8 +728,6 @@ static int saa7134_hwinit2(struct saa7134_dev *dev)
irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18 |
SAA7134_IRQ2_INTE_GPIO18A |
SAA7134_IRQ2_INTE_GPIO16 );
else if (dev->has_remote == SAA7134_REMOTE_I2C)
request_module("ir-kbd-i2c");
saa_writel(SAA7134_IRQ1, 0);
saa_writel(SAA7134_IRQ2, irq2_mask);

View file

@ -485,64 +485,6 @@ static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = {
};
static IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE] = {
[ 0x59 ] = KEY_MUTE,
[ 0x4a ] = KEY_POWER,
[ 0x18 ] = KEY_TEXT,
[ 0x26 ] = KEY_TV,
[ 0x3d ] = KEY_PRINT,
[ 0x48 ] = KEY_RED,
[ 0x04 ] = KEY_GREEN,
[ 0x11 ] = KEY_YELLOW,
[ 0x00 ] = KEY_BLUE,
[ 0x2d ] = KEY_VOLUMEUP,
[ 0x1e ] = KEY_VOLUMEDOWN,
[ 0x49 ] = KEY_MENU,
[ 0x16 ] = KEY_CHANNELUP,
[ 0x17 ] = KEY_CHANNELDOWN,
[ 0x20 ] = KEY_UP,
[ 0x21 ] = KEY_DOWN,
[ 0x22 ] = KEY_LEFT,
[ 0x23 ] = KEY_RIGHT,
[ 0x0d ] = KEY_SELECT,
[ 0x08 ] = KEY_BACK,
[ 0x07 ] = KEY_REFRESH,
[ 0x2f ] = KEY_ZOOM,
[ 0x29 ] = KEY_RECORD,
[ 0x4b ] = KEY_PAUSE,
[ 0x4d ] = KEY_REWIND,
[ 0x2e ] = KEY_PLAY,
[ 0x4e ] = KEY_FORWARD,
[ 0x53 ] = KEY_PREVIOUS,
[ 0x4c ] = KEY_STOP,
[ 0x54 ] = KEY_NEXT,
[ 0x69 ] = KEY_KP0,
[ 0x6a ] = KEY_KP1,
[ 0x6b ] = KEY_KP2,
[ 0x6c ] = KEY_KP3,
[ 0x6d ] = KEY_KP4,
[ 0x6e ] = KEY_KP5,
[ 0x6f ] = KEY_KP6,
[ 0x70 ] = KEY_KP7,
[ 0x71 ] = KEY_KP8,
[ 0x72 ] = KEY_KP9,
[ 0x74 ] = KEY_CHANNEL,
[ 0x0a ] = KEY_BACKSPACE,
};
/* Mapping for the 28 key remote control as seen at
http://www.sednacomputer.com/photo/cardbus-tv.jpg
Pavel Mihaylov <bin@bash.info> */
@ -635,57 +577,6 @@ static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
return 1;
}
/* The new pinnacle PCTV remote (with the colored buttons)
*
* Ricardo Cerqueira <v4l@cerqueira.org>
*/
static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
{
unsigned char b[4];
unsigned int start = 0,parity = 0,code = 0;
/* poll IR chip */
if (4 != i2c_master_recv(&ir->c,b,4)) {
i2cdprintk("read error\n");
return -EIO;
}
for (start = 0; start<4; start++) {
if (b[start] == 0x80) {
code=b[(start+3)%4];
parity=b[(start+2)%4];
}
}
/* Empty Request */
if (parity==0)
return 0;
/* Repeating... */
if (ir->old == parity)
return 0;
ir->old = parity;
/* Reduce code value to fit inside IR_KEYTAB_SIZE
*
* this is the only value that results in 42 unique
* codes < 128
*/
code %= 0x88;
*ir_raw = code;
*ir_key = code;
i2cdprintk("Pinnacle PCTV key %02x\n", code);
return 1;
}
void saa7134_input_irq(struct saa7134_dev *dev)
{
struct saa7134_ir *ir = dev->remote;

View file

@ -49,6 +49,7 @@ struct ir_input_state {
extern IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE];
extern IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE];
extern IR_KEYTAB_TYPE ir_codes_pinnacle[IR_KEYTAB_SIZE];
extern IR_KEYTAB_TYPE ir_codes_empty[IR_KEYTAB_SIZE];
extern IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE];
extern IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE];

View file

@ -19,4 +19,6 @@ struct IR_i2c {
char phys[32];
int (*get_key)(struct IR_i2c*, u32*, u32*);
};
int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw);
#endif