Linux Media Controller development
 help / color / mirror / Atom feed
* [PATCH] stv0900: Multistream support
@ 2012-11-29 19:27 CrazyCat
  2012-11-29 19:41 ` Ezequiel Garcia
  0 siblings, 1 reply; 3+ messages in thread
From: CrazyCat @ 2012-11-29 19:27 UTC (permalink / raw)
  To: linux-media

Multistream support for stv0900. For Netup Dual S2 CI with STV0900BAC/AAC.

Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c
index b551ca3..0fb34e1 100644
--- a/drivers/media/dvb-frontends/stv0900_core.c
+++ b/drivers/media/dvb-frontends/stv0900_core.c
@@ -1558,6 +1558,27 @@ static int stv0900_status(struct stv0900_internal *intp,
 	return locked;
 }
 
+static int stv0900_set_mis(struct stv0900_internal *intp,
+				enum fe_stv0900_demod_num demod, int mis)
+{
+	enum fe_stv0900_error error = STV0900_NO_ERROR;
+
+	dprintk("%s\n", __func__);
+
+	if (mis < 0 || mis > 255) {
+		dprintk("Disable MIS filtering\n");
+		stv0900_write_bits(intp, FILTER_EN, 0);
+	} else {
+		dprintk("Enable MIS filtering - %d\n", mis);
+		stv0900_write_bits(intp, FILTER_EN, 1);
+		stv0900_write_reg(intp, ISIENTRY, mis);
+		stv0900_write_reg(intp, ISIBITENA, 0xff);
+	}
+
+	return error;
+}
+
+
 static enum dvbfe_search stv0900_search(struct dvb_frontend *fe)
 {
 	struct stv0900_state *state = fe->demodulator_priv;
@@ -1578,6 +1599,8 @@ static enum dvbfe_search stv0900_search(struct dvb_frontend *fe)
 	if (state->config->set_ts_params)
 		state->config->set_ts_params(fe, 0);
 
+	stv0900_set_mis(intp, demod, c->stream_id);
+
 	p_result.locked = FALSE;
 	p_search.path = demod;
 	p_search.frequency = c->frequency;
@@ -1935,6 +1958,9 @@ struct dvb_frontend *stv0900_attach(const struct stv0900_config *config,
 		if (err_stv0900)
 			goto error;
 
+		if (state->internal->chip_id >= 0x30)
+			state->frontend.ops.info.caps |= FE_CAN_MULTISTREAM;
+
 		break;
 	default:
 		goto error;
diff --git a/drivers/media/dvb-frontends/stv0900_reg.h b/drivers/media/dvb-frontends/stv0900_reg.h
index 731afe9..511ed2a 100644
--- a/drivers/media/dvb-frontends/stv0900_reg.h
+++ b/drivers/media/dvb-frontends/stv0900_reg.h
@@ -3446,8 +3446,11 @@ extern s32 shiftx(s32 x, int demod, s32 shift);
 #define R0900_P1_PDELCTRL1 0xf550
 #define PDELCTRL1 REGx(R0900_P1_PDELCTRL1)
 #define F0900_P1_INV_MISMASK 0xf5500080
+#define INV_MISMASK FLDx(F0900_P1_INV_MISMASK)
 #define F0900_P1_FILTER_EN 0xf5500020
+#define FILTER_EN FLDx(F0900_P1_FILTER_EN)
 #define F0900_P1_EN_MIS00 0xf5500002
+#define EN_MIS00 FLDx(F0900_P1_EN_MIS00)
 #define F0900_P1_ALGOSWRST 0xf5500001
 #define ALGOSWRST FLDx(F0900_P1_ALGOSWRST)
 

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

* Re: [PATCH] stv0900: Multistream support
  2012-11-29 19:27 [PATCH] stv0900: Multistream support CrazyCat
@ 2012-11-29 19:41 ` Ezequiel Garcia
  2012-11-30  2:35   ` CrazyCat
  0 siblings, 1 reply; 3+ messages in thread
From: Ezequiel Garcia @ 2012-11-29 19:41 UTC (permalink / raw)
  To: CrazyCat; +Cc: linux-media

Hi Evgeny,

On Thu, Nov 29, 2012 at 4:27 PM, CrazyCat <crazycat69@yandex.ru> wrote:
> Multistream support for stv0900. For Netup Dual S2 CI with STV0900BAC/AAC.
>
> Signed-off-by: Evgeny Plehov <EvgenyPlehov@ukr.net>
> diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c
> index b551ca3..0fb34e1 100644
> --- a/drivers/media/dvb-frontends/stv0900_core.c
> +++ b/drivers/media/dvb-frontends/stv0900_core.c
> @@ -1558,6 +1558,27 @@ static int stv0900_status(struct stv0900_internal *intp,
>         return locked;
>  }
>
> +static int stv0900_set_mis(struct stv0900_internal *intp,
> +                               enum fe_stv0900_demod_num demod, int mis)
> +{
> +       enum fe_stv0900_error error = STV0900_NO_ERROR;
> +
> +       dprintk("%s\n", __func__);
> +

Mmm, that's a pretty useless printk, IMHO.
If someone wants to trace a driver it's better to use ftrace, again IMHO.


> +       if (mis < 0 || mis > 255) {
> +               dprintk("Disable MIS filtering\n");
> +               stv0900_write_bits(intp, FILTER_EN, 0);
> +       } else {
> +               dprintk("Enable MIS filtering - %d\n", mis);
> +               stv0900_write_bits(intp, FILTER_EN, 1);
> +               stv0900_write_reg(intp, ISIENTRY, mis);
> +               stv0900_write_reg(intp, ISIBITENA, 0xff);
> +       }
> +
> +       return error;

What's the point in returning an error if you don't use set it and
don't use it below?
I believe you can have this function return void.

> +}
> +
> +
>  static enum dvbfe_search stv0900_search(struct dvb_frontend *fe)
>  {
>         struct stv0900_state *state = fe->demodulator_priv;
> @@ -1578,6 +1599,8 @@ static enum dvbfe_search stv0900_search(struct dvb_frontend *fe)
>         if (state->config->set_ts_params)
>                 state->config->set_ts_params(fe, 0);
>
> +       stv0900_set_mis(intp, demod, c->stream_id);
> +
>         p_result.locked = FALSE;
>         p_search.path = demod;
>         p_search.frequency = c->frequency;
> @@ -1935,6 +1958,9 @@ struct dvb_frontend *stv0900_attach(const struct stv0900_config *config,
>                 if (err_stv0900)
>                         goto error;
>
> +               if (state->internal->chip_id >= 0x30)
> +                       state->frontend.ops.info.caps |= FE_CAN_MULTISTREAM;
> +
>                 break;
>         default:
>                 goto error;
> diff --git a/drivers/media/dvb-frontends/stv0900_reg.h b/drivers/media/dvb-frontends/stv0900_reg.h
> index 731afe9..511ed2a 100644
> --- a/drivers/media/dvb-frontends/stv0900_reg.h
> +++ b/drivers/media/dvb-frontends/stv0900_reg.h
> @@ -3446,8 +3446,11 @@ extern s32 shiftx(s32 x, int demod, s32 shift);
>  #define R0900_P1_PDELCTRL1 0xf550
>  #define PDELCTRL1 REGx(R0900_P1_PDELCTRL1)
>  #define F0900_P1_INV_MISMASK 0xf5500080
> +#define INV_MISMASK FLDx(F0900_P1_INV_MISMASK)
>  #define F0900_P1_FILTER_EN 0xf5500020
> +#define FILTER_EN FLDx(F0900_P1_FILTER_EN)
>  #define F0900_P1_EN_MIS00 0xf5500002
> +#define EN_MIS00 FLDx(F0900_P1_EN_MIS00)
>  #define F0900_P1_ALGOSWRST 0xf5500001
>  #define ALGOSWRST FLDx(F0900_P1_ALGOSWRST)
>
> --

Thanks,

    Ezequiel

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

* Re: [PATCH] stv0900: Multistream support
  2012-11-29 19:41 ` Ezequiel Garcia
@ 2012-11-30  2:35   ` CrazyCat
  0 siblings, 0 replies; 3+ messages in thread
From: CrazyCat @ 2012-11-30  2:35 UTC (permalink / raw)
  To: Ezequiel Garcia; +Cc: linux-media@vger.kernel.org

Yes, really useless :) Need remove it:)

29.11.2012, 21:41, "Ezequiel Garcia" <elezegarcia@gmail.com>:
> Mmm, that's a pretty useless printk, IMHO.
> If someone wants to trace a driver it's better to use ftrace, again IMHO.

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

end of thread, other threads:[~2012-11-30  2:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-29 19:27 [PATCH] stv0900: Multistream support CrazyCat
2012-11-29 19:41 ` Ezequiel Garcia
2012-11-30  2:35   ` CrazyCat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox