Re: [PATCH] media: saa7134: keep demod i2c gate open on Medion 7134

2019-08-20 Thread Maciej S. Szmigiero
Hi Matthias,

On 20.08.2019 21:54, Matthias Schwarzott wrote:
> Hi Maciej,
> 
> some comment about wording in commit message and code-comment.
> 
> As far as I know the terms are defined like this:
> * gate open = i2c-clients behind gate can be reached
> * gate closed = i2c-clients behind gate are not reachable

I always thought that this terminology is like the one used for a switch:
if it is closed then the signal can pass, if open then it blocks the
signal but apparently it is literally like a physical gate, so you are
obviously right here - thanks for pointing this out.

Will respin this patch and also add a second one fixing the terminology
already present in saa7134_i2c_eeprom_md7134_gate().

> Regards
> Matthias

Regards,
Maciej


Re: [PATCH] media: saa7134: keep demod i2c gate open on Medion 7134

2019-08-20 Thread Matthias Schwarzott
Hi Maciej,

some comment about wording in commit message and code-comment.

As far as I know the terms are defined like this:
* gate open = i2c-clients behind gate can be reached
* gate closed = i2c-clients behind gate are not reachable

Regards
Matthias

Am 19.08.19 um 00:55 schrieb Maciej S. Szmigiero:
> Medion 7134 has two i2c eeproms on the same i2c bus sharing the same bus
> addresses: the first one for SAA7134 chip config and the second one behind
> TDA10046 DVB-T demod chip i2c gate storing its firmware.
> The TV tuner on this board is not behind this i2c gate.
> 
> Due to the bus conflict described above, the card PCI SVID / SSID sometimes
> gets garbled after a reboot, which makes it necessary to specify the card
> model manually as an insmod option in order for it to be detected reliably.
> To avoid this, let's just leave the gate permanently open so the eeprom
> chips won't clash.
> 
> The demod firmware load is done with its i2c gate open anyway so it is not
> affected by this change.
> 
> Signed-off-by: Maciej S. Szmigiero 
> ---
>  drivers/media/pci/saa7134/saa7134-dvb.c | 14 ++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c 
> b/drivers/media/pci/saa7134/saa7134-dvb.c
> index eb8377a95023..ace019ef6784 100644
> --- a/drivers/media/pci/saa7134/saa7134-dvb.c
> +++ b/drivers/media/pci/saa7134/saa7134-dvb.c
> @@ -1264,6 +1264,20 @@ static int dvb_init(struct saa7134_dev *dev)
>  _cardbus,
>  >i2c_adap);
>   if (fe0->dvb.frontend) {
> + /*
> +  * The TV tuner on this board is actually NOT
> +  * behind the demod i2c gate.
> +  * However, the demod eeprom is indeed there and it
> +  * conflicts with the SAA7134 chip config eeprom
> +  * if the i2c gate is closed (since they have same
> +  * bus addresses) resulting in card PCI SVID / SSID
> +  * being garbage after a reboot from time to time.
> +  *
> +  * Let's just leave the gate permanently open -
> +  * saa7134_i2c_eeprom_md7134_gate() will open it for
> +  * us at probe time if it was closed for some reason.
> +  */
> + fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL;
>   dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
>  >i2c_adap, medion_cardbus.tuner_address,
>  TUNER_PHILIPS_FMD1216ME_MK3);
> 



[PATCH] media: saa7134: keep demod i2c gate open on Medion 7134

2019-08-18 Thread Maciej S. Szmigiero
Medion 7134 has two i2c eeproms on the same i2c bus sharing the same bus
addresses: the first one for SAA7134 chip config and the second one behind
TDA10046 DVB-T demod chip i2c gate storing its firmware.
The TV tuner on this board is not behind this i2c gate.

Due to the bus conflict described above, the card PCI SVID / SSID sometimes
gets garbled after a reboot, which makes it necessary to specify the card
model manually as an insmod option in order for it to be detected reliably.
To avoid this, let's just leave the gate permanently open so the eeprom
chips won't clash.

The demod firmware load is done with its i2c gate open anyway so it is not
affected by this change.

Signed-off-by: Maciej S. Szmigiero 
---
 drivers/media/pci/saa7134/saa7134-dvb.c | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/drivers/media/pci/saa7134/saa7134-dvb.c 
b/drivers/media/pci/saa7134/saa7134-dvb.c
index eb8377a95023..ace019ef6784 100644
--- a/drivers/media/pci/saa7134/saa7134-dvb.c
+++ b/drivers/media/pci/saa7134/saa7134-dvb.c
@@ -1264,6 +1264,20 @@ static int dvb_init(struct saa7134_dev *dev)
   _cardbus,
   >i2c_adap);
if (fe0->dvb.frontend) {
+   /*
+* The TV tuner on this board is actually NOT
+* behind the demod i2c gate.
+* However, the demod eeprom is indeed there and it
+* conflicts with the SAA7134 chip config eeprom
+* if the i2c gate is closed (since they have same
+* bus addresses) resulting in card PCI SVID / SSID
+* being garbage after a reboot from time to time.
+*
+* Let's just leave the gate permanently open -
+* saa7134_i2c_eeprom_md7134_gate() will open it for
+* us at probe time if it was closed for some reason.
+*/
+   fe0->dvb.frontend->ops.i2c_gate_ctrl = NULL;
dvb_attach(simple_tuner_attach, fe0->dvb.frontend,
   >i2c_adap, medion_cardbus.tuner_address,
   TUNER_PHILIPS_FMD1216ME_MK3);