* [PATCH] mb86a20s: fix ISDB-T mode handling
@ 2014-07-12 16:39 Mauro Carvalho Chehab
2014-07-12 18:52 ` Antti Palosaari
0 siblings, 1 reply; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2014-07-12 16:39 UTC (permalink / raw)
Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
Mauro Carvalho Chehab, stable
The driver was reporting an incorrect mode, when mode 2
is selected.
While testing it, noticed that neither mode 1 or guard
interval 1/32 is supported by this device. Document it,
and ensure that it will report _AUTO when it doesn't lock,
in order to not report a wrong detection to userspace.
Cc: stable@vger.kernel.org
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
---
drivers/media/dvb-frontends/dib0090.c | 6 +++++-
drivers/media/dvb-frontends/mb86a20s.c | 9 +++++----
drivers/media/usb/dvb-usb/dib0700_devices.c | 3 +++
3 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/drivers/media/dvb-frontends/dib0090.c b/drivers/media/dvb-frontends/dib0090.c
index 68e2af2650d3..27d5c5cd439c 100644
--- a/drivers/media/dvb-frontends/dib0090.c
+++ b/drivers/media/dvb-frontends/dib0090.c
@@ -24,6 +24,8 @@
*
*/
+#define DEBUG_AGC
+
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/i2c.h>
@@ -1199,11 +1201,13 @@ int dib0090_gain_control(struct dvb_frontend *fe)
state->rf_gain_limit = state->rf_ramp[0] << WBD_ALPHA;
state->current_gain = ((state->rf_ramp[0] + state->bb_ramp[0]) / 2) << GAIN_ALPHA;
+dprintk("Current gain: %d\n", state->current_gain);
+
*tune_state = CT_AGC_STEP_0;
} else if (!state->agc_freeze) {
s16 wbd = 0, i, cnt;
- int adc;
+ int adc = 0;
wbd_val = dib0090_get_slow_adc_val(state);
if (*tune_state == CT_AGC_STEP_0)
diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
index 227a420f7069..b931179c70a4 100644
--- a/drivers/media/dvb-frontends/mb86a20s.c
+++ b/drivers/media/dvb-frontends/mb86a20s.c
@@ -711,11 +711,10 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
rc = mb86a20s_readreg(state, 0x07);
if (rc < 0)
return rc;
+ c->transmission_mode = TRANSMISSION_MODE_AUTO;
if ((rc & 0x60) == 0x20) {
- switch (rc & 0x0c >> 2) {
- case 0:
- c->transmission_mode = TRANSMISSION_MODE_2K;
- break;
+ /* Only modes 2 and 3 are supported */
+ switch ((rc >> 2) & 0x03) {
case 1:
c->transmission_mode = TRANSMISSION_MODE_4K;
break;
@@ -724,7 +723,9 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
break;
}
}
+ c->guard_interval = GUARD_INTERVAL_AUTO;
if (!(rc & 0x10)) {
+ /* Guard interval 1/32 is not supported */
switch (rc & 0x3) {
case 0:
c->guard_interval = GUARD_INTERVAL_1_4;
diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c
index 501947eaacfe..cad359fcd690 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -1645,6 +1645,8 @@ static int dib8096_set_param_override(struct dvb_frontend *fe)
int ret = 0;
enum frontend_tune_state tune_state = CT_SHUTDOWN;
+printk("%s called.\n", __func__);
+
switch (band) {
default:
deb_info("Warning : Rf frequency (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
@@ -1714,6 +1716,7 @@ static int dib8096_set_param_override(struct dvb_frontend *fe)
} else {
/* for everything else than CBAND we are using standard AGC */
deb_info("not tuning in CBAND - standard AGC startup\n");
+printk("%s: calling dib0090_pwm_gain_reset\n", __func__);
dib0090_pwm_gain_reset(fe);
}
--
1.9.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] mb86a20s: fix ISDB-T mode handling
2014-07-12 16:39 [PATCH] mb86a20s: fix ISDB-T mode handling Mauro Carvalho Chehab
@ 2014-07-12 18:52 ` Antti Palosaari
2014-07-21 17:56 ` Mauro Carvalho Chehab
0 siblings, 1 reply; 3+ messages in thread
From: Antti Palosaari @ 2014-07-12 18:52 UTC (permalink / raw)
To: Mauro Carvalho Chehab
Cc: Linux Media Mailing List, Mauro Carvalho Chehab, stable
Mauro, you have forgot some debug hacks to that patch.
Antti
On 07/12/2014 07:39 PM, Mauro Carvalho Chehab wrote:
> The driver was reporting an incorrect mode, when mode 2
> is selected.
>
> While testing it, noticed that neither mode 1 or guard
> interval 1/32 is supported by this device. Document it,
> and ensure that it will report _AUTO when it doesn't lock,
> in order to not report a wrong detection to userspace.
>
> Cc: stable@vger.kernel.org
> Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
> ---
> drivers/media/dvb-frontends/dib0090.c | 6 +++++-
> drivers/media/dvb-frontends/mb86a20s.c | 9 +++++----
> drivers/media/usb/dvb-usb/dib0700_devices.c | 3 +++
> 3 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/dvb-frontends/dib0090.c b/drivers/media/dvb-frontends/dib0090.c
> index 68e2af2650d3..27d5c5cd439c 100644
> --- a/drivers/media/dvb-frontends/dib0090.c
> +++ b/drivers/media/dvb-frontends/dib0090.c
> @@ -24,6 +24,8 @@
> *
> */
>
> +#define DEBUG_AGC
> +
> #include <linux/kernel.h>
> #include <linux/slab.h>
> #include <linux/i2c.h>
> @@ -1199,11 +1201,13 @@ int dib0090_gain_control(struct dvb_frontend *fe)
> state->rf_gain_limit = state->rf_ramp[0] << WBD_ALPHA;
> state->current_gain = ((state->rf_ramp[0] + state->bb_ramp[0]) / 2) << GAIN_ALPHA;
>
> +dprintk("Current gain: %d\n", state->current_gain);
> +
> *tune_state = CT_AGC_STEP_0;
> } else if (!state->agc_freeze) {
> s16 wbd = 0, i, cnt;
>
> - int adc;
> + int adc = 0;
> wbd_val = dib0090_get_slow_adc_val(state);
>
> if (*tune_state == CT_AGC_STEP_0)
> diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
> index 227a420f7069..b931179c70a4 100644
> --- a/drivers/media/dvb-frontends/mb86a20s.c
> +++ b/drivers/media/dvb-frontends/mb86a20s.c
> @@ -711,11 +711,10 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
> rc = mb86a20s_readreg(state, 0x07);
> if (rc < 0)
> return rc;
> + c->transmission_mode = TRANSMISSION_MODE_AUTO;
> if ((rc & 0x60) == 0x20) {
> - switch (rc & 0x0c >> 2) {
> - case 0:
> - c->transmission_mode = TRANSMISSION_MODE_2K;
> - break;
> + /* Only modes 2 and 3 are supported */
> + switch ((rc >> 2) & 0x03) {
> case 1:
> c->transmission_mode = TRANSMISSION_MODE_4K;
> break;
> @@ -724,7 +723,9 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
> break;
> }
> }
> + c->guard_interval = GUARD_INTERVAL_AUTO;
> if (!(rc & 0x10)) {
> + /* Guard interval 1/32 is not supported */
> switch (rc & 0x3) {
> case 0:
> c->guard_interval = GUARD_INTERVAL_1_4;
> diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c
> index 501947eaacfe..cad359fcd690 100644
> --- a/drivers/media/usb/dvb-usb/dib0700_devices.c
> +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
> @@ -1645,6 +1645,8 @@ static int dib8096_set_param_override(struct dvb_frontend *fe)
> int ret = 0;
> enum frontend_tune_state tune_state = CT_SHUTDOWN;
>
> +printk("%s called.\n", __func__);
> +
> switch (band) {
> default:
> deb_info("Warning : Rf frequency (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
> @@ -1714,6 +1716,7 @@ static int dib8096_set_param_override(struct dvb_frontend *fe)
> } else {
> /* for everything else than CBAND we are using standard AGC */
> deb_info("not tuning in CBAND - standard AGC startup\n");
> +printk("%s: calling dib0090_pwm_gain_reset\n", __func__);
> dib0090_pwm_gain_reset(fe);
> }
>
>
--
http://palosaari.fi/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] mb86a20s: fix ISDB-T mode handling
2014-07-12 18:52 ` Antti Palosaari
@ 2014-07-21 17:56 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 3+ messages in thread
From: Mauro Carvalho Chehab @ 2014-07-21 17:56 UTC (permalink / raw)
To: Antti Palosaari; +Cc: Linux Media Mailing List, Mauro Carvalho Chehab
Em Sat, 12 Jul 2014 21:52:46 +0300
Antti Palosaari <crope@iki.fi> escreveu:
> Mauro, you have forgot some debug hacks to that patch.
Thanks for noticing. Actually, it got merged by mistake with
a hack I'm using to debug another driver.
Just sent a version 2 of this patch.
Regards,
Mauro
>
> Antti
>
> On 07/12/2014 07:39 PM, Mauro Carvalho Chehab wrote:
> > The driver was reporting an incorrect mode, when mode 2
> > is selected.
> >
> > While testing it, noticed that neither mode 1 or guard
> > interval 1/32 is supported by this device. Document it,
> > and ensure that it will report _AUTO when it doesn't lock,
> > in order to not report a wrong detection to userspace.
> >
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
> > ---
> > drivers/media/dvb-frontends/dib0090.c | 6 +++++-
> > drivers/media/dvb-frontends/mb86a20s.c | 9 +++++----
> > drivers/media/usb/dvb-usb/dib0700_devices.c | 3 +++
> > 3 files changed, 13 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/media/dvb-frontends/dib0090.c b/drivers/media/dvb-frontends/dib0090.c
> > index 68e2af2650d3..27d5c5cd439c 100644
> > --- a/drivers/media/dvb-frontends/dib0090.c
> > +++ b/drivers/media/dvb-frontends/dib0090.c
> > @@ -24,6 +24,8 @@
> > *
> > */
> >
> > +#define DEBUG_AGC
> > +
> > #include <linux/kernel.h>
> > #include <linux/slab.h>
> > #include <linux/i2c.h>
> > @@ -1199,11 +1201,13 @@ int dib0090_gain_control(struct dvb_frontend *fe)
> > state->rf_gain_limit = state->rf_ramp[0] << WBD_ALPHA;
> > state->current_gain = ((state->rf_ramp[0] + state->bb_ramp[0]) / 2) << GAIN_ALPHA;
> >
> > +dprintk("Current gain: %d\n", state->current_gain);
> > +
> > *tune_state = CT_AGC_STEP_0;
> > } else if (!state->agc_freeze) {
> > s16 wbd = 0, i, cnt;
> >
> > - int adc;
> > + int adc = 0;
> > wbd_val = dib0090_get_slow_adc_val(state);
> >
> > if (*tune_state == CT_AGC_STEP_0)
> > diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c
> > index 227a420f7069..b931179c70a4 100644
> > --- a/drivers/media/dvb-frontends/mb86a20s.c
> > +++ b/drivers/media/dvb-frontends/mb86a20s.c
> > @@ -711,11 +711,10 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
> > rc = mb86a20s_readreg(state, 0x07);
> > if (rc < 0)
> > return rc;
> > + c->transmission_mode = TRANSMISSION_MODE_AUTO;
> > if ((rc & 0x60) == 0x20) {
> > - switch (rc & 0x0c >> 2) {
> > - case 0:
> > - c->transmission_mode = TRANSMISSION_MODE_2K;
> > - break;
> > + /* Only modes 2 and 3 are supported */
> > + switch ((rc >> 2) & 0x03) {
> > case 1:
> > c->transmission_mode = TRANSMISSION_MODE_4K;
> > break;
> > @@ -724,7 +723,9 @@ static int mb86a20s_get_frontend(struct dvb_frontend *fe)
> > break;
> > }
> > }
> > + c->guard_interval = GUARD_INTERVAL_AUTO;
> > if (!(rc & 0x10)) {
> > + /* Guard interval 1/32 is not supported */
> > switch (rc & 0x3) {
> > case 0:
> > c->guard_interval = GUARD_INTERVAL_1_4;
> > diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c
> > index 501947eaacfe..cad359fcd690 100644
> > --- a/drivers/media/usb/dvb-usb/dib0700_devices.c
> > +++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
> > @@ -1645,6 +1645,8 @@ static int dib8096_set_param_override(struct dvb_frontend *fe)
> > int ret = 0;
> > enum frontend_tune_state tune_state = CT_SHUTDOWN;
> >
> > +printk("%s called.\n", __func__);
> > +
> > switch (band) {
> > default:
> > deb_info("Warning : Rf frequency (%iHz) is not in the supported range, using VHF switch ", fe->dtv_property_cache.frequency);
> > @@ -1714,6 +1716,7 @@ static int dib8096_set_param_override(struct dvb_frontend *fe)
> > } else {
> > /* for everything else than CBAND we are using standard AGC */
> > deb_info("not tuning in CBAND - standard AGC startup\n");
> > +printk("%s: calling dib0090_pwm_gain_reset\n", __func__);
> > dib0090_pwm_gain_reset(fe);
> > }
> >
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-07-21 17:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-12 16:39 [PATCH] mb86a20s: fix ISDB-T mode handling Mauro Carvalho Chehab
2014-07-12 18:52 ` Antti Palosaari
2014-07-21 17:56 ` Mauro Carvalho Chehab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).