From patchwork Fri Mar 27 11:57:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olli Salonen X-Patchwork-Id: 28993 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1YbStZ-0000LQ-36; Fri, 27 Mar 2015 12:57:49 +0100 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.76/mailfrontend-5) with esmtp id 1YbStW-0001O1-8D; Fri, 27 Mar 2015 12:57:48 +0100 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752845AbbC0L5o (ORCPT + 1 other); Fri, 27 Mar 2015 07:57:44 -0400 Received: from mail-lb0-f176.google.com ([209.85.217.176]:36111 "EHLO mail-lb0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752592AbbC0L5n (ORCPT ); Fri, 27 Mar 2015 07:57:43 -0400 Received: by lbbug6 with SMTP id ug6so61768233lbb.3 for ; Fri, 27 Mar 2015 04:57:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=8i94DcOjdn3uJhpI7DwllaYZBDiMRL7EJLCmdbaCZho=; b=WongwPdcVxvmGi8Zn93BBOisQW6hX8VzLRs4hNeNexr7CoEBhWPFCDxYMpacSQcZOo rEAlZaw9U2XS4I9Dz3NqHhLM4F+zIXI8703xtUvc93QzBykoJK6iCqu6WgeGm4nYX1Ka mJkIgitE3T0/7IkNhn20QMrDBHal/gnAJhhcavoHT1AMQJn502BWLNZw7b7TMljgpxtH ZeMW+iJRL1Hg4kZvT0/V+6BRmzmpbCqwX90UydHwvwxJ+xh/0ECQX+2jdJxDzE8Fmzdf 3q+l8KDLtXlfeHxuT2Ll1dwjab3G3WViFM399tbh4EZ7zZB77muW12lC4/zJPhD06jRK 7FuA== X-Gm-Message-State: ALoCoQn+BP75IV3q2U6exX6AIWS07dTQVeyvzU4QBQ1/9APoKXN0Bozeof9Me+a5ouKHHw7vWUw/ X-Received: by 10.112.160.227 with SMTP id xn3mr3763855lbb.112.1427457461518; Fri, 27 Mar 2015 04:57:41 -0700 (PDT) Received: from dl160.lan (37-33-50-203.bb.dnainternet.fi. [37.33.50.203]) by mx.google.com with ESMTPSA id y8sm300615lad.46.2015.03.27.04.57.39 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 27 Mar 2015 04:57:40 -0700 (PDT) From: Olli Salonen To: linux-media@vger.kernel.org Cc: Olli Salonen Subject: [PATCH 5/5] saa7164: Hauppauge HVR-2205 and HVR-2215 DVB-C/T/T2 tuners Date: Fri, 27 Mar 2015 13:57:19 +0200 Message-Id: <1427457439-1493-5-git-send-email-olli.salonen@iki.fi> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1427457439-1493-1-git-send-email-olli.salonen@iki.fi> References: <1427457439-1493-1-git-send-email-olli.salonen@iki.fi> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.3.27.113921 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, ECARD_WORD 0, REFERENCES 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __INT_PROD_TV 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_WWW 0, __URI_NS , __YOUTUBE_RCVD 0' Hauppauge HVR-2205 and HVR-2215 are PCIe dual tuner cards that support DVB-C, DVB-T and DVB-T2. PCIe bridge: SAA7164 Demodulator: Si2168-B40 Tuner: SI2157-A20 I know there's parallel activity ongoing regarding these devices, but I thought I'll submit my own version here as well. The maintainers of each module can then make the call what to merge. Signed-off-by: Olli Salonen --- drivers/media/pci/saa7164/Kconfig | 2 + drivers/media/pci/saa7164/saa7164-cards.c | 101 ++++++++++++++++++++++++++++++ drivers/media/pci/saa7164/saa7164-dvb.c | 67 ++++++++++++++++++++ drivers/media/pci/saa7164/saa7164.h | 2 + 4 files changed, 172 insertions(+) diff --git a/drivers/media/pci/saa7164/Kconfig b/drivers/media/pci/saa7164/Kconfig index a53db7d..5ebe930 100644 --- a/drivers/media/pci/saa7164/Kconfig +++ b/drivers/media/pci/saa7164/Kconfig @@ -8,7 +8,9 @@ config VIDEO_SAA7164 select VIDEOBUF_DVB select DVB_TDA10048 if MEDIA_SUBDRV_AUTOSELECT select DVB_S5H1411 if MEDIA_SUBDRV_AUTOSELECT + select DVB_SI2168 if MEDIA_SUBDRV_AUTOSELECT select MEDIA_TUNER_TDA18271 if MEDIA_SUBDRV_AUTOSELECT + select MEDIA_TUNER_SI2157 if MEDIA_SUBDRV_AUTOSELECT ---help--- This is a video4linux driver for NXP SAA7164 based TV cards. diff --git a/drivers/media/pci/saa7164/saa7164-cards.c b/drivers/media/pci/saa7164/saa7164-cards.c index 5b72da5..5ebd312 100644 --- a/drivers/media/pci/saa7164/saa7164-cards.c +++ b/drivers/media/pci/saa7164/saa7164-cards.c @@ -499,6 +499,90 @@ struct saa7164_board saa7164_boards[] = { .i2c_reg_len = REGLEN_8bit, } }, }, + [SAA7164_BOARD_HAUPPAUGE_HVR2205] = { + .name = "Hauppauge WinTV-HVR2205", + .porta = SAA7164_MPEG_DVB, + .portb = SAA7164_MPEG_DVB, + .chiprev = SAA7164_CHIP_REV3, + .unit = {{ + .id = 0x28, + .type = SAA7164_UNIT_EEPROM, + .name = "4K EEPROM", + .i2c_bus_nr = SAA7164_I2C_BUS_0, + .i2c_bus_addr = 0xa0 >> 1, + .i2c_reg_len = REGLEN_8bit, + }, { + .id = 0x04, + .type = SAA7164_UNIT_TUNER, + .name = "SI2157-1", + .i2c_bus_nr = SAA7164_I2C_BUS_1, + .i2c_bus_addr = 0xc0 >> 1, + .i2c_reg_len = 0, + }, { + .id = 0x05, + .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, + .name = "SI2168-1", + .i2c_bus_nr = SAA7164_I2C_BUS_1, + .i2c_bus_addr = 0xc8 >> 1, + .i2c_reg_len = 0, + }, { + .id = 0x25, + .type = SAA7164_UNIT_TUNER, + .name = "SI2157-2", + .i2c_bus_nr = SAA7164_I2C_BUS_2, + .i2c_bus_addr = 0xc0 >> 1, + .i2c_reg_len = 0, + }, { + .id = 0x26, + .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, + .name = "SI2168-2", + .i2c_bus_nr = SAA7164_I2C_BUS_2, + .i2c_bus_addr = 0xcc >> 1, + .i2c_reg_len = 0, + } }, + }, + [SAA7164_BOARD_HAUPPAUGE_HVR2215] = { + .name = "Hauppauge WinTV-HVR2215", + .porta = SAA7164_MPEG_DVB, + .portb = SAA7164_MPEG_DVB, + .chiprev = SAA7164_CHIP_REV3, + .unit = {{ + .id = 0x28, + .type = SAA7164_UNIT_EEPROM, + .name = "4K EEPROM", + .i2c_bus_nr = SAA7164_I2C_BUS_0, + .i2c_bus_addr = 0xa0 >> 1, + .i2c_reg_len = REGLEN_8bit, + }, { + .id = 0x04, + .type = SAA7164_UNIT_TUNER, + .name = "SI2157-1", + .i2c_bus_nr = SAA7164_I2C_BUS_1, + .i2c_bus_addr = 0xc0 >> 1, + .i2c_reg_len = 0, + }, { + .id = 0x05, + .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, + .name = "SI2168-1", + .i2c_bus_nr = SAA7164_I2C_BUS_1, + .i2c_bus_addr = 0xc8 >> 1, + .i2c_reg_len = 0, + }, { + .id = 0x25, + .type = SAA7164_UNIT_TUNER, + .name = "SI2157-2", + .i2c_bus_nr = SAA7164_I2C_BUS_2, + .i2c_bus_addr = 0xc0 >> 1, + .i2c_reg_len = 0, + }, { + .id = 0x26, + .type = SAA7164_UNIT_DIGITAL_DEMODULATOR, + .name = "SI2168-2", + .i2c_bus_nr = SAA7164_I2C_BUS_2, + .i2c_bus_addr = 0xcc >> 1, + .i2c_reg_len = 0, + } }, + }, }; const unsigned int saa7164_bcount = ARRAY_SIZE(saa7164_boards); @@ -546,6 +630,14 @@ struct saa7164_subid saa7164_subids[] = { .subvendor = 0x0070, .subdevice = 0x8953, .card = SAA7164_BOARD_HAUPPAUGE_HVR2200_5, + }, { + .subvendor = 0x0070, + .subdevice = 0xf120, + .card = SAA7164_BOARD_HAUPPAUGE_HVR2205, + }, { + .subvendor = 0x0070, + .subdevice = 0xf123, + .card = SAA7164_BOARD_HAUPPAUGE_HVR2215, }, }; const unsigned int saa7164_idcount = ARRAY_SIZE(saa7164_subids); @@ -591,6 +683,8 @@ void saa7164_gpio_setup(struct saa7164_dev *dev) case SAA7164_BOARD_HAUPPAUGE_HVR2200_3: case SAA7164_BOARD_HAUPPAUGE_HVR2200_4: case SAA7164_BOARD_HAUPPAUGE_HVR2200_5: + case SAA7164_BOARD_HAUPPAUGE_HVR2205: + case SAA7164_BOARD_HAUPPAUGE_HVR2215: case SAA7164_BOARD_HAUPPAUGE_HVR2250: case SAA7164_BOARD_HAUPPAUGE_HVR2250_2: case SAA7164_BOARD_HAUPPAUGE_HVR2250_3: @@ -647,6 +741,11 @@ static void hauppauge_eeprom(struct saa7164_dev *dev, u8 *eeprom_data) /* WinTV-HVR2200 (PCIe, Retail, half-height) * DVB-T (TDA18271/TDA10048) and basic analog, no IR */ break; + case 151009: + case 151609: + /* WinTV-HVR2205/HVR2215 (PCIe, Retail, full-height bracket) + * DVB-T2/C (Si2157/Si2168) and basic analog, FM */ + break; default: printk(KERN_ERR "%s: Warning: Unknown Hauppauge model #%d\n", dev->name, tv.model); @@ -673,6 +772,8 @@ void saa7164_card_setup(struct saa7164_dev *dev) case SAA7164_BOARD_HAUPPAUGE_HVR2200_3: case SAA7164_BOARD_HAUPPAUGE_HVR2200_4: case SAA7164_BOARD_HAUPPAUGE_HVR2200_5: + case SAA7164_BOARD_HAUPPAUGE_HVR2205: + case SAA7164_BOARD_HAUPPAUGE_HVR2215: case SAA7164_BOARD_HAUPPAUGE_HVR2250: case SAA7164_BOARD_HAUPPAUGE_HVR2250_2: case SAA7164_BOARD_HAUPPAUGE_HVR2250_3: diff --git a/drivers/media/pci/saa7164/saa7164-dvb.c b/drivers/media/pci/saa7164/saa7164-dvb.c index 6b9e8f6..2242ef5 100644 --- a/drivers/media/pci/saa7164/saa7164-dvb.c +++ b/drivers/media/pci/saa7164/saa7164-dvb.c @@ -24,6 +24,8 @@ #include "tda10048.h" #include "tda18271.h" #include "s5h1411.h" +#include "si2168.h" +#include "si2157.h" #define DRIVER_NAME "saa7164" @@ -519,6 +521,71 @@ int saa7164_dvb_register(struct saa7164_port *port) break; } break; + case SAA7164_BOARD_HAUPPAUGE_HVR2205: + case SAA7164_BOARD_HAUPPAUGE_HVR2215: + { + struct si2168_config si2168_config; + struct si2157_config si2157_config; + struct i2c_board_info info; + struct i2c_adapter *adapter; + struct i2c_client *client_demod = NULL; + struct i2c_client *client_tuner = NULL; + + i2c_bus = &dev->i2c_bus[port->nr + 1]; + + /* attach frontend */ + memset(&si2168_config, 0, sizeof(si2168_config)); + si2168_config.i2c_adapter = &adapter; + si2168_config.fe = &port->dvb.frontend; + si2168_config.ts_mode = SI2168_TS_SERIAL; + si2168_config.ts_clock_gapped = true; + memset(&info, 0, sizeof(struct i2c_board_info)); + switch (port->nr) { + case 0: + info.addr = 0xc8 >> 1; + break; + case 1: + info.addr = 0xcc >> 1; + break; + } + strlcpy(info.type, "si2168", I2C_NAME_SIZE); + info.platform_data = &si2168_config; + request_module(info.type); + client_demod = i2c_new_device(&i2c_bus->i2c_adap, + &info); + if (client_demod == NULL || + client_demod->dev.driver == NULL) + break; + if (!try_module_get(client_demod->dev.driver->owner)) { + i2c_unregister_device(client_demod); + break; + } + port->i2c_client_demod = client_demod; + + /* attach tuner */ + memset(&si2157_config, 0, sizeof(si2157_config)); + si2157_config.fe = port->dvb.frontend; + memset(&info, 0, sizeof(struct i2c_board_info)); + strlcpy(info.type, "si2157", I2C_NAME_SIZE); + info.addr = 0xc0 >> 1; + info.platform_data = &si2157_config; + request_module(info.type); + client_tuner = i2c_new_device(adapter, &info); + if (client_tuner == NULL || + client_tuner->dev.driver == NULL) { + module_put(client_demod->dev.driver->owner); + i2c_unregister_device(client_demod); + break; + } + if (!try_module_get(client_tuner->dev.driver->owner)) { + i2c_unregister_device(client_tuner); + module_put(client_demod->dev.driver->owner); + i2c_unregister_device(client_demod); + break; + } + port->i2c_client_tuner = client_tuner; + break; + } case SAA7164_BOARD_HAUPPAUGE_HVR2250: case SAA7164_BOARD_HAUPPAUGE_HVR2250_2: case SAA7164_BOARD_HAUPPAUGE_HVR2250_3: diff --git a/drivers/media/pci/saa7164/saa7164.h b/drivers/media/pci/saa7164/saa7164.h index 37e450a..1b41849 100644 --- a/drivers/media/pci/saa7164/saa7164.h +++ b/drivers/media/pci/saa7164/saa7164.h @@ -83,6 +83,8 @@ #define SAA7164_BOARD_HAUPPAUGE_HVR2250_3 8 #define SAA7164_BOARD_HAUPPAUGE_HVR2200_4 9 #define SAA7164_BOARD_HAUPPAUGE_HVR2200_5 10 +#define SAA7164_BOARD_HAUPPAUGE_HVR2205 11 +#define SAA7164_BOARD_HAUPPAUGE_HVR2215 12 #define SAA7164_MAX_UNITS 8 #define SAA7164_TS_NUMBER_OF_LINES 312