Browse Source

drm/omap: HDMI PLL: use runtime pm

To make it possible to use HDMI PLL for other video outputs than HDMI,
the HDMI PLL code needs to do runtime_get/put for the HDMI IP, so that
the IP (include the PLL) is enabled.

To do that we also need to store the HDMI pdev in the hdmi_pll_data.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Tomi Valkeinen 9 years ago
parent
commit
86c9305c86
2 changed files with 10 additions and 0 deletions
  1. 1 0
      drivers/gpu/drm/omapdrm/dss/hdmi.h
  2. 9 0
      drivers/gpu/drm/omapdrm/dss/hdmi_pll.c

+ 1 - 0
drivers/gpu/drm/omapdrm/dss/hdmi.h

@@ -240,6 +240,7 @@ struct hdmi_pll_data {
 
 
 	void __iomem *base;
 	void __iomem *base;
 
 
+	struct platform_device *pdev;
 	struct hdmi_wp_data *wp;
 	struct hdmi_wp_data *wp;
 };
 };
 
 

+ 9 - 0
drivers/gpu/drm/omapdrm/dss/hdmi_pll.c

@@ -16,6 +16,7 @@
 #include <linux/io.h>
 #include <linux/io.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
 #include <linux/clk.h>
 #include <linux/clk.h>
+#include <linux/pm_runtime.h>
 
 
 #include <video/omapdss.h>
 #include <video/omapdss.h>
 
 
@@ -104,6 +105,9 @@ static int hdmi_pll_enable(struct dss_pll *dsspll)
 	struct hdmi_wp_data *wp = pll->wp;
 	struct hdmi_wp_data *wp = pll->wp;
 	int r;
 	int r;
 
 
+	r = pm_runtime_get_sync(&pll->pdev->dev);
+	WARN_ON(r < 0);
+
 	dss_ctrl_pll_enable(DSS_PLL_HDMI, true);
 	dss_ctrl_pll_enable(DSS_PLL_HDMI, true);
 
 
 	r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
 	r = hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_BOTHON_ALLCLKS);
@@ -117,10 +121,14 @@ static void hdmi_pll_disable(struct dss_pll *dsspll)
 {
 {
 	struct hdmi_pll_data *pll = container_of(dsspll, struct hdmi_pll_data, pll);
 	struct hdmi_pll_data *pll = container_of(dsspll, struct hdmi_pll_data, pll);
 	struct hdmi_wp_data *wp = pll->wp;
 	struct hdmi_wp_data *wp = pll->wp;
+	int r;
 
 
 	hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF);
 	hdmi_wp_set_pll_pwr(wp, HDMI_PLLPWRCMD_ALLOFF);
 
 
 	dss_ctrl_pll_enable(DSS_PLL_HDMI, false);
 	dss_ctrl_pll_enable(DSS_PLL_HDMI, false);
+
+	r = pm_runtime_put_sync(&pll->pdev->dev);
+	WARN_ON(r < 0 && r != -ENOSYS);
 }
 }
 
 
 static const struct dss_pll_ops dsi_pll_ops = {
 static const struct dss_pll_ops dsi_pll_ops = {
@@ -228,6 +236,7 @@ int hdmi_pll_init(struct platform_device *pdev, struct hdmi_pll_data *pll,
 	int r;
 	int r;
 	struct resource *res;
 	struct resource *res;
 
 
+	pll->pdev = pdev;
 	pll->wp = wp;
 	pll->wp = wp;
 
 
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll");
 	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll");