2005-04-17 02:20:36 +04:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Device driver for GPIO attached remote control interfaces
|
|
|
|
* on Conexant 2388x based TV/DVB cards.
|
|
|
|
*
|
|
|
|
* Copyright (c) 2003 Pavel Machek
|
|
|
|
* Copyright (c) 2004 Gerd Knorr
|
2006-01-09 20:25:35 +03:00
|
|
|
* Copyright (c) 2004, 2005 Chris Pascoe
|
2005-04-17 02:20:36 +04:00
|
|
|
*
|
|
|
|
* 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/init.h>
|
2009-07-02 18:50:35 +04:00
|
|
|
#include <linux/hrtimer.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/pci.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 11:04:11 +03:00
|
|
|
#include <linux/slab.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
#include <linux/module.h>
|
|
|
|
|
|
|
|
#include "cx88.h"
|
2010-11-17 19:28:38 +03:00
|
|
|
#include <media/rc-core.h>
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2010-03-13 03:18:14 +03:00
|
|
|
#define MODULE_NAME "cx88xx"
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
struct cx88_IR {
|
2005-07-13 00:58:44 +04:00
|
|
|
struct cx88_core *core;
|
2010-10-29 23:08:23 +04:00
|
|
|
struct rc_dev *dev;
|
2010-03-31 23:07:49 +04:00
|
|
|
|
|
|
|
int users;
|
|
|
|
|
2005-07-13 00:58:44 +04:00
|
|
|
char name[32];
|
|
|
|
char phys[32];
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* sample from gpio pin 16 */
|
2006-01-09 20:25:35 +03:00
|
|
|
u32 sampling;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* poll external decoder */
|
2005-07-13 00:58:44 +04:00
|
|
|
int polling;
|
2009-07-02 18:50:35 +04:00
|
|
|
struct hrtimer timer;
|
2005-07-13 00:58:44 +04:00
|
|
|
u32 gpio_addr;
|
|
|
|
u32 last_gpio;
|
|
|
|
u32 mask_keycode;
|
|
|
|
u32 mask_keydown;
|
|
|
|
u32 mask_keyup;
|
2005-04-17 02:20:36 +04:00
|
|
|
};
|
|
|
|
|
2010-10-29 23:08:02 +04:00
|
|
|
static unsigned ir_samplerate = 4;
|
|
|
|
module_param(ir_samplerate, uint, 0444);
|
|
|
|
MODULE_PARM_DESC(ir_samplerate, "IR samplerate in kHz, 1 - 20, default 4");
|
|
|
|
|
2008-04-22 21:41:48 +04:00
|
|
|
static int ir_debug;
|
2005-07-13 00:58:44 +04:00
|
|
|
module_param(ir_debug, int, 0644); /* debug level [IR] */
|
2005-04-17 02:20:36 +04:00
|
|
|
MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
|
|
|
|
|
|
|
|
#define ir_dprintk(fmt, arg...) if (ir_debug) \
|
2005-09-10 00:03:41 +04:00
|
|
|
printk(KERN_DEBUG "%s IR: " fmt , ir->core->name , ##arg)
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2010-12-30 14:02:51 +03:00
|
|
|
#define dprintk(fmt, arg...) if (ir_debug) \
|
|
|
|
printk(KERN_DEBUG "cx88 IR: " fmt , ##arg)
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
static void cx88_ir_handle_key(struct cx88_IR *ir)
|
|
|
|
{
|
|
|
|
struct cx88_core *core = ir->core;
|
2006-05-22 14:44:02 +04:00
|
|
|
u32 gpio, data, auxgpio;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* read gpio value */
|
|
|
|
gpio = cx_read(ir->gpio_addr);
|
2007-08-15 21:41:57 +04:00
|
|
|
switch (core->boardnr) {
|
2007-06-25 21:54:09 +04:00
|
|
|
case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
|
2006-05-22 14:44:02 +04:00
|
|
|
/* This board apparently uses a combination of 2 GPIO
|
|
|
|
to represent the keys. Additionally, the second GPIO
|
|
|
|
can be used for parity.
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
|
|
|
for key "5"
|
|
|
|
gpio = 0x758, auxgpio = 0xe5 or 0xf5
|
|
|
|
for key "Power"
|
|
|
|
gpio = 0x758, auxgpio = 0xed or 0xfd
|
|
|
|
*/
|
|
|
|
|
|
|
|
auxgpio = cx_read(MO_GP1_IO);
|
|
|
|
/* Take out the parity part */
|
2006-07-17 23:34:27 +04:00
|
|
|
gpio=(gpio & 0x7fd) + (auxgpio & 0xef);
|
2007-06-25 21:54:09 +04:00
|
|
|
break;
|
|
|
|
case CX88_BOARD_WINFAST_DTV1000:
|
2009-05-31 23:47:28 +04:00
|
|
|
case CX88_BOARD_WINFAST_DTV1800H:
|
2011-06-07 20:16:56 +04:00
|
|
|
case CX88_BOARD_WINFAST_DTV1800H_XC4000:
|
2011-06-07 20:14:53 +04:00
|
|
|
case CX88_BOARD_WINFAST_DTV2000H_PLUS:
|
2009-04-29 10:55:31 +04:00
|
|
|
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
|
2011-12-12 03:20:24 +04:00
|
|
|
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F36:
|
|
|
|
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F43:
|
2007-06-25 21:46:05 +04:00
|
|
|
gpio = (gpio & 0x6ff) | ((cx_read(MO_GP1_IO) << 8) & 0x900);
|
|
|
|
auxgpio = gpio;
|
2007-06-25 21:54:09 +04:00
|
|
|
break;
|
|
|
|
default:
|
2006-05-22 14:44:02 +04:00
|
|
|
auxgpio = gpio;
|
2007-06-25 21:54:09 +04:00
|
|
|
}
|
2005-04-17 02:20:36 +04:00
|
|
|
if (ir->polling) {
|
2006-05-22 14:44:02 +04:00
|
|
|
if (ir->last_gpio == auxgpio)
|
2005-04-17 02:20:36 +04:00
|
|
|
return;
|
2006-05-22 14:44:02 +04:00
|
|
|
ir->last_gpio = auxgpio;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* extract data */
|
|
|
|
data = ir_extract_bits(gpio, ir->mask_keycode);
|
|
|
|
ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n",
|
2005-07-13 00:58:44 +04:00
|
|
|
gpio, data,
|
|
|
|
ir->polling ? "poll" : "irq",
|
|
|
|
(gpio & ir->mask_keydown) ? " down" : "",
|
|
|
|
(gpio & ir->mask_keyup) ? " up" : "");
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2007-08-15 21:41:57 +04:00
|
|
|
if (ir->core->boardnr == CX88_BOARD_NORWOOD_MICRO) {
|
2006-08-08 16:10:05 +04:00
|
|
|
u32 gpio_key = cx_read(MO_GP0_IO);
|
|
|
|
|
|
|
|
data = (data << 4) | ((gpio_key & 0xf0) >> 4);
|
|
|
|
|
2014-04-04 03:31:30 +04:00
|
|
|
rc_keydown(ir->dev, RC_TYPE_UNKNOWN, data, 0);
|
|
|
|
|
|
|
|
} else if (ir->core->boardnr == CX88_BOARD_PROLINK_PLAYTVPVR ||
|
|
|
|
ir->core->boardnr == CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO) {
|
|
|
|
/* bit cleared on keydown, NEC scancode, 0xAAAACC, A = 0x866b */
|
|
|
|
u16 addr;
|
|
|
|
u8 cmd;
|
|
|
|
u32 scancode;
|
|
|
|
|
|
|
|
addr = (data >> 8) & 0xffff;
|
|
|
|
cmd = (data >> 0) & 0x00ff;
|
|
|
|
scancode = RC_SCANCODE_NECX(addr, cmd);
|
|
|
|
|
|
|
|
if (0 == (gpio & ir->mask_keyup))
|
|
|
|
rc_keydown_notimeout(ir->dev, RC_TYPE_NEC, scancode, 0);
|
|
|
|
else
|
|
|
|
rc_keyup(ir->dev);
|
2006-08-08 16:10:05 +04:00
|
|
|
|
|
|
|
} else if (ir->mask_keydown) {
|
2005-04-17 02:20:36 +04:00
|
|
|
/* bit set on keydown */
|
2010-06-07 23:32:28 +04:00
|
|
|
if (gpio & ir->mask_keydown)
|
2014-04-04 03:31:30 +04:00
|
|
|
rc_keydown_notimeout(ir->dev, RC_TYPE_UNKNOWN, data, 0);
|
2010-10-29 23:08:07 +04:00
|
|
|
else
|
2010-11-17 19:53:11 +03:00
|
|
|
rc_keyup(ir->dev);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
} else if (ir->mask_keyup) {
|
|
|
|
/* bit cleared on keydown */
|
2010-06-07 23:32:28 +04:00
|
|
|
if (0 == (gpio & ir->mask_keyup))
|
2014-04-04 03:31:30 +04:00
|
|
|
rc_keydown_notimeout(ir->dev, RC_TYPE_UNKNOWN, data, 0);
|
2010-10-29 23:08:07 +04:00
|
|
|
else
|
2010-11-17 19:53:11 +03:00
|
|
|
rc_keyup(ir->dev);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
} else {
|
|
|
|
/* can't distinguish keydown/up :-/ */
|
2014-04-04 03:31:30 +04:00
|
|
|
rc_keydown_notimeout(ir->dev, RC_TYPE_UNKNOWN, data, 0);
|
2010-11-17 19:53:11 +03:00
|
|
|
rc_keyup(ir->dev);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-07-02 18:50:35 +04:00
|
|
|
static enum hrtimer_restart cx88_ir_work(struct hrtimer *timer)
|
2005-04-17 02:20:36 +04:00
|
|
|
{
|
2009-07-02 18:50:35 +04:00
|
|
|
unsigned long missed;
|
|
|
|
struct cx88_IR *ir = container_of(timer, struct cx88_IR, timer);
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
cx88_ir_handle_key(ir);
|
2009-07-02 18:50:35 +04:00
|
|
|
missed = hrtimer_forward_now(&ir->timer,
|
|
|
|
ktime_set(0, ir->polling * 1000000));
|
|
|
|
if (missed > 1)
|
|
|
|
ir_dprintk("Missed ticks %ld\n", missed - 1);
|
|
|
|
|
|
|
|
return HRTIMER_RESTART;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2010-03-31 23:07:49 +04:00
|
|
|
static int __cx88_ir_start(void *priv)
|
2006-11-20 16:23:04 +03:00
|
|
|
{
|
2010-03-31 23:07:49 +04:00
|
|
|
struct cx88_core *core = priv;
|
|
|
|
struct cx88_IR *ir;
|
|
|
|
|
|
|
|
if (!core || !core->ir)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
ir = core->ir;
|
|
|
|
|
2006-11-20 16:23:04 +03:00
|
|
|
if (ir->polling) {
|
2009-07-02 18:50:35 +04:00
|
|
|
hrtimer_init(&ir->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
|
|
|
|
ir->timer.function = cx88_ir_work;
|
|
|
|
hrtimer_start(&ir->timer,
|
|
|
|
ktime_set(0, ir->polling * 1000000),
|
|
|
|
HRTIMER_MODE_REL);
|
2006-11-20 16:23:04 +03:00
|
|
|
}
|
|
|
|
if (ir->sampling) {
|
2007-08-18 13:57:55 +04:00
|
|
|
core->pci_irqmask |= PCI_INT_IR_SMPINT;
|
2010-10-29 23:08:02 +04:00
|
|
|
cx_write(MO_DDS_IO, 0x33F286 * ir_samplerate); /* samplerate */
|
|
|
|
cx_write(MO_DDSCFG_IO, 0x5); /* enable */
|
2006-11-20 16:23:04 +03:00
|
|
|
}
|
2010-03-31 23:07:49 +04:00
|
|
|
return 0;
|
2006-11-20 16:23:04 +03:00
|
|
|
}
|
|
|
|
|
2010-03-31 23:07:49 +04:00
|
|
|
static void __cx88_ir_stop(void *priv)
|
2006-11-20 16:23:04 +03:00
|
|
|
{
|
2010-03-31 23:07:49 +04:00
|
|
|
struct cx88_core *core = priv;
|
|
|
|
struct cx88_IR *ir;
|
|
|
|
|
|
|
|
if (!core || !core->ir)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ir = core->ir;
|
2006-11-20 16:23:04 +03:00
|
|
|
if (ir->sampling) {
|
|
|
|
cx_write(MO_DDSCFG_IO, 0x0);
|
2007-08-18 13:57:55 +04:00
|
|
|
core->pci_irqmask &= ~PCI_INT_IR_SMPINT;
|
2006-11-20 16:23:04 +03:00
|
|
|
}
|
|
|
|
|
2009-03-07 13:42:12 +03:00
|
|
|
if (ir->polling)
|
2009-07-02 18:50:35 +04:00
|
|
|
hrtimer_cancel(&ir->timer);
|
2006-11-20 16:23:04 +03:00
|
|
|
}
|
|
|
|
|
2010-03-31 23:07:49 +04:00
|
|
|
int cx88_ir_start(struct cx88_core *core)
|
|
|
|
{
|
|
|
|
if (core->ir->users)
|
|
|
|
return __cx88_ir_start(core);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void cx88_ir_stop(struct cx88_core *core)
|
|
|
|
{
|
|
|
|
if (core->ir->users)
|
|
|
|
__cx88_ir_stop(core);
|
|
|
|
}
|
|
|
|
|
2010-10-29 23:08:23 +04:00
|
|
|
static int cx88_ir_open(struct rc_dev *rc)
|
2010-03-31 23:07:49 +04:00
|
|
|
{
|
2010-10-29 23:08:23 +04:00
|
|
|
struct cx88_core *core = rc->priv;
|
2010-03-31 23:07:49 +04:00
|
|
|
|
|
|
|
core->ir->users++;
|
|
|
|
return __cx88_ir_start(core);
|
|
|
|
}
|
|
|
|
|
2010-10-29 23:08:23 +04:00
|
|
|
static void cx88_ir_close(struct rc_dev *rc)
|
2010-03-31 23:07:49 +04:00
|
|
|
{
|
2010-10-29 23:08:23 +04:00
|
|
|
struct cx88_core *core = rc->priv;
|
2010-03-31 23:07:49 +04:00
|
|
|
|
|
|
|
core->ir->users--;
|
|
|
|
if (!core->ir->users)
|
|
|
|
__cx88_ir_stop(core);
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
|
|
|
|
{
|
|
|
|
struct cx88_IR *ir;
|
2010-10-29 23:08:23 +04:00
|
|
|
struct rc_dev *dev;
|
2010-04-03 03:01:00 +04:00
|
|
|
char *ir_codes = NULL;
|
2012-10-12 02:11:54 +04:00
|
|
|
u64 rc_type = RC_BIT_OTHER;
|
2006-11-20 16:23:04 +03:00
|
|
|
int err = -ENOMEM;
|
2010-04-04 21:06:55 +04:00
|
|
|
u32 hardware_mask = 0; /* For devices with a hardware mask, when
|
|
|
|
* used with a full-code IR table
|
|
|
|
*/
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2005-09-15 11:01:53 +04:00
|
|
|
ir = kzalloc(sizeof(*ir), GFP_KERNEL);
|
2010-10-29 23:08:23 +04:00
|
|
|
dev = rc_allocate_device();
|
|
|
|
if (!ir || !dev)
|
2006-11-20 16:23:04 +03:00
|
|
|
goto err_out_free;
|
2005-09-15 11:01:53 +04:00
|
|
|
|
2010-10-29 23:08:23 +04:00
|
|
|
ir->dev = dev;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* detect & configure */
|
2007-08-15 21:41:57 +04:00
|
|
|
switch (core->boardnr) {
|
2005-04-17 02:20:36 +04:00
|
|
|
case CX88_BOARD_DNTV_LIVE_DVB_T:
|
2005-06-24 09:05:03 +04:00
|
|
|
case CX88_BOARD_KWORLD_DVB_T:
|
2006-02-07 11:45:33 +03:00
|
|
|
case CX88_BOARD_KWORLD_DVB_T_CX22702:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_DNTV_LIVE_DVB_T;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->gpio_addr = MO_GP1_IO;
|
2005-04-17 02:20:36 +04:00
|
|
|
ir->mask_keycode = 0x1f;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->mask_keyup = 0x60;
|
|
|
|
ir->polling = 50; /* ms */
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2005-09-10 00:03:41 +04:00
|
|
|
case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_CINERGY_1400;
|
2006-01-09 20:25:35 +03:00
|
|
|
ir->sampling = 0xeb04; /* address */
|
2005-09-10 00:03:41 +04:00
|
|
|
break;
|
2005-04-17 02:20:36 +04:00
|
|
|
case CX88_BOARD_HAUPPAUGE:
|
|
|
|
case CX88_BOARD_HAUPPAUGE_DVB_T1:
|
2006-01-09 20:25:02 +03:00
|
|
|
case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
|
|
|
|
case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
|
2006-01-09 20:25:12 +03:00
|
|
|
case CX88_BOARD_HAUPPAUGE_HVR1100:
|
2006-09-30 07:43:58 +04:00
|
|
|
case CX88_BOARD_HAUPPAUGE_HVR3000:
|
2008-09-04 08:17:33 +04:00
|
|
|
case CX88_BOARD_HAUPPAUGE_HVR4000:
|
|
|
|
case CX88_BOARD_HAUPPAUGE_HVR4000LITE:
|
2009-03-01 04:29:20 +03:00
|
|
|
case CX88_BOARD_PCHDTV_HD3000:
|
|
|
|
case CX88_BOARD_PCHDTV_HD5500:
|
2009-03-28 20:22:21 +03:00
|
|
|
case CX88_BOARD_HAUPPAUGE_IRONLY:
|
2011-01-24 18:18:48 +03:00
|
|
|
ir_codes = RC_MAP_HAUPPAUGE;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->sampling = 1;
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2006-05-29 20:56:24 +04:00
|
|
|
case CX88_BOARD_WINFAST_DTV2000H:
|
2009-08-11 05:15:54 +04:00
|
|
|
case CX88_BOARD_WINFAST_DTV2000H_J:
|
2009-05-31 23:47:28 +04:00
|
|
|
case CX88_BOARD_WINFAST_DTV1800H:
|
2011-06-07 20:16:56 +04:00
|
|
|
case CX88_BOARD_WINFAST_DTV1800H_XC4000:
|
2011-06-07 20:14:53 +04:00
|
|
|
case CX88_BOARD_WINFAST_DTV2000H_PLUS:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_WINFAST;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->gpio_addr = MO_GP0_IO;
|
2005-04-17 02:20:36 +04:00
|
|
|
ir->mask_keycode = 0x8f8;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->mask_keyup = 0x100;
|
2006-05-29 20:56:24 +04:00
|
|
|
ir->polling = 50; /* ms */
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2006-11-03 16:45:52 +03:00
|
|
|
case CX88_BOARD_WINFAST2000XP_EXPERT:
|
2007-06-25 21:46:05 +04:00
|
|
|
case CX88_BOARD_WINFAST_DTV1000:
|
2009-04-29 10:55:31 +04:00
|
|
|
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL:
|
2011-12-12 03:20:24 +04:00
|
|
|
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F36:
|
|
|
|
case CX88_BOARD_WINFAST_TV2000_XP_GLOBAL_6F43:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_WINFAST;
|
2006-11-03 16:45:52 +03:00
|
|
|
ir->gpio_addr = MO_GP0_IO;
|
|
|
|
ir->mask_keycode = 0x8f8;
|
|
|
|
ir->mask_keyup = 0x100;
|
|
|
|
ir->polling = 1; /* ms */
|
|
|
|
break;
|
2005-04-17 02:20:36 +04:00
|
|
|
case CX88_BOARD_IODATA_GVBCTV7E:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_IODATA_BCTV7E;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->gpio_addr = MO_GP0_IO;
|
2005-04-17 02:20:36 +04:00
|
|
|
ir->mask_keycode = 0xfd;
|
|
|
|
ir->mask_keydown = 0x02;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->polling = 5; /* ms */
|
2005-04-17 02:20:36 +04:00
|
|
|
break;
|
2006-11-03 16:45:52 +03:00
|
|
|
case CX88_BOARD_PROLINK_PLAYTVPVR:
|
2005-06-24 09:04:53 +04:00
|
|
|
case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO:
|
2010-04-04 21:06:55 +04:00
|
|
|
/*
|
|
|
|
* It seems that this hardware is paired with NEC extended
|
|
|
|
* address 0x866b. So, unfortunately, its usage with other
|
|
|
|
* IR's with different address won't work. Still, there are
|
|
|
|
* other IR's from the same manufacturer that works, like the
|
|
|
|
* 002-T mini RC, provided with newer PV hardware
|
|
|
|
*/
|
|
|
|
ir_codes = RC_MAP_PIXELVIEW_MK12;
|
2014-04-04 03:31:30 +04:00
|
|
|
rc_type = RC_BIT_NEC;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->gpio_addr = MO_GP1_IO;
|
|
|
|
ir->mask_keyup = 0x80;
|
2010-04-04 17:32:04 +04:00
|
|
|
ir->polling = 10; /* ms */
|
2010-04-04 21:06:55 +04:00
|
|
|
hardware_mask = 0x3f; /* Hardware returns only 6 bits from command part */
|
2005-06-24 09:04:53 +04:00
|
|
|
break;
|
2008-04-22 21:46:01 +04:00
|
|
|
case CX88_BOARD_PROLINK_PV_8000GT:
|
2008-09-29 19:08:29 +04:00
|
|
|
case CX88_BOARD_PROLINK_PV_GLOBAL_XTREME:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_PIXELVIEW_NEW;
|
2008-04-22 21:46:01 +04:00
|
|
|
ir->gpio_addr = MO_GP1_IO;
|
|
|
|
ir->mask_keycode = 0x3f;
|
|
|
|
ir->mask_keyup = 0x80;
|
|
|
|
ir->polling = 1; /* ms */
|
|
|
|
break;
|
2006-01-23 14:44:10 +03:00
|
|
|
case CX88_BOARD_KWORLD_LTV883:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_PIXELVIEW;
|
2006-01-23 14:44:10 +03:00
|
|
|
ir->gpio_addr = MO_GP1_IO;
|
|
|
|
ir->mask_keycode = 0x1f;
|
|
|
|
ir->mask_keyup = 0x60;
|
|
|
|
ir->polling = 1; /* ms */
|
|
|
|
break;
|
2005-07-08 04:58:36 +04:00
|
|
|
case CX88_BOARD_ADSTECH_DVB_T_PCI:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_ADSTECH_DVB_T_PCI;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->gpio_addr = MO_GP1_IO;
|
2005-07-08 04:58:36 +04:00
|
|
|
ir->mask_keycode = 0xbf;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->mask_keyup = 0x40;
|
|
|
|
ir->polling = 50; /* ms */
|
|
|
|
break;
|
|
|
|
case CX88_BOARD_MSI_TVANYWHERE_MASTER:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_MSI_TVANYWHERE;
|
2005-07-13 00:58:44 +04:00
|
|
|
ir->gpio_addr = MO_GP1_IO;
|
|
|
|
ir->mask_keycode = 0x1f;
|
|
|
|
ir->mask_keyup = 0x40;
|
|
|
|
ir->polling = 1; /* ms */
|
2005-07-08 04:58:36 +04:00
|
|
|
break;
|
2006-01-09 20:25:19 +03:00
|
|
|
case CX88_BOARD_AVERTV_303:
|
2006-01-09 20:32:46 +03:00
|
|
|
case CX88_BOARD_AVERTV_STUDIO_303:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_AVERTV_303;
|
2006-01-09 20:25:19 +03:00
|
|
|
ir->gpio_addr = MO_GP2_IO;
|
|
|
|
ir->mask_keycode = 0xfb;
|
|
|
|
ir->mask_keydown = 0x02;
|
|
|
|
ir->polling = 50; /* ms */
|
|
|
|
break;
|
2009-09-19 16:51:12 +04:00
|
|
|
case CX88_BOARD_OMICOM_SS4_PCI:
|
|
|
|
case CX88_BOARD_SATTRADE_ST4200:
|
|
|
|
case CX88_BOARD_TBS_8920:
|
|
|
|
case CX88_BOARD_TBS_8910:
|
|
|
|
case CX88_BOARD_PROF_7300:
|
2009-11-17 04:22:32 +03:00
|
|
|
case CX88_BOARD_PROF_7301:
|
2009-09-19 16:51:12 +04:00
|
|
|
case CX88_BOARD_PROF_6200:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_TBS_NEC;
|
2009-09-19 16:51:12 +04:00
|
|
|
ir->sampling = 0xff00; /* address */
|
|
|
|
break;
|
2011-02-26 00:41:24 +03:00
|
|
|
case CX88_BOARD_TEVII_S464:
|
2009-09-19 16:51:12 +04:00
|
|
|
case CX88_BOARD_TEVII_S460:
|
|
|
|
case CX88_BOARD_TEVII_S420:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_TEVII_NEC;
|
2009-09-19 16:51:12 +04:00
|
|
|
ir->sampling = 0xff00; /* address */
|
|
|
|
break;
|
2006-01-09 20:25:35 +03:00
|
|
|
case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_DNTV_LIVE_DVBT_PRO;
|
V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and
the value is the keycode. While this works, it has some drawbacks:
1) It requires that the scancode to be at the range 00-7f;
2) keycodes should be masked on 7 bits in order for it to work;
3) due to the 7 bits approach, sometimes it is not possible to replace
the default keyboard to another one with a different encoding rule;
4) it is different than what is done with dvb-usb approach;
5) it requires a typedef for it to work. This is not a recommended
Linux CodingStyle.
This patch is part of a larger series of IR changes. It basically
replaces the IR_KEYTAB_TYPE tables by a structured table:
struct ir_scancode {
u16 scancode;
u32 keycode;
};
This is very close to what dvb does. So, a further integration with DVB
code will be easy.
While we've changed the tables, for now, the IR keycode handling is still
based on the old approach.
The only notable effect is the redution of about 35% of the ir-common
module size:
text data bss dec hex filename
6721 29208 4 35933 8c5d old/ir-common.ko
5756 18040 4 23800 5cf8 new/ir-common.ko
In thesis, we could be using above u8 for scancode, reducing even more the size
of the module, but defining it as u16 is more convenient, since, on dvb, each
scancode has up to 16 bits, and we currently have a few troubles with rc5, as their
scancodes are defined with more than 8 bits.
This patch itself shouldn't be doing any functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-08-29 21:15:55 +04:00
|
|
|
ir->sampling = 0xff00; /* address */
|
2006-01-09 20:25:35 +03:00
|
|
|
break;
|
2006-08-08 16:10:05 +04:00
|
|
|
case CX88_BOARD_NORWOOD_MICRO:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_NORWOOD;
|
2006-08-08 16:10:05 +04:00
|
|
|
ir->gpio_addr = MO_GP1_IO;
|
|
|
|
ir->mask_keycode = 0x0e;
|
|
|
|
ir->mask_keyup = 0x80;
|
|
|
|
ir->polling = 50; /* ms */
|
|
|
|
break;
|
2006-06-09 00:36:17 +04:00
|
|
|
case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_NPGTECH;
|
V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and
the value is the keycode. While this works, it has some drawbacks:
1) It requires that the scancode to be at the range 00-7f;
2) keycodes should be masked on 7 bits in order for it to work;
3) due to the 7 bits approach, sometimes it is not possible to replace
the default keyboard to another one with a different encoding rule;
4) it is different than what is done with dvb-usb approach;
5) it requires a typedef for it to work. This is not a recommended
Linux CodingStyle.
This patch is part of a larger series of IR changes. It basically
replaces the IR_KEYTAB_TYPE tables by a structured table:
struct ir_scancode {
u16 scancode;
u32 keycode;
};
This is very close to what dvb does. So, a further integration with DVB
code will be easy.
While we've changed the tables, for now, the IR keycode handling is still
based on the old approach.
The only notable effect is the redution of about 35% of the ir-common
module size:
text data bss dec hex filename
6721 29208 4 35933 8c5d old/ir-common.ko
5756 18040 4 23800 5cf8 new/ir-common.ko
In thesis, we could be using above u8 for scancode, reducing even more the size
of the module, but defining it as u16 is more convenient, since, on dvb, each
scancode has up to 16 bits, and we currently have a few troubles with rc5, as their
scancodes are defined with more than 8 bits.
This patch itself shouldn't be doing any functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-08-29 21:15:55 +04:00
|
|
|
ir->gpio_addr = MO_GP0_IO;
|
2006-05-22 14:44:02 +04:00
|
|
|
ir->mask_keycode = 0xfa;
|
V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and
the value is the keycode. While this works, it has some drawbacks:
1) It requires that the scancode to be at the range 00-7f;
2) keycodes should be masked on 7 bits in order for it to work;
3) due to the 7 bits approach, sometimes it is not possible to replace
the default keyboard to another one with a different encoding rule;
4) it is different than what is done with dvb-usb approach;
5) it requires a typedef for it to work. This is not a recommended
Linux CodingStyle.
This patch is part of a larger series of IR changes. It basically
replaces the IR_KEYTAB_TYPE tables by a structured table:
struct ir_scancode {
u16 scancode;
u32 keycode;
};
This is very close to what dvb does. So, a further integration with DVB
code will be easy.
While we've changed the tables, for now, the IR keycode handling is still
based on the old approach.
The only notable effect is the redution of about 35% of the ir-common
module size:
text data bss dec hex filename
6721 29208 4 35933 8c5d old/ir-common.ko
5756 18040 4 23800 5cf8 new/ir-common.ko
In thesis, we could be using above u8 for scancode, reducing even more the size
of the module, but defining it as u16 is more convenient, since, on dvb, each
scancode has up to 16 bits, and we currently have a few troubles with rc5, as their
scancodes are defined with more than 8 bits.
This patch itself shouldn't be doing any functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-08-29 21:15:55 +04:00
|
|
|
ir->polling = 50; /* ms */
|
2006-05-22 14:44:02 +04:00
|
|
|
break;
|
2008-01-22 07:00:33 +03:00
|
|
|
case CX88_BOARD_PINNACLE_PCTV_HD_800i:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_PINNACLE_PCTV_HD;
|
V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and
the value is the keycode. While this works, it has some drawbacks:
1) It requires that the scancode to be at the range 00-7f;
2) keycodes should be masked on 7 bits in order for it to work;
3) due to the 7 bits approach, sometimes it is not possible to replace
the default keyboard to another one with a different encoding rule;
4) it is different than what is done with dvb-usb approach;
5) it requires a typedef for it to work. This is not a recommended
Linux CodingStyle.
This patch is part of a larger series of IR changes. It basically
replaces the IR_KEYTAB_TYPE tables by a structured table:
struct ir_scancode {
u16 scancode;
u32 keycode;
};
This is very close to what dvb does. So, a further integration with DVB
code will be easy.
While we've changed the tables, for now, the IR keycode handling is still
based on the old approach.
The only notable effect is the redution of about 35% of the ir-common
module size:
text data bss dec hex filename
6721 29208 4 35933 8c5d old/ir-common.ko
5756 18040 4 23800 5cf8 new/ir-common.ko
In thesis, we could be using above u8 for scancode, reducing even more the size
of the module, but defining it as u16 is more convenient, since, on dvb, each
scancode has up to 16 bits, and we currently have a few troubles with rc5, as their
scancodes are defined with more than 8 bits.
This patch itself shouldn't be doing any functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-08-29 21:15:55 +04:00
|
|
|
ir->sampling = 1;
|
2008-01-22 07:00:33 +03:00
|
|
|
break;
|
2008-04-09 02:56:44 +04:00
|
|
|
case CX88_BOARD_POWERCOLOR_REAL_ANGEL:
|
2010-04-03 03:01:00 +04:00
|
|
|
ir_codes = RC_MAP_POWERCOLOR_REAL_ANGEL;
|
V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and
the value is the keycode. While this works, it has some drawbacks:
1) It requires that the scancode to be at the range 00-7f;
2) keycodes should be masked on 7 bits in order for it to work;
3) due to the 7 bits approach, sometimes it is not possible to replace
the default keyboard to another one with a different encoding rule;
4) it is different than what is done with dvb-usb approach;
5) it requires a typedef for it to work. This is not a recommended
Linux CodingStyle.
This patch is part of a larger series of IR changes. It basically
replaces the IR_KEYTAB_TYPE tables by a structured table:
struct ir_scancode {
u16 scancode;
u32 keycode;
};
This is very close to what dvb does. So, a further integration with DVB
code will be easy.
While we've changed the tables, for now, the IR keycode handling is still
based on the old approach.
The only notable effect is the redution of about 35% of the ir-common
module size:
text data bss dec hex filename
6721 29208 4 35933 8c5d old/ir-common.ko
5756 18040 4 23800 5cf8 new/ir-common.ko
In thesis, we could be using above u8 for scancode, reducing even more the size
of the module, but defining it as u16 is more convenient, since, on dvb, each
scancode has up to 16 bits, and we currently have a few troubles with rc5, as their
scancodes are defined with more than 8 bits.
This patch itself shouldn't be doing any functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-08-29 21:15:55 +04:00
|
|
|
ir->gpio_addr = MO_GP2_IO;
|
2008-04-09 02:56:44 +04:00
|
|
|
ir->mask_keycode = 0x7e;
|
V4L/DVB (12595): common/ir: use a struct for keycode tables
Currently, V4L uses a scancode table whose index is the scancode and
the value is the keycode. While this works, it has some drawbacks:
1) It requires that the scancode to be at the range 00-7f;
2) keycodes should be masked on 7 bits in order for it to work;
3) due to the 7 bits approach, sometimes it is not possible to replace
the default keyboard to another one with a different encoding rule;
4) it is different than what is done with dvb-usb approach;
5) it requires a typedef for it to work. This is not a recommended
Linux CodingStyle.
This patch is part of a larger series of IR changes. It basically
replaces the IR_KEYTAB_TYPE tables by a structured table:
struct ir_scancode {
u16 scancode;
u32 keycode;
};
This is very close to what dvb does. So, a further integration with DVB
code will be easy.
While we've changed the tables, for now, the IR keycode handling is still
based on the old approach.
The only notable effect is the redution of about 35% of the ir-common
module size:
text data bss dec hex filename
6721 29208 4 35933 8c5d old/ir-common.ko
5756 18040 4 23800 5cf8 new/ir-common.ko
In thesis, we could be using above u8 for scancode, reducing even more the size
of the module, but defining it as u16 is more convenient, since, on dvb, each
scancode has up to 16 bits, and we currently have a few troubles with rc5, as their
scancodes are defined with more than 8 bits.
This patch itself shouldn't be doing any functional changes.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
2009-08-29 21:15:55 +04:00
|
|
|
ir->polling = 100; /* ms */
|
2008-04-09 02:56:44 +04:00
|
|
|
break;
|
2010-08-09 17:18:32 +04:00
|
|
|
case CX88_BOARD_TWINHAN_VP1027_DVBS:
|
|
|
|
ir_codes = RC_MAP_TWINHAN_VP1027_DVBS;
|
|
|
|
ir->sampling = 0xff00; /* address */
|
|
|
|
break;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
2005-06-24 09:05:03 +04:00
|
|
|
|
2010-10-29 23:08:02 +04:00
|
|
|
if (!ir_codes) {
|
2006-11-20 16:23:04 +03:00
|
|
|
err = -ENODEV;
|
|
|
|
goto err_out_free;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2010-04-04 21:06:55 +04:00
|
|
|
/*
|
|
|
|
* The usage of mask_keycode were very convenient, due to several
|
|
|
|
* reasons. Among others, the scancode tables were using the scancode
|
|
|
|
* as the index elements. So, the less bits it was used, the smaller
|
|
|
|
* the table were stored. After the input changes, the better is to use
|
|
|
|
* the full scancodes, since it allows replacing the IR remote by
|
|
|
|
* another one. Unfortunately, there are still some hardware, like
|
|
|
|
* Pixelview Ultra Pro, where only part of the scancode is sent via
|
|
|
|
* GPIO. So, there's no way to get the full scancode. Due to that,
|
|
|
|
* hardware_mask were introduced here: it represents those hardware
|
|
|
|
* that has such limits.
|
|
|
|
*/
|
|
|
|
if (hardware_mask && !ir->mask_keycode)
|
|
|
|
ir->mask_keycode = hardware_mask;
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* init input device */
|
2007-08-15 21:41:57 +04:00
|
|
|
snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)", core->board.name);
|
2005-07-13 00:58:44 +04:00
|
|
|
snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2010-10-29 23:08:23 +04:00
|
|
|
dev->input_name = ir->name;
|
|
|
|
dev->input_phys = ir->phys;
|
|
|
|
dev->input_id.bustype = BUS_PCI;
|
|
|
|
dev->input_id.version = 1;
|
2005-04-17 02:20:36 +04:00
|
|
|
if (pci->subsystem_vendor) {
|
2010-10-29 23:08:23 +04:00
|
|
|
dev->input_id.vendor = pci->subsystem_vendor;
|
|
|
|
dev->input_id.product = pci->subsystem_device;
|
2005-04-17 02:20:36 +04:00
|
|
|
} else {
|
2010-10-29 23:08:23 +04:00
|
|
|
dev->input_id.vendor = pci->vendor;
|
|
|
|
dev->input_id.product = pci->device;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
2010-10-29 23:08:23 +04:00
|
|
|
dev->dev.parent = &pci->dev;
|
|
|
|
dev->map_name = ir_codes;
|
|
|
|
dev->driver_name = MODULE_NAME;
|
|
|
|
dev->priv = core;
|
|
|
|
dev->open = cx88_ir_open;
|
|
|
|
dev->close = cx88_ir_close;
|
2014-04-04 03:32:26 +04:00
|
|
|
dev->scancode_mask = hardware_mask;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2010-10-29 23:08:02 +04:00
|
|
|
if (ir->sampling) {
|
2010-10-29 23:08:23 +04:00
|
|
|
dev->driver_type = RC_DRIVER_IR_RAW;
|
|
|
|
dev->timeout = 10 * 1000 * 1000; /* 10 ms */
|
|
|
|
} else {
|
|
|
|
dev->driver_type = RC_DRIVER_SCANCODE;
|
2014-04-04 03:32:21 +04:00
|
|
|
dev->allowed_protocols = rc_type;
|
2010-10-29 23:08:23 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
ir->core = core;
|
|
|
|
core->ir = ir;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
/* all done */
|
2010-10-29 23:08:23 +04:00
|
|
|
err = rc_register_device(dev);
|
2006-11-20 16:23:04 +03:00
|
|
|
if (err)
|
2010-03-31 23:07:49 +04:00
|
|
|
goto err_out_free;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
|
|
|
return 0;
|
2006-11-20 16:23:04 +03:00
|
|
|
|
2010-10-29 23:08:23 +04:00
|
|
|
err_out_free:
|
|
|
|
rc_free_device(dev);
|
2010-03-31 23:07:49 +04:00
|
|
|
core->ir = NULL;
|
2006-11-20 16:23:04 +03:00
|
|
|
kfree(ir);
|
|
|
|
return err;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
int cx88_ir_fini(struct cx88_core *core)
|
|
|
|
{
|
|
|
|
struct cx88_IR *ir = core->ir;
|
|
|
|
|
|
|
|
/* skip detach on non attached boards */
|
|
|
|
if (NULL == ir)
|
|
|
|
return 0;
|
|
|
|
|
2010-03-31 23:07:49 +04:00
|
|
|
cx88_ir_stop(core);
|
2010-10-29 23:08:23 +04:00
|
|
|
rc_unregister_device(ir->dev);
|
2005-04-17 02:20:36 +04:00
|
|
|
kfree(ir);
|
|
|
|
|
|
|
|
/* done */
|
|
|
|
core->ir = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
void cx88_ir_irq(struct cx88_core *core)
|
|
|
|
{
|
|
|
|
struct cx88_IR *ir = core->ir;
|
2010-10-29 23:08:02 +04:00
|
|
|
u32 samples;
|
|
|
|
unsigned todo, bits;
|
|
|
|
struct ir_raw_event ev;
|
2005-04-17 02:20:36 +04:00
|
|
|
|
2010-10-29 23:08:02 +04:00
|
|
|
if (!ir || !ir->sampling)
|
2005-04-17 02:20:36 +04:00
|
|
|
return;
|
|
|
|
|
2010-10-29 23:08:02 +04:00
|
|
|
/*
|
|
|
|
* Samples are stored in a 32 bit register, oldest sample in
|
|
|
|
* the msb. A set bit represents space and an unset bit
|
|
|
|
* represents a pulse.
|
|
|
|
*/
|
2005-04-17 02:20:36 +04:00
|
|
|
samples = cx_read(MO_SAMPLE_IO);
|
2005-09-10 00:03:41 +04:00
|
|
|
|
2010-10-29 23:08:23 +04:00
|
|
|
if (samples == 0xff && ir->dev->idle)
|
2010-10-29 23:08:02 +04:00
|
|
|
return;
|
2005-09-10 00:03:41 +04:00
|
|
|
|
2010-10-29 23:08:02 +04:00
|
|
|
init_ir_raw_event(&ev);
|
|
|
|
for (todo = 32; todo > 0; todo -= bits) {
|
|
|
|
ev.pulse = samples & 0x80000000 ? false : true;
|
|
|
|
bits = min(todo, 32U - fls(ev.pulse ? samples : ~samples));
|
2011-04-08 16:50:45 +04:00
|
|
|
ev.duration = (bits * (NSEC_PER_SEC / 1000)) / ir_samplerate;
|
2010-10-29 23:08:23 +04:00
|
|
|
ir_raw_event_store_with_filter(ir->dev, &ev);
|
2010-10-29 23:08:02 +04:00
|
|
|
samples <<= bits;
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
2010-10-29 23:08:23 +04:00
|
|
|
ir_raw_event_handle(ir->dev);
|
2005-04-17 02:20:36 +04:00
|
|
|
}
|
|
|
|
|
2014-04-04 03:31:25 +04:00
|
|
|
static int get_key_pvr2000(struct IR_i2c *ir, enum rc_type *protocol,
|
|
|
|
u32 *scancode, u8 *toggle)
|
2010-12-30 14:02:51 +03:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
2014-04-04 03:31:25 +04:00
|
|
|
*protocol = RC_TYPE_UNKNOWN;
|
|
|
|
*scancode = code & 0xff;
|
|
|
|
*toggle = 0;
|
2010-12-30 14:02:51 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-09-23 07:51:44 +04:00
|
|
|
void cx88_i2c_init_ir(struct cx88_core *core)
|
|
|
|
{
|
|
|
|
struct i2c_board_info info;
|
2010-12-30 14:02:51 +03:00
|
|
|
const unsigned short default_addr_list[] = {
|
2010-09-23 07:51:44 +04:00
|
|
|
0x18, 0x6b, 0x71,
|
|
|
|
I2C_CLIENT_END
|
|
|
|
};
|
2010-12-30 14:02:51 +03:00
|
|
|
const unsigned short pvr2000_addr_list[] = {
|
|
|
|
0x18, 0x1a,
|
|
|
|
I2C_CLIENT_END
|
|
|
|
};
|
|
|
|
const unsigned short *addr_list = default_addr_list;
|
2010-09-23 07:51:44 +04:00
|
|
|
const unsigned short *addrp;
|
|
|
|
/* Instantiate the IR receiver device, if present */
|
|
|
|
if (0 != core->i2c_rc)
|
|
|
|
return;
|
|
|
|
|
|
|
|
memset(&info, 0, sizeof(struct i2c_board_info));
|
|
|
|
strlcpy(info.type, "ir_video", I2C_NAME_SIZE);
|
|
|
|
|
2010-12-30 14:02:51 +03:00
|
|
|
switch (core->boardnr) {
|
|
|
|
case CX88_BOARD_LEADTEK_PVR2000:
|
|
|
|
addr_list = pvr2000_addr_list;
|
|
|
|
core->init_data.name = "cx88 Leadtek PVR 2000 remote";
|
2012-10-12 02:11:54 +04:00
|
|
|
core->init_data.type = RC_BIT_UNKNOWN;
|
2010-12-30 14:02:51 +03:00
|
|
|
core->init_data.get_key = get_key_pvr2000;
|
|
|
|
core->init_data.ir_codes = RC_MAP_EMPTY;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-09-23 07:51:44 +04:00
|
|
|
/*
|
|
|
|
* We can't call i2c_new_probed_device() because it uses
|
|
|
|
* quick writes for probing and at least some RC receiver
|
|
|
|
* devices only reply to reads.
|
|
|
|
* Also, Hauppauge XVR needs to be specified, as address 0x71
|
|
|
|
* conflicts with another remote type used with saa7134
|
|
|
|
*/
|
|
|
|
for (addrp = addr_list; *addrp != I2C_CLIENT_END; addrp++) {
|
|
|
|
info.platform_data = NULL;
|
|
|
|
memset(&core->init_data, 0, sizeof(core->init_data));
|
|
|
|
|
|
|
|
if (*addrp == 0x71) {
|
|
|
|
/* Hauppauge XVR */
|
|
|
|
core->init_data.name = "cx88 Hauppauge XVR remote";
|
2011-01-24 18:18:48 +03:00
|
|
|
core->init_data.ir_codes = RC_MAP_HAUPPAUGE;
|
2012-10-12 02:11:54 +04:00
|
|
|
core->init_data.type = RC_BIT_RC5;
|
2010-09-23 07:51:44 +04:00
|
|
|
core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
|
|
|
|
|
|
|
|
info.platform_data = &core->init_data;
|
|
|
|
}
|
|
|
|
if (i2c_smbus_xfer(&core->i2c_adap, *addrp, 0,
|
|
|
|
I2C_SMBUS_READ, 0,
|
|
|
|
I2C_SMBUS_QUICK, NULL) >= 0) {
|
|
|
|
info.addr = *addrp;
|
|
|
|
i2c_new_device(&core->i2c_adap, &info);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-17 02:20:36 +04:00
|
|
|
/* ---------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Gerd Knorr, Pavel Machek, Chris Pascoe");
|
|
|
|
MODULE_DESCRIPTION("input driver for cx88 GPIO-based IR remote controls");
|
|
|
|
MODULE_LICENSE("GPL");
|