Commit af4e067e authored by Luca Olivetti's avatar Luca Olivetti Committed by Mauro Carvalho Chehab

V4L/DVB (5625): Add support for the AF9005 demodulator from Afatech

Signed-off-by: default avatarLuca Olivetti <luca@ventoso.org>
Signed-off-by: default avatarManu Abraham <abraham.manu@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 79d3a8be
...@@ -218,3 +218,19 @@ config DVB_USB_OPERA1 ...@@ -218,3 +218,19 @@ config DVB_USB_OPERA1
select DVB_STV0299 if !DVB_FE_CUSTOMISE select DVB_STV0299 if !DVB_FE_CUSTOMISE
help help
Say Y here to support the Opera DVB-S USB2.0 receiver. Say Y here to support the Opera DVB-S USB2.0 receiver.
config DVB_USB_AF9005
tristate "Afatech AF9005 DVB-T USB1.1 support"
depends on DVB_USB
select DVB_TUNER_MT2060 if !DVB_FE_CUSTOMISE
help
Say Y here to support the Afatech AF9005 based DVB-T USB1.1 receiver
and the TerraTec Cinergy T USB XE (Rev.1)
config DVB_USB_AF9005_REMOTE
tristate "Afatech AF9005 default remote control support"
depends on DVB_USB_AF9005
help
Say Y here to support the default remote control decoding for the
Afatech AF9005 based receiver.
...@@ -55,4 +55,10 @@ dvb-usb-opera-objs = opera1.o ...@@ -55,4 +55,10 @@ dvb-usb-opera-objs = opera1.o
obj-$(CONFIG_DVB_USB_OPERA1) += dvb-usb-opera.o obj-$(CONFIG_DVB_USB_OPERA1) += dvb-usb-opera.o
dvb-usb-af9005-objs = af9005.o af9005-fe.o
obj-$(CONFIG_DVB_USB_AF9005) += dvb-usb-af9005.o
dvb-usb-af9005-remote-objs = af9005-remote.o
obj-$(CONFIG_DVB_USB_AF9005_REMOTE) += dvb-usb-af9005-remote.o
EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
This diff is collapsed.
/* DVB USB compliant Linux driver for the Afatech 9005
* USB1.1 DVB-T receiver.
*
* Standard remote decode function
*
* Copyright (C) 2007 Luca Olivetti (luca@ventoso.org)
*
* Thanks to Afatech who kindly provided information.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* see Documentation/dvb/REDME.dvb-usb for more information
*/
#include "af9005.h"
/* debug */
int dvb_usb_af9005_remote_debug;
module_param_named(debug, dvb_usb_af9005_remote_debug, int, 0644);
MODULE_PARM_DESC(debug,
"enable (1) or disable (0) debug messages."
DVB_USB_DEBUG_STATUS);
#define deb_decode(args...) dprintk(dvb_usb_af9005_remote_debug,0x01,args)
struct dvb_usb_rc_key af9005_rc_keys[] = {
{0x01, 0xb7, KEY_POWER},
{0x01, 0xa7, KEY_VOLUMEUP},
{0x01, 0x87, KEY_CHANNELUP},
{0x01, 0x7f, KEY_MUTE},
{0x01, 0xbf, KEY_VOLUMEDOWN},
{0x01, 0x3f, KEY_CHANNELDOWN},
{0x01, 0xdf, KEY_1},
{0x01, 0x5f, KEY_2},
{0x01, 0x9f, KEY_3},
{0x01, 0x1f, KEY_4},
{0x01, 0xef, KEY_5},
{0x01, 0x6f, KEY_6},
{0x01, 0xaf, KEY_7},
{0x01, 0x27, KEY_8},
{0x01, 0x07, KEY_9},
{0x01, 0xcf, KEY_ZOOM},
{0x01, 0x4f, KEY_0},
{0x01, 0x8f, KEY_GOTO}, /* marked jump on the remote */
{0x00, 0xbd, KEY_POWER},
{0x00, 0x7d, KEY_VOLUMEUP},
{0x00, 0xfd, KEY_CHANNELUP},
{0x00, 0x9d, KEY_MUTE},
{0x00, 0x5d, KEY_VOLUMEDOWN},
{0x00, 0xdd, KEY_CHANNELDOWN},
{0x00, 0xad, KEY_1},
{0x00, 0x6d, KEY_2},
{0x00, 0xed, KEY_3},
{0x00, 0x8d, KEY_4},
{0x00, 0x4d, KEY_5},
{0x00, 0xcd, KEY_6},
{0x00, 0xb5, KEY_7},
{0x00, 0x75, KEY_8},
{0x00, 0xf5, KEY_9},
{0x00, 0x95, KEY_ZOOM},
{0x00, 0x55, KEY_0},
{0x00, 0xd5, KEY_GOTO}, /* marked jump on the remote */
};
int af9005_rc_keys_size = ARRAY_SIZE(af9005_rc_keys);
static int repeatable_keys[] = {
KEY_VOLUMEUP,
KEY_VOLUMEDOWN,
KEY_CHANNELUP,
KEY_CHANNELDOWN
};
int af9005_rc_decode(struct dvb_usb_device *d, u8 * data, int len, u32 * event,
int *state)
{
u16 mark, space;
u32 result;
u8 cust, dat, invdat;
int i;
if (len >= 6) {
mark = (u16) (data[0] << 8) + data[1];
space = (u16) (data[2] << 8) + data[3];
if (space * 3 < mark) {
for (i = 0; i < ARRAY_SIZE(repeatable_keys); i++) {
if (d->last_event == repeatable_keys[i]) {
*state = REMOTE_KEY_REPEAT;
*event = d->last_event;
deb_decode("repeat key, event %x\n",
*event);
return 0;
}
}
deb_decode("repeated key ignored (non repeatable)\n");
return 0;
} else if (len >= 33 * 4) { /*32 bits + start code */
result = 0;
for (i = 4; i < 4 + 32 * 4; i += 4) {
result <<= 1;
mark = (u16) (data[i] << 8) + data[i + 1];
mark >>= 1;
space = (u16) (data[i + 2] << 8) + data[i + 3];
space >>= 1;
if (mark * 2 > space)
result += 1;
}
deb_decode("key pressed, raw value %x\n", result);
if ((result & 0xff000000) != 0xfe000000) {
deb_decode
("doesn't start with 0xfe, ignored\n");
return 0;
}
cust = (result >> 16) & 0xff;
dat = (result >> 8) & 0xff;
invdat = (~result) & 0xff;
if (dat != invdat) {
deb_decode("code != inverted code\n");
return 0;
}
for (i = 0; i < af9005_rc_keys_size; i++) {
if (af9005_rc_keys[i].custom == cust
&& af9005_rc_keys[i].data == dat) {
*event = af9005_rc_keys[i].event;
*state = REMOTE_KEY_PRESSED;
deb_decode
("key pressed, event %x\n", *event);
return 0;
}
}
deb_decode("not found in table\n");
}
}
return 0;
}
EXPORT_SYMBOL(af9005_rc_keys);
EXPORT_SYMBOL(af9005_rc_keys_size);
EXPORT_SYMBOL(af9005_rc_decode);
MODULE_AUTHOR("Luca Olivetti <luca@ventoso.org>");
MODULE_DESCRIPTION
("Standard remote control decoder for Afatech 9005 DVB-T USB1.1 stick");
MODULE_VERSION("1.0");
MODULE_LICENSE("GPL");
/*
File automatically generated by createinit.py using data
extracted from AF05BDA.sys (windows driver):
dd if=AF05BDA.sys of=initsequence bs=1 skip=88316 count=1110
python createinit.py > af9005-script.h
*/
typedef struct {
u16 reg;
u8 pos;
u8 len;
u8 val;
} RegDesc;
RegDesc script[] = {
{0xa180, 0x0, 0x8, 0xa},
{0xa181, 0x0, 0x8, 0xd7},
{0xa182, 0x0, 0x8, 0xa3},
{0xa0a0, 0x0, 0x8, 0x0},
{0xa0a1, 0x0, 0x5, 0x0},
{0xa0a1, 0x5, 0x1, 0x1},
{0xa0c0, 0x0, 0x4, 0x1},
{0xa20e, 0x4, 0x4, 0xa},
{0xa20f, 0x0, 0x8, 0x40},
{0xa210, 0x0, 0x8, 0x8},
{0xa32a, 0x0, 0x4, 0xa},
{0xa32c, 0x0, 0x8, 0x20},
{0xa32b, 0x0, 0x8, 0x15},
{0xa1a0, 0x1, 0x1, 0x1},
{0xa000, 0x0, 0x1, 0x1},
{0xa000, 0x1, 0x1, 0x0},
{0xa001, 0x1, 0x1, 0x1},
{0xa001, 0x0, 0x1, 0x0},
{0xa001, 0x5, 0x1, 0x0},
{0xa00e, 0x0, 0x5, 0x10},
{0xa00f, 0x0, 0x3, 0x4},
{0xa00f, 0x3, 0x3, 0x5},
{0xa010, 0x0, 0x3, 0x4},
{0xa010, 0x3, 0x3, 0x5},
{0xa016, 0x4, 0x4, 0x3},
{0xa01f, 0x0, 0x6, 0xa},
{0xa020, 0x0, 0x6, 0xa},
{0xa2bc, 0x0, 0x1, 0x1},
{0xa2bc, 0x5, 0x1, 0x1},
{0xa015, 0x0, 0x8, 0x50},
{0xa016, 0x0, 0x1, 0x0},
{0xa02a, 0x0, 0x8, 0x50},
{0xa029, 0x0, 0x8, 0x4b},
{0xa614, 0x0, 0x8, 0x46},
{0xa002, 0x0, 0x5, 0x19},
{0xa003, 0x0, 0x5, 0x1a},
{0xa004, 0x0, 0x5, 0x19},
{0xa005, 0x0, 0x5, 0x1a},
{0xa008, 0x0, 0x8, 0x69},
{0xa009, 0x0, 0x2, 0x2},
{0xae1b, 0x0, 0x8, 0x69},
{0xae1c, 0x0, 0x8, 0x2},
{0xae1d, 0x0, 0x8, 0x2a},
{0xa022, 0x0, 0x8, 0xaa},
{0xa006, 0x0, 0x8, 0xc8},
{0xa007, 0x0, 0x2, 0x0},
{0xa00c, 0x0, 0x8, 0xba},
{0xa00d, 0x0, 0x2, 0x2},
{0xa608, 0x0, 0x8, 0xba},
{0xa60e, 0x0, 0x2, 0x2},
{0xa609, 0x0, 0x8, 0x80},
{0xa60e, 0x2, 0x2, 0x3},
{0xa00a, 0x0, 0x8, 0xb6},
{0xa00b, 0x0, 0x2, 0x0},
{0xa011, 0x0, 0x8, 0xb9},
{0xa012, 0x0, 0x2, 0x0},
{0xa013, 0x0, 0x8, 0xbd},
{0xa014, 0x0, 0x2, 0x2},
{0xa366, 0x0, 0x1, 0x1},
{0xa2bc, 0x3, 0x1, 0x0},
{0xa2bd, 0x0, 0x8, 0xa},
{0xa2be, 0x0, 0x8, 0x14},
{0xa2bf, 0x0, 0x8, 0x8},
{0xa60a, 0x0, 0x8, 0xbd},
{0xa60e, 0x4, 0x2, 0x2},
{0xa60b, 0x0, 0x8, 0x86},
{0xa60e, 0x6, 0x2, 0x3},
{0xa001, 0x2, 0x2, 0x1},
{0xa1c7, 0x0, 0x8, 0xf5},
{0xa03d, 0x0, 0x8, 0xb1},
{0xa616, 0x0, 0x8, 0xff},
{0xa617, 0x0, 0x8, 0xad},
{0xa618, 0x0, 0x8, 0xad},
{0xa61e, 0x3, 0x1, 0x1},
{0xae1a, 0x0, 0x8, 0x0},
{0xae19, 0x0, 0x8, 0xc8},
{0xae18, 0x0, 0x8, 0x61},
{0xa140, 0x0, 0x8, 0x0},
{0xa141, 0x0, 0x8, 0xc8},
{0xa142, 0x0, 0x7, 0x61},
{0xa023, 0x0, 0x8, 0xff},
{0xa021, 0x0, 0x8, 0xad},
{0xa026, 0x0, 0x1, 0x0},
{0xa024, 0x0, 0x8, 0xff},
{0xa025, 0x0, 0x8, 0xff},
{0xa1c8, 0x0, 0x8, 0xf},
{0xa2bc, 0x1, 0x1, 0x0},
{0xa60c, 0x0, 0x4, 0x5},
{0xa60c, 0x4, 0x4, 0x6},
{0xa60d, 0x0, 0x8, 0xa},
{0xa371, 0x0, 0x1, 0x1},
{0xa366, 0x1, 0x3, 0x7},
{0xa338, 0x0, 0x8, 0x10},
{0xa339, 0x0, 0x6, 0x7},
{0xa33a, 0x0, 0x6, 0x1f},
{0xa33b, 0x0, 0x8, 0xf6},
{0xa33c, 0x3, 0x5, 0x4},
{0xa33d, 0x4, 0x4, 0x0},
{0xa33d, 0x1, 0x1, 0x1},
{0xa33d, 0x2, 0x1, 0x1},
{0xa33d, 0x3, 0x1, 0x1},
{0xa16d, 0x0, 0x4, 0xf},
{0xa161, 0x0, 0x5, 0x5},
{0xa162, 0x0, 0x4, 0x5},
{0xa165, 0x0, 0x8, 0xff},
{0xa166, 0x0, 0x8, 0x9c},
{0xa2c3, 0x0, 0x4, 0x5},
{0xa61a, 0x0, 0x6, 0xf},
{0xb200, 0x0, 0x8, 0xa1},
{0xb201, 0x0, 0x8, 0x7},
{0xa093, 0x0, 0x1, 0x0},
{0xa093, 0x1, 0x5, 0xf},
{0xa094, 0x0, 0x8, 0xff},
{0xa095, 0x0, 0x8, 0xf},
{0xa080, 0x2, 0x5, 0x3},
{0xa081, 0x0, 0x4, 0x0},
{0xa081, 0x4, 0x4, 0x9},
{0xa082, 0x0, 0x5, 0x1f},
{0xa08d, 0x0, 0x8, 0x1},
{0xa083, 0x0, 0x8, 0x32},
{0xa084, 0x0, 0x1, 0x0},
{0xa08e, 0x0, 0x8, 0x3},
{0xa085, 0x0, 0x8, 0x32},
{0xa086, 0x0, 0x3, 0x0},
{0xa087, 0x0, 0x8, 0x6e},
{0xa088, 0x0, 0x5, 0x15},
{0xa089, 0x0, 0x8, 0x0},
{0xa08a, 0x0, 0x5, 0x19},
{0xa08b, 0x0, 0x8, 0x92},
{0xa08c, 0x0, 0x5, 0x1c},
{0xa120, 0x0, 0x8, 0x0},
{0xa121, 0x0, 0x5, 0x10},
{0xa122, 0x0, 0x8, 0x0},
{0xa123, 0x0, 0x7, 0x40},
{0xa123, 0x7, 0x1, 0x0},
{0xa124, 0x0, 0x8, 0x13},
{0xa125, 0x0, 0x7, 0x10},
{0xa1c0, 0x0, 0x8, 0x0},
{0xa1c1, 0x0, 0x5, 0x4},
{0xa1c2, 0x0, 0x8, 0x0},
{0xa1c3, 0x0, 0x5, 0x10},
{0xa1c3, 0x5, 0x3, 0x0},
{0xa1c4, 0x0, 0x6, 0x0},
{0xa1c5, 0x0, 0x7, 0x10},
{0xa100, 0x0, 0x8, 0x0},
{0xa101, 0x0, 0x5, 0x10},
{0xa102, 0x0, 0x8, 0x0},
{0xa103, 0x0, 0x7, 0x40},
{0xa103, 0x7, 0x1, 0x0},
{0xa104, 0x0, 0x8, 0x18},
{0xa105, 0x0, 0x7, 0xa},
{0xa106, 0x0, 0x8, 0x20},
{0xa107, 0x0, 0x8, 0x40},
{0xa108, 0x0, 0x4, 0x0},
{0xa38c, 0x0, 0x8, 0xfc},
{0xa38d, 0x0, 0x8, 0x0},
{0xa38e, 0x0, 0x8, 0x7e},
{0xa38f, 0x0, 0x8, 0x0},
{0xa390, 0x0, 0x8, 0x2f},
{0xa60f, 0x5, 0x1, 0x1},
{0xa170, 0x0, 0x8, 0xdc},
{0xa171, 0x0, 0x2, 0x0},
{0xa2ae, 0x0, 0x1, 0x1},
{0xa2ae, 0x1, 0x1, 0x1},
{0xa392, 0x0, 0x1, 0x1},
{0xa391, 0x2, 0x1, 0x0},
{0xabc1, 0x0, 0x8, 0xff},
{0xabc2, 0x0, 0x8, 0x0},
{0xabc8, 0x0, 0x8, 0x8},
{0xabca, 0x0, 0x8, 0x10},
{0xabcb, 0x0, 0x1, 0x0},
{0xabc3, 0x5, 0x3, 0x7},
{0xabc0, 0x6, 0x1, 0x0},
{0xabc0, 0x4, 0x2, 0x0},
{0xa344, 0x4, 0x4, 0x1},
{0xabc0, 0x7, 0x1, 0x1},
{0xabc0, 0x2, 0x1, 0x1},
{0xa345, 0x0, 0x8, 0x66},
{0xa346, 0x0, 0x8, 0x66},
{0xa347, 0x0, 0x4, 0x0},
{0xa343, 0x0, 0x4, 0xa},
{0xa347, 0x4, 0x4, 0x2},
{0xa348, 0x0, 0x4, 0xc},
{0xa348, 0x4, 0x4, 0x7},
{0xa349, 0x0, 0x6, 0x2},
};
This diff is collapsed.
This diff is collapsed.
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
/* Vendor IDs */ /* Vendor IDs */
#define USB_VID_ADSTECH 0x06e1 #define USB_VID_ADSTECH 0x06e1
#define USB_VID_AFATECH 0x15a4
#define USB_VID_ALCOR_MICRO 0x058f #define USB_VID_ALCOR_MICRO 0x058f
#define USB_VID_ANCHOR 0x0547 #define USB_VID_ANCHOR 0x0547
#define USB_VID_ANUBIS_ELECTRONIC 0x10fd #define USB_VID_ANUBIS_ELECTRONIC 0x10fd
...@@ -35,6 +36,7 @@ ...@@ -35,6 +36,7 @@
#define USB_VID_MSI 0x0db0 #define USB_VID_MSI 0x0db0
#define USB_VID_OPERA1 0x695c #define USB_VID_OPERA1 0x695c
#define USB_VID_PINNACLE 0x2304 #define USB_VID_PINNACLE 0x2304
#define USB_VID_TERRATEC 0x0ccd
#define USB_VID_VISIONPLUS 0x13d3 #define USB_VID_VISIONPLUS 0x13d3
#define USB_VID_TWINHAN 0x1822 #define USB_VID_TWINHAN 0x1822
#define USB_VID_ULTIMA_ELECTRONIC 0x05d8 #define USB_VID_ULTIMA_ELECTRONIC 0x05d8
...@@ -44,6 +46,7 @@ ...@@ -44,6 +46,7 @@
/* Product IDs */ /* Product IDs */
#define USB_PID_ADSTECH_USB2_COLD 0xa333 #define USB_PID_ADSTECH_USB2_COLD 0xa333
#define USB_PID_ADSTECH_USB2_WARM 0xa334 #define USB_PID_ADSTECH_USB2_WARM 0xa334
#define USB_PID_AFATECH_AF9005 0x9020
#define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001 #define USB_PID_AVERMEDIA_DVBT_USB_COLD 0x0001
#define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002 #define USB_PID_AVERMEDIA_DVBT_USB_WARM 0x0002
#define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800 #define USB_PID_AVERMEDIA_DVBT_USB2_COLD 0xa800
...@@ -69,6 +72,7 @@ ...@@ -69,6 +72,7 @@
#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 #define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1
#define USB_PID_KWORLD_VSTREAM_COLD 0x17de #define USB_PID_KWORLD_VSTREAM_COLD 0x17de
#define USB_PID_KWORLD_VSTREAM_WARM 0x17df #define USB_PID_KWORLD_VSTREAM_WARM 0x17df
#define USB_PID_TERRATEC_CINERGY_T_USB_XE 0x0055
#define USB_PID_TWINHAN_VP7041_COLD 0x3201 #define USB_PID_TWINHAN_VP7041_COLD 0x3201
#define USB_PID_TWINHAN_VP7041_WARM 0x3202 #define USB_PID_TWINHAN_VP7041_WARM 0x3202
#define USB_PID_TWINHAN_VP7020_COLD 0x3203 #define USB_PID_TWINHAN_VP7020_COLD 0x3203
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment