i2c_new_secondary_device — Helper to get the instantiated secondary address and create the associated device
struct i2c_client * i2c_new_secondary_device ( | struct i2c_client * client, |
const char * name, | |
u16 default_addr) ; |
client
Handle to the primary client
name
Handle to specify which secondary address to get
default_addr
Used as a fallback if no secondary address was specified
I2C clients can be composed of multiple I2C slaves bound together in a single component. The I2C client driver then binds to the master I2C slave and needs to create I2C dummy clients to communicate with all the other slaves.
This function creates and returns an I2C dummy client whose I2C address is retrieved from the platform firmware based on the given slave name. If no address is specified by the firmware default_addr is used.
On DT-based platforms the address is retrieved from the “reg” property entry cell whose “reg-names” value matches the slave name.
This returns the new i2c client, which should be saved for later use with
i2c_unregister_device
; or NULL to indicate an error.