diff mbox

[2/2,media] cx231xx: Fix I2C on Internal Master 3 Bus

Message ID 20170207193514.14929-2-oleg@kaa.org.ua (mailing list archive)
State New, archived
Headers show

Commit Message

Oleh Kravchenko Feb. 7, 2017, 7:35 p.m. UTC
Internal Master 3 Bus can send and receive only 4 bytes per time.

Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
---
 drivers/media/usb/cx231xx/cx231xx-core.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Antti Palosaari Feb. 13, 2017, 4:58 a.m. UTC | #1
On 02/07/2017 09:35 PM, Oleh Kravchenko wrote:
> Internal Master 3 Bus can send and receive only 4 bytes per time.
>
> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
> ---
>  drivers/media/usb/cx231xx/cx231xx-core.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
> index 550ec93..46646ec 100644
> --- a/drivers/media/usb/cx231xx/cx231xx-core.c
> +++ b/drivers/media/usb/cx231xx/cx231xx-core.c
> @@ -355,7 +355,12 @@ int cx231xx_send_vendor_cmd(struct cx231xx *dev,
>  	 */
>  	if ((ven_req->wLength > 4) && ((ven_req->bRequest == 0x4) ||
>  					(ven_req->bRequest == 0x5) ||
> -					(ven_req->bRequest == 0x6))) {
> +					(ven_req->bRequest == 0x6) ||
> +
> +					/* Internal Master 3 Bus can send
> +					 * and receive only 4 bytes per time
> +					 */
> +					(ven_req->bRequest == 0x2))) {
>  		unsend_size = 0;
>  		pdata = ven_req->pBuff;
>
>

Good that you finally got i2c fixed properly and get rid of that ugly 
device specific hack.

That new comment still does not open for me, why you call i2c bus tuner 
sits as internal?

There is now commands 2, 4, 5, and 6 that should be split to 4 byte 
long, is there any vendor command that could be longer? Maybe you could 
just add single comment which states what all those 4 commands are.

Your patches are still on wrong order - you should first fix i2c and 
after that add device support.

regards
Antti
Oleh Kravchenko Feb. 13, 2017, 7:38 a.m. UTC | #2
On 13.02.17 06:58, Antti Palosaari wrote:
> On 02/07/2017 09:35 PM, Oleh Kravchenko wrote:
>> Internal Master 3 Bus can send and receive only 4 bytes per time.
>>
>> Signed-off-by: Oleh Kravchenko <oleg@kaa.org.ua>
>> ---
>>  drivers/media/usb/cx231xx/cx231xx-core.c | 7 ++++++-
>>  1 file changed, 6 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
>> index 550ec93..46646ec 100644
>> --- a/drivers/media/usb/cx231xx/cx231xx-core.c
>> +++ b/drivers/media/usb/cx231xx/cx231xx-core.c
>> @@ -355,7 +355,12 @@ int cx231xx_send_vendor_cmd(struct cx231xx *dev,
>>       */
>>      if ((ven_req->wLength > 4) && ((ven_req->bRequest == 0x4) ||
>>                      (ven_req->bRequest == 0x5) ||
>> -                    (ven_req->bRequest == 0x6))) {
>> +                    (ven_req->bRequest == 0x6) ||
>> +
>> +                    /* Internal Master 3 Bus can send
>> +                     * and receive only 4 bytes per time
>> +                     */
>> +                    (ven_req->bRequest == 0x2))) {
>>          unsend_size = 0;
>>          pdata = ven_req->pBuff;
>>
>>
> 
> Good that you finally got i2c fixed properly and get rid of that ugly device specific hack.
> 
> That new comment still does not open for me, why you call i2c bus tuner sits as internal?
 
Because Sri Deevi called it:
        /* Internal Master 3 Bus */
        dev->i2c_bus[2].nr = 2;
        dev->i2c_bus[2].dev = dev;
        dev->i2c_bus[2].i2c_period = I2C_SPEED_100K;    /* 100kHz */
        dev->i2c_bus[2].i2c_nostop = 0;
        dev->i2c_bus[2].i2c_reserve = 0;

> There is now commands 2, 4, 5, and 6 that should be split to 4 byte long, is there any vendor command that could be longer? Maybe you could just add single comment which states what all those 4 commands are.

Those commands is I2C bus numbers, plus read flag:
	0 - write to I2C_0	0+4 - read from I2C_0
	1 - write to I2C_1	1+4 - read from I2C_1
	2 - write to I2C_2	2+4 - read from I2C_2
So I think my comment is good enough.
 
> Your patches are still on wrong order - you should first fix i2c and after that add device support.

Looks like I can't change this, it already merged into linux-next :)

> regards
> Antti
diff mbox

Patch

diff --git a/drivers/media/usb/cx231xx/cx231xx-core.c b/drivers/media/usb/cx231xx/cx231xx-core.c
index 550ec93..46646ec 100644
--- a/drivers/media/usb/cx231xx/cx231xx-core.c
+++ b/drivers/media/usb/cx231xx/cx231xx-core.c
@@ -355,7 +355,12 @@  int cx231xx_send_vendor_cmd(struct cx231xx *dev,
 	 */
 	if ((ven_req->wLength > 4) && ((ven_req->bRequest == 0x4) ||
 					(ven_req->bRequest == 0x5) ||
-					(ven_req->bRequest == 0x6))) {
+					(ven_req->bRequest == 0x6) ||
+
+					/* Internal Master 3 Bus can send
+					 * and receive only 4 bytes per time
+					 */
+					(ven_req->bRequest == 0x2))) {
 		unsend_size = 0;
 		pdata = ven_req->pBuff;