Re: [PATCH 04/13] a2b: add AD24xx I2C interface driver

From: Alvin Šipraga
Date: Tue May 21 2024 - 04:31:43 EST


On Fri, May 17, 2024 at 04:49:20PM GMT, Wolfram Sang wrote:
>
> > + /*
> > + * Enforce some basic assumptions this function makes about the
> > + * transfer. If this proves insufficient, some more complex logic will
> > + * be needed.
> > + */
> > + if (num > 2 || (num == 2 && msgs[0].addr != msgs[1].addr))
> > + return -EOPNOTSUPP;
>
> As you populated 'ad24xx_i2c_adapter_quirks' in the I2C driver, you can
> drop this. The I2C core will do the checks for you.
>

The i2c_xfer function here is also available as a general A2B API, see
a2b.h:

int a2b_node_i2c_xfer(struct a2b_node *node, struct i2c_msg *msgs, int num);

This is used by the beo-shape-node.c driver submitted later in this
series to perform a firmware update of a more peculiar A2B hardware.
In this case it doesn't factor through the codepath you mention, hence
this check.

It's conceivable that there will be other such cases in the future as
well. ADI for example prescribes a specific EEPROM address where device
identification data can be stored with a well-defined format. In the
event that the driver should support some kind of device type detection,
it will also have to perform some I2C transfers out-of-band like this.