RE: [PATCH v4] mfd: da9063: Support SMBus and I2C mode

From: Adam Ward
Date: Tue Mar 09 2021 - 17:43:32 EST


Hi Lee,

Tidy, but I've noticed the logic got inverted along the way:

> On Tue 09 Mar 2021, Lee Jones wrote:
> On Tue, 09 Mar 2021, Mark Jonas wrote:
> This is my suggestion:
>
> /* If SMBus Mode is not available, enter Two-Wire Mode */
> if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) {

Determine bus *is* I2C, so assume SMBus timings not supported...
if (i2c_check_functionality(i2c->adapter, I2C_FUNC_I2C)) {

> ret = regmap_update_bits(da9063->regmap, DA9063_REG_CONFIG_J,
> DA9063_TWOWIRE_TO, DA9063_TWOWIRE_TO);

...and *clear* the (currently set by default) timeout bit:
DA9063_TWOWIRE_TO, 0);

> if (ret < 0) {
> dev_err(da9063->dev, "Failed to set Two-Wire Bus
> Mode\n");
> return -EIO;
> }
> }

I think you're right to exclude a case; vendor motivation to override the TO default seems inherently trustworthy.

Best regards,
Adam