Skip to contentSkip to conversation

drm/meson: enable runtime PM

PATCH In review Kevin Hilman 3 participants 4 messages Sep 25, 2019 – Oct 1, 2019

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/meson: enable runtime PM

From: Kevin Hilman <[email protected]>

On some SoCs, the VPU is in a power-domain and needs runtime PM enabled and used in order to keep the power domain on.

---
 drivers/gpu/drm/meson/meson_drv.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/meson/meson_drv.c +4 -0
index 2310c96fff46..256b6a0e9c6b 100644
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/component.h>
 #include <linux/of_graph.h>
+#include <linux/pm_runtime.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
@@ -274,6 +275,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
 	/* Hardware Initialization */
 
+	pm_runtime_get_sync(dev);
 	meson_vpu_init(priv);
 	meson_venc_init(priv);
 	meson_vpp_init(priv);
@@ -416,6 +418,7 @@ static int meson_drv_probe(struct platform_device *pdev)
 	struct device_node *ep, *remote;
 	int count = 0;
 
+	pm_runtime_enable(&pdev->dev);
 	for_each_endpoint_of_node(np, ep) {
 		remote = of_graph_get_remote_port_parent(ep);
 		if (!remote || !of_device_is_available(remote)) {
@@ -440,6 +443,7 @@ static int meson_drv_probe(struct platform_device *pdev)
 	}
 
 	/* If no output endpoints were available, simply bail out */
+	pm_runtime_disable(&pdev->dev);
 	return 0;
 };
 
Signature · 6 lines
2.22.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

Hi Kevin,

Quoted 40 lines · Kevin Hilman

From: Kevin Hilman <[email protected]>

On some SoCs, the VPU is in a power-domain and needs runtime PM enabled and used in order to keep the power domain on.

---
 drivers/gpu/drm/meson/meson_drv.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/meson/meson_drv.c +3 -0
index 2310c96fff46..256b6a0e9c6b 100644
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/component.h>
 #include <linux/of_graph.h>
+#include <linux/pm_runtime.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
@@ -274,6 +275,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
 	/* Hardware Initialization */
 
+	pm_runtime_get_sync(dev);
 	meson_vpu_init(priv);
 	meson_venc_init(priv);
 	meson_vpp_init(priv);
@@ -416,6 +418,7 @@ static int meson_drv_probe(struct platform_device *pdev)
 	struct device_node *ep, *remote;
 	int count = 0;
 
+	pm_runtime_enable(&pdev->dev);
 	for_each_endpoint_of_node(np, ep) {
 		remote = of_graph_get_remote_port_parent(ep);
 		if (!remote || !of_device_is_available(remote)) {

drivers/gpu/drm/meson/meson_drv.c static int meson_drv_probe(struct platform_device *pdev) · line 449

Quoted 7 lines
drivers/gpu/drm/meson/meson_drv.c +1 -0
@@ -440,6 +443,7 @@ static int meson_drv_probe(struct platform_device *pdev)
 	}
 
 	/* If no output endpoints were available, simply bail out */
+	pm_runtime_disable(&pdev->dev);
 	return 0;
 };
 

I'll rather implement true runtime PM instead,

Neil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

maintainer
#2 lore raw
Quoted 44 lines · Neil Armstrong

Hi Kevin,

Quoted 41 lines · Kevin Hilman

From: Kevin Hilman <[email protected]>

On some SoCs, the VPU is in a power-domain and needs runtime PM enabled and used in order to keep the power domain on.

---
 drivers/gpu/drm/meson/meson_drv.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/meson/meson_drv.c +3 -0
index 2310c96fff46..256b6a0e9c6b 100644
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/component.h>
 #include <linux/of_graph.h>
+#include <linux/pm_runtime.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
@@ -274,6 +275,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
 	/* Hardware Initialization */
 
+	pm_runtime_get_sync(dev);
 	meson_vpu_init(priv);
 	meson_venc_init(priv);
 	meson_vpp_init(priv);
@@ -416,6 +418,7 @@ static int meson_drv_probe(struct platform_device *pdev)
 	struct device_node *ep, *remote;
 	int count = 0;
 
+	pm_runtime_enable(&pdev->dev);
 	for_each_endpoint_of_node(np, ep) {
 		remote = of_graph_get_remote_port_parent(ep);
 		if (!remote || !of_device_is_available(remote)) {
@@ -440,6 +443,7 @@ static int meson_drv_probe(struct platform_device *pdev)
 	}
 
Quoted 8 lines

drivers/gpu/drm/meson/meson_drv.c static int meson_drv_probe(struct platform_device *pdev) · line 449

Quoted 6 lines
drivers/gpu/drm/meson/meson_drv.c +1 -0
 	/* If no output endpoints were available, simply bail out */
+	pm_runtime_disable(&pdev->dev);
 	return 0;
 };
 

I'll rather implement true runtime PM instead,

While this is a minimum implementation, can you explain what you mean by "true" runtime PM?

Kevin
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 55 lines · Kevin Hilman
Quoted 44 lines · Neil Armstrong

Hi Kevin,

Quoted 41 lines · Kevin Hilman

From: Kevin Hilman <[email protected]>

On some SoCs, the VPU is in a power-domain and needs runtime PM enabled and used in order to keep the power domain on.

---
 drivers/gpu/drm/meson/meson_drv.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/meson/meson_drv.c +3 -0
index 2310c96fff46..256b6a0e9c6b 100644
@@ -14,6 +14,7 @@
 #include <linux/platform_device.h>
 #include <linux/component.h>
 #include <linux/of_graph.h>
+#include <linux/pm_runtime.h>
 
 #include <drm/drmP.h>
 #include <drm/drm_atomic.h>
@@ -274,6 +275,7 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)
 
 	/* Hardware Initialization */
 
+	pm_runtime_get_sync(dev);
 	meson_vpu_init(priv);
 	meson_venc_init(priv);
 	meson_vpp_init(priv);
@@ -416,6 +418,7 @@ static int meson_drv_probe(struct platform_device *pdev)
 	struct device_node *ep, *remote;
 	int count = 0;
 
+	pm_runtime_enable(&pdev->dev);
 	for_each_endpoint_of_node(np, ep) {
 		remote = of_graph_get_remote_port_parent(ep);
 		if (!remote || !of_device_is_available(remote)) {
@@ -440,6 +443,7 @@ static int meson_drv_probe(struct platform_device *pdev)
 	}
 
Quoted 8 lines

drivers/gpu/drm/meson/meson_drv.c static int meson_drv_probe(struct platform_device *pdev) · line 449

Quoted 6 lines
drivers/gpu/drm/meson/meson_drv.c +1 -0
 	/* If no output endpoints were available, simply bail out */
+	pm_runtime_disable(&pdev->dev);
 	return 0;
 };
 

I'll rather implement true runtime PM instead,

Quoted 2 lines

While this is a minimum implementation, can you explain what you mean by "true" runtime PM?

Implementing runtime_sync()/_put when the display is used/unused.

ARM did a good job in their malidp driver.

Neil

Quoted 3 lines

Kevin

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel