From 111ac84a80199654db55c06e2565d4ab343c135d Mon Sep 17 00:00:00 2001 From: Sergey Ivanov <123kash@gmail.com> Date: Mon, 9 Aug 2010 10:18:32 -0300 Subject: [media] Twinhan 1027 + IR Port support Patch add support of TwinHan 1027 DVB-S card. Refreshed version of https://patchwork.kernel.org/patch/79753/ patch. (adapted for the new IR system), still works. DVB-S support come from a patch originally authored by Manu Abraham (abraham.manu@gmail.com). IR Port support were added by Sergey. Cc: Manu Abraham Signed-off-by: Mauro Carvalho Chehab --- drivers/media/video/cx88/cx88-cards.c | 23 +++++++++++++ drivers/media/video/cx88/cx88-dvb.c | 61 +++++++++++++++++++++++++++++------ drivers/media/video/cx88/cx88-input.c | 6 ++++ drivers/media/video/cx88/cx88.h | 1 + 4 files changed, 82 insertions(+), 9 deletions(-) (limited to 'drivers/media/video/cx88') diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 97672cb..f220fa2 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -2104,6 +2104,18 @@ static const struct cx88_board cx88_boards[] = { } }, .mpeg = CX88_MPEG_DVB, }, + [CX88_BOARD_TWINHAN_VP1027_DVBS] = { + .name = "Twinhan VP-1027 DVB-S", + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_DVB, + .vmux = 0, + } }, + .mpeg = CX88_MPEG_DVB, + }, }; /* ------------------------------------------------------------------ */ @@ -2576,6 +2588,10 @@ static const struct cx88_subid cx88_subids[] = { .subvendor = 0xb034, .subdevice = 0x3034, .card = CX88_BOARD_PROF_7301, + }, { + .subvendor = 0x1822, + .subdevice = 0x0023, + .card = CX88_BOARD_TWINHAN_VP1027_DVBS, }, }; @@ -3070,6 +3086,13 @@ static void cx88_card_setup_pre_i2c(struct cx88_core *core) cx_set(MO_GP1_IO, 0x10); mdelay(50); break; + + case CX88_BOARD_TWINHAN_VP1027_DVBS: + cx_write(MO_GP0_IO, 0x00003230); + cx_write(MO_GP0_IO, 0x00003210); + msleep(1); + cx_write(MO_GP0_IO, 0x00001230); + break; } } diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index a037e92..367a653 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -56,6 +56,7 @@ #include "stv0900.h" #include "stb6100.h" #include "stb6100_proc.h" +#include "mb86a16.h" MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); MODULE_AUTHOR("Chris Pascoe "); @@ -250,6 +251,10 @@ static const struct zl10353_config cx88_terratec_cinergy_ht_pci_mkii_config = { .if2 = 45600, }; +static struct mb86a16_config twinhan_vp1027 = { + .demod_address = 0x08, +}; + #if defined(CONFIG_VIDEO_CX88_VP3054) || (defined(CONFIG_VIDEO_CX88_VP3054_MODULE) && defined(MODULE)) static int dntv_live_dvbt_pro_demod_init(struct dvb_frontend* fe) { @@ -429,15 +434,41 @@ static int tevii_dvbs_set_voltage(struct dvb_frontend *fe, cx_set(MO_GP0_IO, 0x6040); switch (voltage) { - case SEC_VOLTAGE_13: - cx_clear(MO_GP0_IO, 0x20); - break; - case SEC_VOLTAGE_18: - cx_set(MO_GP0_IO, 0x20); - break; - case SEC_VOLTAGE_OFF: - cx_clear(MO_GP0_IO, 0x20); - break; + case SEC_VOLTAGE_13: + cx_clear(MO_GP0_IO, 0x20); + break; + case SEC_VOLTAGE_18: + cx_set(MO_GP0_IO, 0x20); + break; + case SEC_VOLTAGE_OFF: + cx_clear(MO_GP0_IO, 0x20); + break; + } + + if (core->prev_set_voltage) + return core->prev_set_voltage(fe, voltage); + return 0; +} + +static int vp1027_set_voltage(struct dvb_frontend *fe, + fe_sec_voltage_t voltage) +{ + struct cx8802_dev *dev = fe->dvb->priv; + struct cx88_core *core = dev->core; + + switch (voltage) { + case SEC_VOLTAGE_13: + dprintk(1, "LNB SEC Voltage=13\n"); + cx_write(MO_GP0_IO, 0x00001220); + break; + case SEC_VOLTAGE_18: + dprintk(1, "LNB SEC Voltage=18\n"); + cx_write(MO_GP0_IO, 0x00001222); + break; + case SEC_VOLTAGE_OFF: + dprintk(1, "LNB Voltage OFF\n"); + cx_write(MO_GP0_IO, 0x00001230); + break; } if (core->prev_set_voltage) @@ -1416,6 +1447,18 @@ static int dvb_register(struct cx8802_dev *dev) } break; + case CX88_BOARD_TWINHAN_VP1027_DVBS: + dev->ts_gen_cntrl = 0x00; + fe0->dvb.frontend = dvb_attach(mb86a16_attach, + &twinhan_vp1027, + &core->i2c_adap); + if (fe0->dvb.frontend) { + core->prev_set_voltage = + fe0->dvb.frontend->ops.set_voltage; + fe0->dvb.frontend->ops.set_voltage = + vp1027_set_voltage; + } + break; default: printk(KERN_ERR "%s/2: The frontend of your DVB/ATSC card isn't supported yet\n", diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index d52ce0e..fc777bc 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -405,6 +405,11 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ir->mask_keycode = 0x7e; ir->polling = 100; /* ms */ break; + case CX88_BOARD_TWINHAN_VP1027_DVBS: + ir_codes = RC_MAP_TWINHAN_VP1027_DVBS; + ir_type = IR_TYPE_NEC; + ir->sampling = 0xff00; /* address */ + break; } if (NULL == ir_codes) { @@ -530,6 +535,7 @@ void cx88_ir_irq(struct cx88_core *core) case CX88_BOARD_PROF_7300: case CX88_BOARD_PROF_7301: case CX88_BOARD_PROF_6200: + case CX88_BOARD_TWINHAN_VP1027_DVBS: ircode = ir_decode_pulsedistance(ir->samples, ir->scount, 1, 4); if (ircode == 0xffffffff) { /* decoding error */ diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 127118f..c9981e7 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -239,6 +239,7 @@ extern const struct sram_channel const cx88_sram_channels[]; #define CX88_BOARD_WINFAST_DTV2000H_J 82 #define CX88_BOARD_PROF_7301 83 #define CX88_BOARD_SAMSUNG_SMT_7020 84 +#define CX88_BOARD_TWINHAN_VP1027_DVBS 85 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, -- cgit v1.1