From: Andi Shyti <andi.shyti@kernel.org>
To: Ye Xiang <xiang.ye@intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Arnd Bergmann <arnd@arndb.de>,
Matthias Kaehlcke <mka@chromium.org>, Lee Jones <lee@kernel.org>,
Wolfram Sang <wsa@kernel.org>, Tyrone Ting <kfting@nuvoton.com>,
Mark Brown <broonie@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
linux-usb@vger.kernel.org, linux-i2c@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org,
linux-gpio@vger.kernel.org, srinivas.pandruvada@intel.com,
heikki.krogerus@linux.intel.com,
andriy.shevchenko@linux.intel.com, sakari.ailus@linux.intel.com,
zhifeng.wang@intel.com, wentong.wu@intel.com,
lixu.zhang@intel.com
Subject: Re: [PATCH v6 5/6] i2c: Add support for Intel LJCA USB I2C driver
Date: Sun, 26 Mar 2023 17:38:46 +0200 [thread overview]
Message-ID: <20230326153846.zo77mbgti2injnxl@intel.intel> (raw)
In-Reply-To: <20230323172113.1231050-6-xiang.ye@intel.com>
Hi Ye,
looks good, just a few questions:
On Fri, Mar 24, 2023 at 01:21:12AM +0800, Ye Xiang wrote:
> This patch implements the I2C function of Intel USB-I2C/GPIO/SPI adapter
also here, please keep using the imperative form.
> device named "La Jolla Cove Adapter" (LJCA). It communicate with LJCA
> I2c module with specific protocol through interfaces exported by LJCA USB
> driver.
>
> Signed-off-by: Ye Xiang <xiang.ye@intel.com>
[...]
> +enum ljca_xfer_type {
> + LJCA_I2C_READ_XFER_TYPE,
> + LJCA_I2C_WRITE_XFER_TYPE,
> +};
> +
> +/* I2C r/w Flags */
> +#define LJCA_I2C_SLAVE_TRANSFER_WRITE (0)
> +#define LJCA_I2C_SLAVE_TRANSFER_READ (1)
the enum above and the bits here look a bit redundant to me as
they are the same thing.
What's the point for writing something like:
if (type == LJCA_I2C_READ_XFER_TYPE)
addr |= LJCA_I2C_SLAVE_TRANSFER_WRITE
when the two are the same. You are just adding confusion.
As this is a bit field, you can just keep the defines.
[...]
> +static u8 ljca_i2c_format_slave_addr(u8 slave_addr, u8 type)
> +{
> + return (slave_addr << 1) | (type == LJCA_I2C_READ_XFER_TYPE) ?
> + LJCA_I2C_SLAVE_TRANSFER_READ :
> + LJCA_I2C_SLAVE_TRANSFER_WRITE;
> +}
How about:
return (slave_addr << 1) | !!type;
BTW, am I reading correctly that the address here is composed as:
7 6 5 5 3 2 1 0
ADDR7 ADDR6 ADDR5 ADDR4 ADDR3 ADDR2 ADDR1 R/W
[...]
> +static u32 ljca_i2c_func(struct i2c_adapter *adap)
> +{
> + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
how is the smbus supported here?
Andi
next prev parent reply other threads:[~2023-03-26 15:38 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 17:21 [PATCH v6 0/6] Add Intel LJCA device driver Ye Xiang
2023-03-23 17:21 ` [PATCH v6 1/6] usb: Add support for Intel LJCA device Ye Xiang
2023-03-23 18:05 ` Greg Kroah-Hartman
2023-03-23 18:44 ` Ye, Xiang
2023-03-23 21:59 ` kernel test robot
2023-03-26 15:02 ` Andi Shyti
2023-03-23 17:21 ` [PATCH v6 2/6] usb: ljca: Add transport interfaces for sub-module drivers Ye Xiang
2023-03-26 15:18 ` Andi Shyti
2023-03-23 17:21 ` [PATCH v6 3/6] Documentation: Add ABI doc for attributes of LJCA device Ye Xiang
2023-03-23 17:21 ` [PATCH v6 4/6] gpio: Add support for Intel LJCA USB GPIO driver Ye Xiang
2023-03-23 17:21 ` [PATCH v6 5/6] i2c: Add support for Intel LJCA USB I2C driver Ye Xiang
2023-03-26 15:38 ` Andi Shyti [this message]
2023-04-10 9:22 ` Ye, Xiang
2023-03-23 17:21 ` [PATCH v6 6/6] spi: Add support for Intel LJCA USB SPI driver Ye Xiang
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=20230326153846.zo77mbgti2injnxl@intel.intel \
--to=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=brgl@bgdev.pl \
--cc=broonie@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=kfting@nuvoton.com \
--cc=lee@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=lixu.zhang@intel.com \
--cc=mka@chromium.org \
--cc=sakari.ailus@linux.intel.com \
--cc=srinivas.pandruvada@intel.com \
--cc=wentong.wu@intel.com \
--cc=wsa@kernel.org \
--cc=xiang.ye@intel.com \
--cc=zhifeng.wang@intel.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).