diff options
| author | Philip Richard Oberfichtner <[email protected]> | 2023-10-31 08:38:46 +0100 |
|---|---|---|
| committer | Heiko Schocher <[email protected]> | 2023-10-31 09:08:51 +0100 |
| commit | b48355277340f156f387c31da5a0b8937643c54f (patch) | |
| tree | 593065b5e85ade9b428efe5bfdbe85a69772b37c /include | |
| parent | 31f4ee4b13d974ba4b973211eeb57db70bc5ea77 (diff) | |
i2c: Implement i2c_get_chip_by_phandle()
This new function enhances the i2c_get_chip*() toolbox by implementing a
variant that does not require a chip_addr. Instead, the desired device
is pointed to by a phandle.
Signed-off-by: Philip Richard Oberfichtner <[email protected]>
Reviewed-by: Heiko Schocher <[email protected]>
Diffstat (limited to 'include')
| -rw-r--r-- | include/i2c.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/i2c.h b/include/i2c.h index ef3820eaba7..4e59009cd93 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -538,6 +538,18 @@ int i2c_get_chip_for_busnum(int busnum, int chip_addr, uint offset_len, struct udevice **devp); /** + * i2c_get_chip_by_phandle() - get a device to use to access a chip + * based on a phandle property pointing to it + * + * @parent: Parent device containing the phandle pointer + * @name: Name of phandle property in the parent device node + * @devp: Returns pointer to new device or NULL if not found + * Return: 0 on success, -ve on failure + */ +int i2c_get_chip_by_phandle(const struct udevice *parent, const char *prop_name, + struct udevice **devp); + +/** * i2c_chip_of_to_plat() - Decode standard I2C platform data * * This decodes the chip address from a device tree node and puts it into |
