2005-04-16 22:20:36 +00:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* handle saa7134 IR remotes via linux kernel input layer.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/interrupt.h>
|
include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
percpu.h is included by sched.h and module.h and thus ends up being
included when building most .c files. percpu.h includes slab.h which
in turn includes gfp.h making everything defined by the two files
universally available and complicating inclusion dependencies.
percpu.h -> slab.h dependency is about to be removed. Prepare for
this change by updating users of gfp and slab facilities include those
headers directly instead of assuming availability. As this conversion
needs to touch large number of source files, the following script is
used as the basis of conversion.
http://userweb.kernel.org/~tj/misc/slabh-sweep.py
The script does the followings.
* Scan files for gfp and slab usages and update includes such that
only the necessary includes are there. ie. if only gfp is used,
gfp.h, if slab is used, slab.h.
* When the script inserts a new include, it looks at the include
blocks and try to put the new include such that its order conforms
to its surrounding. It's put in the include block which contains
core kernel includes, in the same order that the rest are ordered -
alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
doesn't seem to be any matching order.
* If the script can't find a place to put a new include (mostly
because the file doesn't have fitting include block), it prints out
an error message indicating which .h file needs to be added to the
file.
The conversion was done in the following steps.
1. The initial automatic conversion of all .c files updated slightly
over 4000 files, deleting around 700 includes and adding ~480 gfp.h
and ~3000 slab.h inclusions. The script emitted errors for ~400
files.
2. Each error was manually checked. Some didn't need the inclusion,
some needed manual addition while adding it to implementation .h or
embedding .c file was more appropriate for others. This step added
inclusions to around 150 files.
3. The script was run again and the output was compared to the edits
from #2 to make sure no file was left behind.
4. Several build tests were done and a couple of problems were fixed.
e.g. lib/decompress_*.c used malloc/free() wrappers around slab
APIs requiring slab.h to be added manually.
5. The script was run on all .h files but without automatically
editing them as sprinkling gfp.h and slab.h inclusions around .h
files could easily lead to inclusion dependency hell. Most gfp.h
inclusion directives were ignored as stuff from gfp.h was usually
wildly available and often used in preprocessor macros. Each
slab.h inclusion directive was examined and added manually as
necessary.
6. percpu.h was updated not to include slab.h.
7. Build test were done on the following configurations and failures
were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
distributed build env didn't work with gcov compiles) and a few
more options had to be turned off depending on archs to make things
build (like ipr on powerpc/64 which failed due to missing writeq).
* x86 and x86_64 UP and SMP allmodconfig and a custom test config.
* powerpc and powerpc64 SMP allmodconfig
* sparc and sparc64 SMP allmodconfig
* ia64 SMP allmodconfig
* s390 SMP allmodconfig
* alpha SMP allmodconfig
* um on x86_64 SMP allmodconfig
8. percpu.h modifications were reverted so that it could be applied as
a separate patch and serve as bisection point.
Given the fact that I had only a couple of failures from tests on step
6, I'm fairly confident about the coverage of this conversion patch.
If there is a breakage, it's likely to be something in one of the arch
headers which should be easily discoverable easily on most builds of
the specific arch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
2010-03-24 08:04:11 +00:00
|
|
|
#include <linux/slab.h>
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
#include "saa7134-reg.h"
|
|
|
|
#include "saa7134.h"
|
|
|
|
|
2010-10-07 01:02:58 +00:00
|
|
|
#define MODULE_NAME "saa7134"
|
2010-03-13 00:18:14 +00:00
|
|
|
|
2008-04-22 17:41:48 +00:00
|
|
|
static unsigned int disable_ir;
|
2005-04-16 22:20:36 +00:00
|
|
|
module_param(disable_ir, int, 0444);
|
|
|
|
MODULE_PARM_DESC(disable_ir,"disable infrared remote support");
|
|
|
|
|
2008-04-22 17:41:48 +00:00
|
|
|
static unsigned int ir_debug;
|
2005-04-16 22:20:36 +00:00
|
|
|
module_param(ir_debug, int, 0644);
|
|
|
|
MODULE_PARM_DESC(ir_debug,"enable debug messages [IR]");
|
|
|
|
|
2008-04-22 17:41:48 +00:00
|
|
|
static int pinnacle_remote;
|
2006-03-26 02:14:42 +00:00
|
|
|
module_param(pinnacle_remote, int, 0644); /* Choose Pinnacle PCTV remote */
|
|
|
|
MODULE_PARM_DESC(pinnacle_remote, "Specify Pinnacle PCTV remote: 0=coloured, 1=grey (defaults to 0)");
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
#define dprintk(fmt, arg...) if (ir_debug) \
|
|
|
|
printk(KERN_DEBUG "%s/ir: " fmt, dev->name , ## arg)
|
2005-11-09 05:37:56 +00:00
|
|
|
#define i2cdprintk(fmt, arg...) if (ir_debug) \
|
2009-05-13 19:48:07 +00:00
|
|
|
printk(KERN_DEBUG "%s/ir: " fmt, ir->name , ## arg)
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-11-17 12:58:09 +00:00
|
|
|
/* Helper function for raw decoding at GPIO16 or GPIO18 */
|
2010-03-20 23:59:44 +00:00
|
|
|
static int saa7134_raw_decode_irq(struct saa7134_dev *dev);
|
2006-12-08 00:45:28 +00:00
|
|
|
|
2005-11-09 05:37:56 +00:00
|
|
|
/* -------------------- GPIO generic keycode builder -------------------- */
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
static int build_key(struct saa7134_dev *dev)
|
|
|
|
{
|
2010-11-17 13:05:29 +00:00
|
|
|
struct saa7134_card_ir *ir = dev->remote;
|
2005-04-16 22:20:36 +00:00
|
|
|
u32 gpio, data;
|
|
|
|
|
2007-10-17 20:58:40 +00:00
|
|
|
/* here comes the additional handshake steps for some cards */
|
|
|
|
switch (dev->board) {
|
|
|
|
case SAA7134_BOARD_GOTVIEW_7135:
|
|
|
|
saa_setb(SAA7134_GPIO_GPSTATUS1, 0x80);
|
|
|
|
saa_clearb(SAA7134_GPIO_GPSTATUS1, 0x80);
|
|
|
|
break;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
/* rising SAA7134_GPIO_GPRESCAN reads the status */
|
|
|
|
saa_clearb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN);
|
|
|
|
saa_setb(SAA7134_GPIO_GPMODE3,SAA7134_GPIO_GPRESCAN);
|
|
|
|
|
|
|
|
gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
|
2005-11-09 05:37:43 +00:00
|
|
|
if (ir->polling) {
|
|
|
|
if (ir->last_gpio == gpio)
|
|
|
|
return 0;
|
|
|
|
ir->last_gpio = gpio;
|
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-11-09 05:37:43 +00:00
|
|
|
data = ir_extract_bits(gpio, ir->mask_keycode);
|
2005-04-16 22:20:36 +00:00
|
|
|
dprintk("build_key gpio=0x%x mask=0x%x data=%d\n",
|
|
|
|
gpio, ir->mask_keycode, data);
|
|
|
|
|
2008-12-07 16:19:29 +00:00
|
|
|
switch (dev->board) {
|
|
|
|
case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG:
|
|
|
|
if (data == ir->mask_keycode)
|
2010-11-17 16:53:11 +00:00
|
|
|
rc_keyup(ir->dev);
|
2008-12-07 16:19:29 +00:00
|
|
|
else
|
2010-11-17 16:53:11 +00:00
|
|
|
rc_keydown_notimeout(ir->dev, data, 0);
|
2008-12-07 16:19:29 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2006-01-09 20:21:23 +00:00
|
|
|
if (ir->polling) {
|
|
|
|
if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
|
|
|
|
(ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
|
2010-11-17 16:53:11 +00:00
|
|
|
rc_keydown_notimeout(ir->dev, data, 0);
|
2006-01-09 20:21:23 +00:00
|
|
|
} else {
|
2010-11-17 16:53:11 +00:00
|
|
|
rc_keyup(ir->dev);
|
2006-01-09 20:21:23 +00:00
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2006-01-09 20:21:23 +00:00
|
|
|
else { /* IRQ driven mode - handle key press and release in one go */
|
|
|
|
if ((ir->mask_keydown && (0 != (gpio & ir->mask_keydown))) ||
|
|
|
|
(ir->mask_keyup && (0 == (gpio & ir->mask_keyup)))) {
|
2010-11-17 16:53:11 +00:00
|
|
|
rc_keydown_notimeout(ir->dev, data, 0);
|
|
|
|
rc_keyup(ir->dev);
|
2006-01-09 20:21:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2005-11-09 05:37:56 +00:00
|
|
|
/* --------------------- Chip specific I2C key builders ----------------- */
|
|
|
|
|
2009-11-24 15:06:52 +00:00
|
|
|
static int get_key_flydvb_trio(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
|
|
|
{
|
|
|
|
int gpio;
|
|
|
|
int attempt = 0;
|
|
|
|
unsigned char b;
|
|
|
|
|
|
|
|
/* We need this to access GPI Used by the saa_readl macro. */
|
|
|
|
struct saa7134_dev *dev = ir->c->adapter->algo_data;
|
|
|
|
|
|
|
|
if (dev == NULL) {
|
2010-05-26 14:58:10 +00:00
|
|
|
i2cdprintk("get_key_flydvb_trio: "
|
|
|
|
"ir->c->adapter->algo_data is NULL!\n");
|
2009-11-24 15:06:52 +00:00
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* rising SAA7134_GPIGPRESCAN reads the status */
|
|
|
|
saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
|
|
|
|
saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
|
|
|
|
|
|
|
|
gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
|
|
|
|
|
|
|
|
if (0x40000 & ~gpio)
|
|
|
|
return 0; /* No button press */
|
|
|
|
|
|
|
|
/* No button press - only before first key pressed */
|
|
|
|
if (b == 0xFF)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* poll IR chip */
|
|
|
|
/* weak up the IR chip */
|
|
|
|
b = 0;
|
|
|
|
|
|
|
|
while (1 != i2c_master_send(ir->c, &b, 1)) {
|
|
|
|
if ((attempt++) < 10) {
|
|
|
|
/*
|
|
|
|
* wait a bit for next attempt -
|
|
|
|
* I don't know how make it better
|
|
|
|
*/
|
|
|
|
msleep(10);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
i2cdprintk("send wake up byte to pic16C505 (IR chip)"
|
|
|
|
"failed %dx\n", attempt);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
if (1 != i2c_master_recv(ir->c, &b, 1)) {
|
|
|
|
i2cdprintk("read error\n");
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
*ir_key = b;
|
|
|
|
*ir_raw = b;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-10-13 11:37:06 +00:00
|
|
|
static int get_key_msi_tvanywhere_plus(struct IR_i2c *ir, u32 *ir_key,
|
|
|
|
u32 *ir_raw)
|
|
|
|
{
|
|
|
|
unsigned char b;
|
|
|
|
int gpio;
|
|
|
|
|
|
|
|
/* <dev> is needed to access GPIO. Used by the saa_readl macro. */
|
2009-05-13 19:48:50 +00:00
|
|
|
struct saa7134_dev *dev = ir->c->adapter->algo_data;
|
2008-10-13 11:37:06 +00:00
|
|
|
if (dev == NULL) {
|
2010-05-26 14:58:10 +00:00
|
|
|
i2cdprintk("get_key_msi_tvanywhere_plus: "
|
|
|
|
"ir->c->adapter->algo_data is NULL!\n");
|
2008-10-13 11:37:06 +00:00
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* rising SAA7134_GPIO_GPRESCAN reads the status */
|
|
|
|
|
|
|
|
saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
|
|
|
|
saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
|
|
|
|
|
|
|
|
gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
|
|
|
|
|
|
|
|
/* GPIO&0x40 is pulsed low when a button is pressed. Don't do
|
|
|
|
I2C receive if gpio&0x40 is not low. */
|
|
|
|
|
|
|
|
if (gpio & 0x40)
|
|
|
|
return 0; /* No button press */
|
|
|
|
|
|
|
|
/* GPIO says there is a button press. Get it. */
|
|
|
|
|
2009-05-13 19:48:50 +00:00
|
|
|
if (1 != i2c_master_recv(ir->c, &b, 1)) {
|
2008-10-13 11:37:06 +00:00
|
|
|
i2cdprintk("read error\n");
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* No button press */
|
|
|
|
|
|
|
|
if (b == 0xff)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Button pressed */
|
|
|
|
|
|
|
|
dprintk("get_key_msi_tvanywhere_plus: Key = 0x%02X\n", b);
|
|
|
|
*ir_key = b;
|
|
|
|
*ir_raw = b;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2005-11-09 05:37:56 +00:00
|
|
|
static int get_key_purpletv(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
|
|
|
{
|
|
|
|
unsigned char b;
|
|
|
|
|
|
|
|
/* poll IR chip */
|
2009-05-13 19:48:50 +00:00
|
|
|
if (1 != i2c_master_recv(ir->c, &b, 1)) {
|
2005-11-09 05:37:56 +00:00
|
|
|
i2cdprintk("read error\n");
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* no button press */
|
|
|
|
if (b==0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* repeating */
|
|
|
|
if (b & 0x80)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
*ir_key = b;
|
|
|
|
*ir_raw = b;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-11-30 00:57:24 +00:00
|
|
|
static int get_key_hvr1110(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
|
|
|
{
|
|
|
|
unsigned char buf[5], cod4, code3, code4;
|
|
|
|
|
|
|
|
/* poll IR chip */
|
2009-05-13 19:48:50 +00:00
|
|
|
if (5 != i2c_master_recv(ir->c, buf, 5))
|
2006-11-30 00:57:24 +00:00
|
|
|
return -EIO;
|
|
|
|
|
|
|
|
cod4 = buf[4];
|
|
|
|
code4 = (cod4 >> 2);
|
|
|
|
code3 = buf[3];
|
|
|
|
if (code3 == 0)
|
|
|
|
/* no key pressed */
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* return key */
|
|
|
|
*ir_key = code4;
|
|
|
|
*ir_raw = code4;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-01-07 08:17:39 +00:00
|
|
|
|
|
|
|
static int get_key_beholdm6xx(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
|
|
|
{
|
|
|
|
unsigned char data[12];
|
|
|
|
u32 gpio;
|
|
|
|
|
2009-05-13 19:48:50 +00:00
|
|
|
struct saa7134_dev *dev = ir->c->adapter->algo_data;
|
2008-01-07 08:17:39 +00:00
|
|
|
|
|
|
|
/* rising SAA7134_GPIO_GPRESCAN reads the status */
|
|
|
|
saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
|
|
|
|
saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
|
|
|
|
|
|
|
|
gpio = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
|
|
|
|
|
2008-01-07 08:18:36 +00:00
|
|
|
if (0x400000 & ~gpio)
|
2008-01-07 08:17:39 +00:00
|
|
|
return 0; /* No button press */
|
|
|
|
|
2009-05-13 19:48:50 +00:00
|
|
|
ir->c->addr = 0x5a >> 1;
|
2008-01-07 08:17:39 +00:00
|
|
|
|
2009-05-13 19:48:50 +00:00
|
|
|
if (12 != i2c_master_recv(ir->c, data, 12)) {
|
2008-01-07 08:17:39 +00:00
|
|
|
i2cdprintk("read error\n");
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
2009-09-07 23:36:05 +00:00
|
|
|
if (data[9] != (unsigned char)(~data[8]))
|
|
|
|
return 0;
|
|
|
|
|
2010-11-19 23:42:46 +00:00
|
|
|
*ir_raw = ((data[10] << 16) | (data[11] << 8) | (data[9] << 0));
|
|
|
|
*ir_key = *ir_raw;
|
2008-01-07 08:17:39 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2008-07-18 01:31:29 +00:00
|
|
|
/* Common (grey or coloured) pinnacle PCTV remote handling
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
static int get_key_pinnacle(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw,
|
|
|
|
int parity_offset, int marker, int code_modulo)
|
|
|
|
{
|
|
|
|
unsigned char b[4];
|
|
|
|
unsigned int start = 0,parity = 0,code = 0;
|
|
|
|
|
|
|
|
/* poll IR chip */
|
2009-05-13 19:48:50 +00:00
|
|
|
if (4 != i2c_master_recv(ir->c, b, 4)) {
|
2008-07-18 01:31:29 +00:00
|
|
|
i2cdprintk("read error\n");
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (start = 0; start < ARRAY_SIZE(b); start++) {
|
|
|
|
if (b[start] == marker) {
|
|
|
|
code=b[(start+parity_offset + 1) % 4];
|
|
|
|
parity=b[(start+parity_offset) % 4];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Empty Request */
|
|
|
|
if (parity == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Repeating... */
|
|
|
|
if (ir->old == parity)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
ir->old = parity;
|
|
|
|
|
|
|
|
/* drop special codes when a key is held down a long time for the grey controller
|
|
|
|
In this case, the second bit of the code is asserted */
|
|
|
|
if (marker == 0xfe && (code & 0x40))
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
code %= code_modulo;
|
|
|
|
|
|
|
|
*ir_raw = code;
|
|
|
|
*ir_key = code;
|
|
|
|
|
|
|
|
i2cdprintk("Pinnacle PCTV key %02x\n", code);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The grey pinnacle PCTV remote
|
|
|
|
*
|
|
|
|
* There are one issue with this remote:
|
|
|
|
* - I2c packet does not change when the same key is pressed quickly. The workaround
|
|
|
|
* is to hold down each key for about half a second, so that another code is generated
|
|
|
|
* in the i2c packet, and the function can distinguish key presses.
|
|
|
|
*
|
|
|
|
* Sylvain Pasche <sylvain.pasche@gmail.com>
|
|
|
|
*/
|
|
|
|
static int get_key_pinnacle_grey(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
|
|
|
{
|
|
|
|
|
|
|
|
return get_key_pinnacle(ir, ir_key, ir_raw, 1, 0xfe, 0xff);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* The new pinnacle PCTV remote (with the colored buttons)
|
|
|
|
*
|
|
|
|
* Ricardo Cerqueira <v4l@cerqueira.org>
|
|
|
|
*/
|
|
|
|
static int get_key_pinnacle_color(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
|
|
|
|
{
|
|
|
|
/* code_modulo parameter (0x88) is used to reduce code value to fit inside IR_KEYTAB_SIZE
|
|
|
|
*
|
|
|
|
* this is the only value that results in 42 unique
|
|
|
|
* codes < 128
|
|
|
|
*/
|
|
|
|
|
|
|
|
return get_key_pinnacle(ir, ir_key, ir_raw, 2, 0x80, 0x88);
|
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
void saa7134_input_irq(struct saa7134_dev *dev)
|
|
|
|
{
|
2010-11-17 13:05:29 +00:00
|
|
|
struct saa7134_card_ir *ir;
|
2010-03-31 17:40:35 +00:00
|
|
|
|
|
|
|
if (!dev || !dev->remote)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ir = dev->remote;
|
|
|
|
if (!ir->running)
|
|
|
|
return;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-11-17 12:58:09 +00:00
|
|
|
if (!ir->polling && !ir->raw_decode) {
|
2005-04-16 22:20:36 +00:00
|
|
|
build_key(dev);
|
2010-03-20 23:59:44 +00:00
|
|
|
} else if (ir->raw_decode) {
|
|
|
|
saa7134_raw_decode_irq(dev);
|
2006-12-08 00:45:28 +00:00
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void saa7134_input_timer(unsigned long data)
|
|
|
|
{
|
2007-05-21 14:41:02 +00:00
|
|
|
struct saa7134_dev *dev = (struct saa7134_dev *)data;
|
2010-11-17 13:05:29 +00:00
|
|
|
struct saa7134_card_ir *ir = dev->remote;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
build_key(dev);
|
2007-05-21 14:41:02 +00:00
|
|
|
mod_timer(&ir->timer, jiffies + msecs_to_jiffies(ir->polling));
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
2010-09-29 16:46:23 +00:00
|
|
|
static void ir_raw_decode_timer_end(unsigned long data)
|
2010-03-20 23:59:44 +00:00
|
|
|
{
|
|
|
|
struct saa7134_dev *dev = (struct saa7134_dev *)data;
|
2010-11-17 13:05:29 +00:00
|
|
|
struct saa7134_card_ir *ir = dev->remote;
|
2010-03-20 23:59:44 +00:00
|
|
|
|
2010-03-21 15:24:24 +00:00
|
|
|
ir_raw_event_handle(dev->remote->dev);
|
2010-03-21 16:00:55 +00:00
|
|
|
|
2010-11-17 13:05:29 +00:00
|
|
|
ir->active = false;
|
2010-03-20 23:59:44 +00:00
|
|
|
}
|
|
|
|
|
2010-03-31 17:40:35 +00:00
|
|
|
static int __saa7134_ir_start(void *priv)
|
2006-11-20 13:23:04 +00:00
|
|
|
{
|
2010-03-31 17:40:35 +00:00
|
|
|
struct saa7134_dev *dev = priv;
|
2010-11-17 13:05:29 +00:00
|
|
|
struct saa7134_card_ir *ir;
|
2010-03-31 17:40:35 +00:00
|
|
|
|
2010-11-19 23:42:51 +00:00
|
|
|
if (!dev || !dev->remote)
|
2010-03-31 17:40:35 +00:00
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
ir = dev->remote;
|
2010-03-20 03:25:37 +00:00
|
|
|
if (ir->running)
|
2010-03-31 17:40:35 +00:00
|
|
|
return 0;
|
2010-03-20 03:25:37 +00:00
|
|
|
|
2011-03-06 16:00:38 +00:00
|
|
|
/* Moved here from saa7134_input_init1() because the latter
|
|
|
|
* is not called on device resume */
|
|
|
|
switch (dev->board) {
|
|
|
|
case SAA7134_BOARD_MD2819:
|
|
|
|
case SAA7134_BOARD_KWORLD_VSTREAM_XPERT:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_305:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_307:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_305:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_505:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_307:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_507:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_507UA:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_GO_007_FM:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_M102:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS:
|
|
|
|
/* Without this we won't receive key up events */
|
|
|
|
saa_setb(SAA7134_GPIO_GPMODE0, 0x4);
|
|
|
|
saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4);
|
|
|
|
break;
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_777:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_A16AR:
|
|
|
|
/* Without this we won't receive key up events */
|
|
|
|
saa_setb(SAA7134_GPIO_GPMODE1, 0x1);
|
|
|
|
saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1);
|
|
|
|
break;
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_A16D:
|
|
|
|
/* Without this we won't receive key up events */
|
|
|
|
saa_setb(SAA7134_GPIO_GPMODE1, 0x1);
|
|
|
|
saa_setb(SAA7134_GPIO_GPSTATUS1, 0x1);
|
|
|
|
break;
|
|
|
|
case SAA7134_BOARD_GOTVIEW_7135:
|
|
|
|
saa_setb(SAA7134_GPIO_GPMODE1, 0x80);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-11-17 13:05:29 +00:00
|
|
|
ir->running = true;
|
2010-11-19 23:42:51 +00:00
|
|
|
ir->active = false;
|
|
|
|
|
2006-11-20 13:23:04 +00:00
|
|
|
if (ir->polling) {
|
2007-05-21 14:41:02 +00:00
|
|
|
setup_timer(&ir->timer, saa7134_input_timer,
|
|
|
|
(unsigned long)dev);
|
2010-11-19 23:42:57 +00:00
|
|
|
ir->timer.expires = jiffies + HZ;
|
2006-11-20 13:23:04 +00:00
|
|
|
add_timer(&ir->timer);
|
2010-03-20 23:59:44 +00:00
|
|
|
} else if (ir->raw_decode) {
|
|
|
|
/* set timer_end for code completion */
|
2010-11-19 23:42:57 +00:00
|
|
|
setup_timer(&ir->timer, ir_raw_decode_timer_end,
|
2010-11-19 23:42:51 +00:00
|
|
|
(unsigned long)dev);
|
2006-11-20 13:23:04 +00:00
|
|
|
}
|
2010-03-31 17:40:35 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-11-20 13:23:04 +00:00
|
|
|
}
|
|
|
|
|
2010-03-31 17:40:35 +00:00
|
|
|
static void __saa7134_ir_stop(void *priv)
|
2006-11-20 13:23:04 +00:00
|
|
|
{
|
2010-03-31 17:40:35 +00:00
|
|
|
struct saa7134_dev *dev = priv;
|
2010-11-17 13:05:29 +00:00
|
|
|
struct saa7134_card_ir *ir;
|
2010-03-31 17:40:35 +00:00
|
|
|
|
2010-11-19 23:42:51 +00:00
|
|
|
if (!dev || !dev->remote)
|
2010-03-31 17:40:35 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
ir = dev->remote;
|
2010-03-20 03:25:37 +00:00
|
|
|
if (!ir->running)
|
|
|
|
return;
|
2010-11-19 23:42:51 +00:00
|
|
|
|
2010-11-19 23:42:57 +00:00
|
|
|
if (ir->polling || ir->raw_decode)
|
2010-11-19 23:42:51 +00:00
|
|
|
del_timer_sync(&ir->timer);
|
2010-03-20 23:59:44 +00:00
|
|
|
|
2010-11-19 23:42:51 +00:00
|
|
|
ir->active = false;
|
2010-11-17 13:05:29 +00:00
|
|
|
ir->running = false;
|
2010-03-31 17:40:35 +00:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int saa7134_ir_start(struct saa7134_dev *dev)
|
|
|
|
{
|
|
|
|
if (dev->remote->users)
|
|
|
|
return __saa7134_ir_start(dev);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void saa7134_ir_stop(struct saa7134_dev *dev)
|
|
|
|
{
|
|
|
|
if (dev->remote->users)
|
|
|
|
__saa7134_ir_stop(dev);
|
|
|
|
}
|
|
|
|
|
2010-10-29 19:08:23 +00:00
|
|
|
static int saa7134_ir_open(struct rc_dev *rc)
|
2010-03-31 17:40:35 +00:00
|
|
|
{
|
2010-10-29 19:08:23 +00:00
|
|
|
struct saa7134_dev *dev = rc->priv;
|
2010-03-31 17:40:35 +00:00
|
|
|
|
|
|
|
dev->remote->users++;
|
|
|
|
return __saa7134_ir_start(dev);
|
|
|
|
}
|
|
|
|
|
2010-10-29 19:08:23 +00:00
|
|
|
static void saa7134_ir_close(struct rc_dev *rc)
|
2010-03-31 17:40:35 +00:00
|
|
|
{
|
2010-10-29 19:08:23 +00:00
|
|
|
struct saa7134_dev *dev = rc->priv;
|
2010-03-31 17:40:35 +00:00
|
|
|
|
|
|
|
dev->remote->users--;
|
|
|
|
if (!dev->remote->users)
|
|
|
|
__saa7134_ir_stop(dev);
|
2010-03-20 03:25:37 +00:00
|
|
|
}
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
int saa7134_input_init1(struct saa7134_dev *dev)
|
|
|
|
{
|
2010-11-17 13:05:29 +00:00
|
|
|
struct saa7134_card_ir *ir;
|
2010-10-29 19:08:23 +00:00
|
|
|
struct rc_dev *rc;
|
2010-04-02 23:01:00 +00:00
|
|
|
char *ir_codes = NULL;
|
2005-04-16 22:20:36 +00:00
|
|
|
u32 mask_keycode = 0;
|
|
|
|
u32 mask_keydown = 0;
|
|
|
|
u32 mask_keyup = 0;
|
2010-11-19 23:42:51 +00:00
|
|
|
unsigned polling = 0;
|
|
|
|
bool raw_decode = false;
|
2006-11-20 13:23:04 +00:00
|
|
|
int err;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2005-11-09 05:38:47 +00:00
|
|
|
if (dev->has_remote != SAA7134_REMOTE_GPIO)
|
2005-04-16 22:20:36 +00:00
|
|
|
return -ENODEV;
|
|
|
|
if (disable_ir)
|
|
|
|
return -ENODEV;
|
|
|
|
|
|
|
|
/* detect & configure */
|
|
|
|
switch (dev->board) {
|
|
|
|
case SAA7134_BOARD_FLYVIDEO2000:
|
|
|
|
case SAA7134_BOARD_FLYVIDEO3000:
|
2005-11-09 05:37:43 +00:00
|
|
|
case SAA7134_BOARD_FLYTVPLATINUM_FM:
|
2005-11-09 05:36:55 +00:00
|
|
|
case SAA7134_BOARD_FLYTVPLATINUM_MINI2:
|
2009-08-29 12:32:11 +00:00
|
|
|
case SAA7134_BOARD_ROVERMEDIA_LINK_PRO_FM:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_FLYVIDEO;
|
2005-04-16 22:20:36 +00:00
|
|
|
mask_keycode = 0xEC00000;
|
|
|
|
mask_keydown = 0x0040000;
|
|
|
|
break;
|
|
|
|
case SAA7134_BOARD_CINERGY400:
|
|
|
|
case SAA7134_BOARD_CINERGY600:
|
|
|
|
case SAA7134_BOARD_CINERGY600_MK3:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_CINERGY;
|
2005-04-16 22:20:36 +00:00
|
|
|
mask_keycode = 0x00003f;
|
|
|
|
mask_keyup = 0x040000;
|
|
|
|
break;
|
|
|
|
case SAA7134_BOARD_ECS_TVP3XP:
|
|
|
|
case SAA7134_BOARD_ECS_TVP3XP_4CB5:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_EZTV;
|
2005-07-12 20:59:01 +00:00
|
|
|
mask_keycode = 0x00017c;
|
|
|
|
mask_keyup = 0x000002;
|
2005-04-16 22:20:36 +00:00
|
|
|
polling = 50; // ms
|
2005-07-12 20:59:01 +00:00
|
|
|
break;
|
|
|
|
case SAA7134_BOARD_KWORLD_XPERT:
|
2005-04-16 22:20:36 +00:00
|
|
|
case SAA7134_BOARD_AVACSSMARTTV:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_PIXELVIEW;
|
2005-04-16 22:20:36 +00:00
|
|
|
mask_keycode = 0x00001F;
|
|
|
|
mask_keyup = 0x000020;
|
|
|
|
polling = 50; // ms
|
|
|
|
break;
|
|
|
|
case SAA7134_BOARD_MD2819:
|
2005-06-24 05:05:09 +00:00
|
|
|
case SAA7134_BOARD_KWORLD_VSTREAM_XPERT:
|
2005-04-16 22:20:36 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_305:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_307:
|
2005-06-24 05:05:09 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_305:
|
2009-08-27 01:10:55 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_505:
|
2005-06-24 05:05:09 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_307:
|
2006-10-06 23:23:47 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_507:
|
2009-04-08 17:01:19 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_STUDIO_507UA:
|
2005-06-24 05:05:09 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_GO_007_FM:
|
2007-12-09 12:44:38 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_M102:
|
2008-12-31 02:26:09 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_GO_007_FM_PLUS:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_AVERMEDIA;
|
2005-04-16 22:20:36 +00:00
|
|
|
mask_keycode = 0x0007C8;
|
|
|
|
mask_keydown = 0x000010;
|
|
|
|
polling = 50; // ms
|
2011-03-06 16:00:38 +00:00
|
|
|
/* GPIO stuff moved to __saa7134_ir_start() */
|
2005-04-16 22:20:36 +00:00
|
|
|
break;
|
2008-06-26 20:03:00 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_M135A:
|
2010-05-10 18:43:31 +00:00
|
|
|
ir_codes = RC_MAP_AVERMEDIA_M135A;
|
V4L/DVB: ir-nec-decoder: Reimplement the entire decoder
Thanks to Andy Walls <awalls@md.metrocast.net> for pointing me his
code, that gave me some ideas to better implement it.
After some work with saa7134 bits, I found a way to catch both IRQ
edge pulses. By enabling it, the NEC decoder can now take both
pulse and spaces into account, making it more precise.
Instead of the old strategy of handling the events all at once,
this code implements a state machine. Due to that, it handles
individual pulse or space events, validating them against the
protocol, producing a much more reliable decoding.
With the new implementation, the protocol trailer bits are properly
handled, making possible for the repeat key to work.
Also, the code is now capable of handling both NEC and NEC extended
IR devices. With NEC, it produces a 16 bits code, while with NEC
extended, a 24 bits code is returned.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-04-03 21:51:50 +00:00
|
|
|
mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
|
|
|
|
mask_keyup = 0x0040000;
|
2010-03-20 03:23:30 +00:00
|
|
|
mask_keycode = 0xffff;
|
2010-11-19 23:42:51 +00:00
|
|
|
raw_decode = true;
|
2008-06-26 20:03:00 +00:00
|
|
|
break;
|
2010-05-08 05:23:37 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_M733A:
|
|
|
|
ir_codes = RC_MAP_AVERMEDIA_M733A_RM_K6;
|
|
|
|
mask_keydown = 0x0040000;
|
|
|
|
mask_keyup = 0x0040000;
|
|
|
|
mask_keycode = 0xffff;
|
2010-11-19 23:42:51 +00:00
|
|
|
raw_decode = true;
|
2010-05-08 05:23:37 +00:00
|
|
|
break;
|
2006-11-12 17:22:32 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_777:
|
2006-11-12 17:23:32 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_A16AR:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_AVERMEDIA;
|
2006-11-12 17:22:32 +00:00
|
|
|
mask_keycode = 0x02F200;
|
|
|
|
mask_keydown = 0x000400;
|
|
|
|
polling = 50; // ms
|
2011-03-06 16:00:38 +00:00
|
|
|
/* GPIO stuff moved to __saa7134_ir_start() */
|
2006-11-13 17:50:11 +00:00
|
|
|
break;
|
2008-06-15 16:33:42 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_A16D:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_AVERMEDIA_A16D;
|
2008-06-15 16:33:42 +00:00
|
|
|
mask_keycode = 0x02F200;
|
|
|
|
mask_keydown = 0x000400;
|
|
|
|
polling = 50; /* ms */
|
2011-03-06 16:00:38 +00:00
|
|
|
/* GPIO stuff moved to __saa7134_ir_start() */
|
2008-06-15 16:33:42 +00:00
|
|
|
break;
|
2005-11-09 05:37:43 +00:00
|
|
|
case SAA7134_BOARD_KWORLD_TERMINATOR:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_PIXELVIEW;
|
2005-11-09 05:37:00 +00:00
|
|
|
mask_keycode = 0x00001f;
|
|
|
|
mask_keyup = 0x000060;
|
|
|
|
polling = 50; // ms
|
|
|
|
break;
|
2005-06-24 05:05:09 +00:00
|
|
|
case SAA7134_BOARD_MANLI_MTV001:
|
|
|
|
case SAA7134_BOARD_MANLI_MTV002:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_MANLI;
|
2008-04-23 17:09:08 +00:00
|
|
|
mask_keycode = 0x001f00;
|
|
|
|
mask_keyup = 0x004000;
|
|
|
|
polling = 50; /* ms */
|
|
|
|
break;
|
2005-11-09 05:36:16 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_409FM:
|
2008-01-07 08:17:39 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_401:
|
|
|
|
case SAA7134_BOARD_BEHOLD_403:
|
|
|
|
case SAA7134_BOARD_BEHOLD_403FM:
|
|
|
|
case SAA7134_BOARD_BEHOLD_405:
|
|
|
|
case SAA7134_BOARD_BEHOLD_405FM:
|
|
|
|
case SAA7134_BOARD_BEHOLD_407:
|
|
|
|
case SAA7134_BOARD_BEHOLD_407FM:
|
|
|
|
case SAA7134_BOARD_BEHOLD_409:
|
|
|
|
case SAA7134_BOARD_BEHOLD_505FM:
|
2009-12-21 05:00:38 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_505RDS_MK5:
|
|
|
|
case SAA7134_BOARD_BEHOLD_505RDS_MK3:
|
2008-01-07 08:17:39 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_507_9FM:
|
2009-04-23 05:32:49 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_507RDS_MK3:
|
|
|
|
case SAA7134_BOARD_BEHOLD_507RDS_MK5:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_MANLI;
|
2008-04-23 17:09:08 +00:00
|
|
|
mask_keycode = 0x003f00;
|
|
|
|
mask_keyup = 0x004000;
|
|
|
|
polling = 50; /* ms */
|
|
|
|
break;
|
|
|
|
case SAA7134_BOARD_BEHOLD_COLUMBUS_TVFM:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_BEHOLD_COLUMBUS;
|
2008-04-23 17:09:08 +00:00
|
|
|
mask_keycode = 0x003f00;
|
2005-06-24 05:05:09 +00:00
|
|
|
mask_keyup = 0x004000;
|
|
|
|
polling = 50; // ms
|
|
|
|
break;
|
2005-11-09 05:38:47 +00:00
|
|
|
case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_PCTV_SEDNA;
|
2005-11-09 05:38:43 +00:00
|
|
|
mask_keycode = 0x001f00;
|
|
|
|
mask_keyup = 0x004000;
|
|
|
|
polling = 50; // ms
|
|
|
|
break;
|
2005-11-09 05:37:43 +00:00
|
|
|
case SAA7134_BOARD_GOTVIEW_7135:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_GOTVIEW7135;
|
2007-10-17 20:58:40 +00:00
|
|
|
mask_keycode = 0x0003CC;
|
2005-11-09 05:36:22 +00:00
|
|
|
mask_keydown = 0x000010;
|
2007-10-17 20:58:40 +00:00
|
|
|
polling = 5; /* ms */
|
2011-03-06 16:00:38 +00:00
|
|
|
/* GPIO stuff moved to __saa7134_ir_start() */
|
2005-11-09 05:36:22 +00:00
|
|
|
break;
|
2005-04-16 22:20:36 +00:00
|
|
|
case SAA7134_BOARD_VIDEOMATE_TV_PVR:
|
2006-01-09 17:25:33 +00:00
|
|
|
case SAA7134_BOARD_VIDEOMATE_GOLD_PLUS:
|
2005-07-12 20:59:01 +00:00
|
|
|
case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_VIDEOMATE_TV_PVR;
|
2005-04-16 22:20:36 +00:00
|
|
|
mask_keycode = 0x00003F;
|
|
|
|
mask_keyup = 0x400000;
|
|
|
|
polling = 50; // ms
|
|
|
|
break;
|
2006-09-13 19:42:42 +00:00
|
|
|
case SAA7134_BOARD_PROTEUS_2309:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_PROTEUS_2309;
|
2006-09-13 19:42:42 +00:00
|
|
|
mask_keycode = 0x00007F;
|
|
|
|
mask_keyup = 0x000080;
|
|
|
|
polling = 50; // ms
|
|
|
|
break;
|
2005-11-09 05:37:43 +00:00
|
|
|
case SAA7134_BOARD_VIDEOMATE_DVBT_300:
|
|
|
|
case SAA7134_BOARD_VIDEOMATE_DVBT_200:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_VIDEOMATE_TV_PVR;
|
2005-11-09 05:36:47 +00:00
|
|
|
mask_keycode = 0x003F00;
|
|
|
|
mask_keyup = 0x040000;
|
|
|
|
break;
|
2007-07-02 15:53:25 +00:00
|
|
|
case SAA7134_BOARD_FLYDVBS_LR300:
|
2006-02-07 08:49:09 +00:00
|
|
|
case SAA7134_BOARD_FLYDVBT_LR301:
|
2006-02-27 03:08:46 +00:00
|
|
|
case SAA7134_BOARD_FLYDVBTDUO:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_FLYDVB;
|
2006-02-07 08:49:09 +00:00
|
|
|
mask_keycode = 0x0001F00;
|
|
|
|
mask_keydown = 0x0040000;
|
|
|
|
break;
|
2006-12-08 00:45:28 +00:00
|
|
|
case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
|
2007-03-29 21:32:49 +00:00
|
|
|
case SAA7134_BOARD_ASUSTeK_P7131_HYBRID_LNA:
|
2009-08-20 13:13:40 +00:00
|
|
|
case SAA7134_BOARD_ASUSTeK_P7131_ANALOG:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_ASUS_PC39;
|
2010-09-30 17:46:47 +00:00
|
|
|
mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
|
|
|
|
mask_keyup = 0x0040000;
|
|
|
|
mask_keycode = 0xffff;
|
2010-11-19 23:42:51 +00:00
|
|
|
raw_decode = true;
|
2006-12-08 00:45:28 +00:00
|
|
|
break;
|
2006-12-27 15:46:36 +00:00
|
|
|
case SAA7134_BOARD_ENCORE_ENLTV:
|
|
|
|
case SAA7134_BOARD_ENCORE_ENLTV_FM:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_ENCORE_ENLTV;
|
2006-12-27 15:46:36 +00:00
|
|
|
mask_keycode = 0x00007f;
|
|
|
|
mask_keyup = 0x040000;
|
|
|
|
polling = 50; // ms
|
|
|
|
break;
|
2008-06-26 20:03:00 +00:00
|
|
|
case SAA7134_BOARD_ENCORE_ENLTV_FM53:
|
2011-01-19 18:25:17 +00:00
|
|
|
case SAA7134_BOARD_ENCORE_ENLTV_FM3:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_ENCORE_ENLTV_FM53;
|
2010-11-17 12:58:09 +00:00
|
|
|
mask_keydown = 0x0040000; /* Enable GPIO18 line on both edges */
|
|
|
|
mask_keyup = 0x0040000;
|
|
|
|
mask_keycode = 0xffff;
|
2010-11-19 23:42:51 +00:00
|
|
|
raw_decode = true;
|
2008-06-26 20:03:00 +00:00
|
|
|
break;
|
2007-05-11 14:33:50 +00:00
|
|
|
case SAA7134_BOARD_10MOONSTVMASTER3:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_ENCORE_ENLTV;
|
2007-05-11 14:33:50 +00:00
|
|
|
mask_keycode = 0x5f80000;
|
|
|
|
mask_keyup = 0x8000000;
|
|
|
|
polling = 50; //ms
|
|
|
|
break;
|
2008-02-11 15:40:53 +00:00
|
|
|
case SAA7134_BOARD_GENIUS_TVGO_A11MCE:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_GENIUS_TVGO_A11MCE;
|
2008-02-11 15:40:53 +00:00
|
|
|
mask_keycode = 0xff;
|
|
|
|
mask_keydown = 0xf00000;
|
|
|
|
polling = 50; /* ms */
|
|
|
|
break;
|
2008-06-26 20:03:00 +00:00
|
|
|
case SAA7134_BOARD_REAL_ANGEL_220:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_REAL_AUDIO_220_32_KEYS;
|
2008-06-26 20:03:00 +00:00
|
|
|
mask_keycode = 0x3f00;
|
|
|
|
mask_keyup = 0x4000;
|
|
|
|
polling = 50; /* ms */
|
|
|
|
break;
|
2008-12-07 16:19:29 +00:00
|
|
|
case SAA7134_BOARD_KWORLD_PLUS_TV_ANALOG:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_KWORLD_PLUS_TV_ANALOG;
|
2008-12-07 16:19:29 +00:00
|
|
|
mask_keycode = 0x7f;
|
|
|
|
polling = 40; /* ms */
|
|
|
|
break;
|
2009-08-14 00:42:21 +00:00
|
|
|
case SAA7134_BOARD_VIDEOMATE_S350:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_VIDEOMATE_S350;
|
2009-08-14 00:42:21 +00:00
|
|
|
mask_keycode = 0x003f00;
|
|
|
|
mask_keydown = 0x040000;
|
|
|
|
break;
|
2009-10-31 17:05:42 +00:00
|
|
|
case SAA7134_BOARD_LEADTEK_WINFAST_DTV1000S:
|
2010-04-02 23:01:00 +00:00
|
|
|
ir_codes = RC_MAP_WINFAST;
|
2009-10-31 17:05:42 +00:00
|
|
|
mask_keycode = 0x5f00;
|
|
|
|
mask_keyup = 0x020000;
|
2009-11-01 14:16:10 +00:00
|
|
|
polling = 50; /* ms */
|
2009-10-31 17:05:42 +00:00
|
|
|
break;
|
2010-12-26 21:13:30 +00:00
|
|
|
case SAA7134_BOARD_VIDEOMATE_M1F:
|
|
|
|
ir_codes = RC_MAP_VIDEOMATE_M1F;
|
|
|
|
mask_keycode = 0x0ff00;
|
|
|
|
mask_keyup = 0x040000;
|
|
|
|
break;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
if (NULL == ir_codes) {
|
|
|
|
printk("%s: Oops: IR config error [card=%d]\n",
|
|
|
|
dev->name, dev->board);
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
|
2005-09-15 07:01:53 +00:00
|
|
|
ir = kzalloc(sizeof(*ir), GFP_KERNEL);
|
2010-10-29 19:08:23 +00:00
|
|
|
rc = rc_allocate_device();
|
|
|
|
if (!ir || !rc) {
|
2006-11-20 13:23:04 +00:00
|
|
|
err = -ENOMEM;
|
|
|
|
goto err_out_free;
|
2005-09-15 07:01:53 +00:00
|
|
|
}
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-10-29 19:08:23 +00:00
|
|
|
ir->dev = rc;
|
2010-03-20 03:25:37 +00:00
|
|
|
dev->remote = ir;
|
|
|
|
|
2005-04-16 22:20:36 +00:00
|
|
|
/* init hardware-specific stuff */
|
|
|
|
ir->mask_keycode = mask_keycode;
|
|
|
|
ir->mask_keydown = mask_keydown;
|
|
|
|
ir->mask_keyup = mask_keyup;
|
2005-11-09 05:37:43 +00:00
|
|
|
ir->polling = polling;
|
2010-03-20 23:59:44 +00:00
|
|
|
ir->raw_decode = raw_decode;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
/* init input device */
|
|
|
|
snprintf(ir->name, sizeof(ir->name), "saa7134 IR (%s)",
|
|
|
|
saa7134_boards[dev->board].name);
|
|
|
|
snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
|
|
|
|
pci_name(dev->pci));
|
|
|
|
|
2010-10-29 19:08:23 +00:00
|
|
|
rc->priv = dev;
|
|
|
|
rc->open = saa7134_ir_open;
|
|
|
|
rc->close = saa7134_ir_close;
|
2010-04-07 02:21:46 +00:00
|
|
|
if (raw_decode)
|
2010-10-29 19:08:23 +00:00
|
|
|
rc->driver_type = RC_DRIVER_IR_RAW;
|
2010-04-07 02:21:46 +00:00
|
|
|
|
2010-10-29 19:08:23 +00:00
|
|
|
rc->input_name = ir->name;
|
|
|
|
rc->input_phys = ir->phys;
|
|
|
|
rc->input_id.bustype = BUS_PCI;
|
|
|
|
rc->input_id.version = 1;
|
2005-04-16 22:20:36 +00:00
|
|
|
if (dev->pci->subsystem_vendor) {
|
2010-10-29 19:08:23 +00:00
|
|
|
rc->input_id.vendor = dev->pci->subsystem_vendor;
|
|
|
|
rc->input_id.product = dev->pci->subsystem_device;
|
2005-04-16 22:20:36 +00:00
|
|
|
} else {
|
2010-10-29 19:08:23 +00:00
|
|
|
rc->input_id.vendor = dev->pci->vendor;
|
|
|
|
rc->input_id.product = dev->pci->device;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
2010-10-29 19:08:23 +00:00
|
|
|
rc->dev.parent = &dev->pci->dev;
|
|
|
|
rc->map_name = ir_codes;
|
|
|
|
rc->driver_name = MODULE_NAME;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
2010-10-29 19:08:23 +00:00
|
|
|
err = rc_register_device(rc);
|
2006-11-20 13:23:04 +00:00
|
|
|
if (err)
|
2010-03-31 17:40:35 +00:00
|
|
|
goto err_out_free;
|
2005-04-16 22:20:36 +00:00
|
|
|
|
|
|
|
return 0;
|
2006-11-20 13:23:04 +00:00
|
|
|
|
2010-03-31 17:40:35 +00:00
|
|
|
err_out_free:
|
2010-10-29 19:08:23 +00:00
|
|
|
rc_free_device(rc);
|
2006-11-20 13:23:04 +00:00
|
|
|
dev->remote = NULL;
|
|
|
|
kfree(ir);
|
|
|
|
return err;
|
2005-04-16 22:20:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void saa7134_input_fini(struct saa7134_dev *dev)
|
|
|
|
{
|
|
|
|
if (NULL == dev->remote)
|
|
|
|
return;
|
|
|
|
|
2006-11-20 13:23:04 +00:00
|
|
|
saa7134_ir_stop(dev);
|
2010-10-29 19:08:23 +00:00
|
|
|
rc_unregister_device(dev->remote->dev);
|
2005-04-16 22:20:36 +00:00
|
|
|
kfree(dev->remote);
|
|
|
|
dev->remote = NULL;
|
|
|
|
}
|
|
|
|
|
2009-05-13 19:48:50 +00:00
|
|
|
void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
|
2005-11-09 05:37:56 +00:00
|
|
|
{
|
2009-10-02 08:47:08 +00:00
|
|
|
struct i2c_board_info info;
|
2009-05-13 19:48:50 +00:00
|
|
|
struct i2c_msg msg_msi = {
|
|
|
|
.addr = 0x50,
|
|
|
|
.flags = I2C_M_RD,
|
|
|
|
.len = 0,
|
|
|
|
.buf = NULL,
|
|
|
|
};
|
|
|
|
int rc;
|
|
|
|
|
2005-11-09 05:37:56 +00:00
|
|
|
if (disable_ir) {
|
2009-05-13 19:48:50 +00:00
|
|
|
dprintk("IR has been disabled, not probing for i2c remote\n");
|
2005-11-09 05:37:56 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2009-10-02 08:47:08 +00:00
|
|
|
memset(&info, 0, sizeof(struct i2c_board_info));
|
2009-09-07 05:22:01 +00:00
|
|
|
memset(&dev->init_data, 0, sizeof(dev->init_data));
|
2009-10-02 08:47:08 +00:00
|
|
|
strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
|
2009-05-13 19:48:50 +00:00
|
|
|
|
2005-11-09 05:37:56 +00:00
|
|
|
switch (dev->board) {
|
|
|
|
case SAA7134_BOARD_PINNACLE_PCTV_110i:
|
2006-10-12 22:46:16 +00:00
|
|
|
case SAA7134_BOARD_PINNACLE_PCTV_310i:
|
2009-09-07 05:22:01 +00:00
|
|
|
dev->init_data.name = "Pinnacle PCTV";
|
2006-03-26 02:14:42 +00:00
|
|
|
if (pinnacle_remote == 0) {
|
2009-09-07 05:22:01 +00:00
|
|
|
dev->init_data.get_key = get_key_pinnacle_color;
|
2010-04-02 23:01:00 +00:00
|
|
|
dev->init_data.ir_codes = RC_MAP_PINNACLE_COLOR;
|
2009-10-02 08:47:08 +00:00
|
|
|
info.addr = 0x47;
|
2006-03-26 02:14:42 +00:00
|
|
|
} else {
|
2009-09-07 05:22:01 +00:00
|
|
|
dev->init_data.get_key = get_key_pinnacle_grey;
|
2010-04-02 23:01:00 +00:00
|
|
|
dev->init_data.ir_codes = RC_MAP_PINNACLE_GREY;
|
2009-10-02 08:47:08 +00:00
|
|
|
info.addr = 0x47;
|
2006-03-26 02:14:42 +00:00
|
|
|
}
|
2005-11-09 05:37:56 +00:00
|
|
|
break;
|
|
|
|
case SAA7134_BOARD_UPMOST_PURPLE_TV:
|
2009-09-07 05:22:01 +00:00
|
|
|
dev->init_data.name = "Purple TV";
|
|
|
|
dev->init_data.get_key = get_key_purpletv;
|
2010-04-02 23:01:00 +00:00
|
|
|
dev->init_data.ir_codes = RC_MAP_PURPLETV;
|
2009-10-02 11:47:22 +00:00
|
|
|
info.addr = 0x7a;
|
2005-11-09 05:37:56 +00:00
|
|
|
break;
|
2008-10-13 11:37:06 +00:00
|
|
|
case SAA7134_BOARD_MSI_TVATANYWHERE_PLUS:
|
2009-09-07 05:22:01 +00:00
|
|
|
dev->init_data.name = "MSI TV@nywhere Plus";
|
|
|
|
dev->init_data.get_key = get_key_msi_tvanywhere_plus;
|
2010-04-02 23:01:00 +00:00
|
|
|
dev->init_data.ir_codes = RC_MAP_MSI_TVANYWHERE_PLUS;
|
2010-09-23 04:23:10 +00:00
|
|
|
/*
|
|
|
|
* MSI TV@nyware Plus requires more frequent polling
|
|
|
|
* otherwise it will miss some keypresses
|
|
|
|
*/
|
|
|
|
dev->init_data.polling_interval = 50;
|
2009-10-02 08:47:08 +00:00
|
|
|
info.addr = 0x30;
|
2009-05-13 19:51:46 +00:00
|
|
|
/* MSI TV@nywhere Plus controller doesn't seem to
|
|
|
|
respond to probes unless we read something from
|
|
|
|
an existing device. Weird...
|
|
|
|
REVISIT: might no longer be needed */
|
|
|
|
rc = i2c_transfer(&dev->i2c_adap, &msg_msi, 1);
|
2010-10-26 02:44:25 +00:00
|
|
|
dprintk("probe 0x%02x @ %s: %s\n",
|
2009-05-13 19:51:46 +00:00
|
|
|
msg_msi.addr, dev->i2c_adap.name,
|
|
|
|
(1 == rc) ? "yes" : "no");
|
2008-10-13 11:37:06 +00:00
|
|
|
break;
|
2006-11-30 00:57:24 +00:00
|
|
|
case SAA7134_BOARD_HAUPPAUGE_HVR1110:
|
2009-09-07 05:22:01 +00:00
|
|
|
dev->init_data.name = "HVR 1110";
|
|
|
|
dev->init_data.get_key = get_key_hvr1110;
|
2010-04-02 23:01:00 +00:00
|
|
|
dev->init_data.ir_codes = RC_MAP_HAUPPAUGE_NEW;
|
2009-10-02 12:48:04 +00:00
|
|
|
info.addr = 0x71;
|
2006-11-30 00:57:24 +00:00
|
|
|
break;
|
2009-04-23 05:32:49 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_607FM_MK3:
|
|
|
|
case SAA7134_BOARD_BEHOLD_607FM_MK5:
|
|
|
|
case SAA7134_BOARD_BEHOLD_609FM_MK3:
|
|
|
|
case SAA7134_BOARD_BEHOLD_609FM_MK5:
|
|
|
|
case SAA7134_BOARD_BEHOLD_607RDS_MK3:
|
|
|
|
case SAA7134_BOARD_BEHOLD_607RDS_MK5:
|
|
|
|
case SAA7134_BOARD_BEHOLD_609RDS_MK3:
|
|
|
|
case SAA7134_BOARD_BEHOLD_609RDS_MK5:
|
2008-01-07 08:17:39 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_M6:
|
2008-06-10 17:22:00 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_M63:
|
|
|
|
case SAA7134_BOARD_BEHOLD_M6_EXTRA:
|
2008-04-26 17:53:48 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_H6:
|
2009-08-26 04:01:12 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_X7:
|
2010-04-06 04:00:05 +00:00
|
|
|
case SAA7134_BOARD_BEHOLD_H7:
|
|
|
|
case SAA7134_BOARD_BEHOLD_A7:
|
2009-09-07 05:22:01 +00:00
|
|
|
dev->init_data.name = "BeholdTV";
|
|
|
|
dev->init_data.get_key = get_key_beholdm6xx;
|
2010-04-02 23:01:00 +00:00
|
|
|
dev->init_data.ir_codes = RC_MAP_BEHOLD;
|
2010-11-17 17:20:52 +00:00
|
|
|
dev->init_data.type = RC_TYPE_NEC;
|
2009-10-02 12:48:04 +00:00
|
|
|
info.addr = 0x2d;
|
2005-11-09 05:37:56 +00:00
|
|
|
break;
|
2009-05-13 19:52:44 +00:00
|
|
|
case SAA7134_BOARD_AVERMEDIA_CARDBUS_501:
|
|
|
|
case SAA7134_BOARD_AVERMEDIA_CARDBUS_506:
|
2009-10-02 08:47:08 +00:00
|
|
|
info.addr = 0x40;
|
2009-05-13 19:52:44 +00:00
|
|
|
break;
|
2009-11-24 15:06:52 +00:00
|
|
|
case SAA7134_BOARD_FLYDVB_TRIO:
|
|
|
|
dev->init_data.name = "FlyDVB Trio";
|
|
|
|
dev->init_data.get_key = get_key_flydvb_trio;
|
2010-04-02 23:01:00 +00:00
|
|
|
dev->init_data.ir_codes = RC_MAP_FLYDVB;
|
2009-11-24 15:06:52 +00:00
|
|
|
info.addr = 0x0b;
|
|
|
|
break;
|
2009-10-02 12:48:04 +00:00
|
|
|
default:
|
|
|
|
dprintk("No I2C IR support for board %x\n", dev->board);
|
|
|
|
return;
|
2005-11-09 05:37:56 +00:00
|
|
|
}
|
|
|
|
|
2009-09-07 05:22:01 +00:00
|
|
|
if (dev->init_data.name)
|
2009-10-02 08:47:08 +00:00
|
|
|
info.platform_data = &dev->init_data;
|
2009-10-02 12:48:04 +00:00
|
|
|
i2c_new_device(&dev->i2c_adap, &info);
|
2005-11-09 05:37:56 +00:00
|
|
|
}
|
2006-12-08 00:45:28 +00:00
|
|
|
|
2010-03-20 23:59:44 +00:00
|
|
|
static int saa7134_raw_decode_irq(struct saa7134_dev *dev)
|
|
|
|
{
|
2010-11-19 23:42:51 +00:00
|
|
|
struct saa7134_card_ir *ir = dev->remote;
|
|
|
|
unsigned long timeout;
|
V4L/DVB: ir-nec-decoder: Reimplement the entire decoder
Thanks to Andy Walls <awalls@md.metrocast.net> for pointing me his
code, that gave me some ideas to better implement it.
After some work with saa7134 bits, I found a way to catch both IRQ
edge pulses. By enabling it, the NEC decoder can now take both
pulse and spaces into account, making it more precise.
Instead of the old strategy of handling the events all at once,
this code implements a state machine. Due to that, it handles
individual pulse or space events, validating them against the
protocol, producing a much more reliable decoding.
With the new implementation, the protocol trailer bits are properly
handled, making possible for the repeat key to work.
Also, the code is now capable of handling both NEC and NEC extended
IR devices. With NEC, it produces a 16 bits code, while with NEC
extended, a 24 bits code is returned.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-04-03 21:51:50 +00:00
|
|
|
int space;
|
2010-03-20 23:59:44 +00:00
|
|
|
|
|
|
|
/* Generate initial event */
|
|
|
|
saa_clearb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
|
|
|
|
saa_setb(SAA7134_GPIO_GPMODE3, SAA7134_GPIO_GPRESCAN);
|
V4L/DVB: ir-nec-decoder: Reimplement the entire decoder
Thanks to Andy Walls <awalls@md.metrocast.net> for pointing me his
code, that gave me some ideas to better implement it.
After some work with saa7134 bits, I found a way to catch both IRQ
edge pulses. By enabling it, the NEC decoder can now take both
pulse and spaces into account, making it more precise.
Instead of the old strategy of handling the events all at once,
this code implements a state machine. Due to that, it handles
individual pulse or space events, validating them against the
protocol, producing a much more reliable decoding.
With the new implementation, the protocol trailer bits are properly
handled, making possible for the repeat key to work.
Also, the code is now capable of handling both NEC and NEC extended
IR devices. With NEC, it produces a 16 bits code, while with NEC
extended, a 24 bits code is returned.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2010-04-03 21:51:50 +00:00
|
|
|
space = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2) & ir->mask_keydown;
|
2010-04-08 16:10:00 +00:00
|
|
|
ir_raw_event_store_edge(dev->remote->dev, space ? IR_SPACE : IR_PULSE);
|
2010-03-20 23:59:44 +00:00
|
|
|
|
2010-03-21 16:00:55 +00:00
|
|
|
/*
|
|
|
|
* Wait 15 ms from the start of the first IR event before processing
|
|
|
|
* the event. This time is enough for NEC protocol. May need adjustments
|
|
|
|
* to work with other protocols.
|
|
|
|
*/
|
|
|
|
if (!ir->active) {
|
|
|
|
timeout = jiffies + jiffies_to_msecs(15);
|
2010-11-19 23:42:57 +00:00
|
|
|
mod_timer(&ir->timer, timeout);
|
2010-11-17 13:05:29 +00:00
|
|
|
ir->active = true;
|
2010-03-21 16:00:55 +00:00
|
|
|
}
|
2010-03-20 23:59:44 +00:00
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|