From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>
Subject: [PATCH 2/4] [media] cx88: Add RC logic for Leadtek PVR 2000
Date: Thu, 30 Dec 2010 09:45:10 -0200 [thread overview]
Message-ID: <20101230094510.56bfb97a@gaivota> (raw)
In-Reply-To: <cover.1293709356.git.mchehab@redhat.com>
Currently, lirc-i2c has a decoding logic for Leadtek Remote
Control. Move it to cx88, as we intend to remove lirc-i2c.
For now, initialize LIRC remote keytable with RC_MAP_EMPTY, as
we don't know its keymap yet. It would be nice to later check
if is there any file on LIRC userspace with that keytable.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index 4a3bf54..06f7d1d 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -68,6 +68,9 @@ MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
#define ir_dprintk(fmt, arg...) if (ir_debug) \
printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg)
+#define dprintk(fmt, arg...) if (ir_debug) \
+ printk(KERN_DEBUG "cx88 IR: " fmt , ##arg)
+
/* ---------------------------------------------------------------------- */
static void cx88_ir_handle_key(struct cx88_IR *ir)
@@ -527,13 +530,47 @@ void cx88_ir_irq(struct cx88_core *core)
ir_raw_event_handle(ir->dev);
}
+static int get_key_pvr2000(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
+{
+ int flags, code;
+
+ /* poll IR chip */
+ flags = i2c_smbus_read_byte_data(ir->c, 0x10);
+ if (flags < 0) {
+ dprintk("read error\n");
+ return 0;
+ }
+ /* key pressed ? */
+ if (0 == (flags & 0x80))
+ return 0;
+
+ /* read actual key code */
+ code = i2c_smbus_read_byte_data(ir->c, 0x00);
+ if (code < 0) {
+ dprintk("read error\n");
+ return 0;
+ }
+
+ dprintk("IR Key/Flags: (0x%02x/0x%02x)\n",
+ code & 0xff, flags & 0xff);
+
+ *ir_key = code & 0xff;
+ *ir_raw = code;
+ return 1;
+}
+
void cx88_i2c_init_ir(struct cx88_core *core)
{
struct i2c_board_info info;
- const unsigned short addr_list[] = {
+ const unsigned short default_addr_list[] = {
0x18, 0x6b, 0x71,
I2C_CLIENT_END
};
+ const unsigned short pvr2000_addr_list[] = {
+ 0x18, 0x1a,
+ I2C_CLIENT_END
+ };
+ const unsigned short *addr_list = default_addr_list;
const unsigned short *addrp;
/* Instantiate the IR receiver device, if present */
if (0 != core->i2c_rc)
@@ -542,6 +579,16 @@ void cx88_i2c_init_ir(struct cx88_core *core)
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
+ switch (core->boardnr) {
+ case CX88_BOARD_LEADTEK_PVR2000:
+ addr_list = pvr2000_addr_list;
+ core->init_data.name = "cx88 Leadtek PVR 2000 remote";
+ core->init_data.type = RC_TYPE_UNKNOWN;
+ core->init_data.get_key = get_key_pvr2000;
+ core->init_data.ir_codes = RC_MAP_EMPTY;
+ break;
+ }
+
/*
* We can't call i2c_new_probed_device() because it uses
* quick writes for probing and at least some RC receiver
--
1.7.3.4
next prev parent reply other threads:[~2010-12-30 11:51 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1293709356.git.mchehab@redhat.com>
2010-12-30 11:45 ` [PATCH 4/4] [media] Remove staging/lirc/lirc_i2c driver Mauro Carvalho Chehab
2010-12-30 11:45 ` [PATCH 3/4] [media] ivtv: Add Adaptec Remote Controller Mauro Carvalho Chehab
2010-12-30 11:56 ` Hans Verkuil
2010-12-30 12:09 ` Mauro Carvalho Chehab
2010-12-30 12:34 ` Hans Verkuil
2010-12-30 13:32 ` Mauro Carvalho Chehab
2010-12-30 12:36 ` Andy Walls
2010-12-30 13:30 ` Mauro Carvalho Chehab
2010-12-30 13:53 ` Andy Walls
2010-12-30 12:46 ` Andy Walls
2010-12-30 13:29 ` Mauro Carvalho Chehab
2010-12-30 13:46 ` Andy Walls
2010-12-30 13:05 ` [PATCH v2] " Mauro Carvalho Chehab
2010-12-30 13:35 ` Andy Walls
2010-12-30 11:45 ` Mauro Carvalho Chehab [this message]
2010-12-30 11:45 ` [PATCH 1/4] [media] bttv-input: Add a note about PV951 RC Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101230094510.56bfb97a@gaivota \
--to=mchehab@redhat.com \
--cc=linux-media@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.