Message ID | 5783D80F.2040808@gmx.de (mailing list archive) |
---|---|
State | Superseded, archived |
Headers |
Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.84_2) (envelope-from <linux-media-owner@vger.kernel.org>) id 1bMf3z-0005NN-M4; Mon, 11 Jul 2016 17:32:11 +0000 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.84_2/mailfrontend-6) with esmtp id 1bMf3w-0003uw-5B; Mon, 11 Jul 2016 19:32:10 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932826AbcGKRcG (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Mon, 11 Jul 2016 13:32:06 -0400 Received: from mout.gmx.net ([212.227.15.18]:63162 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932720AbcGKRcE (ORCPT <rfc822;linux-media@vger.kernel.org>); Mon, 11 Jul 2016 13:32:04 -0400 Received: from [192.168.6.10] ([217.250.32.138]) by mail.gmx.com (mrgmx002) with ESMTPSA (Nemesis) id 0MI5JG-1bPPQ613rq-003vRB for <linux-media@vger.kernel.org>; Mon, 11 Jul 2016 19:32:00 +0200 To: Linux Media Mailing List <linux-media@vger.kernel.org> From: =?UTF-8?Q?Stefan_P=c3=b6schel?= <basic.master@gmx.de> Subject: [PATCH] af9035: fix dual tuner detection with PCTV 79e Message-ID: <5783D80F.2040808@gmx.de> Date: Mon, 11 Jul 2016 19:31:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K0:EyP9lCg5MIkImIWH+hvfUauH0Nu7jq4znngmdiGLAu4gAN/8X9R mvavquqSUaZhajyd9Mz3Bgh92kKbRe6RDiK61ftmcMBBmaO4WD2jLzePoDACdLA1N0kSQCP g9sLDUXvTElqNAZnLXxVE8PbdthvfU5g7+XilLv2kptF038Q/3L58pgrcJh3UoywrtqlqMo LvhmWMN8F1YFtx2+9Nndw== X-UI-Out-Filterresults: notjunk:1; V01:K0:Cd8XPZj6+2U=:2EIuBO2SLRgQ1EWAMDKDp/ IQzAJIbqwvNcXq7o+lmrvvUE2IPWLxnvaX5AGBxk5xea1P4OcYTmgHpjjdv1hc0GTggB4sDwj 3SQwsyGDAdOoZkLH+wMCNvnRrgbtwNxCzHMJdOq4rQVim5eeMcOtJebtlxWpwcN+60IbHjjEk cgNQwbM3+lUn2W2C5T3vlbzfitwbEmtPfBs/BRk1QNq/UH7sVtPazuTHj+zTO6DMHmb5exGo1 Axsfy2IuO1X7uRSHIwW+DvRCrsYYAw4hPNTT20xaC+cLXgVjbmNt0DOkz0Qi9VOAMnyHaGbex io68OiSJME7Ua+53gaj7dFfY9B3x3Rmq913L5H6dY/46Z3l2JXVrB9r5JwHVVGmZgd+Mlcvcw dzVJB/Z3C9qhiQA9ImQx8I0Kny0s4lYchx8ek/QOr15iIUjcoOPJNOPb3JVa3LnbSVrAL+Ux4 3SrHcQuEhjb5WJjPSBIh3+YYIC0SKbvPh7LwyUKnEBnfjtF5zi0ityQS3FvWcyp0zuGbFpg+K Hopak/uunL8ziNEbNn2SsCRqXjPq45TUYUFE6BIAbCAicxWk6aVL7O93+PRKOElqBnYEYLgic eHFCSHb7pszQLaTvMRVP8YtJkHGXDyoEWMSaYanSsHEJQN1iTNkQnTrRVpbQkhs0RQ3wKKG0k QJKYbjkTbpVY9QWEIJPxYjdLyb7aeCCnYVsfPP40xkwpL/jzFNcGJxdDJCfrJNWB/m3m5xZJH jhgEfQMll7Z2LL7aGydBuYncB5gW1r76h9XCA0YfbjXoAzHb1IuInutUAbf/G2XuUEB+0Zer/ J//Wk8d Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2016.7.11.172116 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MSGID_ADDED_BY_MTA 0.05, BODY_SIZE_3000_3999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, NO_URI_HTTPS 0, SINGLE_URI_IN_BODY 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __CT 0, __CTE 0, __CT_TEXT_PLAIN 0, __FRAUD_BODY_WEBMAIL 0, __FRAUD_WEBMAIL 0, __FRAUD_WEBMAIL_FROM 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __MOZILLA_USER_AGENT 0, __PHISH_SPEAR_STRUCTURE_1 0, __SANE_MSGID 0, __SINGLE_URI_TEXT 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __URI_IN_BODY 0, __URI_NO_WWW 0, __URI_NS , __URI_WITH_PATH 0, __USER_AGENT 0' |
Commit Message
Stefan Pöschel
July 11, 2016, 5:31 p.m. UTC
The value 5 of the EEPROM_TS_MODE register (meaning dual tuner presence) is
only valid for AF9035 devices. For IT9135 devices it is invalid and led to a
false positive dual tuner mode detection with PCTV 79e.
Therefore on non-AF9035 devices and with value 5 the driver now defaults to
single tuner mode and outputs a regarding info message to log.
This fixes Bugzilla bug #118561.
Reported-by: Marc Duponcheel <marc@offline.be>
Signed-off-by: Stefan Pöschel <basic.master@gmx.de>
---
drivers/media/usb/dvb-usb-v2/af9035.c | 50 +++++++++++++++++++++++------------
drivers/media/usb/dvb-usb-v2/af9035.h | 2 +-
2 files changed, 34 insertions(+), 18 deletions(-)
Comments
Applied and PULL requested for 4.7. Anyhow, it does not apply for 4.6. You must backport that patch to 4.6 stable also! regards Antti On 07/11/2016 08:31 PM, Stefan Pöschel wrote: > The value 5 of the EEPROM_TS_MODE register (meaning dual tuner presence) is > only valid for AF9035 devices. For IT9135 devices it is invalid and led to a > false positive dual tuner mode detection with PCTV 79e. > Therefore on non-AF9035 devices and with value 5 the driver now defaults to > single tuner mode and outputs a regarding info message to log. > > This fixes Bugzilla bug #118561. > > Reported-by: Marc Duponcheel <marc@offline.be> > Signed-off-by: Stefan Pöschel <basic.master@gmx.de> > --- > drivers/media/usb/dvb-usb-v2/af9035.c | 50 +++++++++++++++++++++++------------ > drivers/media/usb/dvb-usb-v2/af9035.h | 2 +- > 2 files changed, 34 insertions(+), 18 deletions(-) > > diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c > index eabede4..ca018cd 100644 > --- a/drivers/media/usb/dvb-usb-v2/af9035.c > +++ b/drivers/media/usb/dvb-usb-v2/af9035.c > @@ -496,7 +496,8 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) > { > struct state *state = d_to_priv(d); > struct usb_interface *intf = d->intf; > - int ret; > + int ret, ts_mode_invalid; > + u8 tmp; > u8 wbuf[1] = { 1 }; > u8 rbuf[4]; > struct usb_req req = { CMD_FW_QUERYINFO, 0, sizeof(wbuf), wbuf, > @@ -530,6 +531,36 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) > state->eeprom_addr = EEPROM_BASE_AF9035; > } > > + > + /* check for dual tuner mode */ > + ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); > + if (ret < 0) > + goto err; > + > + ts_mode_invalid = 0; > + switch (tmp) { > + case 0: > + break; > + case 1: > + case 3: > + state->dual_mode = true; > + break; > + case 5: > + if (state->chip_type != 0x9135 && state->chip_type != 0x9306) > + state->dual_mode = true; /* AF9035 */ > + else > + ts_mode_invalid = 1; > + break; > + default: > + ts_mode_invalid = 1; > + } > + > + dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, state->dual_mode); > + > + if (ts_mode_invalid) > + dev_info(&intf->dev, "ts mode=%d not supported, defaulting to single tuner mode!", tmp); > + > + > ret = af9035_ctrl_msg(d, &req); > if (ret < 0) > goto err; > @@ -698,11 +729,7 @@ static int af9035_download_firmware(struct dvb_usb_device *d, > * which is done by master demod. > * Master feeds also clock and controls power via GPIO. > */ > - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); > - if (ret < 0) > - goto err; > - > - if (tmp == 1 || tmp == 3 || tmp == 5) { > + if (state->dual_mode) { > /* configure gpioh1, reset & power slave demod */ > ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01); > if (ret < 0) > @@ -835,17 +862,6 @@ static int af9035_read_config(struct dvb_usb_device *d) > } > > > - > - /* check if there is dual tuners */ > - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); > - if (ret < 0) > - goto err; > - > - if (tmp == 1 || tmp == 3 || tmp == 5) > - state->dual_mode = true; > - > - dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, state->dual_mode); > - > if (state->dual_mode) { > /* read 2nd demodulator I2C address */ > ret = af9035_rd_reg(d, > diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h > index c91d1a3..1f83c92 100644 > --- a/drivers/media/usb/dvb-usb-v2/af9035.h > +++ b/drivers/media/usb/dvb-usb-v2/af9035.h > @@ -113,7 +113,7 @@ static const u32 clock_lut_it9135[] = { > * 0 TS > * 1 DCA + PIP > * 3 PIP > - * 5 DCA + PIP > + * 5 DCA + PIP (AF9035 only) > * n DCA > * > * Values 0, 3 and 5 are seen to this day. 0 for single TS and 3/5 for dual TS. >
Em Fri, 15 Jul 2016 09:21:51 +0300 Antti Palosaari <crope@iki.fi> escreveu: > Applied and PULL requested for 4.7. It is too late to be applied on 4.7. I can apply it to the next merge window. > > Anyhow, it does not apply for 4.6. You must backport that patch to 4.6 > stable also! > > regards > Antti > > On 07/11/2016 08:31 PM, Stefan Pöschel wrote: > > The value 5 of the EEPROM_TS_MODE register (meaning dual tuner presence) is > > only valid for AF9035 devices. For IT9135 devices it is invalid and led to a > > false positive dual tuner mode detection with PCTV 79e. > > Therefore on non-AF9035 devices and with value 5 the driver now defaults to > > single tuner mode and outputs a regarding info message to log. > > > > This fixes Bugzilla bug #118561. > > > > Reported-by: Marc Duponcheel <marc@offline.be> > > Signed-off-by: Stefan Pöschel <basic.master@gmx.de> > > --- > > drivers/media/usb/dvb-usb-v2/af9035.c | 50 +++++++++++++++++++++++------------ > > drivers/media/usb/dvb-usb-v2/af9035.h | 2 +- > > 2 files changed, 34 insertions(+), 18 deletions(-) > > > > diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c > > index eabede4..ca018cd 100644 > > --- a/drivers/media/usb/dvb-usb-v2/af9035.c > > +++ b/drivers/media/usb/dvb-usb-v2/af9035.c > > @@ -496,7 +496,8 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) > > { > > struct state *state = d_to_priv(d); > > struct usb_interface *intf = d->intf; > > - int ret; > > + int ret, ts_mode_invalid; > > + u8 tmp; > > u8 wbuf[1] = { 1 }; > > u8 rbuf[4]; > > struct usb_req req = { CMD_FW_QUERYINFO, 0, sizeof(wbuf), wbuf, > > @@ -530,6 +531,36 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) > > state->eeprom_addr = EEPROM_BASE_AF9035; > > } > > > > + > > + /* check for dual tuner mode */ > > + ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); > > + if (ret < 0) > > + goto err; > > + > > + ts_mode_invalid = 0; > > + switch (tmp) { > > + case 0: > > + break; > > + case 1: > > + case 3: > > + state->dual_mode = true; > > + break; > > + case 5: > > + if (state->chip_type != 0x9135 && state->chip_type != 0x9306) > > + state->dual_mode = true; /* AF9035 */ > > + else > > + ts_mode_invalid = 1; > > + break; > > + default: > > + ts_mode_invalid = 1; > > + } > > + > > + dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, state->dual_mode); > > + > > + if (ts_mode_invalid) > > + dev_info(&intf->dev, "ts mode=%d not supported, defaulting to single tuner mode!", tmp); > > + > > + > > ret = af9035_ctrl_msg(d, &req); > > if (ret < 0) > > goto err; > > @@ -698,11 +729,7 @@ static int af9035_download_firmware(struct dvb_usb_device *d, > > * which is done by master demod. > > * Master feeds also clock and controls power via GPIO. > > */ > > - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); > > - if (ret < 0) > > - goto err; > > - > > - if (tmp == 1 || tmp == 3 || tmp == 5) { > > + if (state->dual_mode) { > > /* configure gpioh1, reset & power slave demod */ > > ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01); > > if (ret < 0) > > @@ -835,17 +862,6 @@ static int af9035_read_config(struct dvb_usb_device *d) > > } > > > > > > - > > - /* check if there is dual tuners */ > > - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); > > - if (ret < 0) > > - goto err; > > - > > - if (tmp == 1 || tmp == 3 || tmp == 5) > > - state->dual_mode = true; > > - > > - dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, state->dual_mode); > > - > > if (state->dual_mode) { > > /* read 2nd demodulator I2C address */ > > ret = af9035_rd_reg(d, > > diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h > > index c91d1a3..1f83c92 100644 > > --- a/drivers/media/usb/dvb-usb-v2/af9035.h > > +++ b/drivers/media/usb/dvb-usb-v2/af9035.h > > @@ -113,7 +113,7 @@ static const u32 clock_lut_it9135[] = { > > * 0 TS > > * 1 DCA + PIP > > * 3 PIP > > - * 5 DCA + PIP > > + * 5 DCA + PIP (AF9035 only) > > * n DCA > > * > > * Values 0, 3 and 5 are seen to this day. 0 for single TS and 3/5 for dual TS. > > > Thanks, Mauro -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Am 15.07.2016 um 08:21 schrieb Antti Palosaari: > Applied and PULL requested for 4.7. Great, thanks! > Anyhow, it does not apply for 4.6. You must backport that patch to 4.6 > stable also! I have never done backporting before, so I need some advice I think: Am I right that I have to create the patch, now just based on tag "v4.6" of the media_tree repo? And then move that patch (properly named) to the backports subdir of the media_build repo, with regarding modification of the backports.txt: Using an "add" entry under "[4.6.255]" and an "delete" entry under "[4.5.255]" (so that it just gets applied to 4.6.x) ? BTW I wonder about the status update of https://patchwork.linuxtv.org/patch/35337/ from "New" to "Superseeded" (instead of "Accepted")...why is this? Regards, Stefan > On 07/11/2016 08:31 PM, Stefan Pöschel wrote: >> The value 5 of the EEPROM_TS_MODE register (meaning dual tuner >> presence) is >> only valid for AF9035 devices. For IT9135 devices it is invalid and >> led to a >> false positive dual tuner mode detection with PCTV 79e. >> Therefore on non-AF9035 devices and with value 5 the driver now >> defaults to >> single tuner mode and outputs a regarding info message to log. >> >> This fixes Bugzilla bug #118561. >> >> Reported-by: Marc Duponcheel <marc@offline.be> >> Signed-off-by: Stefan Pöschel <basic.master@gmx.de> >> --- >> drivers/media/usb/dvb-usb-v2/af9035.c | 50 >> +++++++++++++++++++++++------------ >> drivers/media/usb/dvb-usb-v2/af9035.h | 2 +- >> 2 files changed, 34 insertions(+), 18 deletions(-) >> >> diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c >> b/drivers/media/usb/dvb-usb-v2/af9035.c >> index eabede4..ca018cd 100644 >> --- a/drivers/media/usb/dvb-usb-v2/af9035.c >> +++ b/drivers/media/usb/dvb-usb-v2/af9035.c >> @@ -496,7 +496,8 @@ static int af9035_identify_state(struct >> dvb_usb_device *d, const char **name) >> { >> struct state *state = d_to_priv(d); >> struct usb_interface *intf = d->intf; >> - int ret; >> + int ret, ts_mode_invalid; >> + u8 tmp; >> u8 wbuf[1] = { 1 }; >> u8 rbuf[4]; >> struct usb_req req = { CMD_FW_QUERYINFO, 0, sizeof(wbuf), wbuf, >> @@ -530,6 +531,36 @@ static int af9035_identify_state(struct >> dvb_usb_device *d, const char **name) >> state->eeprom_addr = EEPROM_BASE_AF9035; >> } >> >> + >> + /* check for dual tuner mode */ >> + ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); >> + if (ret < 0) >> + goto err; >> + >> + ts_mode_invalid = 0; >> + switch (tmp) { >> + case 0: >> + break; >> + case 1: >> + case 3: >> + state->dual_mode = true; >> + break; >> + case 5: >> + if (state->chip_type != 0x9135 && state->chip_type != 0x9306) >> + state->dual_mode = true; /* AF9035 */ >> + else >> + ts_mode_invalid = 1; >> + break; >> + default: >> + ts_mode_invalid = 1; >> + } >> + >> + dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, >> state->dual_mode); >> + >> + if (ts_mode_invalid) >> + dev_info(&intf->dev, "ts mode=%d not supported, defaulting to >> single tuner mode!", tmp); >> + >> + >> ret = af9035_ctrl_msg(d, &req); >> if (ret < 0) >> goto err; >> @@ -698,11 +729,7 @@ static int af9035_download_firmware(struct >> dvb_usb_device *d, >> * which is done by master demod. >> * Master feeds also clock and controls power via GPIO. >> */ >> - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); >> - if (ret < 0) >> - goto err; >> - >> - if (tmp == 1 || tmp == 3 || tmp == 5) { >> + if (state->dual_mode) { >> /* configure gpioh1, reset & power slave demod */ >> ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01); >> if (ret < 0) >> @@ -835,17 +862,6 @@ static int af9035_read_config(struct >> dvb_usb_device *d) >> } >> >> >> - >> - /* check if there is dual tuners */ >> - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); >> - if (ret < 0) >> - goto err; >> - >> - if (tmp == 1 || tmp == 3 || tmp == 5) >> - state->dual_mode = true; >> - >> - dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, >> state->dual_mode); >> - >> if (state->dual_mode) { >> /* read 2nd demodulator I2C address */ >> ret = af9035_rd_reg(d, >> diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h >> b/drivers/media/usb/dvb-usb-v2/af9035.h >> index c91d1a3..1f83c92 100644 >> --- a/drivers/media/usb/dvb-usb-v2/af9035.h >> +++ b/drivers/media/usb/dvb-usb-v2/af9035.h >> @@ -113,7 +113,7 @@ static const u32 clock_lut_it9135[] = { >> * 0 TS >> * 1 DCA + PIP >> * 3 PIP >> - * 5 DCA + PIP >> + * 5 DCA + PIP (AF9035 only) >> * n DCA >> * >> * Values 0, 3 and 5 are seen to this day. 0 for single TS and 3/5 >> for dual TS. >> > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 07/16/2016 11:05 PM, Stefan Pöschel wrote: > Am 15.07.2016 um 08:21 schrieb Antti Palosaari: >> Applied and PULL requested for 4.7. > > Great, thanks! > >> Anyhow, it does not apply for 4.6. You must backport that patch to 4.6 >> stable also! > > I have never done backporting before, so I need some advice I think: > Am I right that I have to create the patch, now just based on tag "v4.6" > of the media_tree repo? Just make patch that compiles and works against kernel tag v4.6. No need to backport it to media_tree or media_build. It should go 4.6 kernel stable tree. Antti > And then move that patch (properly named) to the backports subdir of the > media_build repo, with regarding modification of the backports.txt: > Using an "add" entry under "[4.6.255]" and an "delete" entry under > "[4.5.255]" (so that it just gets applied to 4.6.x) ? > > BTW I wonder about the status update of > https://patchwork.linuxtv.org/patch/35337/ from "New" to "Superseeded" > (instead of "Accepted")...why is this? > > Regards, > Stefan > > >> On 07/11/2016 08:31 PM, Stefan Pöschel wrote: >>> The value 5 of the EEPROM_TS_MODE register (meaning dual tuner >>> presence) is >>> only valid for AF9035 devices. For IT9135 devices it is invalid and >>> led to a >>> false positive dual tuner mode detection with PCTV 79e. >>> Therefore on non-AF9035 devices and with value 5 the driver now >>> defaults to >>> single tuner mode and outputs a regarding info message to log. >>> >>> This fixes Bugzilla bug #118561. >>> >>> Reported-by: Marc Duponcheel <marc@offline.be> >>> Signed-off-by: Stefan Pöschel <basic.master@gmx.de> >>> --- >>> drivers/media/usb/dvb-usb-v2/af9035.c | 50 >>> +++++++++++++++++++++++------------ >>> drivers/media/usb/dvb-usb-v2/af9035.h | 2 +- >>> 2 files changed, 34 insertions(+), 18 deletions(-) >>> >>> diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c >>> b/drivers/media/usb/dvb-usb-v2/af9035.c >>> index eabede4..ca018cd 100644 >>> --- a/drivers/media/usb/dvb-usb-v2/af9035.c >>> +++ b/drivers/media/usb/dvb-usb-v2/af9035.c >>> @@ -496,7 +496,8 @@ static int af9035_identify_state(struct >>> dvb_usb_device *d, const char **name) >>> { >>> struct state *state = d_to_priv(d); >>> struct usb_interface *intf = d->intf; >>> - int ret; >>> + int ret, ts_mode_invalid; >>> + u8 tmp; >>> u8 wbuf[1] = { 1 }; >>> u8 rbuf[4]; >>> struct usb_req req = { CMD_FW_QUERYINFO, 0, sizeof(wbuf), wbuf, >>> @@ -530,6 +531,36 @@ static int af9035_identify_state(struct >>> dvb_usb_device *d, const char **name) >>> state->eeprom_addr = EEPROM_BASE_AF9035; >>> } >>> >>> + >>> + /* check for dual tuner mode */ >>> + ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); >>> + if (ret < 0) >>> + goto err; >>> + >>> + ts_mode_invalid = 0; >>> + switch (tmp) { >>> + case 0: >>> + break; >>> + case 1: >>> + case 3: >>> + state->dual_mode = true; >>> + break; >>> + case 5: >>> + if (state->chip_type != 0x9135 && state->chip_type != 0x9306) >>> + state->dual_mode = true; /* AF9035 */ >>> + else >>> + ts_mode_invalid = 1; >>> + break; >>> + default: >>> + ts_mode_invalid = 1; >>> + } >>> + >>> + dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, >>> state->dual_mode); >>> + >>> + if (ts_mode_invalid) >>> + dev_info(&intf->dev, "ts mode=%d not supported, defaulting to >>> single tuner mode!", tmp); >>> + >>> + >>> ret = af9035_ctrl_msg(d, &req); >>> if (ret < 0) >>> goto err; >>> @@ -698,11 +729,7 @@ static int af9035_download_firmware(struct >>> dvb_usb_device *d, >>> * which is done by master demod. >>> * Master feeds also clock and controls power via GPIO. >>> */ >>> - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); >>> - if (ret < 0) >>> - goto err; >>> - >>> - if (tmp == 1 || tmp == 3 || tmp == 5) { >>> + if (state->dual_mode) { >>> /* configure gpioh1, reset & power slave demod */ >>> ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01); >>> if (ret < 0) >>> @@ -835,17 +862,6 @@ static int af9035_read_config(struct >>> dvb_usb_device *d) >>> } >>> >>> >>> - >>> - /* check if there is dual tuners */ >>> - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); >>> - if (ret < 0) >>> - goto err; >>> - >>> - if (tmp == 1 || tmp == 3 || tmp == 5) >>> - state->dual_mode = true; >>> - >>> - dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, >>> state->dual_mode); >>> - >>> if (state->dual_mode) { >>> /* read 2nd demodulator I2C address */ >>> ret = af9035_rd_reg(d, >>> diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h >>> b/drivers/media/usb/dvb-usb-v2/af9035.h >>> index c91d1a3..1f83c92 100644 >>> --- a/drivers/media/usb/dvb-usb-v2/af9035.h >>> +++ b/drivers/media/usb/dvb-usb-v2/af9035.h >>> @@ -113,7 +113,7 @@ static const u32 clock_lut_it9135[] = { >>> * 0 TS >>> * 1 DCA + PIP >>> * 3 PIP >>> - * 5 DCA + PIP >>> + * 5 DCA + PIP (AF9035 only) >>> * n DCA >>> * >>> * Values 0, 3 and 5 are seen to this day. 0 for single TS and 3/5 >>> for dual TS. >>> >>
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c index eabede4..ca018cd 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.c +++ b/drivers/media/usb/dvb-usb-v2/af9035.c @@ -496,7 +496,8 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) { struct state *state = d_to_priv(d); struct usb_interface *intf = d->intf; - int ret; + int ret, ts_mode_invalid; + u8 tmp; u8 wbuf[1] = { 1 }; u8 rbuf[4]; struct usb_req req = { CMD_FW_QUERYINFO, 0, sizeof(wbuf), wbuf, @@ -530,6 +531,36 @@ static int af9035_identify_state(struct dvb_usb_device *d, const char **name) state->eeprom_addr = EEPROM_BASE_AF9035; } + + /* check for dual tuner mode */ + ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); + if (ret < 0) + goto err; + + ts_mode_invalid = 0; + switch (tmp) { + case 0: + break; + case 1: + case 3: + state->dual_mode = true; + break; + case 5: + if (state->chip_type != 0x9135 && state->chip_type != 0x9306) + state->dual_mode = true; /* AF9035 */ + else + ts_mode_invalid = 1; + break; + default: + ts_mode_invalid = 1; + } + + dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, state->dual_mode); + + if (ts_mode_invalid) + dev_info(&intf->dev, "ts mode=%d not supported, defaulting to single tuner mode!", tmp); + + ret = af9035_ctrl_msg(d, &req); if (ret < 0) goto err; @@ -698,11 +729,7 @@ static int af9035_download_firmware(struct dvb_usb_device *d, * which is done by master demod. * Master feeds also clock and controls power via GPIO. */ - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); - if (ret < 0) - goto err; - - if (tmp == 1 || tmp == 3 || tmp == 5) { + if (state->dual_mode) { /* configure gpioh1, reset & power slave demod */ ret = af9035_wr_reg_mask(d, 0x00d8b0, 0x01, 0x01); if (ret < 0) @@ -835,17 +862,6 @@ static int af9035_read_config(struct dvb_usb_device *d) } - - /* check if there is dual tuners */ - ret = af9035_rd_reg(d, state->eeprom_addr + EEPROM_TS_MODE, &tmp); - if (ret < 0) - goto err; - - if (tmp == 1 || tmp == 3 || tmp == 5) - state->dual_mode = true; - - dev_dbg(&intf->dev, "ts mode=%d dual mode=%d\n", tmp, state->dual_mode); - if (state->dual_mode) { /* read 2nd demodulator I2C address */ ret = af9035_rd_reg(d, diff --git a/drivers/media/usb/dvb-usb-v2/af9035.h b/drivers/media/usb/dvb-usb-v2/af9035.h index c91d1a3..1f83c92 100644 --- a/drivers/media/usb/dvb-usb-v2/af9035.h +++ b/drivers/media/usb/dvb-usb-v2/af9035.h @@ -113,7 +113,7 @@ static const u32 clock_lut_it9135[] = { * 0 TS * 1 DCA + PIP * 3 PIP - * 5 DCA + PIP + * 5 DCA + PIP (AF9035 only) * n DCA * * Values 0, 3 and 5 are seen to this day. 0 for single TS and 3/5 for dual TS.