All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit
@ 2015-06-06  7:44 Olli Salonen
  2015-06-06  7:44 ` [PATCH 2/2] Revert "[media] saa7164: Improvements for I2C handling" Olli Salonen
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Olli Salonen @ 2015-06-06  7:44 UTC (permalink / raw)
  To: linux-media; +Cc: Olli Salonen

The i2c_reg_len for Si2168 should be 0 for correct I2C communication.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
 drivers/media/pci/saa7164/saa7164-cards.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/saa7164/saa7164-cards.c b/drivers/media/pci/saa7164/saa7164-cards.c
index 8a6455d..c2b7382 100644
--- a/drivers/media/pci/saa7164/saa7164-cards.c
+++ b/drivers/media/pci/saa7164/saa7164-cards.c
@@ -621,7 +621,7 @@ struct saa7164_board saa7164_boards[] = {
 			.name		= "SI2168-1",
 			.i2c_bus_nr	= SAA7164_I2C_BUS_2,
 			.i2c_bus_addr	= 0xc8 >> 1,
-			.i2c_reg_len	= REGLEN_8bit,
+			.i2c_reg_len	= REGLEN_0bit,
 		}, {
 			.id		= 0x25,
 			.type		= SAA7164_UNIT_TUNER,
@@ -635,7 +635,7 @@ struct saa7164_board saa7164_boards[] = {
 			.name		= "SI2168-2",
 			.i2c_bus_nr	= SAA7164_I2C_BUS_2,
 			.i2c_bus_addr	= 0xcc >> 1,
-			.i2c_reg_len	= REGLEN_8bit,
+			.i2c_reg_len	= REGLEN_0bit,
 		} },
 	},
 };
-- 
1.9.1


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

* [PATCH 2/2] Revert "[media] saa7164: Improvements for I2C handling"
  2015-06-06  7:44 [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit Olli Salonen
@ 2015-06-06  7:44 ` Olli Salonen
  2015-06-06  9:11   ` Antti Palosaari
  2015-06-11 19:48   ` Steven Toth
  2015-06-06  9:10 ` [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit Antti Palosaari
  2015-06-11 19:46 ` Steven Toth
  2 siblings, 2 replies; 6+ messages in thread
From: Olli Salonen @ 2015-06-06  7:44 UTC (permalink / raw)
  To: linux-media; +Cc: Olli Salonen

This reverts commit ad90b6b0f10566d4a5546e27fe455ce3b5e6b6c7.

This patch breaks I2C communication towards Si2168. After reverting and 
applying the other patch in this series the I2C communication is 
correct.

Signed-off-by: Olli Salonen <olli.salonen@iki.fi>
---
 drivers/media/pci/saa7164/saa7164-api.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/media/pci/saa7164/saa7164-api.c b/drivers/media/pci/saa7164/saa7164-api.c
index e807703..e7e586c 100644
--- a/drivers/media/pci/saa7164/saa7164-api.c
+++ b/drivers/media/pci/saa7164/saa7164-api.c
@@ -1385,8 +1385,7 @@ int saa7164_api_i2c_read(struct saa7164_i2c *bus, u8 addr, u32 reglen, u8 *reg,
 	 *       08... register address
 	 */
 	memset(buf, 0, sizeof(buf));
-	if (reg)
-		memcpy((buf + 2 * sizeof(u32) + 0), reg, reglen);
+	memcpy((buf + 2 * sizeof(u32) + 0), reg, reglen);
 	*((u32 *)(buf + 0 * sizeof(u32))) = reglen;
 	*((u32 *)(buf + 1 * sizeof(u32))) = datalen;
 
@@ -1475,14 +1474,6 @@ int saa7164_api_i2c_write(struct saa7164_i2c *bus, u8 addr, u32 datalen,
 	 *       04-07 dest bytes to write
 	 *       08... register address
 	 */
-	if (datalen == 1) {
-		/* Workaround for issues with i2c components
-		 * that issue writes with no data. IE: SI2168/2157
-		 * Increase reglen by 1, strobe out an additional byte,
-		 * ignored by SI2168/2157.
-		 */
-		datalen++;
-	}
 	*((u32 *)(buf + 0 * sizeof(u32))) = reglen;
 	*((u32 *)(buf + 1 * sizeof(u32))) = datalen - reglen;
 	memcpy((buf + 2 * sizeof(u32)), data, datalen);
-- 
1.9.1


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

* Re: [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit
  2015-06-06  7:44 [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit Olli Salonen
  2015-06-06  7:44 ` [PATCH 2/2] Revert "[media] saa7164: Improvements for I2C handling" Olli Salonen
@ 2015-06-06  9:10 ` Antti Palosaari
  2015-06-11 19:46 ` Steven Toth
  2 siblings, 0 replies; 6+ messages in thread
From: Antti Palosaari @ 2015-06-06  9:10 UTC (permalink / raw)
  To: Olli Salonen, linux-media

On 06/06/2015 10:44 AM, Olli Salonen wrote:
> The i2c_reg_len for Si2168 should be 0 for correct I2C communication.
>
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>

Reviewed-by: Antti Palosaari <crope@iki.fi>

PS. As I mentioned few times already, that kind I2C client register map 
layout information does not belongs to adapter level at all. I wonder 
why it is here. Likely some further clean-ups are possible.

regards
Antti


> ---
>   drivers/media/pci/saa7164/saa7164-cards.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/pci/saa7164/saa7164-cards.c b/drivers/media/pci/saa7164/saa7164-cards.c
> index 8a6455d..c2b7382 100644
> --- a/drivers/media/pci/saa7164/saa7164-cards.c
> +++ b/drivers/media/pci/saa7164/saa7164-cards.c
> @@ -621,7 +621,7 @@ struct saa7164_board saa7164_boards[] = {
>   			.name		= "SI2168-1",
>   			.i2c_bus_nr	= SAA7164_I2C_BUS_2,
>   			.i2c_bus_addr	= 0xc8 >> 1,
> -			.i2c_reg_len	= REGLEN_8bit,
> +			.i2c_reg_len	= REGLEN_0bit,
>   		}, {
>   			.id		= 0x25,
>   			.type		= SAA7164_UNIT_TUNER,
> @@ -635,7 +635,7 @@ struct saa7164_board saa7164_boards[] = {
>   			.name		= "SI2168-2",
>   			.i2c_bus_nr	= SAA7164_I2C_BUS_2,
>   			.i2c_bus_addr	= 0xcc >> 1,
> -			.i2c_reg_len	= REGLEN_8bit,
> +			.i2c_reg_len	= REGLEN_0bit,
>   		} },
>   	},
>   };
>

-- 
http://palosaari.fi/

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

* Re: [PATCH 2/2] Revert "[media] saa7164: Improvements for I2C handling"
  2015-06-06  7:44 ` [PATCH 2/2] Revert "[media] saa7164: Improvements for I2C handling" Olli Salonen
@ 2015-06-06  9:11   ` Antti Palosaari
  2015-06-11 19:48   ` Steven Toth
  1 sibling, 0 replies; 6+ messages in thread
From: Antti Palosaari @ 2015-06-06  9:11 UTC (permalink / raw)
  To: Olli Salonen, linux-media

On 06/06/2015 10:44 AM, Olli Salonen wrote:
> This reverts commit ad90b6b0f10566d4a5546e27fe455ce3b5e6b6c7.
>
> This patch breaks I2C communication towards Si2168. After reverting and
> applying the other patch in this series the I2C communication is
> correct.
>
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>

Reviewed-by: Antti Palosaari <crope@iki.fi>

Antti

> ---
>   drivers/media/pci/saa7164/saa7164-api.c | 11 +----------
>   1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/media/pci/saa7164/saa7164-api.c b/drivers/media/pci/saa7164/saa7164-api.c
> index e807703..e7e586c 100644
> --- a/drivers/media/pci/saa7164/saa7164-api.c
> +++ b/drivers/media/pci/saa7164/saa7164-api.c
> @@ -1385,8 +1385,7 @@ int saa7164_api_i2c_read(struct saa7164_i2c *bus, u8 addr, u32 reglen, u8 *reg,
>   	 *       08... register address
>   	 */
>   	memset(buf, 0, sizeof(buf));
> -	if (reg)
> -		memcpy((buf + 2 * sizeof(u32) + 0), reg, reglen);
> +	memcpy((buf + 2 * sizeof(u32) + 0), reg, reglen);
>   	*((u32 *)(buf + 0 * sizeof(u32))) = reglen;
>   	*((u32 *)(buf + 1 * sizeof(u32))) = datalen;
>
> @@ -1475,14 +1474,6 @@ int saa7164_api_i2c_write(struct saa7164_i2c *bus, u8 addr, u32 datalen,
>   	 *       04-07 dest bytes to write
>   	 *       08... register address
>   	 */
> -	if (datalen == 1) {
> -		/* Workaround for issues with i2c components
> -		 * that issue writes with no data. IE: SI2168/2157
> -		 * Increase reglen by 1, strobe out an additional byte,
> -		 * ignored by SI2168/2157.
> -		 */
> -		datalen++;
> -	}
>   	*((u32 *)(buf + 0 * sizeof(u32))) = reglen;
>   	*((u32 *)(buf + 1 * sizeof(u32))) = datalen - reglen;
>   	memcpy((buf + 2 * sizeof(u32)), data, datalen);
>

-- 
http://palosaari.fi/

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

* Re: [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit
  2015-06-06  7:44 [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit Olli Salonen
  2015-06-06  7:44 ` [PATCH 2/2] Revert "[media] saa7164: Improvements for I2C handling" Olli Salonen
  2015-06-06  9:10 ` [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit Antti Palosaari
@ 2015-06-11 19:46 ` Steven Toth
  2 siblings, 0 replies; 6+ messages in thread
From: Steven Toth @ 2015-06-11 19:46 UTC (permalink / raw)
  To: Olli Salonen; +Cc: Linux-Media

On Sat, Jun 6, 2015 at 3:44 AM, Olli Salonen <olli.salonen@iki.fi> wrote:
> The i2c_reg_len for Si2168 should be 0 for correct I2C communication.
>
> Signed-off-by: Olli Salonen <olli.salonen@iki.fi>

Tested-By: Steven Toth <stoth@kernellabs.com>

Checked with a HVR-2205 and a HVR-2215, firmware loads as expected.

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.com

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

* Re: [PATCH 2/2] Revert "[media] saa7164: Improvements for I2C handling"
  2015-06-06  7:44 ` [PATCH 2/2] Revert "[media] saa7164: Improvements for I2C handling" Olli Salonen
  2015-06-06  9:11   ` Antti Palosaari
@ 2015-06-11 19:48   ` Steven Toth
  1 sibling, 0 replies; 6+ messages in thread
From: Steven Toth @ 2015-06-11 19:48 UTC (permalink / raw)
  To: Olli Salonen; +Cc: Linux-Media

On Sat, Jun 6, 2015 at 3:44 AM, Olli Salonen <olli.salonen@iki.fi> wrote:
> This reverts commit ad90b6b0f10566d4a5546e27fe455ce3b5e6b6c7.
>
> This patch breaks I2C communication towards Si2168. After reverting and
> applying the other patch in this series the I2C communication is
> correct.

Tested-By: Steven Toth <stoth@kernellabs.com>

Checked with a HVR-2205 and a HVR-2215, firmware loads as expected.

Thanks for chasing this down Olli.

-- 
Steven Toth - Kernel Labs
http://www.kernellabs.com

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

end of thread, other threads:[~2015-06-11 19:48 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-06  7:44 [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit Olli Salonen
2015-06-06  7:44 ` [PATCH 2/2] Revert "[media] saa7164: Improvements for I2C handling" Olli Salonen
2015-06-06  9:11   ` Antti Palosaari
2015-06-11 19:48   ` Steven Toth
2015-06-06  9:10 ` [PATCH 1/2] saa7164: change Si2168 reglen to 0 bit Antti Palosaari
2015-06-11 19:46 ` Steven Toth

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.