[PATCH 2/2] cx24117[v4]: Add new dvb-frontend: add supported cards to cx23885. Currently tested with TBS6980 and TBS6981.
v4: Patch order fixed. Changed some msleep's to clear checkpatch warnings. Signed-off-by: Luis Alves lja...@gmail.com --- drivers/media/pci/cx23885/Kconfig |1 + drivers/media/pci/cx23885/cx23885-cards.c | 67 + drivers/media/pci/cx23885/cx23885-dvb.c | 31 + drivers/media/pci/cx23885/cx23885-input.c | 12 ++ drivers/media/pci/cx23885/cx23885.h |2 + 5 files changed, 113 insertions(+) diff --git a/drivers/media/pci/cx23885/Kconfig b/drivers/media/pci/cx23885/Kconfig index b3688aa..91b2ed7 100644 --- a/drivers/media/pci/cx23885/Kconfig +++ b/drivers/media/pci/cx23885/Kconfig @@ -23,6 +23,7 @@ config VIDEO_CX23885 select DVB_STB6100 if MEDIA_SUBDRV_AUTOSELECT select DVB_STV6110 if MEDIA_SUBDRV_AUTOSELECT select DVB_CX24116 if MEDIA_SUBDRV_AUTOSELECT + select DVB_CX24117 if MEDIA_SUBDRV_AUTOSELECT select DVB_STV0900 if MEDIA_SUBDRV_AUTOSELECT select DVB_DS3000 if MEDIA_SUBDRV_AUTOSELECT select DVB_TS2020 if MEDIA_SUBDRV_AUTOSELECT diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 7e923f8..7ecd3fb 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -259,6 +259,16 @@ struct cx23885_board cx23885_boards[] = { .name = TurboSight TBS 6920, .portb = CX23885_MPEG_DVB, }, + [CX23885_BOARD_TBS_6980] = { + .name = TurboSight TBS 6980, + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, + }, + [CX23885_BOARD_TBS_6981] = { + .name = TurboSight TBS 6981, + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, + }, [CX23885_BOARD_TEVII_S470] = { .name = TeVii S470, .portb = CX23885_MPEG_DVB, @@ -698,6 +708,14 @@ struct cx23885_subid cx23885_subids[] = { .subdevice = 0x, .card = CX23885_BOARD_TBS_6920, }, { + .subvendor = 0x6980, + .subdevice = 0x, + .card = CX23885_BOARD_TBS_6980, + }, { + .subvendor = 0x6981, + .subdevice = 0x, + .card = CX23885_BOARD_TBS_6981, + }, { .subvendor = 0xd470, .subdevice = 0x9022, .card = CX23885_BOARD_TEVII_S470, @@ -1022,6 +1040,35 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) dev-name, tv.model); } +/* Some TBS cards require initing a chip using a bitbanged SPI attached + to the cx23885 gpio's. If this chip doesn't get init'ed the demod + doesn't respond to any command. */ +static void tbs_card_init(struct cx23885_dev *dev) +{ + int i; + const u8 buf[] = { + 0xe0, 0x06, 0x66, 0x33, 0x65, + 0x01, 0x17, 0x06, 0xde}; + + switch (dev-board) { + case CX23885_BOARD_TBS_6980: + case CX23885_BOARD_TBS_6981: + cx_set(GP0_IO, 0x00070007); + usleep_range(1000, 1); + cx_clear(GP0_IO, 2); + usleep_range(1000, 1); + for (i = 0; i 9 * 8; i++) { + cx_clear(GP0_IO, 7); + usleep_range(1000, 1); + cx_set(GP0_IO, + ((buf[i 3] (7 - (i 7))) 1) | 4); + usleep_range(1000, 1); + } + cx_set(GP0_IO, 7); + break; + } +} + int cx23885_tuner_callback(void *priv, int component, int command, int arg) { struct cx23885_tsport *port = priv; @@ -1224,6 +1271,8 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) cx_set(GP0_IO, 0x00040004); break; case CX23885_BOARD_TBS_6920: + case CX23885_BOARD_TBS_6980: + case CX23885_BOARD_TBS_6981: case CX23885_BOARD_PROF_8000: cx_write(MC417_CTL, 0x0036); cx_write(MC417_OEN, 0x1000); @@ -1472,6 +1521,8 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: case CX23885_BOARD_TEVII_S470: case CX23885_BOARD_MYGICA_X8507: + case CX23885_BOARD_TBS_6980: + case CX23885_BOARD_TBS_6981: if (!enable_885_ir) break; dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1515,6 +1566,8 @@ void cx23885_ir_fini(struct cx23885_dev *dev) case CX23885_BOARD_TEVII_S470: case CX23885_BOARD_HAUPPAUGE_HVR1250: case CX23885_BOARD_MYGICA_X8507: + case CX23885_BOARD_TBS_6980: + case CX23885_BOARD_TBS_6981:
Re: [PATCH 2/2] cx24117[v4]: Add new dvb-frontend: add supported cards to cx23885. Currently tested with TBS6980 and TBS6981.
On 07/24/2013 06:18 PM, Luis Alves wrote: v4: Patch order fixed. Changed some msleep's to clear checkpatch warnings. Signed-off-by: Luis Alves lja...@gmail.com Reviewed-by: Antti Palosaari cr...@iki.fi --- drivers/media/pci/cx23885/Kconfig |1 + drivers/media/pci/cx23885/cx23885-cards.c | 67 + drivers/media/pci/cx23885/cx23885-dvb.c | 31 + drivers/media/pci/cx23885/cx23885-input.c | 12 ++ drivers/media/pci/cx23885/cx23885.h |2 + 5 files changed, 113 insertions(+) diff --git a/drivers/media/pci/cx23885/Kconfig b/drivers/media/pci/cx23885/Kconfig index b3688aa..91b2ed7 100644 --- a/drivers/media/pci/cx23885/Kconfig +++ b/drivers/media/pci/cx23885/Kconfig @@ -23,6 +23,7 @@ config VIDEO_CX23885 select DVB_STB6100 if MEDIA_SUBDRV_AUTOSELECT select DVB_STV6110 if MEDIA_SUBDRV_AUTOSELECT select DVB_CX24116 if MEDIA_SUBDRV_AUTOSELECT + select DVB_CX24117 if MEDIA_SUBDRV_AUTOSELECT select DVB_STV0900 if MEDIA_SUBDRV_AUTOSELECT select DVB_DS3000 if MEDIA_SUBDRV_AUTOSELECT select DVB_TS2020 if MEDIA_SUBDRV_AUTOSELECT diff --git a/drivers/media/pci/cx23885/cx23885-cards.c b/drivers/media/pci/cx23885/cx23885-cards.c index 7e923f8..7ecd3fb 100644 --- a/drivers/media/pci/cx23885/cx23885-cards.c +++ b/drivers/media/pci/cx23885/cx23885-cards.c @@ -259,6 +259,16 @@ struct cx23885_board cx23885_boards[] = { .name = TurboSight TBS 6920, .portb = CX23885_MPEG_DVB, }, + [CX23885_BOARD_TBS_6980] = { + .name = TurboSight TBS 6980, + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, + }, + [CX23885_BOARD_TBS_6981] = { + .name = TurboSight TBS 6981, + .portb = CX23885_MPEG_DVB, + .portc = CX23885_MPEG_DVB, + }, [CX23885_BOARD_TEVII_S470] = { .name = TeVii S470, .portb = CX23885_MPEG_DVB, @@ -698,6 +708,14 @@ struct cx23885_subid cx23885_subids[] = { .subdevice = 0x, .card = CX23885_BOARD_TBS_6920, }, { + .subvendor = 0x6980, + .subdevice = 0x, + .card = CX23885_BOARD_TBS_6980, + }, { + .subvendor = 0x6981, + .subdevice = 0x, + .card = CX23885_BOARD_TBS_6981, + }, { .subvendor = 0xd470, .subdevice = 0x9022, .card = CX23885_BOARD_TEVII_S470, @@ -1022,6 +1040,35 @@ static void hauppauge_eeprom(struct cx23885_dev *dev, u8 *eeprom_data) dev-name, tv.model); } +/* Some TBS cards require initing a chip using a bitbanged SPI attached + to the cx23885 gpio's. If this chip doesn't get init'ed the demod + doesn't respond to any command. */ +static void tbs_card_init(struct cx23885_dev *dev) +{ + int i; + const u8 buf[] = { + 0xe0, 0x06, 0x66, 0x33, 0x65, + 0x01, 0x17, 0x06, 0xde}; + + switch (dev-board) { + case CX23885_BOARD_TBS_6980: + case CX23885_BOARD_TBS_6981: + cx_set(GP0_IO, 0x00070007); + usleep_range(1000, 1); + cx_clear(GP0_IO, 2); + usleep_range(1000, 1); + for (i = 0; i 9 * 8; i++) { + cx_clear(GP0_IO, 7); + usleep_range(1000, 1); + cx_set(GP0_IO, + ((buf[i 3] (7 - (i 7))) 1) | 4); + usleep_range(1000, 1); + } + cx_set(GP0_IO, 7); + break; + } +} + int cx23885_tuner_callback(void *priv, int component, int command, int arg) { struct cx23885_tsport *port = priv; @@ -1224,6 +1271,8 @@ void cx23885_gpio_setup(struct cx23885_dev *dev) cx_set(GP0_IO, 0x00040004); break; case CX23885_BOARD_TBS_6920: + case CX23885_BOARD_TBS_6980: + case CX23885_BOARD_TBS_6981: case CX23885_BOARD_PROF_8000: cx_write(MC417_CTL, 0x0036); cx_write(MC417_OEN, 0x1000); @@ -1472,6 +1521,8 @@ int cx23885_ir_init(struct cx23885_dev *dev) case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: case CX23885_BOARD_TEVII_S470: case CX23885_BOARD_MYGICA_X8507: + case CX23885_BOARD_TBS_6980: + case CX23885_BOARD_TBS_6981: if (!enable_885_ir) break; dev-sd_ir = cx23885_find_hw(dev, CX23885_HW_AV_CORE); @@ -1515,6 +1566,8 @@ void cx23885_ir_fini(struct cx23885_dev *dev) case CX23885_BOARD_TEVII_S470: case CX23885_BOARD_HAUPPAUGE_HVR1250: case CX23885_BOARD_MYGICA_X8507: