drivers: i2c: Add an i2c_configure_dt function

Add an i2c_configure_dt function, that is equivalent
to calling i2c_configure(spec->bus, dev_config) to
simplify the calling.

Signed-off-by: James Roy <rruuaanng@outlook.com>
This commit is contained in:
James Roy 2025-03-05 09:18:10 +08:00 committed by Benjamin Cabé
parent 66b2a6ad2d
commit a6f5897e21

View File

@ -723,6 +723,25 @@ static inline int z_impl_i2c_configure(const struct device *dev,
return api->configure(dev, dev_config);
}
/**
* @brief Configure operation of a host controller.
*
* This is equivalent to:
*
* i2c_configure(spec->bus, dev_config);
*
* @param spec I2C specification from devicetree.
* @param dev_config Bit-packed 32-bit value to the device runtime configuration
* for the I2C controller.
*
* @return a value from i2c_configure()
*/
static inline int i2c_configure_dt(const struct i2c_dt_spec *spec,
uint32_t dev_config)
{
return i2c_configure(spec->bus, dev_config);
}
/**
* @brief Get configuration of a host controller.
*