On Wed, Jan 11, 2017 at 9:00 AM, Oleh Kravchenko <o...@kaa.org.ua> wrote:
> On 11.01.17 15:53, Steven Toth wrote:
>>> diff --git a/drivers/media/usb/cx231xx/cx231xx-i2c.c 
>>> b/drivers/media/usb/cx231xx/cx231xx-i2c.c
>>> index 35e9acf..60412ec 100644
>>> --- a/drivers/media/usb/cx231xx/cx231xx-i2c.c
>>> +++ b/drivers/media/usb/cx231xx/cx231xx-i2c.c
>>> @@ -171,6 +171,43 @@ static int cx231xx_i2c_send_bytes(struct i2c_adapter 
>>> *i2c_adap,
>>>                 bus->i2c_nostop = 0;
>>>                 bus->i2c_reserve = 0;
>>>
>>> +       } else if (dev->model == CX231XX_BOARD_EVROMEDIA_FULL_HYBRID_FULLHD
>>> +               && msg->addr == dev->tuner_addr
>>> +               && msg->len > 4) {
>>> +               /* special case for Evromedia USB Full Hybrid Full HD tuner 
>>> chip */
>>> +               size = msg->len;
>>> +               saddr_len = 1;
>>> +
>>> +               /* adjust the length to correct length */
>>> +               size -= saddr_len;
>>> +
>>> +               buf_ptr = (u8*)(msg->buf + 1);
>>> +
>>> +               do {
>>> +                       /* prepare xfer_data struct */
>>> +                       req_data.dev_addr = msg->addr;
>>> +                       req_data.direction = msg->flags;
>>> +                       req_data.saddr_len = saddr_len;
>>> +                       req_data.saddr_dat = msg->buf[0];
>>> +                       req_data.buf_size = size > 4 ? 4 : size;
>>> +                       req_data.p_buffer = (u8*)(buf_ptr + loop * 4);
>>> +
>>> +                       bus->i2c_nostop = (size > 4) ? 1 : 0;
>>> +                       bus->i2c_reserve = (loop == 0) ? 0 : 1;
>>> +
>>> +                       /* usb send command */
>>> +                       status = dev->cx231xx_send_usb_command(bus, 
>>> &req_data);
>>> +                       loop++;
>>> +
>>> +                       if (size >= 4) {
>>> +                               size -= 4;
>>> +                       } else {
>>> +                               size = 0;
>>> +                       }
>>> +               } while (size > 0);
>>> +
>>> +               bus->i2c_nostop = 0;
>>> +               bus->i2c_reserve = 0;
>>>         } else {                /* regular case */
>>>
>>>                 /* prepare xfer_data struct */
>> If the i2c functionality is broken in some way, I suggest its fixed
>> first, along with a correct patch description, as a separate piece of
>> work. Lets not group this in with a board profile.
>>
>> Almost certainly we should never see a "if board == X" in any i2c
>> implementation without proper discussion.
>>
> I'm interested in accepting this patch :) What I should do?

Lets start the conversion with what's wrong with the current
implementation that prevents it from working with the new design.
Lets discuss the I2C needs of the parts you need to communicate with,
and why the current design is broken.

Then, lets think about a better solution.

A BOARD == X is the wrong solution to the problem.


-- 
Steven Toth - Kernel Labs
http://www.kernellabs.com
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to