platform: dce: add device_link b/w display and dce

- add the device link between display and DCE such that
DCE KMD module will enter suspend after display suspend is
complete and DCE KMD module resumes early before display
resumes as DCE bootstrap has to be complete for display
to proceed with initialization.

Bug 3685062
Bug 3826630

Signed-off-by: Santosh Reddy Galma <galmar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2780892
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Mahesh Kumar <mahkumar@nvidia.com>
Reviewed-by: Arun Swain <arswain@nvidia.com>
Change-Id: I4d84d8b5723747d984f0883aba697a5a0a0a21bf
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2824217
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
Tested-by: Mahesh Kumar <mahkumar@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Santosh Reddy Galma
2022-09-23 06:49:41 +00:00
committed by Laxman Dewangan
parent 12a8ee706f
commit 31b6d913ab

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019-2022, NVIDIA CORPORATION. All rights reserved. * Copyright (c) 2019-2023, NVIDIA CORPORATION. All rights reserved.
* *
* This program is free software; you can redistribute it and/or modify it * This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License, * under the terms and conditions of the GNU General Public License,
@@ -19,6 +19,7 @@
#include <linux/of_device.h> #include <linux/of_device.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include <linux/device.h>
/** /**
* The following platform info is needed for backdoor * The following platform info is needed for backdoor
@@ -168,6 +169,16 @@ static int dce_req_interrupts(struct platform_device *pdev)
return ret; return ret;
} }
static int match_display_dev(struct device *dev, const void *data)
{
if ((dev != NULL) && (dev->of_node != NULL)) {
if (of_device_is_compatible(dev->of_node, "nvidia,tegra234-display"))
return 1;
}
return 0;
}
static int tegra_dce_probe(struct platform_device *pdev) static int tegra_dce_probe(struct platform_device *pdev)
{ {
int err = 0; int err = 0;
@@ -175,6 +186,8 @@ static int tegra_dce_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct dce_platform_data *pdata = NULL; struct dce_platform_data *pdata = NULL;
const struct of_device_id *match = NULL; const struct of_device_id *match = NULL;
struct device *c_dev;
struct device_link *link;
match = of_match_device(tegra_dce_of_match, dev); match = of_match_device(tegra_dce_of_match, dev);
if (!match) { if (!match) {
@@ -225,6 +238,17 @@ static int tegra_dce_probe(struct platform_device *pdev)
dce_init_debug(d); dce_init_debug(d);
#endif #endif
c_dev = bus_find_device(&platform_bus_type, NULL, NULL, match_display_dev);
if (c_dev != NULL) {
dce_info(d, "Found display consumer device");
link = device_link_add(c_dev, dev,
DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_SUPPLIER);
if (link == NULL) {
dce_err(d, "Failed to create device link to %s\n", dev_name(c_dev));
return -EINVAL;
}
}
return 0; return 0;
req_intr_err: req_intr_err: