Re: [PATCH v6 5/6] i2c: Add support for Intel LJCA USB I2C driver
From: Ye, Xiang
Date: Mon Apr 10 2023 - 05:22:50 EST
Hi Andi,
Thanks for the review.
On Sun, Mar 26, 2023 at 05:38:46PM +0200, Andi Shyti wrote:
> 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.
Got it.
>
> > device named "La Jolla Cove Adapter" (LJCA). It communicate with LJCA
> > I2c module with specific protocol through interfaces exported by LJCA USB
> > driver.
...
> > +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
>
> [...]
>
You are correct. Will adopt this solution on next version.
> > +static u32 ljca_i2c_func(struct i2c_adapter *adap)
> > +{
> > + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
>
> how is the smbus supported here?
The i2c-sub module of LJCA device is SMBUS compatible.
It's supported by LJCA device hardware itself.
Thanks
Ye Xiang