On Tue, 09 Mar 2021, Adam Ward wrote: > 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); Thanks for checking this. You're right. The example was provided as a back-of-a-fag-packet design, not a fully tested (or even compiled) solution. It took me 2 mins to type out. > > 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. A default value is a default value. :) -- Lee Jones [李琼斯] Senior Technical Lead - Developer Services Linaro.org │ Open source software for Arm SoCs Follow Linaro: Facebook | Twitter | Blog