Re: [PATCH 4/8] rtl28xxu: add support for Panasonic MN88472 slave demod

2014-11-14 Thread Mauro Carvalho Chehab
Em Wed, 12 Nov 2014 06:23:06 +0200
Antti Palosaari cr...@iki.fi escreveu:

 There is RTL2832P devices having extra MN88472 demodulator. This
 patch add support for such configuration. Logically MN88472 slave
 demodulator is connected to RTL2832 master demodulator, both I2C
 bus and TS input. RTL2832 is integrated to RTL2832U and RTL2832P
 chips. Chip version RTL2832P has extra TS interface for connecting
 slave demodulator.
 
 Signed-off-by: Antti Palosaari cr...@iki.fi
 ---
  drivers/media/usb/dvb-usb-v2/Kconfig|   1 +
  drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 143 
 +---
  drivers/media/usb/dvb-usb-v2/rtl28xxu.h |   5 ++
  3 files changed, 118 insertions(+), 31 deletions(-)
 
 diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig 
 b/drivers/media/usb/dvb-usb-v2/Kconfig
 index 7423033..9050933 100644
 --- a/drivers/media/usb/dvb-usb-v2/Kconfig
 +++ b/drivers/media/usb/dvb-usb-v2/Kconfig
 @@ -130,6 +130,7 @@ config DVB_USB_RTL28XXU
   select DVB_RTL2830
   select DVB_RTL2832
   select DVB_RTL2832_SDR if (MEDIA_SUBDRV_AUTOSELECT  MEDIA_SDR_SUPPORT)
 + select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT
   select MEDIA_TUNER_QT1010 if MEDIA_SUBDRV_AUTOSELECT
   select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
   select MEDIA_TUNER_MXL5005S if MEDIA_SUBDRV_AUTOSELECT

This is not a good idea, as the MN88472 is in staging.

Select is not recursive, and won't select STAGING. Also, we don't want
to enable a staging driver by default on distros.

 diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
 b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
 index 5ea52c7..e3c20f4 100644
 --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
 +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
 @@ -24,6 +24,7 @@
  
  #include rtl2830.h
  #include rtl2832.h
 +#include mn88472.h
  
  #include qt1010.h
  #include mt2060.h
 @@ -420,6 +421,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
   struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf};
   struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
   struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
 + struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf};
  
   dev_dbg(d-udev-dev, %s:\n, __func__);
  
 @@ -449,7 +451,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
   if (ret == 0  buf[0] == 0xa1) {
   priv-tuner = TUNER_RTL2832_FC0012;
   priv-tuner_name = FC0012;
 - goto found;
 + goto tuner_found;
   }
  
   /* check FC0013 ID register; reg=00 val=a3 */
 @@ -457,7 +459,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
   if (ret == 0  buf[0] == 0xa3) {
   priv-tuner = TUNER_RTL2832_FC0013;
   priv-tuner_name = FC0013;
 - goto found;
 + goto tuner_found;
   }
  
   /* check MT2266 ID register; reg=00 val=85 */
 @@ -465,7 +467,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
   if (ret == 0  buf[0] == 0x85) {
   priv-tuner = TUNER_RTL2832_MT2266;
   priv-tuner_name = MT2266;
 - goto found;
 + goto tuner_found;
   }
  
   /* check FC2580 ID register; reg=01 val=56 */
 @@ -473,7 +475,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
   if (ret == 0  buf[0] == 0x56) {
   priv-tuner = TUNER_RTL2832_FC2580;
   priv-tuner_name = FC2580;
 - goto found;
 + goto tuner_found;
   }
  
   /* check MT2063 ID register; reg=00 val=9e || 9c */
 @@ -481,7 +483,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
   if (ret == 0  (buf[0] == 0x9e || buf[0] == 0x9c)) {
   priv-tuner = TUNER_RTL2832_MT2063;
   priv-tuner_name = MT2063;
 - goto found;
 + goto tuner_found;
   }
  
   /* check MAX3543 ID register; reg=00 val=38 */
 @@ -489,7 +491,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
   if (ret == 0  buf[0] == 0x38) {
   priv-tuner = TUNER_RTL2832_MAX3543;
   priv-tuner_name = MAX3543;
 - goto found;
 + goto tuner_found;
   }
  
   /* check TUA9001 ID register; reg=7e val=2328 */
 @@ -497,7 +499,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
   if (ret == 0  buf[0] == 0x23  buf[1] == 0x28) {
   priv-tuner = TUNER_RTL2832_TUA9001;
   priv-tuner_name = TUA9001;
 - goto found;
 + goto tuner_found;
   }
  
   /* check MXL5007R ID register; reg=d9 val=14 */
 @@ -505,7 +507,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
   if (ret == 0  buf[0] == 0x14) {
   priv-tuner = TUNER_RTL2832_MXL5007T;
   priv-tuner_name = MXL5007T;
 - goto found;
 + goto tuner_found;
   }
  
   /* check E4000 ID register; reg=02 

Re: [PATCH 4/8] rtl28xxu: add support for Panasonic MN88472 slave demod

2014-11-14 Thread Antti Palosaari



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

Em Wed, 12 Nov 2014 06:23:06 +0200
Antti Palosaari cr...@iki.fi escreveu:


There is RTL2832P devices having extra MN88472 demodulator. This
patch add support for such configuration. Logically MN88472 slave
demodulator is connected to RTL2832 master demodulator, both I2C
bus and TS input. RTL2832 is integrated to RTL2832U and RTL2832P
chips. Chip version RTL2832P has extra TS interface for connecting
slave demodulator.

Signed-off-by: Antti Palosaari cr...@iki.fi
---
  drivers/media/usb/dvb-usb-v2/Kconfig|   1 +
  drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 143 +---
  drivers/media/usb/dvb-usb-v2/rtl28xxu.h |   5 ++
  3 files changed, 118 insertions(+), 31 deletions(-)

diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig 
b/drivers/media/usb/dvb-usb-v2/Kconfig
index 7423033..9050933 100644
--- a/drivers/media/usb/dvb-usb-v2/Kconfig
+++ b/drivers/media/usb/dvb-usb-v2/Kconfig
@@ -130,6 +130,7 @@ config DVB_USB_RTL28XXU
select DVB_RTL2830
select DVB_RTL2832
select DVB_RTL2832_SDR if (MEDIA_SUBDRV_AUTOSELECT  MEDIA_SDR_SUPPORT)
+   select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_QT1010 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
select MEDIA_TUNER_MXL5005S if MEDIA_SUBDRV_AUTOSELECT


This is not a good idea, as the MN88472 is in staging.

Select is not recursive, and won't select STAGING. Also, we don't want
to enable a staging driver by default on distros.


I think it should work just fine. It is I2C driver. If distributions 
disables stating nothing will happen but MN88472 driver is not compiled. 
When there is no driver load, it will continue with reduced mode using 
single demod. I tested that scenario where driver was missing. Anyhow, I 
didn't test case where CONFIG_STAGING Kconfig option was disable, but I 
will do.


regards
Antti





diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 5ea52c7..e3c20f4 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -24,6 +24,7 @@

  #include rtl2830.h
  #include rtl2832.h
+#include mn88472.h

  #include qt1010.h
  #include mt2060.h
@@ -420,6 +421,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf};
struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
+   struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf};

dev_dbg(d-udev-dev, %s:\n, __func__);

@@ -449,7 +451,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0xa1) {
priv-tuner = TUNER_RTL2832_FC0012;
priv-tuner_name = FC0012;
-   goto found;
+   goto tuner_found;
}

/* check FC0013 ID register; reg=00 val=a3 */
@@ -457,7 +459,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0xa3) {
priv-tuner = TUNER_RTL2832_FC0013;
priv-tuner_name = FC0013;
-   goto found;
+   goto tuner_found;
}

/* check MT2266 ID register; reg=00 val=85 */
@@ -465,7 +467,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x85) {
priv-tuner = TUNER_RTL2832_MT2266;
priv-tuner_name = MT2266;
-   goto found;
+   goto tuner_found;
}

/* check FC2580 ID register; reg=01 val=56 */
@@ -473,7 +475,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x56) {
priv-tuner = TUNER_RTL2832_FC2580;
priv-tuner_name = FC2580;
-   goto found;
+   goto tuner_found;
}

/* check MT2063 ID register; reg=00 val=9e || 9c */
@@ -481,7 +483,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  (buf[0] == 0x9e || buf[0] == 0x9c)) {
priv-tuner = TUNER_RTL2832_MT2063;
priv-tuner_name = MT2063;
-   goto found;
+   goto tuner_found;
}

/* check MAX3543 ID register; reg=00 val=38 */
@@ -489,7 +491,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x38) {
priv-tuner = TUNER_RTL2832_MAX3543;
priv-tuner_name = MAX3543;
-   goto found;
+   goto tuner_found;
}

/* check TUA9001 ID register; reg=7e val=2328 */
@@ -497,7 +499,7 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
if (ret == 0  buf[0] == 0x23  buf[1] == 0x28) {
priv-tuner = TUNER_RTL2832_TUA9001;
priv-tuner_name = 

Re: [PATCH 4/8] rtl28xxu: add support for Panasonic MN88472 slave demod

2014-11-14 Thread Mauro Carvalho Chehab
Em Sat, 15 Nov 2014 01:42:43 +0200
Antti Palosaari cr...@iki.fi escreveu:

 
 
 On 11/14/2014 09:39 PM, Mauro Carvalho Chehab wrote:
  Em Wed, 12 Nov 2014 06:23:06 +0200
  Antti Palosaari cr...@iki.fi escreveu:
 
  There is RTL2832P devices having extra MN88472 demodulator. This
  patch add support for such configuration. Logically MN88472 slave
  demodulator is connected to RTL2832 master demodulator, both I2C
  bus and TS input. RTL2832 is integrated to RTL2832U and RTL2832P
  chips. Chip version RTL2832P has extra TS interface for connecting
  slave demodulator.
 
  Signed-off-by: Antti Palosaari cr...@iki.fi
  ---
drivers/media/usb/dvb-usb-v2/Kconfig|   1 +
drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 143 
  +---
drivers/media/usb/dvb-usb-v2/rtl28xxu.h |   5 ++
3 files changed, 118 insertions(+), 31 deletions(-)
 
  diff --git a/drivers/media/usb/dvb-usb-v2/Kconfig 
  b/drivers/media/usb/dvb-usb-v2/Kconfig
  index 7423033..9050933 100644
  --- a/drivers/media/usb/dvb-usb-v2/Kconfig
  +++ b/drivers/media/usb/dvb-usb-v2/Kconfig
  @@ -130,6 +130,7 @@ config DVB_USB_RTL28XXU
 select DVB_RTL2830
 select DVB_RTL2832
 select DVB_RTL2832_SDR if (MEDIA_SUBDRV_AUTOSELECT  MEDIA_SDR_SUPPORT)
  +  select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT
 select MEDIA_TUNER_QT1010 if MEDIA_SUBDRV_AUTOSELECT
 select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT
 select MEDIA_TUNER_MXL5005S if MEDIA_SUBDRV_AUTOSELECT
 
  This is not a good idea, as the MN88472 is in staging.
 
  Select is not recursive, and won't select STAGING. Also, we don't want
  to enable a staging driver by default on distros.
 
 I think it should work just fine. It is I2C driver. If distributions 
 disables stating nothing will happen but MN88472 driver is not compiled. 
 When there is no driver load, it will continue with reduced mode using 
 single demod. I tested that scenario where driver was missing. Anyhow, I 
 didn't test case where CONFIG_STAGING Kconfig option was disable, but I 
 will do.

select will just ignore config_staging, enabling this driver even if
staging is disabled.

Perhaps one way to solve would be to do:

select DVB_MN88472 if MEDIA_SUBDRV_AUTOSELECT  STAGING

Still, I the best would be to just remove that line, and add a 
documentation on our wiki (and/or via printk) warning the user to
manually enable the driver on staging, if the user has a device that
needs it.

Regards,
Mauro

PS.: I'll do a deeper look on your comments about patch 2/8 likely
tomorrow or next week.
 
 regards
 Antti
 
 
 
  diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c 
  b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
  index 5ea52c7..e3c20f4 100644
  --- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
  +++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
  @@ -24,6 +24,7 @@
 
#include rtl2830.h
#include rtl2832.h
  +#include mn88472.h
 
#include qt1010.h
#include mt2060.h
  @@ -420,6 +421,7 @@ static int rtl2832u_read_config(struct dvb_usb_device 
  *d)
 struct rtl28xxu_req req_tda18272 = {0x00c0, CMD_I2C_RD, 2, buf};
 struct rtl28xxu_req req_r820t = {0x0034, CMD_I2C_RD, 1, buf};
 struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
  +  struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf};
 
 dev_dbg(d-udev-dev, %s:\n, __func__);
 
  @@ -449,7 +451,7 @@ static int rtl2832u_read_config(struct dvb_usb_device 
  *d)
 if (ret == 0  buf[0] == 0xa1) {
 priv-tuner = TUNER_RTL2832_FC0012;
 priv-tuner_name = FC0012;
  -  goto found;
  +  goto tuner_found;
 }
 
 /* check FC0013 ID register; reg=00 val=a3 */
  @@ -457,7 +459,7 @@ static int rtl2832u_read_config(struct dvb_usb_device 
  *d)
 if (ret == 0  buf[0] == 0xa3) {
 priv-tuner = TUNER_RTL2832_FC0013;
 priv-tuner_name = FC0013;
  -  goto found;
  +  goto tuner_found;
 }
 
 /* check MT2266 ID register; reg=00 val=85 */
  @@ -465,7 +467,7 @@ static int rtl2832u_read_config(struct dvb_usb_device 
  *d)
 if (ret == 0  buf[0] == 0x85) {
 priv-tuner = TUNER_RTL2832_MT2266;
 priv-tuner_name = MT2266;
  -  goto found;
  +  goto tuner_found;
 }
 
 /* check FC2580 ID register; reg=01 val=56 */
  @@ -473,7 +475,7 @@ static int rtl2832u_read_config(struct dvb_usb_device 
  *d)
 if (ret == 0  buf[0] == 0x56) {
 priv-tuner = TUNER_RTL2832_FC2580;
 priv-tuner_name = FC2580;
  -  goto found;
  +  goto tuner_found;
 }
 
 /* check MT2063 ID register; reg=00 val=9e || 9c */
  @@ -481,7 +483,7 @@ static int rtl2832u_read_config(struct dvb_usb_device 
  *d)
 if (ret == 0  (buf[0] == 0x9e || buf[0] == 0x9c)) {
 priv-tuner = TUNER_RTL2832_MT2063;
 priv-tuner_name = MT2063;
  -  goto found;
  +  goto tuner_found;
 }
 
 /* check MAX3543 ID register; reg=00 val=38 */
  @@