Hauppauge Solo/Dual HD spectral inversion
Subsystems (3)
cover Hauppauge Solo/Dual HD spectral inversion
This is a misplaced addendum to my series:
- Hauppauge em28xx/lgdt3306a soloHD/DualHD support
This patch set requires:
https://patchwork.linuxtv.org/patch/46326/
https://patchwork.linuxtv.org/patch/46330/
https://patchwork.linuxtv.org/patch/46327/
https://patchwork.linuxtv.org/patch/46334/
https://patchwork.linuxtv.org/patch/46333/
https://patchwork.linuxtv.org/patch/46331/
https://patchwork.linuxtv.org/patch/46328/
https://patchwork.linuxtv.org/patch/46335/
https://patchwork.linuxtv.org/patch/46332/
This adds a spectrum inversion property to si2168 frontend configuration. Hauppauge Solo/Dual HD DVB models have si2157 which produces inverted spectrum, so they enable the property.
Brad Love (2):
si2168: Add spectrum inversion property
em28xx: Enable spectrum inversion for Hauppauge Solo/Dual HD DVB
drivers/media/dvb-frontends/si2168.c | 2 ++ drivers/media/dvb-frontends/si2168.h | 3 +++ drivers/media/usb/em28xx/em28xx-dvb.c | 2 ++ 3 files changed, 7 insertions(+)
Signature · 1 line
2.7.4
PATCH 1/2 si2168: Add spectrum inversion property
Some tuners produce inverted spectrum, but the si2168 is not currently set up to accept it. This adds an optional parameter to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion will utilize this.
--- drivers/media/dvb-frontends/si2168.c | 2 ++ drivers/media/dvb-frontends/si2168.h | 3 +++ 2 files changed, 5 insertions(+)
drivers/media/dvb-frontends/si2168.c +2 -0
@@ -339,6 +339,8 @@ static int si2168_set_frontend(struct dvb_frontend *fe)memcpy (cmd.args,"\x14\x00\x0a\x10\x00\x00" ,6 ); cmd.args[4 ] = delivery_system | bandwidth; +if (config->spectral_inversion) + cmd.args[5 ] |=1 ; cmd.wlen =6 ; cmd.rlen =4 ; ret =si2168_cmd_execute (client, &cmd);
drivers/media/dvb-frontends/si2168.h +3 -0
@@ -46,6 +46,9 @@ struct si2168_config {/* TS clock gapped */ bool ts_clock_gapped; + +/* Inverted spectrum */ + bool spectral_inversion; };#endif
Signature · 1 line
2.7.4
PATCH v2 1/2 si2168: Add spectrum inversion property
Some tuners produce inverted spectrum, but the si2168 is not currently set up to accept it. This adds an optional parameter to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion will utilize this.
---
Changes since v1:
- Embarassing build failure due to missing declaration.
drivers/media/dvb-frontends/si2168.c | 3 +++ drivers/media/dvb-frontends/si2168.h | 3 +++ 2 files changed, 6 insertions(+)
drivers/media/dvb-frontends/si2168.c +3 -0
@@ -213,6 +213,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe)struct i2c_client *client = fe->demodulator_priv;struct si2168_dev *dev =i2c_get_clientdata (client);struct dtv_frontend_properties *c = &fe->dtv_property_cache; +struct si2168_config *config = client->dev.platform_data;int ret;struct si2168_cmd cmd;u8 bandwidth, delivery_system;
@@ -339,6 +340,8 @@ static int si2168_set_frontend(struct dvb_frontend *fe)memcpy (cmd.args,"\x14\x00\x0a\x10\x00\x00" ,6 ); cmd.args[4 ] = delivery_system | bandwidth; +if (config->spectral_inversion) + cmd.args[5 ] |=1 ; cmd.wlen =6 ; cmd.rlen =4 ; ret =si2168_cmd_execute (client, &cmd);
drivers/media/dvb-frontends/si2168.h +3 -0
@@ -46,6 +46,9 @@ struct si2168_config {/* TS clock gapped */ bool ts_clock_gapped; + +/* Inverted spectrum */ + bool spectral_inversion; };#endif
Signature · 1 line
2.7.4
Re: [PATCH v2 1/2] si2168: Add spectrum inversion property
Quoted 21 lines · Brad Love
Some tuners produce inverted spectrum, but the si2168 is not currently set up to accept it. This adds an optional parameter to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion will utilize this.
Signed-off-by Brad Love <[email protected]>---
Changes since v1:
- Embarassing build failure due to missing declaration.drivers/media/dvb-frontends/si2168.c | 3 +++ drivers/media/dvb-frontends/si2168.h | 3 +++ 2 files changed, 6 insertions(+)drivers/media/dvb-frontends/si2168.c +0
-0
drivers/media/dvb-frontends/si2168.c static int si2168_set_frontend(struct dvb_frontend *fe) · line 216
Quoted 4 lines
drivers/media/dvb-frontends/si2168.c +1
-0@@ -213,6 +213,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe)struct i2c_client *client = fe->demodulator_priv;struct si2168_dev *dev =i2c_get_clientdata (client);struct dtv_frontend_properties *c = &fe->dtv_property_cache; +struct si2168_config *config = client->dev.platform_data;
hmmm, are you sure platform data pointer points is const? I usually tend to store all config information to device state. Then there is no need to care if pointer is valid or not anymore.
And inversion happens when those wires are cross-connected
Quoted 27 lines
drivers/media/dvb-frontends/si2168.c +2
-0int ret;struct si2168_cmd cmd;u8 bandwidth, delivery_system;@@ -339,6 +340,8 @@ static int si2168_set_frontend(struct dvb_frontend *fe)memcpy (cmd.args,"\x14\x00\x0a\x10\x00\x00" ,6 ); cmd.args[4 ] = delivery_system | bandwidth; +if (config->spectral_inversion) + cmd.args[5 ] |=1 ; cmd.wlen =6 ; cmd.rlen =4 ; ret =si2168_cmd_execute (client, &cmd);drivers/media/dvb-frontends/si2168.h +3
-0@@ -46,6 +46,9 @@ struct si2168_config {/* TS clock gapped */ bool ts_clock_gapped; + +/* Inverted spectrum */ + bool spectral_inversion; };#endif
Signature · 1 line
http://palosaari.fi/
Re: [PATCH v2 1/2] si2168: Add spectrum inversion property
Quoted 35 lines · Antti Palosaari
Quoted 22 lines · Brad Love
Some tuners produce inverted spectrum, but the si2168 is not currently set up to accept it. This adds an optional parameter to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion will utilize this.
Signed-off-by Brad Love <[email protected]>---
Changes since v1:
- Embarassing build failure due to missing declaration.
drivers/media/dvb-frontends/si2168.c| 3 +++
drivers/media/dvb-frontends/si2168.h| 3 +++2 files changed, 6 insertions(+)drivers/media/dvb-frontends/si2168.c +0
-0drivers/media/dvb-frontends/si2168.c static int si2168_set_frontend(struct · line 217
Quoted 5 lines
drivers/media/dvb-frontends/si2168.c +1
-0@@ -213,6 +213,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe) struct i2c_client *client = fe->demodulator_priv; struct si2168_dev *dev = i2c_get_clientdata(client); struct dtv_frontend_properties *c = &fe->dtv_property_cache; + struct si2168_config *config = client->dev.platform_data;hmmm, are you sure platform data pointer points is const? I usually tend to store all config information to device state. Then there is no need to care if pointer is valid or not anymore.
Quoted 1 line
And inversion happens when those wires are cross-connected
It just dawned on me that the platform_data is stack allocated and therefore not safe to access outside of probe. I will fix this momentarily.
I was informed by one of our hardware guys that the two models in patch 2/2 are inverted spectrum, so I guess they have wires cross-connected. I can verify this again to be sure.
Quoted 28 lines
Quoted 27 lines
drivers/media/dvb-frontends/si2168.c +0
-0int ret; struct si2168_cmd cmd;u8 bandwidth,
delivery_system;drivers/media/dvb-frontends/si2168.c +2
-0@@ -339,6 +340,8 @@ static int si2168_set_frontend(struct dvb_frontend *fe) memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6); cmd.args[4] = delivery_system | bandwidth; + if (config->spectral_inversion) + cmd.args[5] |= 1; cmd.wlen = 6; cmd.rlen = 4; ret = si2168_cmd_execute(client, &cmd);drivers/media/dvb-frontends/si2168.h +3
-0@@ -46,6 +46,9 @@ struct si2168_config { /* TS clock gapped */ bool ts_clock_gapped; + + /* Inverted spectrum */ + bool spectral_inversion; }; #endif
Re: [PATCH v2 1/2] si2168: Add spectrum inversion property
Quoted 34 lines · Brad Love
Quoted 33 lines · Antti Palosaari
Quoted 22 lines · Brad Love
Some tuners produce inverted spectrum, but the si2168 is not currently set up to accept it. This adds an optional parameter to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion will utilize this.
Signed-off-by Brad Love <[email protected]>---
Changes since v1:
- Embarassing build failure due to missing declaration.
drivers/media/dvb-frontends/si2168.c| 3 +++
drivers/media/dvb-frontends/si2168.h| 3 +++2 files changed, 6 insertions(+)drivers/media/dvb-frontends/si2168.c +0
-0drivers/media/dvb-frontends/si2168.c static int si2168_set_frontend(struct · line 217
Quoted 5 lines
drivers/media/dvb-frontends/si2168.c +1
-0@@ -213,6 +213,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe) struct i2c_client *client = fe->demodulator_priv; struct si2168_dev *dev = i2c_get_clientdata(client); struct dtv_frontend_properties *c = &fe->dtv_property_cache; + struct si2168_config *config = client->dev.platform_data;hmmm, are you sure platform data pointer points is const? I usually tend to store all config information to device state. Then there is no need to care if pointer is valid or not anymore.
Quoted 7 lines
Quoted 1 line
And inversion happens when those wires are cross-connected
It just dawned on me that the
platform_datais stack allocated and therefore not safe to access outside of probe. I will fix this momentarily.I was informed by one of our hardware guys that the two models in patch 2/2 are inverted spectrum, so I guess they have wires cross-connected. I can verify this again to be sure.
Hello Antti,
I have confirmation. No 'cross-connected' / swapped differential pair polarities (if that's what you meant) on the IF pins. The si2157 inverted spectrum output is configurable though, and Hauppauge have the tuner set up to output inverted. Sounds like it was a decision based on interoperability with older demods.
Cheers,
Brad
Quoted 26 lines
Quoted 26 lines
Quoted 26 lines
drivers/media/dvb-frontends/si2168.c +0
-0int ret; struct si2168_cmd cmd;u8 bandwidth,
delivery_system;drivers/media/dvb-frontends/si2168.c +2
-0@@ -339,6 +340,8 @@ static int si2168_set_frontend(struct dvb_frontend *fe) memcpy(cmd.args, "\x14\x00\x0a\x10\x00\x00", 6); cmd.args[4] = delivery_system | bandwidth; + if (config->spectral_inversion) + cmd.args[5] |= 1; cmd.wlen = 6; cmd.rlen = 4; ret = si2168_cmd_execute(client, &cmd);drivers/media/dvb-frontends/si2168.h +3
-0@@ -46,6 +46,9 @@ struct si2168_config { /* TS clock gapped */ bool ts_clock_gapped; + + /* Inverted spectrum */ + bool spectral_inversion; }; #endif
Re: [PATCH v2 1/2] si2168: Add spectrum inversion property
Quoted 45 lines · Brad Love
Quoted 34 lines · Brad Love
Quoted 33 lines · Antti Palosaari
Quoted 22 lines · Brad Love
Some tuners produce inverted spectrum, but the si2168 is not currently set up to accept it. This adds an optional parameter to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion will utilize this.
Signed-off-by Brad Love <[email protected]>---
Changes since v1:
- Embarassing build failure due to missing declaration.drivers/media/dvb-frontends/si2168.c | 3 +++ drivers/media/dvb-frontends/si2168.h | 3 +++ 2 files changed, 6 insertions(+)drivers/media/dvb-frontends/si2168.c +0
-0drivers/media/dvb-frontends/si2168.c static int si2168_set_frontend(struct · line 217
Quoted 5 lines
drivers/media/dvb-frontends/si2168.c +1
-0@@ -213,6 +213,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe) struct i2c_client *client = fe->demodulator_priv; struct si2168_dev *dev = i2c_get_clientdata(client); struct dtv_frontend_properties *c = &fe->dtv_property_cache; + struct si2168_config *config = client->dev.platform_data;hmmm, are you sure platform data pointer points is const? I usually tend to store all config information to device state. Then there is no need to care if pointer is valid or not anymore.
Quoted 7 lines
Quoted 1 line
And inversion happens when those wires are cross-connected
It just dawned on me that the
platform_datais stack allocated and therefore not safe to access outside of probe. I will fix this momentarily.I was informed by one of our hardware guys that the two models in patch 2/2 are inverted spectrum, so I guess they have wires cross-connected. I can verify this again to be sure.
Quoted 7 lines
Hello Antti,
I have confirmation. No 'cross-connected' / swapped differential pair polarities (if that's what you meant) on the IF pins. The si2157 inverted spectrum output is configurable though, and Hauppauge have the tuner set up to output inverted. Sounds like it was a decision based on interoperability with older demods.
yeah, that was what I was thinking for. That board single tuner and two demods which other demod does not support if spectrum inversion?
If there is just si2168 and si2157, you can set both to invert or both to non-invert - the end result is same.
Antti
Signature · 1 line
http://palosaari.fi/
Re: [PATCH v2 1/2] si2168: Add spectrum inversion property
Quoted 56 lines · Antti Palosaari
Quoted 47 lines · Brad Love
Quoted 35 lines · Brad Love
Quoted 33 lines · Antti Palosaari
Quoted 22 lines · Brad Love
Some tuners produce inverted spectrum, but the si2168 is not currently set up to accept it. This adds an optional parameter to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion will utilize this.
Signed-off-by Brad Love <[email protected]>---
Changes since v1:
- Embarassing build failure due to missing declaration.
drivers/media/dvb-frontends/si2168.c| 3 +++
drivers/media/dvb-frontends/si2168.h| 3 +++2 files changed, 6 insertions(+)drivers/media/dvb-frontends/si2168.c +0
-0drivers/media/dvb-frontends/si2168.c static int si2168_set_frontend(struct · line 217
Quoted 5 lines
drivers/media/dvb-frontends/si2168.c +1
-0@@ -213,6 +213,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe) struct i2c_client *client = fe->demodulator_priv; struct si2168_dev *dev = i2c_get_clientdata(client); struct dtv_frontend_properties *c = &fe->dtv_property_cache; + struct si2168_config *config = client->dev.platform_data;hmmm, are you sure platform data pointer points is const? I usually tend to store all config information to device state. Then there is no need to care if pointer is valid or not anymore.
Quoted 1 line
And inversion happens when those wires are cross-connected
Quoted 8 lines
It just dawned on me that the
platform_datais stack allocated and therefore not safe to access outside of probe. I will fix this momentarily.I was informed by one of our hardware guys that the two models in patch 2/2 are inverted spectrum, so I guess they have wires cross-connected. I
can verify this again to be sure.Quoted 7 lines
Hello Antti,
I have confirmation. No 'cross-connected' / swapped differential pair polarities (if that's what you meant) on the IF pins. The si2157 inverted spectrum output is configurable though, and Hauppauge have the tuner set up to output inverted. Sounds like it was a decision based on interoperability with older demods.
Quoted 7 lines
yeah, that was what I was thinking for. That board single tuner and two demods which other demod does not support if spectrum inversion?
If there is just si2168 and si2157, you can set both to invert or both to non-invert - the end result is same.
Antti
I will check on the HVR975 tomorrow, if it's affected as well I'll submit a patch. The lgdt3306a frontend is already set up for auto spectrum inversion, so it is able handle the si2157 in either config.
Re: [PATCH v2 1/2] si2168: Add spectrum inversion property
Quoted 56 lines · Brad Love
Quoted 55 lines · Antti Palosaari
Quoted 44 lines · Brad Love
Quoted 34 lines · Brad Love
Quoted 32 lines · Antti Palosaari
Quoted 22 lines · Brad Love
Some tuners produce inverted spectrum, but the si2168 is not currently set up to accept it. This adds an optional parameter to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion will utilize this.
Signed-off-by Brad Love <[email protected]>---
Changes since v1:
- Embarassing build failure due to missing declaration.
drivers/media/dvb-frontends/si2168.c| 3 +++
drivers/media/dvb-frontends/si2168.h| 3 +++2 files changed, 6 insertions(+)drivers/media/dvb-frontends/si2168.c +0
-0drivers/media/dvb-frontends/si2168.c static int si2168_set_frontend(struct · line 217
Quoted 5 lines
drivers/media/dvb-frontends/si2168.c +1
-0@@ -213,6 +213,7 @@ static int si2168_set_frontend(struct dvb_frontend *fe) struct i2c_client *client = fe->demodulator_priv; struct si2168_dev *dev = i2c_get_clientdata(client); struct dtv_frontend_properties *c = &fe->dtv_property_cache; + struct si2168_config *config = client->dev.platform_data;hmmm, are you sure platform data pointer points is const? I usually tend to store all config information to device state. Then there is no need to care if pointer is valid or not anymore.
Quoted 1 line
And inversion happens when those wires are cross-connected
Quoted 8 lines
It just dawned on me that the
platform_datais stack allocated and therefore not safe to access outside of probe. I will fix this momentarily.I was informed by one of our hardware guys that the two models in patch 2/2 are inverted spectrum, so I guess they have wires cross-connected. I
can verify this again to be sure.Quoted 7 lines
Hello Antti,
I have confirmation. No 'cross-connected' / swapped differential pair polarities (if that's what you meant) on the IF pins. The si2157 inverted spectrum output is configurable though, and Hauppauge have the tuner set up to output inverted. Sounds like it was a decision based on interoperability with older demods.
yeah, that was what I was thinking for. That board single tuner and two demods which other demod does not support if spectrum inversion?
Quoted 9 lines
Quoted 4 lines
If there is just si2168 and si2157, you can set both to invert or both to non-invert - the end result is same.
Antti
I will check on the HVR975 tomorrow, if it's affected as well I'll submit a patch. The lgdt3306a frontend is already set up for auto spectrum inversion, so it is able handle the si2157 in either config.
The HVR975 should be good as currently submitted.
Cheers,
Brad
PATCH v3 1/2 si2168: Add spectrum inversion property
In reply to Brad LoveSome tuners produce inverted spectrum, but the si2168 is not currently set up to accept it. This adds an optional parameter to set the frontend up to receive inverted spectrum.
Parameter is optional and only boards who enable inversion will utilize this.
---
Changes since v2:
- platform_data is not safe outside of probe, move property to state
Changes since v1:
- Embarassing build failure due to missing declaration.
drivers/media/dvb-frontends/si2168.c | 3 +++ drivers/media/dvb-frontends/si2168.h | 3 +++ drivers/media/dvb-frontends/si2168_priv.h | 1 + 3 files changed, 7 insertions(+)
drivers/media/dvb-frontends/si2168.c +3 -0
@@ -339,6 +339,8 @@ static int si2168_set_frontend(struct dvb_frontend *fe)memcpy (cmd.args,"\x14\x00\x0a\x10\x00\x00" ,6 ); cmd.args[4 ] = delivery_system | bandwidth; +if (dev->spectral_inversion) + cmd.args[5 ] |=1 ; cmd.wlen =6 ; cmd.rlen =4 ; ret =si2168_cmd_execute (client, &cmd);
@@ -799,6 +801,7 @@ static int si2168_probe(struct i2c_client *client, dev->ts_mode = config->ts_mode; dev->ts_clock_inv = config->ts_clock_inv; dev->ts_clock_gapped = config->ts_clock_gapped; + dev->spectral_inversion = config->spectral_inversion; dev_info(&client->dev, "Silicon Labs Si2168-%c%d%d successfully identified\n", dev->version >> 24 & 0xff, dev->version >> 16 & 0xff,
drivers/media/dvb-frontends/si2168.h +3 -0
@@ -46,6 +46,9 @@ struct si2168_config {/* TS clock gapped */ bool ts_clock_gapped; + +/* Inverted spectrum */ + bool spectral_inversion; };#endif
drivers/media/dvb-frontends/si2168_priv.h +1 -0
@@ -48,6 +48,7 @@ struct si2168_dev {u8 ts_mode;bool ts_clock_inv;bool ts_clock_gapped; +bool spectral_inversion; };/* firmware command struct */
Signature · 1 line
2.7.4
PATCH 2/2 em28xx: Enable inversion for Solo/Dual HD DVB models
In reply to Brad LoveHauppauge Solo/Dual HD DVB models use a si2157 tuner, which is set to produce inverted spectrum. This configures the si2168 DVB demod for inverted spectrum on both affected models.
--- drivers/media/usb/em28xx/em28xx-dvb.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/usb/em28xx/em28xx-dvb.c +2 -0
@@ -1727,6 +1727,7 @@ static int em28xx_dvb_init(struct em28xx *dev) si2168_config.i2c_adapter = &adapter; si2168_config.fe = &dvb->fe[0 ]; si2168_config.ts_mode =SI2168_TS_PARALLEL ; + si2168_config.spectral_inversion = true;memset (&info,0 ,sizeof (struct i2c_board_info ));strlcpy (info.type,"si2168" ,I2C_NAME_SIZE ); info.addr =0x64 ;
@@ -1911,6 +1912,7 @@ static int em28xx_dvb_init(struct em28xx *dev) si2168_config.i2c_adapter = &adapter; si2168_config.fe = &dvb->fe[0 ]; si2168_config.ts_mode =SI2168_TS_SERIAL ; + si2168_config.spectral_inversion = true;memset (&info,0 ,sizeof (struct i2c_board_info ));strlcpy (info.type,"si2168" ,I2C_NAME_SIZE );if (dev->ts ==PRIMARY_TS )
Signature · 1 line
2.7.4