i2c: add device config helpers
Add some macros that drivers and applications can use in describing I2C clients. Change-Id: Ic7af97804e88ed3b9d4f68f9ac358a425f4cc17c Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com>
This commit is contained in:
parent
2982f0e730
commit
8fed55f640
1 changed files with 16 additions and 0 deletions
|
@ -411,6 +411,22 @@ static inline int i2c_resume(struct device *dev)
|
||||||
return api->resume(dev);
|
return api->resume(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct i2c_client_config {
|
||||||
|
char *i2c_master;
|
||||||
|
uint16_t i2c_addr;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define I2C_DECLARE_CLIENT_CONFIG struct i2c_client_config i2c_client
|
||||||
|
|
||||||
|
#define I2C_CLIENT(_master, _addr) \
|
||||||
|
.i2c_client = { \
|
||||||
|
.i2c_master = (_master), \
|
||||||
|
.i2c_addr = (_addr), \
|
||||||
|
}
|
||||||
|
|
||||||
|
#define I2C_GET_MASTER(_conf) ((_conf)->i2c_client.i2c_master)
|
||||||
|
#define I2C_GET_ADDR(_conf) ((_conf)->i2c_client.i2c_addr)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue