[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAD=FV=VV1U2o41iz_NANvk=EZcMcrurvhN31s--_srU=4yuWcA@mail.gmail.com>
Date: Wed, 1 Oct 2014 15:47:06 -0700
From: Doug Anderson <dianders@...omium.org>
To: Alexandru M Stan <amstan@...omium.org>
Cc: Max Schwarz <max.schwarz@...ine.de>,
Wolfram Sang <wsa@...-dreams.de>,
Sonny Rao <sonnyrao@...omium.org>,
addy ke <addy.ke@...k-chips.com>,
Jeffy Chen <jeffy.chen@...k-chips.com>,
ZhengShunQian <zhengsq@...k-chips.com>,
linux-rockchip@...ts.infradead.org,
Heiko Stübner <heiko@...ech.de>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] i2c: rk3x: fix 0 length write transfers
Alex,
On Wed, Oct 1, 2014 at 10:40 AM, Alexandru M Stan <amstan@...omium.org> wrote:
> i2cdetect -q was broken (everything was a false positive, and no transfers were
> actually being sent over i2c). The way it works is by sending a 0 length write
> request and checking for NACK. This patch fixes the 0 length writes and actually
> sends them.
>
> Reported-by: Doug Anderson <dianders@...omium.org>
> Signed-off-by: Alexandru M Stan <amstan@...omium.org>
> ---
> drivers/i2c/busses/i2c-rk3x.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
> index b41d979..f486d0e 100644
> --- a/drivers/i2c/busses/i2c-rk3x.c
> +++ b/drivers/i2c/busses/i2c-rk3x.c
> @@ -238,7 +238,7 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c)
> for (i = 0; i < 8; ++i) {
> val = 0;
> for (j = 0; j < 4; ++j) {
> - if (i2c->processed == i2c->msg->len)
> + if ((i2c->processed == i2c->msg->len) && (cnt != 0))
This looks good to me. Basically we still need to write the address
of the device onto the bus even if there's no data.
Reviewed-by: Doug Anderson <dianders@...omium.org>
Tested-by: Doug Anderson <dianders@...omium.org>
-Doug
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists