All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct
@ 2017-05-01 11:38 Mauro Carvalho Chehab
  2017-05-01 11:38 ` [PATCH 2/2] em28xx: add support for new revisions of Terratec H6 Mauro Carvalho Chehab
  2017-05-01 14:11 ` [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct Frank Schäfer
  0 siblings, 2 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2017-05-01 11:38 UTC (permalink / raw)
  To: Linux Media Mailing List, Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab

Right now, all devices use bus 0 for eeprom. However, newer
versions of Terratec H6 use a different buffer for eeprom.

So, add support to use a different I2C address for eeprom.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 drivers/media/usb/em28xx/em28xx-cards.c | 1 +
 drivers/media/usb/em28xx/em28xx-i2c.c   | 5 +----
 drivers/media/usb/em28xx/em28xx.h       | 4 +++-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index a12b599a1fa2..c7754303e88e 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -2669,6 +2669,7 @@ static inline void em28xx_set_model(struct em28xx *dev)
 
 	/* Should be initialized early, for I2C to work */
 	dev->def_i2c_bus = dev->board.def_i2c_bus;
+	dev->eeprom_i2c_bus = dev->board.eeprom_i2c_bus;
 }
 
 /* Wait until AC97_RESET reports the expected value reliably before proceeding.
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index 8c472d5adb50..df0ab4b6f18f 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -665,8 +665,6 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
 	*eedata = NULL;
 	*eedata_len = 0;
 
-	/* EEPROM is always on i2c bus 0 on all known devices. */
-
 	dev->i2c_client[bus].addr = 0xa0 >> 1;
 
 	/* Check if board has eeprom */
@@ -975,8 +973,7 @@ int em28xx_i2c_register(struct em28xx *dev, unsigned bus,
 	dev->i2c_client[bus] = em28xx_client_template;
 	dev->i2c_client[bus].adapter = &dev->i2c_adap[bus];
 
-	/* Up to now, all eeproms are at bus 0 */
-	if (!bus) {
+	if (bus == dev->eeprom_i2c_bus) {
 		retval = em28xx_i2c_eeprom(dev, bus, &dev->eedata, &dev->eedata_len);
 		if ((retval < 0) && (retval != -ENODEV)) {
 			dev_err(&dev->intf->dev,
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index e8d97d5ec161..8117536343ab 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -440,7 +440,8 @@ struct em28xx_board {
 	int vchannels;
 	int tuner_type;
 	int tuner_addr;
-	unsigned def_i2c_bus;	/* Default I2C bus */
+	unsigned def_i2c_bus;		/* Default I2C bus */
+	unsigned eeprom_i2c_bus;	/* EEPROM I2C bus */
 
 	/* i2c flags */
 	unsigned int tda9887_conf;
@@ -643,6 +644,7 @@ struct em28xx {
 
 	unsigned char eeprom_addrwidth_16bit:1;
 	unsigned def_i2c_bus;	/* Default I2C bus */
+	unsigned eeprom_i2c_bus;/* EEPROM I2C bus */
 	unsigned cur_i2c_bus;	/* Current I2C bus */
 	struct rt_mutex i2c_bus_lock;
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] em28xx: add support for new revisions of Terratec H6
  2017-05-01 11:38 [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct Mauro Carvalho Chehab
@ 2017-05-01 11:38 ` Mauro Carvalho Chehab
  2017-05-01 14:11 ` [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct Frank Schäfer
  1 sibling, 0 replies; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2017-05-01 11:38 UTC (permalink / raw)
  To: Linux Media Mailing List, Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab, Mauro Carvalho Chehab

There's a new version of Terratec H6 with uses USB ID
0ccd:10b2. This version is similar to the old one (with is
supported via the HTC entry), except that this one has the
eeprom on the second bus.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
---
 drivers/media/usb/em28xx/em28xx-cards.c | 19 +++++++++++++++++++
 drivers/media/usb/em28xx/em28xx-dvb.c   |  1 +
 drivers/media/usb/em28xx/em28xx.h       |  1 +
 3 files changed, 21 insertions(+)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index c7754303e88e..b788ae0d5646 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -1193,6 +1193,23 @@ struct em28xx_board em28xx_boards[] = {
 		.i2c_speed    = EM28XX_I2C_CLK_WAIT_ENABLE |
 				EM28XX_I2C_FREQ_400_KHZ,
 	},
+	[EM2884_BOARD_TERRATEC_H6] = {
+		.name         = "Terratec Cinergy H6",
+		.has_dvb      = 1,
+		.ir_codes     = RC_MAP_NEC_TERRATEC_CINERGY_XS,
+#if 0
+		.tuner_type   = TUNER_PHILIPS_TDA8290,
+		.tuner_addr   = 0x41,
+		.dvb_gpio     = terratec_h5_digital, /* FIXME: probably wrong */
+		.tuner_gpio   = terratec_h5_gpio,
+#else
+		.tuner_type   = TUNER_ABSENT,
+#endif
+		.def_i2c_bus  = 1,
+		.eeprom_i2c_bus  = 1,
+		.i2c_speed    = EM28XX_I2C_CLK_WAIT_ENABLE |
+				EM28XX_I2C_FREQ_400_KHZ,
+	},
 	[EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C] = {
 		.name         = "Hauppauge WinTV HVR 930C",
 		.has_dvb      = 1,
@@ -2496,6 +2513,8 @@ struct usb_device_id em28xx_id_table[] = {
 			.driver_info = EM2884_BOARD_TERRATEC_H5 },
 	{ USB_DEVICE(0x0ccd, 0x10b6),	/* H5 Rev. 3 */
 			.driver_info = EM2884_BOARD_TERRATEC_H5 },
+	{ USB_DEVICE(0x0ccd, 0x10b2),	/* H6 */
+			.driver_info = EM2884_BOARD_TERRATEC_H6 },
 	{ USB_DEVICE(0x0ccd, 0x0084),
 			.driver_info = EM2860_BOARD_TERRATEC_AV350 },
 	{ USB_DEVICE(0x0ccd, 0x0096),
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 82edd37f0d73..4a7db623fe29 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1522,6 +1522,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
 		break;
 	case EM2884_BOARD_ELGATO_EYETV_HYBRID_2008:
 	case EM2884_BOARD_CINERGY_HTC_STICK:
+	case EM2884_BOARD_TERRATEC_H6:
 		terratec_htc_stick_init(dev);
 
 		/* attach demodulator */
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 8117536343ab..a333ca954129 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -148,6 +148,7 @@
 #define EM28178_BOARD_PLEX_PX_BCUD                98
 #define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_DVB  99
 #define EM28174_BOARD_HAUPPAUGE_WINTV_DUALHD_01595 100
+#define EM2884_BOARD_TERRATEC_H6		  101
 
 /* Limits minimum and default number of buffers */
 #define EM28XX_MIN_BUF 4
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct
  2017-05-01 11:38 [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct Mauro Carvalho Chehab
  2017-05-01 11:38 ` [PATCH 2/2] em28xx: add support for new revisions of Terratec H6 Mauro Carvalho Chehab
@ 2017-05-01 14:11 ` Frank Schäfer
  2017-05-01 14:21   ` Devin Heitmueller
  2017-05-01 17:54   ` Mauro Carvalho Chehab
  1 sibling, 2 replies; 6+ messages in thread
From: Frank Schäfer @ 2017-05-01 14:11 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Linux Media Mailing List, Linux Doc Mailing List
  Cc: Mauro Carvalho Chehab


Am 01.05.2017 um 13:38 schrieb Mauro Carvalho Chehab:
> Right now, all devices use bus 0 for eeprom. However, newer
> versions of Terratec H6 use a different buffer for eeprom.
>
> So, add support to use a different I2C address for eeprom.

Has this been tested ?
Did you read my reply to the previous patch version ?:
See http://www.spinics.net/lists/linux-media/msg114860.html

I doubt it will work. At least not for the device from the thread in the
Kodi-forum.

Regards,
Frank

> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> ---
>  drivers/media/usb/em28xx/em28xx-cards.c | 1 +
>  drivers/media/usb/em28xx/em28xx-i2c.c   | 5 +----
>  drivers/media/usb/em28xx/em28xx.h       | 4 +++-
>  3 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
> index a12b599a1fa2..c7754303e88e 100644
> --- a/drivers/media/usb/em28xx/em28xx-cards.c
> +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> @@ -2669,6 +2669,7 @@ static inline void em28xx_set_model(struct em28xx *dev)
>  
>  	/* Should be initialized early, for I2C to work */
>  	dev->def_i2c_bus = dev->board.def_i2c_bus;
> +	dev->eeprom_i2c_bus = dev->board.eeprom_i2c_bus;
>  }
>  
>  /* Wait until AC97_RESET reports the expected value reliably before proceeding.
> diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
> index 8c472d5adb50..df0ab4b6f18f 100644
> --- a/drivers/media/usb/em28xx/em28xx-i2c.c
> +++ b/drivers/media/usb/em28xx/em28xx-i2c.c
> @@ -665,8 +665,6 @@ static int em28xx_i2c_eeprom(struct em28xx *dev, unsigned bus,
>  	*eedata = NULL;
>  	*eedata_len = 0;
>  
> -	/* EEPROM is always on i2c bus 0 on all known devices. */
> -
>  	dev->i2c_client[bus].addr = 0xa0 >> 1;
>  
>  	/* Check if board has eeprom */
> @@ -975,8 +973,7 @@ int em28xx_i2c_register(struct em28xx *dev, unsigned bus,
>  	dev->i2c_client[bus] = em28xx_client_template;
>  	dev->i2c_client[bus].adapter = &dev->i2c_adap[bus];
>  
> -	/* Up to now, all eeproms are at bus 0 */
> -	if (!bus) {
> +	if (bus == dev->eeprom_i2c_bus) {
>  		retval = em28xx_i2c_eeprom(dev, bus, &dev->eedata, &dev->eedata_len);
>  		if ((retval < 0) && (retval != -ENODEV)) {
>  			dev_err(&dev->intf->dev,
> diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
> index e8d97d5ec161..8117536343ab 100644
> --- a/drivers/media/usb/em28xx/em28xx.h
> +++ b/drivers/media/usb/em28xx/em28xx.h
> @@ -440,7 +440,8 @@ struct em28xx_board {
>  	int vchannels;
>  	int tuner_type;
>  	int tuner_addr;
> -	unsigned def_i2c_bus;	/* Default I2C bus */
> +	unsigned def_i2c_bus;		/* Default I2C bus */
> +	unsigned eeprom_i2c_bus;	/* EEPROM I2C bus */
>  
>  	/* i2c flags */
>  	unsigned int tda9887_conf;
> @@ -643,6 +644,7 @@ struct em28xx {
>  
>  	unsigned char eeprom_addrwidth_16bit:1;
>  	unsigned def_i2c_bus;	/* Default I2C bus */
> +	unsigned eeprom_i2c_bus;/* EEPROM I2C bus */
>  	unsigned cur_i2c_bus;	/* Current I2C bus */
>  	struct rt_mutex i2c_bus_lock;
>  

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct
  2017-05-01 14:11 ` [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct Frank Schäfer
@ 2017-05-01 14:21   ` Devin Heitmueller
  2017-05-01 17:54   ` Mauro Carvalho Chehab
  1 sibling, 0 replies; 6+ messages in thread
From: Devin Heitmueller @ 2017-05-01 14:21 UTC (permalink / raw)
  To: Frank Schäfer
  Cc: Mauro Carvalho Chehab, Linux Media Mailing List,
	Linux Doc Mailing List, Mauro Carvalho Chehab

On Mon, May 1, 2017 at 10:11 AM, Frank Schäfer
<fschaefer.oss@googlemail.com> wrote:
>
> Am 01.05.2017 um 13:38 schrieb Mauro Carvalho Chehab:
>> Right now, all devices use bus 0 for eeprom. However, newer
>> versions of Terratec H6 use a different buffer for eeprom.
>>
>> So, add support to use a different I2C address for eeprom.
>
> Has this been tested ?
> Did you read my reply to the previous patch version ?:
> See http://www.spinics.net/lists/linux-media/msg114860.html
>
> I doubt it will work. At least not for the device from the thread in the
> Kodi-forum.

Based on what I know about the Empia 2874/2884 design, I would be
absolutely shocked if the eeprom was really on the second I2C bus.
The boot code in ROM requires the eeprom to be on bus 0 in order to
find the 8051 microcode to be executed.  This is a documented hardware
design requirement.

I have seen designs where the first bus is accessible through an I2C
gate on a demodulator on the second bus.  This creates a multi-master
situation and I have no idea why anyone would ever do this.  However
it does explain a situation where the EEPROM could be optionally
accessed via the second bus (if the I2C gate on the demod was open at
the time).

Devin

-- 
Devin J. Heitmueller - Kernel Labs
http://www.kernellabs.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct
  2017-05-01 14:11 ` [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct Frank Schäfer
  2017-05-01 14:21   ` Devin Heitmueller
@ 2017-05-01 17:54   ` Mauro Carvalho Chehab
  2017-05-02 17:00     ` Frank Schäfer
  1 sibling, 1 reply; 6+ messages in thread
From: Mauro Carvalho Chehab @ 2017-05-01 17:54 UTC (permalink / raw)
  To: Frank Schäfer
  Cc: Linux Media Mailing List, Linux Doc Mailing List, Mauro Carvalho Chehab

Hi Frank,

Em Mon, 1 May 2017 16:11:51 +0200
Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:

> Am 01.05.2017 um 13:38 schrieb Mauro Carvalho Chehab:
> > Right now, all devices use bus 0 for eeprom. However, newer
> > versions of Terratec H6 use a different buffer for eeprom.
> >
> > So, add support to use a different I2C address for eeprom.  
> 
> Has this been tested ?
> Did you read my reply to the previous patch version ?:
> See http://www.spinics.net/lists/linux-media/msg114860.html
> 
> I doubt it will work. At least not for the device from the thread in the
> Kodi-forum.

Yes. Someone at IRC were complaining about this device (his nick is
buxy81). According with the tests he did, with both patches his
device is now working.

That's said, it would be great if he could provide us more details
about the tests he did, with the logs enabled, in order for us to see
if the eeprom contents is properly read.


Thanks,
Mauro

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct
  2017-05-01 17:54   ` Mauro Carvalho Chehab
@ 2017-05-02 17:00     ` Frank Schäfer
  0 siblings, 0 replies; 6+ messages in thread
From: Frank Schäfer @ 2017-05-02 17:00 UTC (permalink / raw)
  To: Mauro Carvalho Chehab
  Cc: Linux Media Mailing List, Linux Doc Mailing List, Mauro Carvalho Chehab


Am 01.05.2017 um 19:54 schrieb Mauro Carvalho Chehab:
> Hi Frank,
>
> Em Mon, 1 May 2017 16:11:51 +0200
> Frank Schäfer <fschaefer.oss@googlemail.com> escreveu:
>
>> Am 01.05.2017 um 13:38 schrieb Mauro Carvalho Chehab:
>>> Right now, all devices use bus 0 for eeprom. However, newer
>>> versions of Terratec H6 use a different buffer for eeprom.
>>>
>>> So, add support to use a different I2C address for eeprom.  
>> Has this been tested ?
>> Did you read my reply to the previous patch version ?:
>> See http://www.spinics.net/lists/linux-media/msg114860.html
>>
>> I doubt it will work. At least not for the device from the thread in the
>> Kodi-forum.
> Yes. Someone at IRC were complaining about this device (his nick is
> buxy81). 
Ahh, you are in contact with him ? That's good.

> According with the tests he did, with both patches his
> device is now working.
I guess it works because (due to the first patch) no eeprom is detected
anymore.
In this case the driver prints a "board has no eeprom" message to the
log and continues.

> That's said, it would be great if he could provide us more details
> about the tests he did, with the logs enabled, in order for us to see
> if the eeprom contents is properly read.
Yes, further tests/details are required.
Can you ask him to join the list ?

Regards,
Frank



>
>
> Thanks,
> Mauro

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-05-02 17:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-01 11:38 [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct Mauro Carvalho Chehab
2017-05-01 11:38 ` [PATCH 2/2] em28xx: add support for new revisions of Terratec H6 Mauro Carvalho Chehab
2017-05-01 14:11 ` [PATCH 1/2] em28xx: allow setting the eeprom bus at cards struct Frank Schäfer
2017-05-01 14:21   ` Devin Heitmueller
2017-05-01 17:54   ` Mauro Carvalho Chehab
2017-05-02 17:00     ` Frank Schäfer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.