gpu: host1x: Support sub-devices recursively
PATCH 1/1 gpu: host1x: Support sub-devices recursively
From: Thierry Reding <[email protected]>
The display architecture in Tegra186 changes slightly compared to earlier Tegra generations, which requires that we recursively scan host1x sub-devices from device tree.
Signed-off-by Thierry Reding <[email protected]>
--- drivers/gpu/host1x/bus.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
drivers/gpu/host1x/bus.c +25 -1
@@ -44,9 +44,14 @@ struct host1x_subdev {* @np: device node */ static int host1x_subdev_add (struct host1x_device *device, +struct host1x_driver *driver,struct device_node *np) {struct host1x_subdev *subdev; +struct device_node *child; +int err; + +dev_info (&device->dev,"adding subdevice %s\n" , np->full_name); subdev =kzalloc (sizeof (*subdev),GFP_KERNEL );if (!subdev)
@@ -59,6 +64,19 @@ static int host1x_subdev_add(struct host1x_device *device,list_add_tail (&subdev->list, &device->subdevs);mutex_unlock (&device->subdevs_lock); +/* recursively add children */ +for_each_child_of_node (np, child) { +if (of_match_node (driver->subdevs, child) && +of_device_is_available (child)) { + err =host1x_subdev_add (device, driver, child); +if (err <0 ) { +/* XXX cleanup? */ +of_node_put (child); +return err; + } + } + } +return 0 ; }
@@ -87,7 +105,7 @@ static int host1x_device_parse_dt(struct host1x_device *device,for_each_child_of_node (device->dev.parent->of_node, np) {if (of_match_node (driver->subdevs, np) &&of_device_is_available (np)) { - err =host1x_subdev_add (device, np); + err =host1x_subdev_add (device, driver, np);if (err <0 ) {of_node_put (np);return err;
@@ -104,6 +122,8 @@ static void host1x_subdev_register(struct host1x_device *device, {int err; +dev_info (&device->dev,"registering subdevice %s\n" , subdev->np->full_name); +/* * Move the subdevice to the list of active (registered) subdevices * and associate it with a client. At the same time, associate the
@@ -124,6 +144,10 @@ static void host1x_subdev_register(struct host1x_device *device,dev_err (&device->dev,"failed to add: %d\n" , err); else device->registered = true; + }else { +dev_info (&device->dev,"remaining subdevices:\n" ); +list_for_each_entry (subdev, &device->subdevs, list) +dev_info (&device->dev," %s\n" , subdev->np->full_name); } }
Signature · 1 line
2.13.3
A message that is not in the archive (sent off-list or not yet received): 20170815134622.21289-1-thierry.reding-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
Thierry Reding
AppliedQuoted 10 lines · Thierry Reding
From: Thierry Reding <[email protected]>
The display architecture in Tegra186 changes slightly compared to earlier Tegra generations, which requires that we recursively scan host1x sub-devices from device tree.
Signed-off-by Thierry Reding <[email protected]>--- drivers/gpu/host1x/bus.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-)
Applied, with leftover debug messages removed.
Thierry