mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 10:00:17 +00:00
i2c-gpio: Also set bus numbers from reg property
I2C busses can be assigned specific bus numbers using aliases in Device Tree - string properties where the name is the alias and the value is the path to the node. The current DT parameter mechanism does not allow property names to be derived from a parameter value in any way, so it isn't possible to generate unique or matching aliases for nodes from an overlay that can generate multiple instances, e.g. i2c-gpio. Work around this limitation (at least temporarily) by allowing the i2c adapter number to be initialised from the "reg" property if present. Signed-off-by: Phil Elwell <phil@raspberrypi.org>
This commit is contained in:
@@ -445,6 +445,8 @@ static int i2c_gpio_probe(struct platform_device *pdev)
|
|||||||
adap->dev.parent = dev;
|
adap->dev.parent = dev;
|
||||||
adap->dev.of_node = np;
|
adap->dev.of_node = np;
|
||||||
|
|
||||||
|
if (pdev->id != PLATFORM_DEVID_NONE || !pdev->dev.of_node ||
|
||||||
|
of_property_read_u32(pdev->dev.of_node, "reg", &adap->nr))
|
||||||
adap->nr = pdev->id;
|
adap->nr = pdev->id;
|
||||||
ret = i2c_bit_add_numbered_bus(adap);
|
ret = i2c_bit_add_numbered_bus(adap);
|
||||||
if (ret)
|
if (ret)
|
||||||
|
|||||||
Reference in New Issue
Block a user