Re: [PATCH 2/8] rtl2832: implement PIP mode

2014-11-16 Thread Antti Palosaari

On 11/16/2014 01:36 PM, Benjamin Larsson wrote:

On 11/16/2014 11:25 AM, Mauro Carvalho Chehab wrote:


[...]
What demod(s) are exposed to userspace? both or just demod#1?

If both are exposed, how userspace knows that demod#0 should not be
used?

Regards,
Mauro



Currently both demods are exposed to userspace. While it is nice to have
both I suggest that if a NM8847x demod is activated only expose that
demod. That would remove the hack in master and would make it possible
to faster move the NM8847x demods out of staging. The main reason for
this hardware is the DVB-C and DVB-T2 support. Lets focus on getting
that in an easy obtainable way.


Yeah, both demods are exposed on single adapter, but two frontends.
frontend0 == DVB-T demod RTL2832
frontend1 == DVB-T/T2/C demod MN88472

frontend0 is pretty useless if frontend1 is loaded...

regards
Antti

--
http://palosaari.fi/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/8] rtl2832: implement PIP mode

2014-11-16 Thread Benjamin Larsson

On 11/16/2014 11:25 AM, Mauro Carvalho Chehab wrote:


[...]
What demod(s) are exposed to userspace? both or just demod#1?

If both are exposed, how userspace knows that demod#0 should not be
used?

Regards,
Mauro



Currently both demods are exposed to userspace. While it is nice to have 
both I suggest that if a NM8847x demod is activated only expose that 
demod. That would remove the hack in master and would make it possible 
to faster move the NM8847x demods out of staging. The main reason for 
this hardware is the DVB-C and DVB-T2 support. Lets focus on getting 
that in an easy obtainable way.


MvH
Benjamin Larsson
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/8] rtl2832: implement PIP mode

2014-11-16 Thread Mauro Carvalho Chehab
Em Sat, 15 Nov 2014 01:36:48 +0200
Antti Palosaari  escreveu:

> Moikka!
> 
> On 11/14/2014 09:34 PM, Mauro Carvalho Chehab wrote:
> > Em Wed, 12 Nov 2014 06:23:04 +0200
> > Antti Palosaari  escreveu:
> >
> >> Implement PIP mode to stream from slave demodulator. PIP mode is
> >> enabled when .set_frontend is called with RF frequency 0, otherwise
> >> normal demod mode is enabled.
> >
> > This would be an API change, so, a DocBook patch is required.
> 
> You are wrong. PIP mode is driver/device internal thing and will not be 
> revealed to userspace.
> 
> > Anyway, using frequency=0 for PIP doesn't seem to be a good idea,
> > as a read from GET_PROPERTY should override the cache with the real
> > frequency.
> 
> Yes, it is a hackish solution, used to put demod#0 on certain config 
> when demod#1 is used. When PIP mode is set that demod#0 is totally 
> useless as demod#1 is in use instead. Cache is garbage and no meaning at 
> all.
> 
> > Also, someone came with me with a case where auto-frequency would
> > be interesting, and proposed frequency=0. I was not convinced
> > (and patches weren't sent), but using 0 for AUTO seems more
> > appropriate, as we do the same for bandwidth (and may do the same
> > for symbol_rate).
> 
> I totally agree that is is hackish solution. That is called from 
> rtl28xxu.c driver and I added already comment it is hackish solution, 
> but you didn't apply that commit.
> 
> > So, the best seems to add a new property to enable PIP mode.
> 
> No, no, no. It is like a PIP filter. It is actually special case of PID 
> filter, having mux, to multiplex 2 TS interfaces to one (PIP = Picture 
> in Picture).
> 
> 
> .
> . RTL2832P integrates RTL2832 demodulator   .
> .   .  
> .|   USB IF   |  |   demod| . |   demod|
> .||  || . ||
> .|  RTL2832P  |  |  RTL2832   | . |  MN88472   |
> .||TS bus|-/ -|-.---TS bus||
> .||  || . ||
> .
> 
> 
> So the basically both demod PID filters are now implemented in RTL2832 
> demod. Currently PIP mode is configured just to pass all the PIDs from 
> MN88472 and reject RTL2832 PIDs. And when PIP mode is off, at pass all 
> the PIDs from RTL2832, but rejects all PIDs from MN88472.

Oh, I see.

What demod(s) are exposed to userspace? both or just demod#1?

If both are exposed, how userspace knows that demod#0 should not be
used?

Regards,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/8] rtl2832: implement PIP mode

2014-11-14 Thread Antti Palosaari

Moikka!

On 11/14/2014 09:34 PM, Mauro Carvalho Chehab wrote:

Em Wed, 12 Nov 2014 06:23:04 +0200
Antti Palosaari  escreveu:


Implement PIP mode to stream from slave demodulator. PIP mode is
enabled when .set_frontend is called with RF frequency 0, otherwise
normal demod mode is enabled.


This would be an API change, so, a DocBook patch is required.


You are wrong. PIP mode is driver/device internal thing and will not be 
revealed to userspace.



Anyway, using frequency=0 for PIP doesn't seem to be a good idea,
as a read from GET_PROPERTY should override the cache with the real
frequency.


Yes, it is a hackish solution, used to put demod#0 on certain config 
when demod#1 is used. When PIP mode is set that demod#0 is totally 
useless as demod#1 is in use instead. Cache is garbage and no meaning at 
all.



Also, someone came with me with a case where auto-frequency would
be interesting, and proposed frequency=0. I was not convinced
(and patches weren't sent), but using 0 for AUTO seems more
appropriate, as we do the same for bandwidth (and may do the same
for symbol_rate).


I totally agree that is is hackish solution. That is called from 
rtl28xxu.c driver and I added already comment it is hackish solution, 
but you didn't apply that commit.



So, the best seems to add a new property to enable PIP mode.


No, no, no. It is like a PIP filter. It is actually special case of PID 
filter, having mux, to multiplex 2 TS interfaces to one (PIP = Picture 
in Picture).



.
. RTL2832P integrates RTL2832 demodulator   .
.   .  
.|   USB IF   |  |   demod| . |   demod|
.||  || . ||
.|  RTL2832P  |  |  RTL2832   | . |  MN88472   |
.||TS bus|-/ -|-.---TS bus||
.||  || . ||
.


So the basically both demod PID filters are now implemented in RTL2832 
demod. Currently PIP mode is configured just to pass all the PIDs from 
MN88472 and reject RTL2832 PIDs. And when PIP mode is off, at pass all 
the PIDs from RTL2832, but rejects all PIDs from MN88472.


regards
Antti




Regards,
Mauro


Signed-off-by: Antti Palosaari 
---
  drivers/media/dvb-frontends/rtl2832.c | 42 ---
  1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/rtl2832.c 
b/drivers/media/dvb-frontends/rtl2832.c
index eb737cf..a58b456 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -258,13 +258,11 @@ static int rtl2832_rd_regs(struct rtl2832_priv *priv, u8 
reg, u8 page, u8 *val,
return rtl2832_rd(priv, reg, val, len);
  }

-#if 0 /* currently not used */
  /* write single register */
  static int rtl2832_wr_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 val)
  {
return rtl2832_wr_regs(priv, reg, page, &val, 1);
  }
-#endif

  /* read single register */
  static int rtl2832_rd_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val)
@@ -595,6 +593,44 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
"%s: frequency=%d bandwidth_hz=%d inversion=%d\n",
__func__, c->frequency, c->bandwidth_hz, c->inversion);

+   /* PIP mode */
+   if (c->frequency == 0) {
+   dev_dbg(&priv->i2c->dev, "%s: setting PIP mode\n", __func__);
+   ret = rtl2832_wr_regs(priv, 0x0c, 1, "\x5f\xff", 2);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_demod_reg(priv, DVBT_PIP_ON, 0x1);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0xbc, 0, 0x18);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0x22, 0, 0x01);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0x26, 0, 0x1f);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0x27, 0, 0xff);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_regs(priv, 0x92, 1, "\x7f\xf7\xff", 3);
+   if (ret)
+   goto err;
+
+   goto exit_soft_reset;
+   } else {
+   ret = rtl2832_wr_regs(priv, 0x92, 1, "\x00\x0f\xff", 3);
+   if (ret)
+   goto err;
+   }
+
/* program tuner */
if (fe->ops.tuner_ops.set_params)
fe->ops.tuner_ops.set_params(fe);
@@ -661,7 +697,7 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;

-
+exit_soft_reset:
/* soft reset */
ret = rtl2832_wr_dem

Re: [PATCH 2/8] rtl2832: implement PIP mode

2014-11-14 Thread Mauro Carvalho Chehab
Em Wed, 12 Nov 2014 06:23:04 +0200
Antti Palosaari  escreveu:

> Implement PIP mode to stream from slave demodulator. PIP mode is
> enabled when .set_frontend is called with RF frequency 0, otherwise
> normal demod mode is enabled.

This would be an API change, so, a DocBook patch is required.

Anyway, using frequency=0 for PIP doesn't seem to be a good idea,
as a read from GET_PROPERTY should override the cache with the real
frequency.

Also, someone came with me with a case where auto-frequency would
be interesting, and proposed frequency=0. I was not convinced
(and patches weren't sent), but using 0 for AUTO seems more
appropriate, as we do the same for bandwidth (and may do the same
for symbol_rate).

So, the best seems to add a new property to enable PIP mode.

Regards,
Mauro
> 
> Signed-off-by: Antti Palosaari 
> ---
>  drivers/media/dvb-frontends/rtl2832.c | 42 
> ---
>  1 file changed, 39 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/dvb-frontends/rtl2832.c 
> b/drivers/media/dvb-frontends/rtl2832.c
> index eb737cf..a58b456 100644
> --- a/drivers/media/dvb-frontends/rtl2832.c
> +++ b/drivers/media/dvb-frontends/rtl2832.c
> @@ -258,13 +258,11 @@ static int rtl2832_rd_regs(struct rtl2832_priv *priv, 
> u8 reg, u8 page, u8 *val,
>   return rtl2832_rd(priv, reg, val, len);
>  }
>  
> -#if 0 /* currently not used */
>  /* write single register */
>  static int rtl2832_wr_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 val)
>  {
>   return rtl2832_wr_regs(priv, reg, page, &val, 1);
>  }
> -#endif
>  
>  /* read single register */
>  static int rtl2832_rd_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 
> *val)
> @@ -595,6 +593,44 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
>   "%s: frequency=%d bandwidth_hz=%d inversion=%d\n",
>   __func__, c->frequency, c->bandwidth_hz, c->inversion);
>  
> + /* PIP mode */
> + if (c->frequency == 0) {
> + dev_dbg(&priv->i2c->dev, "%s: setting PIP mode\n", __func__);
> + ret = rtl2832_wr_regs(priv, 0x0c, 1, "\x5f\xff", 2);
> + if (ret)
> + goto err;
> +
> + ret = rtl2832_wr_demod_reg(priv, DVBT_PIP_ON, 0x1);
> + if (ret)
> + goto err;
> +
> + ret = rtl2832_wr_reg(priv, 0xbc, 0, 0x18);
> + if (ret)
> + goto err;
> +
> + ret = rtl2832_wr_reg(priv, 0x22, 0, 0x01);
> + if (ret)
> + goto err;
> +
> + ret = rtl2832_wr_reg(priv, 0x26, 0, 0x1f);
> + if (ret)
> + goto err;
> +
> + ret = rtl2832_wr_reg(priv, 0x27, 0, 0xff);
> + if (ret)
> + goto err;
> +
> + ret = rtl2832_wr_regs(priv, 0x92, 1, "\x7f\xf7\xff", 3);
> + if (ret)
> + goto err;
> +
> + goto exit_soft_reset;
> + } else {
> + ret = rtl2832_wr_regs(priv, 0x92, 1, "\x00\x0f\xff", 3);
> + if (ret)
> + goto err;
> + }
> +
>   /* program tuner */
>   if (fe->ops.tuner_ops.set_params)
>   fe->ops.tuner_ops.set_params(fe);
> @@ -661,7 +697,7 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
>   if (ret)
>   goto err;
>  
> -
> +exit_soft_reset:
>   /* soft reset */
>   ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x1);
>   if (ret)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] rtl2832: implement PIP mode

2014-11-11 Thread Antti Palosaari
Implement PIP mode to stream from slave demodulator. PIP mode is
enabled when .set_frontend is called with RF frequency 0, otherwise
normal demod mode is enabled.

Signed-off-by: Antti Palosaari 
---
 drivers/media/dvb-frontends/rtl2832.c | 42 ---
 1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/drivers/media/dvb-frontends/rtl2832.c 
b/drivers/media/dvb-frontends/rtl2832.c
index eb737cf..a58b456 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -258,13 +258,11 @@ static int rtl2832_rd_regs(struct rtl2832_priv *priv, u8 
reg, u8 page, u8 *val,
return rtl2832_rd(priv, reg, val, len);
 }
 
-#if 0 /* currently not used */
 /* write single register */
 static int rtl2832_wr_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 val)
 {
return rtl2832_wr_regs(priv, reg, page, &val, 1);
 }
-#endif
 
 /* read single register */
 static int rtl2832_rd_reg(struct rtl2832_priv *priv, u8 reg, u8 page, u8 *val)
@@ -595,6 +593,44 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
"%s: frequency=%d bandwidth_hz=%d inversion=%d\n",
__func__, c->frequency, c->bandwidth_hz, c->inversion);
 
+   /* PIP mode */
+   if (c->frequency == 0) {
+   dev_dbg(&priv->i2c->dev, "%s: setting PIP mode\n", __func__);
+   ret = rtl2832_wr_regs(priv, 0x0c, 1, "\x5f\xff", 2);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_demod_reg(priv, DVBT_PIP_ON, 0x1);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0xbc, 0, 0x18);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0x22, 0, 0x01);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0x26, 0, 0x1f);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_reg(priv, 0x27, 0, 0xff);
+   if (ret)
+   goto err;
+
+   ret = rtl2832_wr_regs(priv, 0x92, 1, "\x7f\xf7\xff", 3);
+   if (ret)
+   goto err;
+
+   goto exit_soft_reset;
+   } else {
+   ret = rtl2832_wr_regs(priv, 0x92, 1, "\x00\x0f\xff", 3);
+   if (ret)
+   goto err;
+   }
+
/* program tuner */
if (fe->ops.tuner_ops.set_params)
fe->ops.tuner_ops.set_params(fe);
@@ -661,7 +697,7 @@ static int rtl2832_set_frontend(struct dvb_frontend *fe)
if (ret)
goto err;
 
-
+exit_soft_reset:
/* soft reset */
ret = rtl2832_wr_demod_reg(priv, DVBT_SOFT_RST, 0x1);
if (ret)
-- 
http://palosaari.fi/

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html