Skip to content

Commit

Permalink
V4L/DVB (5334): Dvb-ttpci: Infrared remote control refactoring
Browse files Browse the repository at this point in the history
Infrared remote control support rewritten.
Now each device provides its own event device, keymap, protocol,
inversion and address setting.
EVIOCGKEYCODE and EVIOCSKEYCODE ioctls are supported to read/modify
a keymap. Keymaps may be loaded using
- input tools (keyb etc.)
- av7110_loadkeys (obsolete, for backward compatibility)
New command line parameters:
- ir_protocol:    select infrared protocol: 0 RC5, 1 RCMM (default)
- ir_inversion:   signal inversion: 0 not inverted (default), 1 inverted
- ir_device_mask: bitmask of infrared devices (default: accept all)
Those parameters may be set anytime.

Signed-off-by: Oliver Endriss <o.endriss@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
  • Loading branch information
Oliver Endriss authored and Mauro Carvalho Chehab committed Apr 27, 2007
1 parent db48367 commit ee820a6
Show file tree
Hide file tree
Showing 3 changed files with 265 additions and 134 deletions.
13 changes: 10 additions & 3 deletions drivers/media/dvb/ttpci/av7110.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ static void recover_arm(struct av7110 *av7110)
av7110->recover(av7110);

restart_feeds(av7110);
av7110_fw_cmd(av7110, COMTYPE_PIDFILTER, SetIR, 1, av7110->ir_config);

#if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE)
av7110_check_ir_config(av7110, true);
#endif
}

static void av7110_arm_sync(struct av7110 *av7110)
Expand Down Expand Up @@ -250,6 +253,10 @@ static int arm_thread(void *data)
if (!av7110->arm_ready)
continue;

#if defined(CONFIG_INPUT_EVDEV) || defined(CONFIG_INPUT_EVDEV_MODULE)
av7110_check_ir_config(av7110, false);
#endif

if (mutex_lock_interruptible(&av7110->dcomlock))
break;
newloops = rdebi(av7110, DEBINOSWAP, STATUS_LOOPS, 0, 2);
Expand Down Expand Up @@ -667,8 +674,8 @@ static void gpioirq(unsigned long data)
return;

case DATA_IRCOMMAND:
if (av7110->ir_handler)
av7110->ir_handler(av7110,
if (av7110->ir.ir_handler)
av7110->ir.ir_handler(av7110,
swahw32(irdebi(av7110, DEBINOSWAP, Reserved, 0, 4)));
iwdebi(av7110, DEBINOSWAP, RX_BUFF, 0, 2);
break;
Expand Down
28 changes: 24 additions & 4 deletions drivers/media/dvb/ttpci/av7110.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <linux/socket.h>
#include <linux/netdevice.h>
#include <linux/i2c.h>
#include <linux/input.h>

#include <linux/dvb/video.h>
#include <linux/dvb/audio.h>
Expand Down Expand Up @@ -66,6 +67,27 @@ struct dvb_video_events {
};


struct av7110;

/* infrared remote control */
struct infrared {
u16 key_map[256];
struct input_dev *input_dev;
char input_phys[32];
struct timer_list keyup_timer;
struct tasklet_struct ir_tasklet;
void (*ir_handler)(struct av7110 *av7110, u32 ircom);
u32 ir_command;
u32 ir_config;
u32 device_mask;
u8 protocol;
u8 inversion;
u16 last_key;
u16 last_toggle;
u8 delay_timer_finished;
};


/* place to store all the necessary device information */
struct av7110 {

Expand Down Expand Up @@ -227,10 +249,7 @@ struct av7110 {
u16 wssMode;
u16 wssData;

u32 ir_config;
u32 ir_command;
void (*ir_handler)(struct av7110 *av7110, u32 ircom);
struct tasklet_struct ir_tasklet;
struct infrared ir;

/* firmware stuff */
unsigned char *bin_fw;
Expand Down Expand Up @@ -268,6 +287,7 @@ struct av7110 {
extern int ChangePIDs(struct av7110 *av7110, u16 vpid, u16 apid, u16 ttpid,
u16 subpid, u16 pcrpid);

extern int av7110_check_ir_config(struct av7110 *av7110, int force);
extern int av7110_ir_init(struct av7110 *av7110);
extern void av7110_ir_exit(struct av7110 *av7110);

Expand Down
Loading

0 comments on commit ee820a6

Please sign in to comment.