diff mbox series

[v7,11/37] gpu: host1x: Add stub driver for MPE, VI, EPP and ISP

Message ID 20210701232728.23591-12-digetx@gmail.com
State Superseded
Headers show
Series NVIDIA Tegra power management patches for 5.15 | expand

Commit Message

Dmitry Osipenko July 1, 2021, 11:27 p.m. UTC
We never had drivers for MPE, VI, EPP and ISP hardware units on Tegra20
and Tegra30 and they are specified in the device-trees. Thus, a device is
getting created for them by host1x bus, but driver is never getting bound.
After adding support for generic power domains, we now have a situation
where the state of PMC driver is never synced because consumer device
never becomes ready due to the missing drivers and it needs to be synced
in order to allow scaling of SoC core voltage. Add a stub driver in order
to resolve the problem.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/gpu/host1x/dev.c | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)
diff mbox series

Patch

diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index 0945df6039af..400a3b9d8857 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -616,7 +616,46 @@  static struct platform_driver tegra_host1x_driver = {
 	.remove = host1x_remove,
 };
 
+/*
+ * We never had drivers for MPE, VI, EPP and ISP hardware units on Tegra20
+ * and Tegra30, but they are specified in the device-trees, and thus,
+ * device entity is getting created for them by host1x bus a, but driver
+ * is never getting bound.  After adding support for generic power domains
+ * on Tegra20/30, we now have a situation where the state of PMC driver is
+ * never synced because consumer device never becomes ready due to the
+ * missing drivers.  The PMC state needs to be synced in order to allow
+ * scaling of the SoC core voltage.  In order to solve this problem,
+ * we will create and bind a dummy driver to the offending devices until
+ * we will have a real driver for them.
+ */
+static const struct of_device_id host1x_stub_of_matches[] = {
+	{ .compatible = "nvidia,tegra20-mpe", },
+	{ .compatible = "nvidia,tegra30-mpe", },
+	{ .compatible = "nvidia,tegra20-epp", },
+	{ .compatible = "nvidia,tegra30-epp", },
+	{ .compatible = "nvidia,tegra20-vi", },
+	{ .compatible = "nvidia,tegra30-vi", },
+	{ .compatible = "nvidia,tegra20-isp", },
+	{ .compatible = "nvidia,tegra30-isp", },
+	{ /* sentinel */ }
+};
+
+static int host1x_stub_probe(struct platform_device *pdev)
+{
+	pm_runtime_enable(&pdev->dev);
+	return 0;
+}
+
+static struct platform_driver tegra_host1x_stub_driver = {
+	.driver = {
+		.name = "tegra-host1x-stub",
+		.of_match_table = host1x_stub_of_matches,
+	},
+	.probe = host1x_stub_probe,
+};
+
 static struct platform_driver * const drivers[] = {
+	&tegra_host1x_stub_driver,
 	&tegra_host1x_driver,
 	&tegra_mipi_driver,
 };