diff mbox

[V2,13/13] cx231xx: scan all four existing i2c busses instead of the 3 masters

Message ID 1412140821-16285-14-git-send-email-zzam@gentoo.org (mailing list archive)
State New, archived
Headers show

Commit Message

Matthias Schwarzott Oct. 1, 2014, 5:20 a.m. UTC
The scanning itself just fails (as before this series) but now the correct busses are scanned.

V2: Changed to symbolic names where muxed adapters can be seen directly.

Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
---
 drivers/media/usb/cx231xx/cx231xx-core.c | 6 ++++++
 drivers/media/usb/cx231xx/cx231xx-i2c.c  | 8 ++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

Comments

Antti Palosaari Oct. 1, 2014, 7:47 p.m. UTC | #1
Reviewed-by: Antti Palosaari <crope@iki.fi>

btw. is there some reason you those on that order? I mean you scan I2C_2 
between MUX segments?

Antti

On 10/01/2014 08:20 AM, Matthias Schwarzott wrote:
> The scanning itself just fails (as before this series) but now the correct busses are scanned.
>
> V2: Changed to symbolic names where muxed adapters can be seen directly.
>
> Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
> ---
>   drivers/media/usb/cx231xx/cx231xx-core.c | 6 ++++++
>   drivers/media/usb/cx231xx/cx231xx-i2c.c  | 8 ++++----
>   2 files changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
> index c49022f..60dbbbb 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-core.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-core.c
> @@ -1303,6 +1303,12 @@ int cx231xx_dev_init(struct cx231xx *dev)
>   	cx231xx_i2c_mux_register(dev, 0);
>   	cx231xx_i2c_mux_register(dev, 1);
>
> +	/* scan the real bus segments */
> +	cx231xx_do_i2c_scan(dev, I2C_0);
> +	cx231xx_do_i2c_scan(dev, I2C_1_MUX_1);
> +	cx231xx_do_i2c_scan(dev, I2C_2);
> +	cx231xx_do_i2c_scan(dev, I2C_1_MUX_3);
> +
>   	/* init hardware */
>   	/* Note : with out calling set power mode function,
>   	afe can not be set up correctly */
> diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c
> index bb82e6d..0df50d3 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
> @@ -492,6 +492,9 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)
>   	int i, rc;
>   	struct i2c_client client;
>
> +	if (!i2c_scan)
> +		return;
> +
>   	memset(&client, 0, sizeof(client));
>   	client.adapter = cx231xx_get_i2c_adap(dev, i2c_port);
>
> @@ -533,10 +536,7 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)
>   	i2c_set_adapdata(&bus->i2c_adap, &dev->v4l2_dev);
>   	i2c_add_adapter(&bus->i2c_adap);
>
> -	if (0 == bus->i2c_rc) {
> -		if (i2c_scan)
> -			cx231xx_do_i2c_scan(dev, bus->nr);
> -	} else
> +	if (0 != bus->i2c_rc)
>   		cx231xx_warn("%s: i2c bus %d register FAILED\n",
>   			     dev->name, bus->nr);
>
>
Matthias Schwarzott Oct. 2, 2014, 4:31 a.m. UTC | #2
On 01.10.2014 21:47, Antti Palosaari wrote:
> Reviewed-by: Antti Palosaari <crope@iki.fi>
> 
> btw. is there some reason you those on that order? I mean you scan I2C_2
> between MUX segments?
> 
> Antti

Hi Antti,

the only reason is that this is the order of the physical ports.
I can add a comment to the code.

Regards
Matthias
> 
> On 10/01/2014 08:20 AM, Matthias Schwarzott wrote:
>> The scanning itself just fails (as before this series) but now the
>> correct busses are scanned.
>>
>> V2: Changed to symbolic names where muxed adapters can be seen directly.
>>
>> Signed-off-by: Matthias Schwarzott <zzam@gentoo.org>
>> ---
>>   drivers/media/usb/cx231xx/cx231xx-core.c | 6 ++++++
>>   drivers/media/usb/cx231xx/cx231xx-i2c.c  | 8 ++++----
>>   2 files changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c
>> b/drivers/media/usb/cx231xx/cx231xx-core.c
>> index c49022f..60dbbbb 100644
>> --- a/drivers/media/usb/cx231xx/cx231xx-core.c
>> +++ b/drivers/media/usb/cx231xx/cx231xx-core.c
>> @@ -1303,6 +1303,12 @@ int cx231xx_dev_init(struct cx231xx *dev)
>>       cx231xx_i2c_mux_register(dev, 0);
>>       cx231xx_i2c_mux_register(dev, 1);
>>
>> +    /* scan the real bus segments */
>> +    cx231xx_do_i2c_scan(dev, I2C_0);
>> +    cx231xx_do_i2c_scan(dev, I2C_1_MUX_1);
>> +    cx231xx_do_i2c_scan(dev, I2C_2);
>> +    cx231xx_do_i2c_scan(dev, I2C_1_MUX_3);
>> +
>>       /* init hardware */
>>       /* Note : with out calling set power mode function,
>>       afe can not be set up correctly */
>> diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c
>> b/drivers/media/usb/cx231xx/cx231xx-i2c.c
>> index bb82e6d..0df50d3 100644
>> --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
>> +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
>> @@ -492,6 +492,9 @@ void cx231xx_do_i2c_scan(struct cx231xx *dev, int
>> i2c_port)
>>       int i, rc;
>>       struct i2c_client client;
>>
>> +    if (!i2c_scan)
>> +        return;
>> +
>>       memset(&client, 0, sizeof(client));
>>       client.adapter = cx231xx_get_i2c_adap(dev, i2c_port);
>>
>> @@ -533,10 +536,7 @@ int cx231xx_i2c_register(struct cx231xx_i2c *bus)
>>       i2c_set_adapdata(&bus->i2c_adap, &dev->v4l2_dev);
>>       i2c_add_adapter(&bus->i2c_adap);
>>
>> -    if (0 == bus->i2c_rc) {
>> -        if (i2c_scan)
>> -            cx231xx_do_i2c_scan(dev, bus->nr);
>> -    } else
>> +    if (0 != bus->i2c_rc)
>>           cx231xx_warn("%s: i2c bus %d register FAILED\n",
>>                    dev->name, bus->nr);
>>
>>
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
index c49022f..60dbbbb 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -1303,6 +1303,12 @@  int cx231xx_dev_init(struct cx231xx *dev)
 	cx231xx_i2c_mux_register(dev, 0);
 	cx231xx_i2c_mux_register(dev, 1);
 
+	/* scan the real bus segments */
+	cx231xx_do_i2c_scan(dev, I2C_0);
+	cx231xx_do_i2c_scan(dev, I2C_1_MUX_1);
+	cx231xx_do_i2c_scan(dev, I2C_2);
+	cx231xx_do_i2c_scan(dev, I2C_1_MUX_3);
+
 	/* init hardware */
 	/* Note : with out calling set power mode function,
 	afe can not be set up correctly */
diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c b/drivers/media/usb/cx231xx/cx231xx-i2c.c
index bb82e6d..0df50d3 100644
--- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
+++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
@@ -492,6 +492,9 @@  void cx231xx_do_i2c_scan(struct cx231xx *dev, int i2c_port)
 	int i, rc;
 	struct i2c_client client;
 
+	if (!i2c_scan)
+		return;
+
 	memset(&client, 0, sizeof(client));
 	client.adapter = cx231xx_get_i2c_adap(dev, i2c_port);
 
@@ -533,10 +536,7 @@  int cx231xx_i2c_register(struct cx231xx_i2c *bus)
 	i2c_set_adapdata(&bus->i2c_adap, &dev->v4l2_dev);
 	i2c_add_adapter(&bus->i2c_adap);
 
-	if (0 == bus->i2c_rc) {
-		if (i2c_scan)
-			cx231xx_do_i2c_scan(dev, bus->nr);
-	} else
+	if (0 != bus->i2c_rc)
 		cx231xx_warn("%s: i2c bus %d register FAILED\n",
 			     dev->name, bus->nr);