RE: [PATCH v19 2/4] i2c: Add support for Intel LJCA USB I2C driver

Wu, Wentong
2023-09-29T16:11:36Z

> From: Wolfram Sang <wsa@kernel.org>
>
> > +static u32 ljca_i2c_func(struct i2c_adapter *adap) {
> > + return I2C_FUNC_I2C;
>
> You could use this here to make the driver way more useful:
>
> return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL &
> ~I2C_FUNC_SMBUS_QUICK);
>
> Except I2C_FUNC_SMBUS_QUICK, emulated SMBUS calls work out of the box.
>
> For I2C_FUNC_SMBUS_QUICK, you need to test zero-length transfers indeed
> ('i2cdetect <busnum>' will use it and is a good testcase). Which would be good
> anyway, because if it is not supporting zero-length, we need to add an adapter-
> >quirk flag as well.

Thanks.

And with i2cdetect -q busnum, I see error on driver side which enable
I2C_FUNC_SMBUS_EMUL and not disable I2C_FUNC_SMBUS_QUICK, I think
it means we don't support zero-length transfer if I understand correctly.

>
> We could add this incrementally, but it will be better to have this correct right
> away. i2cdetect is a good and simple testcase.

So the code will be like below, please help take a look, thanks.

static u32 ljca_i2c_func(struct i2c_adapter *adap)
{
return I2C_FUNC_I2C | (I2C_FUNC_SMBUS_EMUL & ~I2C_FUNC_SMBUS_QUICK);
}

static const struct i2c_adapter_quirks ljca_i2c_quirks = {
.flags = I2C_AQ_NO_ZERO_LEN,
.max_read_len = LJCA_I2C_MAX_XFER_SIZE,
.max_write_len = LJCA_I2C_MAX_XFER_SIZE,
};

BR,
Wentong