All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] af9035: fix dual tuner detection with PCTV 79e
@ 2016-07-11 17:31 Stefan Pöschel
  2016-07-15  6:21 ` Antti Palosaari
  0 siblings, 1 reply; 7+ messages in thread
From: Stefan Pöschel @ 2016-07-11 17:31 UTC (permalink / raw)
  To: Linux Media Mailing List

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.
-- 
2.9.0

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] af9035: fix dual tuner detection with PCTV 79e
  2016-07-11 17:31 [PATCH] af9035: fix dual tuner detection with PCTV 79e Stefan Pöschel
@ 2016-07-15  6:21 ` Antti Palosaari
  2016-07-15 10:24   ` Mauro Carvalho Chehab
  2016-07-16 20:05   ` Stefan Pöschel
  0 siblings, 2 replies; 7+ messages in thread
From: Antti Palosaari @ 2016-07-15  6:21 UTC (permalink / raw)
  To: Stefan Pöschel, Linux Media Mailing List

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.
>

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] af9035: fix dual tuner detection with PCTV 79e
  2016-07-15  6:21 ` Antti Palosaari
@ 2016-07-15 10:24   ` Mauro Carvalho Chehab
  2016-07-16 20:05   ` Stefan Pöschel
  1 sibling, 0 replies; 7+ messages in thread
From: Mauro Carvalho Chehab @ 2016-07-15 10:24 UTC (permalink / raw)
  To: Antti Palosaari; +Cc: Stefan Pöschel, Linux Media Mailing List

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] af9035: fix dual tuner detection with PCTV 79e
  2016-07-15  6:21 ` Antti Palosaari
  2016-07-15 10:24   ` Mauro Carvalho Chehab
@ 2016-07-16 20:05   ` Stefan Pöschel
  2016-07-17  8:59     ` Antti Palosaari
  1 sibling, 1 reply; 7+ messages in thread
From: Stefan Pöschel @ 2016-07-16 20:05 UTC (permalink / raw)
  To: Linux Media Mailing List; +Cc: Antti Palosaari

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.
>>
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] af9035: fix dual tuner detection with PCTV 79e
  2016-07-16 20:05   ` Stefan Pöschel
@ 2016-07-17  8:59     ` Antti Palosaari
  2016-07-20 17:14       ` basic.master
  0 siblings, 1 reply; 7+ messages in thread
From: Antti Palosaari @ 2016-07-17  8:59 UTC (permalink / raw)
  To: Stefan Pöschel, Linux Media Mailing List

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.
>>>
>>

-- 
http://palosaari.fi/

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] af9035: fix dual tuner detection with PCTV 79e
  2016-07-17  8:59     ` Antti Palosaari
@ 2016-07-20 17:14       ` basic.master
  0 siblings, 0 replies; 7+ messages in thread
From: basic.master @ 2016-07-20 17:14 UTC (permalink / raw)
  To: Antti Palosaari, Linux Media Mailing List

Am 17.07.2016 um 10:59 schrieb Antti Palosaari:
> 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.

Please find the backport patch below. Is sending to this ML here enough or are there any further steps needed to do by me?

Regards,
	Stefan
-------------------------------------




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.

(backport of 4.7)

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 | 53 +++++++++++++++++++++++------------
 drivers/media/usb/dvb-usb-v2/af9035.h |  2 +-
 2 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 2638e32..14dbfeb 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -475,7 +475,8 @@ static struct i2c_algorithm af9035_i2c_algo = {
 static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
 {
 	struct state *state = d_to_priv(d);
-	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,
@@ -511,6 +512,38 @@ 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(&d->udev->dev, "%s: ts mode=%d dual mode=%d\n",
+			__func__, tmp, state->dual_mode);
+
+	if (ts_mode_invalid)
+		dev_info(&d->udev->dev, "%s: ts mode=%d not supported, defaulting to single tuner mode!",
+				__func__, tmp);
+
+
 	ret = af9035_ctrl_msg(d, &req);
 	if (ret < 0)
 		goto err;
@@ -680,11 +713,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)
@@ -817,18 +846,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(&d->udev->dev, "%s: ts mode=%d dual mode=%d\n", __func__,
-			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 df22001..d50ff15 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.h
+++ b/drivers/media/usb/dvb-usb-v2/af9035.h
@@ -112,7 +112,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.
-- 
2.9.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] af9035: fix dual tuner detection with PCTV 79e
@ 2016-09-02 23:37 Antti Palosaari
  0 siblings, 0 replies; 7+ messages in thread
From: Antti Palosaari @ 2016-09-02 23:37 UTC (permalink / raw)
  To: linux-media; +Cc: Stefan Pöschel, Antti Palosaari

From: Stefan Pöschel <basic.master@gmx.de>

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.

(backport of 4.7)

Fixes: b8278f8b961a ("[media] af9035: add support for 2nd tuner of MSI DigiVox Diversity")
Cc: <stable@vger.kernel.org> # 4.6
Reported-by: Marc Duponcheel <marc@offline.be>
Signed-off-by: Stefan Pöschel <basic.master@gmx.de>
Signed-off-by: Antti Palosaari <crope@iki.fi>
---
 drivers/media/usb/dvb-usb-v2/af9035.c | 53 +++++++++++++++++++++++------------
 drivers/media/usb/dvb-usb-v2/af9035.h |  2 +-
 2 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 2638e32..14dbfeb 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -475,7 +475,8 @@ static struct i2c_algorithm af9035_i2c_algo = {
 static int af9035_identify_state(struct dvb_usb_device *d, const char **name)
 {
 	struct state *state = d_to_priv(d);
-	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,
@@ -511,6 +512,38 @@ 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(&d->udev->dev, "%s: ts mode=%d dual mode=%d\n",
+			__func__, tmp, state->dual_mode);
+
+	if (ts_mode_invalid)
+		dev_info(&d->udev->dev, "%s: ts mode=%d not supported, defaulting to single tuner mode!",
+				__func__, tmp);
+
+
 	ret = af9035_ctrl_msg(d, &req);
 	if (ret < 0)
 		goto err;
@@ -680,11 +713,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)
@@ -817,18 +846,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(&d->udev->dev, "%s: ts mode=%d dual mode=%d\n", __func__,
-			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 df22001..d50ff15 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.h
+++ b/drivers/media/usb/dvb-usb-v2/af9035.h
@@ -112,7 +112,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.
-- 
http://palosaari.fi/


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2016-09-02 23:37 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-11 17:31 [PATCH] af9035: fix dual tuner detection with PCTV 79e Stefan Pöschel
2016-07-15  6:21 ` Antti Palosaari
2016-07-15 10:24   ` Mauro Carvalho Chehab
2016-07-16 20:05   ` Stefan Pöschel
2016-07-17  8:59     ` Antti Palosaari
2016-07-20 17:14       ` basic.master
2016-09-02 23:37 Antti Palosaari

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.