All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steven Toth <stoth@kernellabs.com>
To: Oleh Kravchenko <oleg@kaa.org.ua>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	"Jacob Johan (Hans) Verkuil" <hverkuil@xs4all.nl>,
	Antti Palosaari <crope@iki.fi>
Subject: Re: [PATCH] [media] cx231xx: Initial support Evromedia USB Full Hybrid Full HD
Date: Wed, 11 Jan 2017 08:53:12 -0500	[thread overview]
Message-ID: <CALzAhNXJYtg+wpmq48DKzznyO2NvmrQYONxK_-Ajb_UESEXrCg@mail.gmail.com> (raw)
In-Reply-To: <20170111100819.2190-1-oleg@kaa.org.ua>

> 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.

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

  reply	other threads:[~2017-01-11 13:53 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 10:08 [PATCH] [media] cx231xx: Initial support Evromedia USB Full Hybrid Full HD Oleh Kravchenko
2017-01-11 13:53 ` Steven Toth [this message]
2017-01-11 14:00   ` Oleh Kravchenko
2017-01-11 14:13     ` Steven Toth
2017-01-11 15:00       ` Broken cx231xx-i2c.c Oleh Kravchenko
2017-01-24  7:16         ` For cx231xx users Oleh Kravchenko
     [not found]       ` <8aa6b3c4-5fcb-d67c-040e-4220e30658f2@kaa.org.ua>
2017-01-11 17:14         ` Broken cx231xx-i2c.c Steven Toth
  -- strict thread matches above, loose matches on Subject: below --
2017-01-29 18:03 [PATCH] [media] cx231xx: Initial support Evromedia USB Full Hybrid Full HD Oleh Kravchenko
2017-01-10 21:41 Oleh Kravchenko
2017-01-11  0:16 ` Antti Palosaari
2017-01-11  7:28   ` Oleh Kravchenko
2017-01-09 21:41 Oleh Kravchenko
2017-01-09 15:23 Oleh Kravchenko
2017-01-09 16:59 ` Antti Palosaari
2017-01-09 21:49   ` Oleh Kravchenko
2017-01-09 22:35     ` Antti Palosaari
2017-01-09 20:08 ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CALzAhNXJYtg+wpmq48DKzznyO2NvmrQYONxK_-Ajb_UESEXrCg@mail.gmail.com \
    --to=stoth@kernellabs.com \
    --cc=crope@iki.fi \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=oleg@kaa.org.ua \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.