From: Inki Dae <inki.dae@samsung.com>
To: dri-devel@lists.freedesktop.org
Cc: airlied@linux.ie, linux-samsung-soc@vger.kernel.org,
Gustavo Padovan <gustavo.padovan@collabora.co.uk>,
Inki Dae <inki.dae@samsung.com>
Subject: [PATCH v2 3/7] drm/exynos: add pm_runtime to HDMI
Date: Tue, 03 Nov 2015 19:47:05 +0900 [thread overview]
Message-ID: <1446547629-12521-4-git-send-email-inki.dae@samsung.com> (raw)
In-Reply-To: <1446547629-12521-1-git-send-email-inki.dae@samsung.com>
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Let pm_runtime handle the enabling/disabling of the device with proper
refcnt instead of rely on specific flags to track the enabled state.
Changelog v2:
- Mofidy CONFIG_PM_SLEEP -> CONFIG_PM
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
---
drivers/gpu/drm/exynos/exynos_hdmi.c | 56 ++++++++++++++++++++++++------------
1 file changed, 38 insertions(+), 18 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index 57b6755..d0362af 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -102,7 +102,6 @@ struct hdmi_context {
struct device *dev;
struct drm_device *drm_dev;
struct drm_connector connector;
- bool powered;
bool dvi_mode;
struct delayed_work hotplug_work;
struct drm_display_mode current_mode;
@@ -113,7 +112,7 @@ struct hdmi_context {
void __iomem *regs_hdmiphy;
struct i2c_client *hdmiphy_port;
struct i2c_adapter *ddc_adpt;
- struct gpio_desc *hpd_gpio;
+ struct gpio_desc *hpd_gpio;
int irq;
struct regmap *pmureg;
struct clk *hdmi;
@@ -1585,11 +1584,6 @@ static void hdmi_enable(struct drm_encoder *encoder)
{
struct hdmi_context *hdata = encoder_to_hdmi(encoder);
- if (hdata->powered)
- return;
-
- hdata->powered = true;
-
pm_runtime_get_sync(hdata->dev);
if (regulator_bulk_enable(ARRAY_SIZE(supply), hdata->regul_bulk))
@@ -1599,9 +1593,6 @@ static void hdmi_enable(struct drm_encoder *encoder)
regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
PMU_HDMI_PHY_ENABLE_BIT, 1);
- clk_prepare_enable(hdata->hdmi);
- clk_prepare_enable(hdata->sclk_hdmi);
-
hdmi_conf_apply(hdata);
}
@@ -1611,9 +1602,6 @@ static void hdmi_disable(struct drm_encoder *encoder)
struct drm_crtc *crtc = encoder->crtc;
const struct drm_crtc_helper_funcs *funcs = NULL;
- if (!hdata->powered)
- return;
-
/*
* The SFRs of VP and Mixer are updated by Vertical Sync of
* Timing generator which is a part of HDMI so the sequence
@@ -1633,9 +1621,6 @@ static void hdmi_disable(struct drm_encoder *encoder)
cancel_delayed_work(&hdata->hotplug_work);
- clk_disable_unprepare(hdata->sclk_hdmi);
- clk_disable_unprepare(hdata->hdmi);
-
/* reset pmu hdmiphy control bit to disable hdmiphy */
regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
PMU_HDMI_PHY_ENABLE_BIT, 0);
@@ -1643,8 +1628,6 @@ static void hdmi_disable(struct drm_encoder *encoder)
regulator_bulk_disable(ARRAY_SIZE(supply), hdata->regul_bulk);
pm_runtime_put_sync(hdata->dev);
-
- hdata->powered = false;
}
static struct drm_encoder_helper_funcs exynos_hdmi_encoder_helper_funcs = {
@@ -1978,12 +1961,49 @@ static int hdmi_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+static int exynos_hdmi_suspend(struct device *dev)
+{
+ struct hdmi_context *hdata = dev_get_drvdata(dev);
+
+ clk_disable_unprepare(hdata->sclk_hdmi);
+ clk_disable_unprepare(hdata->hdmi);
+
+ return 0;
+}
+
+static int exynos_hdmi_resume(struct device *dev)
+{
+ struct hdmi_context *hdata = dev_get_drvdata(dev);
+ int ret;
+
+ ret = clk_prepare_enable(hdata->hdmi);
+ if (ret < 0) {
+ DRM_ERROR("Failed to prepare_enable the hdmi clk [%d]\n", ret);
+ return ret;
+ }
+ ret = clk_prepare_enable(hdata->sclk_hdmi);
+ if (ret < 0) {
+ DRM_ERROR("Failed to prepare_enable the sclk_mixer clk [%d]\n",
+ ret);
+ return ret;
+ }
+
+ return 0;
+}
+#endif
+
+static const struct dev_pm_ops exynos_hdmi_pm_ops = {
+ SET_RUNTIME_PM_OPS(exynos_hdmi_suspend, exynos_hdmi_resume, NULL)
+};
+
struct platform_driver hdmi_driver = {
.probe = hdmi_probe,
.remove = hdmi_remove,
.driver = {
.name = "exynos-hdmi",
.owner = THIS_MODULE,
+ .pm = &exynos_hdmi_pm_ops,
.of_match_table = hdmi_match_types,
},
};
--
1.9.1
next prev parent reply other threads:[~2015-11-03 10:47 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-03 10:47 [PATCH v2 0/7] drm/exynos: add pm runtime support Inki Dae
2015-11-03 10:47 ` [PATCH v2 1/7] drm/exynos: do not start enabling DP at bind() phase Inki Dae
2015-11-03 10:47 ` [PATCH v2 2/7] drm/exynos: add pm_runtime to DP Inki Dae
2015-11-03 10:47 ` Inki Dae [this message]
2015-11-03 10:47 ` [PATCH v2 4/7] drm/exynos: add pm_runtime to Mixer Inki Dae
2015-11-03 10:47 ` [PATCH v2 5/7] drm/exynos: add pm_runtime to FIMD Inki Dae
2015-11-03 10:47 ` [PATCH v2 6/7] drm/exynos: add pm_runtime to DECON 5433 Inki Dae
2015-11-03 10:47 ` [PATCH v2 7/7] drm/exynos: add pm_runtime to DECON 7 Inki Dae
2015-11-03 13:24 ` [PATCH v2 0/7] drm/exynos: add pm runtime support Andrzej Hajda
2015-11-03 15:38 ` Inki Dae
2015-11-04 7:24 ` Andrzej Hajda
2015-11-04 7:56 ` Inki Dae
2015-11-04 10:13 ` Andrzej Hajda
2015-11-04 11:46 ` Inki Dae
2015-11-19 14:51 ` Javier Martinez Canillas
2015-11-19 14:55 ` Javier Martinez Canillas
2015-11-19 15:51 ` Javier Martinez Canillas
2015-11-20 10:59 ` Inki Dae
2015-11-20 11:13 ` Inki Dae
2015-11-20 16:44 ` Javier Martinez Canillas
2015-11-21 9:38 ` Inki Dae
2015-11-21 13:40 ` Daniel Stone
2015-11-21 14:59 ` Inki Dae
2015-11-23 12:25 ` Javier Martinez Canillas
2015-11-23 16:47 ` Inki Dae
2015-11-23 18:38 ` Javier Martinez Canillas
2015-11-24 2:28 ` Inki Dae
2015-11-24 13:19 ` Javier Martinez Canillas
2015-11-25 15:52 ` Inki Dae
2015-11-20 16:23 ` Javier Martinez Canillas
2015-11-21 9:40 ` Inki Dae
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1446547629-12521-4-git-send-email-inki.dae@samsung.com \
--to=inki.dae@samsung.com \
--cc=airlied@linux.ie \
--cc=dri-devel@lists.freedesktop.org \
--cc=gustavo.padovan@collabora.co.uk \
--cc=linux-samsung-soc@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox