Commit 25ae30d2 authored by Thierry Reding's avatar Thierry Reding

gpu: host1x: Support sub-devices recursively

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: default avatarThierry Reding <treding@nvidia.com>
parent 7b2c63de
...@@ -45,9 +45,12 @@ struct host1x_subdev { ...@@ -45,9 +45,12 @@ struct host1x_subdev {
* @np: device node * @np: device node
*/ */
static int host1x_subdev_add(struct host1x_device *device, static int host1x_subdev_add(struct host1x_device *device,
struct host1x_driver *driver,
struct device_node *np) struct device_node *np)
{ {
struct host1x_subdev *subdev; struct host1x_subdev *subdev;
struct device_node *child;
int err;
subdev = kzalloc(sizeof(*subdev), GFP_KERNEL); subdev = kzalloc(sizeof(*subdev), GFP_KERNEL);
if (!subdev) if (!subdev)
...@@ -60,6 +63,19 @@ static int host1x_subdev_add(struct host1x_device *device, ...@@ -60,6 +63,19 @@ static int host1x_subdev_add(struct host1x_device *device,
list_add_tail(&subdev->list, &device->subdevs); list_add_tail(&subdev->list, &device->subdevs);
mutex_unlock(&device->subdevs_lock); 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; return 0;
} }
...@@ -88,7 +104,7 @@ static int host1x_device_parse_dt(struct host1x_device *device, ...@@ -88,7 +104,7 @@ static int host1x_device_parse_dt(struct host1x_device *device,
for_each_child_of_node(device->dev.parent->of_node, np) { for_each_child_of_node(device->dev.parent->of_node, np) {
if (of_match_node(driver->subdevs, np) && if (of_match_node(driver->subdevs, np) &&
of_device_is_available(np)) { of_device_is_available(np)) {
err = host1x_subdev_add(device, np); err = host1x_subdev_add(device, driver, np);
if (err < 0) { if (err < 0) {
of_node_put(np); of_node_put(np);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment