[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230326153846.zo77mbgti2injnxl@intel.intel>
Date: Sun, 26 Mar 2023 17:38:46 +0200
From: Andi Shyti <andi.shyti@...nel.org>
To: Ye Xiang <xiang.ye@...el.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>,
Matthias Kaehlcke <mka@...omium.org>,
Lee Jones <lee@...nel.org>, Wolfram Sang <wsa@...nel.org>,
Tyrone Ting <kfting@...oton.com>,
Mark Brown <broonie@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>, linux-usb@...r.kernel.org,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-spi@...r.kernel.org, linux-gpio@...r.kernel.org,
srinivas.pandruvada@...el.com, heikki.krogerus@...ux.intel.com,
andriy.shevchenko@...ux.intel.com, sakari.ailus@...ux.intel.com,
zhifeng.wang@...el.com, wentong.wu@...el.com, lixu.zhang@...el.com
Subject: Re: [PATCH v6 5/6] i2c: Add support for Intel LJCA USB I2C driver
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@...el.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
Powered by blists - more mailing lists