From: rishi gupta <gupt21@gmail.com>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Jiri Kosina <jikos@kernel.org>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
wsa+renesas@sang-engineering.com,
Greg KH <gregkh@linuxfoundation.org>,
Linux I2C <linux-i2c@vger.kernel.org>,
"open list:HID CORE LAYER" <linux-input@vger.kernel.org>,
lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3] HID: mcp2221: add usb to i2c-smbus host bridge
Date: Tue, 10 Mar 2020 18:24:10 +0530 [thread overview]
Message-ID: <CALUj-guKqkRKVKDa1U+gv0rLx23zc5cFT3Qnakp4muk9LSUYfQ@mail.gmail.com> (raw)
In-Reply-To: <20200310122934.GA13896@ninjato>
I will send two more patches in sometime.
Patch 1: Define i2c_adapter_quirks to let i2c core check msg's order,
type and length
As of now this driver itself is doing this sanity.
Patch 2: Add support for GPIO functionality
On Tue, Mar 10, 2020 at 5:59 PM Wolfram Sang <wsa@the-dreams.de> wrote:
>
>
> > + if (num == 1) {
> > + if (msgs->flags & I2C_M_RD) {
> > + ret = mcp_i2c_smbus_read(mcp, msgs, MCP2221_I2C_RD_DATA,
> > + 0, 0, NULL);
> > + } else {
> > + ret = mcp_i2c_write(mcp, msgs, MCP2221_I2C_WR_DATA, 1);
> > + }
> > + if (ret)
> > + goto exit;
> > + ret = num;
> > + } else if (num == 2) {
> > + /* Ex transaction; send reg address and read its contents */
> > + if (msgs[0].addr == msgs[1].addr &&
> > + !(msgs[0].flags & I2C_M_RD) &&
> > + (msgs[1].flags & I2C_M_RD)) {
> > +
> > + ret = mcp_i2c_write(mcp, &msgs[0],
> > + MCP2221_I2C_WR_NO_STOP, 0);
> > + if (ret)
> > + goto exit;
> > +
> > + ret = mcp_i2c_smbus_read(mcp, &msgs[1],
> > + MCP2221_I2C_RD_RPT_START,
> > + 0, 0, NULL);
> > + if (ret)
> > + goto exit;
> > + ret = num;
> > + } else {
> > + dev_err(&adapter->dev,
> > + "unsupported multi-msg i2c transaction\n");
> > + ret = -EOPNOTSUPP;
> > + }
> > + } else {
> > + dev_err(&adapter->dev,
> > + "unsupported multi-msg i2c transaction\n");
> > + ret = -EOPNOTSUPP;
> > + }
>
> Have a look at struct i2c_adapter_quirks and especially the flags to let
> the I2C core do the sanity checks from here.
>
prev parent reply other threads:[~2020-03-10 13:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-28 4:18 [PATCH v3] HID: mcp2221: add usb to i2c-smbus host bridge Rishi Gupta
2020-02-10 13:50 ` rishi gupta
2020-03-02 8:38 ` rishi gupta
2020-03-10 11:42 ` Jiri Kosina
2020-03-10 12:11 ` rishi gupta
2020-03-10 12:29 ` Wolfram Sang
2020-03-10 12:54 ` rishi gupta [this message]
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=CALUj-guKqkRKVKDa1U+gv0rLx23zc5cFT3Qnakp4muk9LSUYfQ@mail.gmail.com \
--to=gupt21@gmail.com \
--cc=benjamin.tissoires@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=jikos@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wsa+renesas@sang-engineering.com \
--cc=wsa@the-dreams.de \
/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).