UPSTREAM: drm/tegra: dc: Restore coupling of display controllers

Coupling of display controllers used to rely on runtime PM to take the
companion controller out of reset. Commit fd67e9c6ed5a ("drm/tegra: Do
not implement runtime PM") accidentally broke this when runtime PM was
removed.

Restore this functionality by reusing the hierarchical host1x client
suspend/resume infrastructure that's similar to runtime PM and which
perfectly fits this use-case.

Change-Id: I74817efbdb2afa6f775ad9b8d1657496f4c5626b
Fixes: fd67e9c6ed5a ("drm/tegra: Do not implement runtime PM")
Reported-by: Dmitry Osipenko <digetx@gmail.com>
Reported-by: Paul Fertser <fercerpav@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2545938
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Thierry Reding
2021-03-19 08:06:37 +01:00
committed by Laxman Dewangan
parent f34bc1606f
commit b2f9239e03

View File

@@ -2577,22 +2577,18 @@ static int tegra_dc_couple(struct tegra_dc *dc)
* POWER_CONTROL registers during CRTC enabling. * POWER_CONTROL registers during CRTC enabling.
*/ */
if (dc->soc->coupled_pm && dc->pipe == 1) { if (dc->soc->coupled_pm && dc->pipe == 1) {
u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_CONSUMER; struct device *companion;
struct device_link *link; struct tegra_dc *parent;
struct device *partner;
partner = driver_find_device(dc->dev->driver, NULL, NULL, companion = driver_find_device(dc->dev->driver, NULL, (const void *)0,
tegra_dc_match_by_pipe); tegra_dc_match_by_pipe);
if (!partner) if (!companion)
return -EPROBE_DEFER; return -EPROBE_DEFER;
link = device_link_add(dc->dev, partner, flags); parent = dev_get_drvdata(companion);
if (!link) { dc->client.parent = &parent->client;
dev_err(dc->dev, "failed to link controllers\n");
return -EINVAL;
}
dev_dbg(dc->dev, "coupled to %s\n", dev_name(partner)); dev_dbg(dc->dev, "coupled to %s\n", dev_name(companion));
} }
return 0; return 0;