Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver

From: Jie Deng
Date: Wed Mar 03 2021 - 20:53:45 EST



On 2021/3/3 17:38, Viresh Kumar wrote:
On 03-03-21, 16:46, Jie Deng wrote:
This is not a problem. My original proposal was to mirror the struct
i2c_msg.
The code you looked at was based on that.
However, the virtio TC prefer not to mirror it. They have some concerns.
For example, there is a bit I2C_M_RD in i2c_msg.flag which has the same
meaning with
the R/W in virtio descriptor. This is a repetition which may cause problems.
So the virtio_i2c_out_hdr.flags is used to instead of i2c_msg.flags for
extension.
So by default we don't support any of the existing flags except
I2C_M_RD?
Yes. That's the current status.
#define I2C_M_TEN 0x0010 /* this is a ten bit chip address */
#define I2C_M_RD 0x0001 /* read data, from slave to master */
#define I2C_M_STOP 0x8000 /* if I2C_FUNC_PROTOCOL_MANGLING */
#define I2C_M_NOSTART 0x4000 /* if I2C_FUNC_NOSTART */
#define I2C_M_REV_DIR_ADDR 0x2000 /* if I2C_FUNC_PROTOCOL_MANGLING */
#define I2C_M_IGNORE_NAK 0x1000 /* if I2C_FUNC_PROTOCOL_MANGLING */
#define I2C_M_NO_RD_ACK 0x0800 /* if I2C_FUNC_PROTOCOL_MANGLING */
#define I2C_M_RECV_LEN 0x0400 /* length will be first received byte */

How do we work with clients who want to use such flags now ?
My plan is to have a minimum driver get merged. Then we have a base and we can
update virtio_i2c_out_hdr.flags for the feature extensibility. Then, If you want to help to develop
this stuff, you can just follow the same flow. First, you can update the Spec by sending
comments to virtio-comment@xxxxxxxxxxxxxxxxxxxx. Once your Spec patch is acked by the
virtio TC, you can then send patches to update the corresponding drivers.

Thanks.