/** * sccb_is_available - Check if the adapter supports SCCB protocol * @adap: I2C adapter * * Return true if the I2C adapter is capable of using SCCB helper functions, * false otherwise.
*/ staticbool sccb_is_available(struct i2c_adapter *adap)
{
u32 needed_funcs = I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_WRITE_BYTE_DATA;
/* * If we ever want support for hardware doing SCCB natively, we will * introduce a sccb_xfer() callback to struct i2c_algorithm and check * for it here.
*/
/** * regmap_sccb_read - Read data from SCCB slave device * @context: Device that will be interacted with * @reg: Register to be read from * @val: Pointer to store read value * * This executes the 2-phase write transmission cycle that is followed by a * 2-phase read transmission cycle, returning negative errno else zero on * success.
*/ staticint regmap_sccb_read(void *context, unsignedint reg, unsignedint *val)
{ struct device *dev = context; struct i2c_client *i2c = to_i2c_client(dev); int ret; union i2c_smbus_data data;
i2c_lock_bus(i2c->adapter, I2C_LOCK_SEGMENT);
ret = __i2c_smbus_xfer(i2c->adapter, i2c->addr, i2c->flags,
I2C_SMBUS_WRITE, reg, I2C_SMBUS_BYTE, NULL); if (ret < 0) goto out;
ret = __i2c_smbus_xfer(i2c->adapter, i2c->addr, i2c->flags,
I2C_SMBUS_READ, 0, I2C_SMBUS_BYTE, &data); if (ret < 0) goto out;
/** * regmap_sccb_write - Write data to SCCB slave device * @context: Device that will be interacted with * @reg: Register to write to * @val: Value to be written * * This executes the SCCB 3-phase write transmission cycle, returning negative * errno else zero on success.
*/ staticint regmap_sccb_write(void *context, unsignedint reg, unsignedint val)
{ struct device *dev = context; struct i2c_client *i2c = to_i2c_client(dev);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.