linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wolfram Sang <wsa@the-dreams.de>
To: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: linux-arm-kernel@lists.infradead.org,
	Matthias Brugger <matthias.bgg@gmail.com>,
	Jun Gao <jun.gao@mediatek.com>,
	Ryder Lee <ryder.lee@mediatek.com>,
	linux-i2c@vger.kernel.org, linux-mediatek@lists.infradead.org,
	linux-kernel@vger.kernel.org, qii.wang@mediatek.com
Subject: Re: [PATCH] i2c: mediatek: modify threshold passed to i2c_get_dma_safe_msg_buf()
Date: Fri, 8 Mar 2019 12:29:19 +0100	[thread overview]
Message-ID: <20190308112919.GA1674@kunai> (raw)
In-Reply-To: <CAJMQK-jzvMBD_AaB7XMJtMqNWiEin25bem4Zo9T5W86Z-U=Tww@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1722 bytes --]

On Fri, Feb 22, 2019 at 02:04:11PM +0800, Hsin-Yi Wang wrote:
> Thanks for the solution.
> Previously we were testing if the driver can handle zero-length
> transfer, but it turns out it will timeout. (Also checked this from
> mtk's datasheet)
> Adding original owner qii.wang to verify that. We'll apply this after
> verification.

I just checked this issue again and concluded that both are reasonable,
the suggestion from me below with the adapter quirk AND your original
patch setting the threshold to 1. With my suggestion the core will
prevent 0-length messages. But still, we should set the threshold to 1
because 0 is a value the HW is not capable of.

> 
> On Sat, Feb 16, 2019 at 12:36 AM Wolfram Sang <wsa@the-dreams.de> wrote:
> >
> >
> > >> > Ok, I can add a check in another patch. Should we return NULL pointer
> > >> > if msg->len is 0 or print out some warnings? Thanks.
> > >>
> > >> No warning, msg->len == 0 is a valid setting. But interesting question:
> > >> I was about to say NULL, but your driver would assume ENOMEM there and
> > >> discard the message which is also not correct since msg->len == 0 is a
> > >> valid setting. So, should we just return msg->buf then? Will this work
> > >> with your driver? Can it handle zero-length transfers?
> > >
> > > dma_map_single(i2c->dev, msg->buf , msgs->len, DMA_TO_DEVICE); breaks
> > > kernel if msgs->len is 0, so I think it doesn't handle zero-length transfer.
> >
> > Please don't drop the lists.
> >
> > Then, the correct solution is to forbid those transfer with this
> > controller. Check I2C_AQ_NO_ZERO_LEN. Also, update the functionality
> > like this .. (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK).
> >

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2019-03-08 11:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15  9:02 [PATCH] i2c: mediatek: modify threshold passed to i2c_get_dma_safe_msg_buf() Hsin-Yi Wang
2019-02-15  9:09 ` Wolfram Sang
2019-02-15  9:17   ` Hsin-Yi Wang
2019-02-15  9:25     ` Wolfram Sang
2019-02-15 16:36       ` Wolfram Sang
2019-02-22  6:04         ` Hsin-Yi Wang
2019-03-08 11:29           ` Wolfram Sang [this message]
2019-03-08 14:39             ` Hsin-Yi Wang
2019-03-08 14:52               ` Wolfram Sang
2019-03-08 16:22                 ` Hsin-Yi Wang
2019-03-09  9:42 ` Wolfram Sang

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=20190308112919.GA1674@kunai \
    --to=wsa@the-dreams.de \
    --cc=hsinyi@chromium.org \
    --cc=jun.gao@mediatek.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=matthias.bgg@gmail.com \
    --cc=qii.wang@mediatek.com \
    --cc=ryder.lee@mediatek.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).