* [PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-24 6:31 ` Tycho Lürsen
2015-04-24 6:57 ` Tycho Lürsen
2015-04-23 21:11 ` [PATCH 03/12] si2157: support selection of IF interface Olli Salonen
` (9 subsequent siblings)
10 siblings, 2 replies; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Change the dvbsky driver to support gapped clock instead of the current
hack.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/usb/dvb-usb-v2/dvbsky.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index cdf59bc..0f73b1d 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -615,7 +615,8 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
memset(&si2168_config, 0, sizeof(si2168_config));
si2168_config.i2c_adapter = &i2c_adapter;
si2168_config.fe = &adap->fe[0];
- si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40;
+ si2168_config.ts_mode = SI2168_TS_PARALLEL;
+ si2168_config.ts_clock_gapped = true;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2168", I2C_NAME_SIZE);
info.addr = 0x64;
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped
2015-04-23 21:11 ` [PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped Olli Salonen
@ 2015-04-24 6:31 ` Tycho Lürsen
2015-04-24 6:57 ` Tycho Lürsen
1 sibling, 0 replies; 21+ messages in thread
From: Tycho Lürsen @ 2015-04-24 6:31 UTC (permalink / raw)
To: Olli Salonen, linux-media
Hi Olli,
in saa716x_budget.c I've also got (for TBS6285)
si2168_config.i2c_adapter = &i2cadapter;
si2168_config.fe = &adapter->fe;
si2168_config.ts_mode = SI2168_TS_SERIAL;
memset(&info, 0, sizeof(struct i2c_board_info));
Should I just add it like this?
si2168_config.ts_mode = SI2168_TS_SERIAL;
si2168_config.ts_clock_gapped = true;
memset(&info, 0, sizeof(struct i2c_board_info));
Kind regards,
Tycho.
Op 23-04-15 om 23:11 schreef Olli Salonen:
> Change the dvbsky driver to support gapped clock instead of the current
> hack.
>
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/usb/dvb-usb-v2/dvbsky.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> index cdf59bc..0f73b1d 100644
> --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
> +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> @@ -615,7 +615,8 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
> memset(&si2168_config, 0, sizeof(si2168_config));
> si2168_config.i2c_adapter = &i2c_adapter;
> si2168_config.fe = &adap->fe[0];
> - si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40;
> + si2168_config.ts_mode = SI2168_TS_PARALLEL;
> + si2168_config.ts_clock_gapped = true;
> memset(&info, 0, sizeof(struct i2c_board_info));
> strlcpy(info.type, "si2168", I2C_NAME_SIZE);
> info.addr = 0x64;
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped
2015-04-23 21:11 ` [PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped Olli Salonen
2015-04-24 6:31 ` Tycho Lürsen
@ 2015-04-24 6:57 ` Tycho Lürsen
[not found] ` <CAAZRmGzPZaJoMtHXYuFo081xbG3Eb_1+WwePziKfp6R5kREGDw@mail.gmail.com>
1 sibling, 1 reply; 21+ messages in thread
From: Tycho Lürsen @ 2015-04-24 6:57 UTC (permalink / raw)
To: Olli Salonen, linux-media
One more question:
cx23885-dvb.c (and maybe others) contains a couple of instances of
si2168_config.ts_mode = SI2168_TS_PARALLEL;
and
si2168_config.ts_mode = SI2168_TS_SERIAL;
But you don't patch them with
si2168_config.ts_clock_gapped = true;
Is this intentional?
Kind regards,
Tycho
Op 23-04-15 om 23:11 schreef Olli Salonen:
> Change the dvbsky driver to support gapped clock instead of the current
> hack.
>
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/usb/dvb-usb-v2/dvbsky.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> index cdf59bc..0f73b1d 100644
> --- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
> +++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
> @@ -615,7 +615,8 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
> memset(&si2168_config, 0, sizeof(si2168_config));
> si2168_config.i2c_adapter = &i2c_adapter;
> si2168_config.fe = &adap->fe[0];
> - si2168_config.ts_mode = SI2168_TS_PARALLEL | 0x40;
> + si2168_config.ts_mode = SI2168_TS_PARALLEL;
> + si2168_config.ts_clock_gapped = true;
> memset(&info, 0, sizeof(struct i2c_board_info));
> strlcpy(info.type, "si2168", I2C_NAME_SIZE);
> info.addr = 0x64;
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 03/12] si2157: support selection of IF interface
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
2015-04-23 21:11 ` [PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-24 3:52 ` Mauro Carvalho Chehab
2015-04-23 21:11 ` [PATCH 04/12] cx23885: specify if_port for si2157 devices Olli Salonen
` (8 subsequent siblings)
10 siblings, 1 reply; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
The chips supported by the si2157 driver have two IF outputs (either
pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
add an option to choose which output shall be used.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/tuners/si2157.c | 4 +++-
drivers/media/tuners/si2157.h | 6 ++++++
drivers/media/tuners/si2157_priv.h | 1 +
3 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
index d74ae26..cdaf687 100644
--- a/drivers/media/tuners/si2157.c
+++ b/drivers/media/tuners/si2157.c
@@ -298,7 +298,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
if (dev->chiptype == SI2157_CHIPTYPE_SI2146)
memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6);
else
- memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6);
+ memcpy(cmd.args, "\x14\x00\x02\x07\x00\x00", 6);
+ cmd.args[4] = dev->if_port;
cmd.wlen = 6;
cmd.rlen = 4;
ret = si2157_cmd_execute(client, &cmd);
@@ -378,6 +379,7 @@ static int si2157_probe(struct i2c_client *client,
i2c_set_clientdata(client, dev);
dev->fe = cfg->fe;
dev->inversion = cfg->inversion;
+ dev->if_port = cfg->if_port;
dev->fw_loaded = false;
dev->chiptype = (u8)id->driver_data;
dev->if_frequency = 5000000; /* default value of property 0x0706 */
diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
index a564c4a..4db97ab 100644
--- a/drivers/media/tuners/si2157.h
+++ b/drivers/media/tuners/si2157.h
@@ -34,6 +34,12 @@ struct si2157_config {
* Spectral Inversion
*/
bool inversion;
+
+ /*
+ * Port selection
+ * Select the RF interface to use (pins 9+11 or 12+13)
+ */
+ u8 if_port;
};
#endif
diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h
index cd8fa5b..71a5f8c 100644
--- a/drivers/media/tuners/si2157_priv.h
+++ b/drivers/media/tuners/si2157_priv.h
@@ -28,6 +28,7 @@ struct si2157_dev {
bool fw_loaded;
bool inversion;
u8 chiptype;
+ u8 if_port;
u32 if_frequency;
};
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH 03/12] si2157: support selection of IF interface
2015-04-23 21:11 ` [PATCH 03/12] si2157: support selection of IF interface Olli Salonen
@ 2015-04-24 3:52 ` Mauro Carvalho Chehab
0 siblings, 0 replies; 21+ messages in thread
From: Mauro Carvalho Chehab @ 2015-04-24 3:52 UTC (permalink / raw)
To: Olli Salonen; +Cc: linux-media
Hi Olli,
Em Fri, 24 Apr 2015 00:11:02 +0300
Olli Salonen <olli.salonen@iki.fi> escreveu:
> The chips supported by the si2157 driver have two IF outputs (either
> pins 12+13 or pins 9+11). Instead of hardcoding the output to be used
> add an option to choose which output shall be used.
>
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
> ---
> drivers/media/tuners/si2157.c | 4 +++-
> drivers/media/tuners/si2157.h | 6 ++++++
> drivers/media/tuners/si2157_priv.h | 1 +
> 3 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c
> index d74ae26..cdaf687 100644
> --- a/drivers/media/tuners/si2157.c
> +++ b/drivers/media/tuners/si2157.c
> @@ -298,7 +298,8 @@ static int si2157_set_params(struct dvb_frontend *fe)
> if (dev->chiptype == SI2157_CHIPTYPE_SI2146)
> memcpy(cmd.args, "\x14\x00\x02\x07\x00\x01", 6);
> else
> - memcpy(cmd.args, "\x14\x00\x02\x07\x01\x00", 6);
> + memcpy(cmd.args, "\x14\x00\x02\x07\x00\x00", 6);
As you're changing the default, you should fold the patches that use
si2157_config.if_port = 1 on this patch (e.g. patches 4-10), as we don't
want to break git bisectability.
Regards,
Mauro
> + cmd.args[4] = dev->if_port;
> cmd.wlen = 6;
> cmd.rlen = 4;
> ret = si2157_cmd_execute(client, &cmd);
> @@ -378,6 +379,7 @@ static int si2157_probe(struct i2c_client *client,
> i2c_set_clientdata(client, dev);
> dev->fe = cfg->fe;
> dev->inversion = cfg->inversion;
> + dev->if_port = cfg->if_port;
> dev->fw_loaded = false;
> dev->chiptype = (u8)id->driver_data;
> dev->if_frequency = 5000000; /* default value of property 0x0706 */
> diff --git a/drivers/media/tuners/si2157.h b/drivers/media/tuners/si2157.h
> index a564c4a..4db97ab 100644
> --- a/drivers/media/tuners/si2157.h
> +++ b/drivers/media/tuners/si2157.h
> @@ -34,6 +34,12 @@ struct si2157_config {
> * Spectral Inversion
> */
> bool inversion;
> +
> + /*
> + * Port selection
> + * Select the RF interface to use (pins 9+11 or 12+13)
> + */
> + u8 if_port;
> };
>
> #endif
> diff --git a/drivers/media/tuners/si2157_priv.h b/drivers/media/tuners/si2157_priv.h
> index cd8fa5b..71a5f8c 100644
> --- a/drivers/media/tuners/si2157_priv.h
> +++ b/drivers/media/tuners/si2157_priv.h
> @@ -28,6 +28,7 @@ struct si2157_dev {
> bool fw_loaded;
> bool inversion;
> u8 chiptype;
> + u8 if_port;
> u32 if_frequency;
> };
>
^ permalink raw reply [flat|nested] 21+ messages in thread
* [PATCH 04/12] cx23885: specify if_port for si2157 devices
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
2015-04-23 21:11 ` [PATCH 02/12] dvbsky: use si2168 config option ts_clock_gapped Olli Salonen
2015-04-23 21:11 ` [PATCH 03/12] si2157: support selection of IF interface Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-23 21:11 ` [PATCH 05/12] smipcie: " Olli Salonen
` (7 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Set the if_port parameter for all Si2157-based devices.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/pci/cx23885/cx23885-dvb.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/media/pci/cx23885/cx23885-dvb.c b/drivers/media/pci/cx23885/cx23885-dvb.c
index 745caab..37fd013 100644
--- a/drivers/media/pci/cx23885/cx23885-dvb.c
+++ b/drivers/media/pci/cx23885/cx23885-dvb.c
@@ -1912,6 +1912,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+ si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -1957,6 +1958,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+ si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2093,6 +2095,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+ si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -2172,6 +2175,7 @@ static int dvb_register(struct cx23885_tsport *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = fe0->dvb.frontend;
+ si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 05/12] smipcie: specify if_port for si2157 devices
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
` (2 preceding siblings ...)
2015-04-23 21:11 ` [PATCH 04/12] cx23885: specify if_port for si2157 devices Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-23 21:11 ` [PATCH 06/12] cx231xx: " Olli Salonen
` (6 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Set the if_port parameter for all Si2157-based devices.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/pci/smipcie/smipcie.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/pci/smipcie/smipcie.c b/drivers/media/pci/smipcie/smipcie.c
index 4115925..143fd78 100644
--- a/drivers/media/pci/smipcie/smipcie.c
+++ b/drivers/media/pci/smipcie/smipcie.c
@@ -657,6 +657,7 @@ static int smi_dvbsky_sit2_fe_attach(struct smi_port *port)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = port->fe;
+ si2157_config.if_port = 1;
memset(&client_info, 0, sizeof(struct i2c_board_info));
strlcpy(client_info.type, "si2157", I2C_NAME_SIZE);
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 06/12] cx231xx: specify if_port for si2157 devices
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
` (3 preceding siblings ...)
2015-04-23 21:11 ` [PATCH 05/12] smipcie: " Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-23 21:11 ` [PATCH 07/12] af9035: " Olli Salonen
` (5 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Set the if_port parameter for all Si2157-based devices.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/usb/cx231xx/cx231xx-dvb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c
index 610d567..66ee161 100644
--- a/drivers/media/usb/cx231xx/cx231xx-dvb.c
+++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c
@@ -797,6 +797,7 @@ static int dvb_init(struct cx231xx *dev)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dev->dvb->frontend;
+ si2157_config.if_port = 1;
si2157_config.inversion = true;
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -852,6 +853,7 @@ static int dvb_init(struct cx231xx *dev)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dev->dvb->frontend;
+ si2157_config.if_port = 1;
si2157_config.inversion = true;
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 07/12] af9035: specify if_port for si2157 devices
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
` (4 preceding siblings ...)
2015-04-23 21:11 ` [PATCH 06/12] cx231xx: " Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-23 21:11 ` [PATCH 08/12] dvbsky: " Olli Salonen
` (4 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Set the if_port parameter for all Si2157-based devices.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/usb/dvb-usb-v2/af9035.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index 80a29f5..7b7f75d 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -1569,6 +1569,7 @@ static int it930x_tuner_attach(struct dvb_usb_adapter *adap)
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = adap->fe[0];
+ si2157_config.if_port = 1;
ret = af9035_add_i2c_dev(d, "si2157", 0x63,
&si2157_config, state->i2c_adapter_demod);
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 08/12] dvbsky: specify if_port for si2157 devices
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
` (5 preceding siblings ...)
2015-04-23 21:11 ` [PATCH 07/12] af9035: " Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-23 21:11 ` [PATCH 09/12] cxusb: " Olli Salonen
` (3 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Set the if_port parameter for all Si2157-based devices.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/usb/dvb-usb-v2/dvbsky.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/usb/dvb-usb-v2/dvbsky.c b/drivers/media/usb/dvb-usb-v2/dvbsky.c
index 0f73b1d..57c8c2d 100644
--- a/drivers/media/usb/dvb-usb-v2/dvbsky.c
+++ b/drivers/media/usb/dvb-usb-v2/dvbsky.c
@@ -549,6 +549,7 @@ static int dvbsky_t680c_attach(struct dvb_usb_adapter *adap)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = adap->fe[0];
+ si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -633,6 +634,7 @@ static int dvbsky_t330_attach(struct dvb_usb_adapter *adap)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = adap->fe[0];
+ si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 09/12] cxusb: specify if_port for si2157 devices
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
` (6 preceding siblings ...)
2015-04-23 21:11 ` [PATCH 08/12] dvbsky: " Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-23 21:11 ` [PATCH 10/12] em28xx: " Olli Salonen
` (2 subsequent siblings)
10 siblings, 0 replies; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Set the if_port parameter for all Si2157-based devices.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/usb/dvb-usb/cxusb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/media/usb/dvb-usb/cxusb.c b/drivers/media/usb/dvb-usb/cxusb.c
index ffc3704..ab71511 100644
--- a/drivers/media/usb/dvb-usb/cxusb.c
+++ b/drivers/media/usb/dvb-usb/cxusb.c
@@ -1350,6 +1350,7 @@ static int cxusb_mygica_t230_frontend_attach(struct dvb_usb_adapter *adap)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = adap->fe_adap[0].fe;
+ si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 10/12] em28xx: specify if_port for si2157 devices
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
` (7 preceding siblings ...)
2015-04-23 21:11 ` [PATCH 09/12] cxusb: " Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-23 21:11 ` [PATCH 11/12] rtl28xxu: add I2C read without write Olli Salonen
2015-04-23 21:11 ` [PATCH 12/12] rtl2832: add support for GoTView MasterHD 3 USB tuner Olli Salonen
10 siblings, 0 replies; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Set the if_port parameter for all Si2157-based devices.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/usb/em28xx/em28xx-dvb.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index a5b22c5..5b7c7c88 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1579,6 +1579,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dvb->fe[0];
+ si2157_config.if_port = 1;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2157", I2C_NAME_SIZE);
info.addr = 0x60;
@@ -1639,6 +1640,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
/* attach tuner */
memset(&si2157_config, 0, sizeof(si2157_config));
si2157_config.fe = dvb->fe[0];
+ si2157_config.if_port = 0;
memset(&info, 0, sizeof(struct i2c_board_info));
strlcpy(info.type, "si2146", I2C_NAME_SIZE);
info.addr = 0x60;
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 11/12] rtl28xxu: add I2C read without write
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
` (8 preceding siblings ...)
2015-04-23 21:11 ` [PATCH 10/12] em28xx: " Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-23 21:11 ` [PATCH 12/12] rtl2832: add support for GoTView MasterHD 3 USB tuner Olli Salonen
10 siblings, 0 replies; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
Add support for I2C read operation without a preceeding write.
While here, change the error code to EOPNOTSUPP in case an
unsupported I2C operation is attempted.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index f1a7613..5e0c015 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -232,8 +232,14 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
req.data = msg[0].buf;
ret = rtl28xxu_ctrl_msg(d, &req);
}
+ } else if (num == 1 && (msg[0].flags & I2C_M_RD)) {
+ req.value = (msg[0].addr << 1);
+ req.index = CMD_I2C_DA_RD;
+ req.size = msg[0].len;
+ req.data = msg[0].buf;
+ ret = rtl28xxu_ctrl_msg(d, &req);
} else {
- ret = -EINVAL;
+ ret = -EOPNOTSUPP;
}
err_mutex_unlock:
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* [PATCH 12/12] rtl2832: add support for GoTView MasterHD 3 USB tuner
2015-04-23 21:11 [PATCH 01/12] si2168: add support for gapped clock Olli Salonen
` (9 preceding siblings ...)
2015-04-23 21:11 ` [PATCH 11/12] rtl28xxu: add I2C read without write Olli Salonen
@ 2015-04-23 21:11 ` Olli Salonen
2015-04-23 22:07 ` Benjamin Larsson
10 siblings, 1 reply; 21+ messages in thread
From: Olli Salonen @ 2015-04-23 21:11 UTC (permalink / raw)
To: linux-media; +Cc: Olli Salonen
GoTView MasterHD 3 is a DVB-T2/C USB 2.0 tuner.
It's based on the following components:
- USB bridge: RTL2832P (contains also DVB-T demodulator)
- Demodulator: Si2168-A30
- Tuner: Si2148-A20
The demodulator and the tuner will need firmwares. The Si2148 uses Si2158
firmware. Antti has the firmwares available for download:
http://palosaari.fi/linux/v4l-dvb/firmware/
Do note that for DVB-T either of the demodulators can be used. DVB-C and
DVB-T2 are only supported by the Si2168 demodulator. The driver will
register 2 frontends for the same adapter. Frontend 0 will be the RTL2832
demodulator and frontend 1 will be the Si2168 demodulator. The same
tuner is used for both.
As a consequence of the above, it's recommended to use application that
do implement proper DVBv5 support.
For some reason, the old I2C write method sporadically failed. Thus the
need for an option to only use the new I2C write method supported by the
RTL2832.
Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
drivers/media/dvb-frontends/rtl2832.c | 4 +
drivers/media/dvb-frontends/rtl2832.h | 1 +
drivers/media/dvb-frontends/rtl2832_priv.h | 25 +++++++
drivers/media/usb/dvb-usb-v2/rtl28xxu.c | 116 ++++++++++++++++++++++++++++-
drivers/media/usb/dvb-usb-v2/rtl28xxu.h | 5 ++
5 files changed, 148 insertions(+), 3 deletions(-)
diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c
index 20fa245..08558eb 100644
--- a/drivers/media/dvb-frontends/rtl2832.c
+++ b/drivers/media/dvb-frontends/rtl2832.c
@@ -376,6 +376,10 @@ static int rtl2832_init(struct dvb_frontend *fe)
len = ARRAY_SIZE(rtl2832_tuner_init_r820t);
init = rtl2832_tuner_init_r820t;
break;
+ case RTL2832_TUNER_SI2157:
+ len = ARRAY_SIZE(rtl2832_tuner_init_si2157);
+ init = rtl2832_tuner_init_si2157;
+ break;
default:
ret = -EINVAL;
goto err;
diff --git a/drivers/media/dvb-frontends/rtl2832.h b/drivers/media/dvb-frontends/rtl2832.h
index a8e912e..c6cdcc4 100644
--- a/drivers/media/dvb-frontends/rtl2832.h
+++ b/drivers/media/dvb-frontends/rtl2832.h
@@ -47,6 +47,7 @@ struct rtl2832_platform_data {
#define RTL2832_TUNER_FC0013 0x29
#define RTL2832_TUNER_R820T 0x2a
#define RTL2832_TUNER_R828D 0x2b
+#define RTL2832_TUNER_SI2157 0x2c
u8 tuner;
struct dvb_frontend* (*get_dvb_frontend)(struct i2c_client *);
diff --git a/drivers/media/dvb-frontends/rtl2832_priv.h b/drivers/media/dvb-frontends/rtl2832_priv.h
index c3a922c..a973b8a 100644
--- a/drivers/media/dvb-frontends/rtl2832_priv.h
+++ b/drivers/media/dvb-frontends/rtl2832_priv.h
@@ -377,4 +377,29 @@ static const struct rtl2832_reg_value rtl2832_tuner_init_r820t[] = {
{DVBT_SPEC_INV, 0x1},
};
+static const struct rtl2832_reg_value rtl2832_tuner_init_si2157[] = {
+ {DVBT_DAGC_TRG_VAL, 0x39},
+ {DVBT_AGC_TARG_VAL_0, 0x0},
+ {DVBT_AGC_TARG_VAL_8_1, 0x40},
+ {DVBT_AAGC_LOOP_GAIN, 0x16},
+ {DVBT_LOOP_GAIN2_3_0, 0x8},
+ {DVBT_LOOP_GAIN2_4, 0x1},
+ {DVBT_LOOP_GAIN3, 0x18},
+ {DVBT_VTOP1, 0x35},
+ {DVBT_VTOP2, 0x21},
+ {DVBT_VTOP3, 0x21},
+ {DVBT_KRF1, 0x0},
+ {DVBT_KRF2, 0x40},
+ {DVBT_KRF3, 0x10},
+ {DVBT_KRF4, 0x10},
+ {DVBT_IF_AGC_MIN, 0x80},
+ {DVBT_IF_AGC_MAX, 0x7f},
+ {DVBT_RF_AGC_MIN, 0x80},
+ {DVBT_RF_AGC_MAX, 0x7f},
+ {DVBT_POLAR_RF_AGC, 0x0},
+ {DVBT_POLAR_IF_AGC, 0x0},
+ {DVBT_AD7_SETTING, 0xe9f4},
+ {DVBT_SPEC_INV, 0x0},
+};
+
#endif /* RTL2832_PRIV_H */
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index 5e0c015..c2bd24f 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -217,7 +217,7 @@ static int rtl28xxu_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msg[],
req.data = &msg[0].buf[1];
ret = rtl28xxu_ctrl_msg(d, &req);
}
- } else if (msg[0].len < 23) {
+ } else if ((msg[0].len < 23) && (!dev->new_i2c_write)) {
/* method 2 - old I2C */
req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
req.index = CMD_I2C_WR;
@@ -363,6 +363,8 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
struct rtl28xxu_req req_r828d = {0x0074, CMD_I2C_RD, 1, buf};
struct rtl28xxu_req req_mn88472 = {0xff38, CMD_I2C_RD, 1, buf};
struct rtl28xxu_req req_mn88473 = {0xff38, CMD_I2C_RD, 1, buf};
+ struct rtl28xxu_req req_si2157 = {0x00c0, CMD_I2C_RD, 1, buf};
+ struct rtl28xxu_req req_si2168 = {0x00c8, CMD_I2C_RD, 1, buf};
dev_dbg(&d->intf->dev, "\n");
@@ -483,6 +485,35 @@ static int rtl2832u_read_config(struct dvb_usb_device *d)
goto tuner_found;
}
+ /* GPIO0 and GPIO5 to reset Si2157/Si2168 tuner and demod */
+ ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x00, 0x21);
+ if (ret)
+ goto err;
+
+ ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x00, 0x21);
+ if (ret)
+ goto err;
+
+ msleep(50);
+
+ ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_VAL, 0x21, 0x21);
+ if (ret)
+ goto err;
+
+ ret = rtl28xxu_wr_reg_mask(d, SYS_GPIO_OUT_EN, 0x21, 0x21);
+ if (ret)
+ goto err;
+
+ msleep(50);
+
+ /* check Si2157 ID register; reg=c0 val=80 */
+ ret = rtl28xxu_ctrl_msg(d, &req_si2157);
+ if (ret == 0 && ((buf[0] & 0x80) == 0x80)) {
+ dev->tuner = TUNER_RTL2832_SI2157;
+ dev->tuner_name = "SI2157";
+ goto tuner_found;
+ }
+
tuner_found:
dev_dbg(&d->intf->dev, "tuner=%s\n", dev->tuner_name);
@@ -516,6 +547,15 @@ tuner_found:
goto demod_found;
}
}
+ if (dev->tuner == TUNER_RTL2832_SI2157) {
+ /* check Si2168 ID register; reg=c8 val=80 */
+ ret = rtl28xxu_ctrl_msg(d, &req_si2168);
+ if (ret == 0 && ((buf[0] & 0x80) == 0x80)) {
+ dev_dbg(&d->intf->dev, "Si2168 found\n");
+ dev->slave_demod = SLAVE_DEMOD_SI2168;
+ goto demod_found;
+ }
+ }
demod_found:
/* close demod I2C gate */
@@ -674,6 +714,11 @@ static const struct rtl2832_platform_data rtl2832_r820t_platform_data = {
.tuner = TUNER_RTL2832_R820T,
};
+static const struct rtl2832_platform_data rtl2832_si2157_platform_data = {
+ .clk = 28800000,
+ .tuner = TUNER_RTL2832_SI2157,
+};
+
static int rtl2832u_fc0012_tuner_callback(struct dvb_usb_device *d,
int cmd, int arg)
{
@@ -825,6 +870,9 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
case TUNER_RTL2832_R828D:
*pdata = rtl2832_r820t_platform_data;
break;
+ case TUNER_RTL2832_SI2157:
+ *pdata = rtl2832_si2157_platform_data;
+ break;
default:
dev_err(&d->intf->dev, "unknown tuner %s\n", dev->tuner_name);
ret = -ENODEV;
@@ -892,7 +940,7 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
}
dev->i2c_client_slave_demod = client;
- } else {
+ } else if (dev->slave_demod == SLAVE_DEMOD_MN88473) {
struct mn88473_config mn88473_config = {};
mn88473_config.fe = &adap->fe[1];
@@ -914,9 +962,36 @@ static int rtl2832u_frontend_attach(struct dvb_usb_adapter *adap)
}
dev->i2c_client_slave_demod = client;
+ } else {
+ struct si2168_config si2168_config = {};
+ struct i2c_adapter *adapter;
+
+ si2168_config.i2c_adapter = &adapter;
+ si2168_config.fe = &adap->fe[1];
+ si2168_config.ts_mode = SI2168_TS_SERIAL;
+ si2168_config.ts_clock_inv = false;
+ strlcpy(info.type, "si2168", I2C_NAME_SIZE);
+ info.addr = 0x64;
+ info.platform_data = &si2168_config;
+ request_module(info.type);
+ client = i2c_new_device(&d->i2c_adap, &info);
+ if (client == NULL || client->dev.driver == NULL) {
+ dev->slave_demod = SLAVE_DEMOD_NONE;
+ goto err_slave_demod_failed;
+ }
+
+ if (!try_module_get(client->dev.driver->owner)) {
+ i2c_unregister_device(client);
+ dev->slave_demod = SLAVE_DEMOD_NONE;
+ goto err_slave_demod_failed;
+ }
+
+ dev->i2c_client_slave_demod = client;
+
+ /* for Si2168 devices use only new I2C write method */
+ dev->new_i2c_write = true;
}
}
-
return 0;
err_slave_demod_failed:
err:
@@ -1156,6 +1231,39 @@ static int rtl2832u_tuner_attach(struct dvb_usb_adapter *adap)
adap->fe[1]->ops.tuner_ops.get_rf_strength;
}
break;
+ case TUNER_RTL2832_SI2157: {
+ struct si2157_config si2157_config = {
+ .fe = adap->fe[0],
+ .if_port = 0,
+ .inversion = false,
+ };
+
+ strlcpy(info.type, "si2157", I2C_NAME_SIZE);
+ info.addr = 0x60;
+ info.platform_data = &si2157_config;
+ request_module(info.type);
+ client = i2c_new_device(&d->i2c_adap, &info);
+ if (client == NULL || client->dev.driver == NULL)
+ break;
+
+ if (!try_module_get(client->dev.driver->owner)) {
+ i2c_unregister_device(client);
+ break;
+ }
+
+ dev->i2c_client_tuner = client;
+ subdev = i2c_get_clientdata(client);
+
+ /* copy tuner ops for 2nd FE as tuner is shared */
+ if (adap->fe[1]) {
+ adap->fe[1]->tuner_priv =
+ adap->fe[0]->tuner_priv;
+ memcpy(&adap->fe[1]->ops.tuner_ops,
+ &adap->fe[0]->ops.tuner_ops,
+ sizeof(struct dvb_tuner_ops));
+ }
+ }
+ break;
default:
dev_err(&d->intf->dev, "unknown tuner %d\n", dev->tuner);
}
@@ -1772,6 +1880,8 @@ static const struct usb_device_id rtl28xxu_id_table[] = {
/* RTL2832P devices: */
{ DVB_USB_DEVICE(USB_VID_HANFTEK, 0x0131,
&rtl28xxu_props, "Astrometa DVB-T2", NULL) },
+ { DVB_USB_DEVICE(0x5654, 0xca42,
+ &rtl28xxu_props, "GoTView MasterHD 3", NULL) },
{ }
};
MODULE_DEVICE_TABLE(usb, rtl28xxu_id_table);
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
index 1b5d7ff..9f6115a 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.h
@@ -41,6 +41,8 @@
#include "fc2580.h"
#include "tua9001.h"
#include "r820t.h"
+#include "si2168.h"
+#include "si2157.h"
/*
* USB commands
@@ -76,6 +78,7 @@ struct rtl28xxu_dev {
u8 page; /* integrated demod active register page */
struct i2c_adapter *demod_i2c_adapter;
bool rc_active;
+ bool new_i2c_write;
struct i2c_client *i2c_client_demod;
struct i2c_client *i2c_client_tuner;
struct i2c_client *i2c_client_slave_demod;
@@ -83,6 +86,7 @@ struct rtl28xxu_dev {
#define SLAVE_DEMOD_NONE 0
#define SLAVE_DEMOD_MN88472 1
#define SLAVE_DEMOD_MN88473 2
+ #define SLAVE_DEMOD_SI2168 3
unsigned int slave_demod:2;
union {
struct rtl2830_platform_data rtl2830_platform_data;
@@ -116,6 +120,7 @@ enum rtl28xxu_tuner {
TUNER_RTL2832_FC0013,
TUNER_RTL2832_R820T,
TUNER_RTL2832_R828D,
+ TUNER_RTL2832_SI2157,
};
struct rtl28xxu_req {
--
1.9.1
^ permalink raw reply related [flat|nested] 21+ messages in thread* Re: [PATCH 12/12] rtl2832: add support for GoTView MasterHD 3 USB tuner
2015-04-23 21:11 ` [PATCH 12/12] rtl2832: add support for GoTView MasterHD 3 USB tuner Olli Salonen
@ 2015-04-23 22:07 ` Benjamin Larsson
0 siblings, 0 replies; 21+ messages in thread
From: Benjamin Larsson @ 2015-04-23 22:07 UTC (permalink / raw)
To: Olli Salonen, linux-media
On 04/23/2015 11:11 PM, Olli Salonen wrote:
> GoTView MasterHD 3 is a DVB-T2/C USB 2.0 tuner.
>
> It's based on the following components:
> - USB bridge: RTL2832P (contains also DVB-T demodulator)
> - Demodulator: Si2168-A30
> - Tuner: Si2148-A20
>
[...]
>
> For some reason, the old I2C write method sporadically failed. Thus the
> need for an option to only use the new I2C write method supported by the
> RTL2832.
Hi, I also experienced this with the Astrometa stick. I guess the
new_i2c_write flag should be set on those devices also.
Do you plan on adding pid filter support also? I posted a non working
rfc patch you could base it on.
MvH
Benjamin Larsson
^ permalink raw reply [flat|nested] 21+ messages in thread