From: Rahul Sharma <rahul.sharma@samsung.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-samsung-soc@vger.kernel.org, inki.dae@samsung.com,
kgene.kim@samsung.com, joshi@samsung.com, r.sh.open@gmail.com,
Rahul Sharma <rahul.sharma@samsung.com>
Subject: [PATCH] drm/exynos: defer hdmi probe when fail to get regulators
Date: Wed, 18 Jun 2014 19:12:56 +0530 [thread overview]
Message-ID: <1403098976-6506-1-git-send-email-rahul.sharma@samsung.com> (raw)
HDMI probe proceeds with dummy regulators when the regulators
are not provided in DT node or regulator provider has not get
probed or failed to register the regulators.
This patch modify hdmi driver to defer the probe in case the
regulators are not available.
Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com>
---
Based on exynos-drm-fixes branch in Inki dae's tree.
drivers/gpu/drm/exynos/exynos_hdmi.c | 69 ++++++++++++++++++++++++----------
1 file changed, 50 insertions(+), 19 deletions(-)
diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c
index aa259b0..3f24c49 100644
--- a/drivers/gpu/drm/exynos/exynos_hdmi.c
+++ b/drivers/gpu/drm/exynos/exynos_hdmi.c
@@ -83,7 +83,7 @@ struct hdmi_resources {
struct clk *sclk_pixel;
struct clk *sclk_hdmiphy;
struct clk *mout_hdmi;
- struct regulator_bulk_data *regul_bulk;
+ struct regulator **regulators;
int regul_count;
};
@@ -2022,6 +2022,36 @@ static void hdmi_commit(struct exynos_drm_display *display)
hdmi_conf_apply(hdata);
}
+int hdmi_regulator_enable(struct hdmi_context *hdata)
+{
+ struct hdmi_resources *res = &hdata->res;
+ int i, ret;
+
+ for (i = 0; i < res->regul_count; ++i) {
+ ret = regulator_enable(res->regulators[i]);
+ if (ret < 0) {
+ DRM_ERROR("fail to enable regulators.\n");
+ return ret;
+ }
+ }
+ return 0;
+}
+
+int hdmi_regulator_disable(struct hdmi_context *hdata)
+{
+ struct hdmi_resources *res = &hdata->res;
+ int i, ret;
+
+ for (i = 0; i < res->regul_count; ++i) {
+ ret = regulator_disable(res->regulators[i]);
+ if (ret < 0) {
+ DRM_ERROR("fail to disable regulators.\n");
+ return ret;
+ }
+ }
+ return 0;
+}
+
static void hdmi_poweron(struct exynos_drm_display *display)
{
struct hdmi_context *hdata = display->ctx;
@@ -2039,8 +2069,8 @@ static void hdmi_poweron(struct exynos_drm_display *display)
pm_runtime_get_sync(hdata->dev);
- if (regulator_bulk_enable(res->regul_count, res->regul_bulk))
- DRM_DEBUG_KMS("failed to enable regulator bulk\n");
+ if (hdmi_regulator_enable(hdata))
+ DRM_DEBUG_KMS("failed to enable regulators\n");
/* set pmu hdmiphy control bit to enable hdmiphy */
regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
@@ -2077,7 +2107,8 @@ static void hdmi_poweroff(struct exynos_drm_display *display)
regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
PMU_HDMI_PHY_ENABLE_BIT, 0);
- regulator_bulk_disable(res->regul_count, res->regul_bulk);
+ if (hdmi_regulator_disable(hdata))
+ DRM_DEBUG_KMS("failed to disable regulators\n");
pm_runtime_put_sync(hdata->dev);
@@ -2211,24 +2242,24 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
clk_set_parent(res->mout_hdmi, res->sclk_pixel);
- res->regul_bulk = devm_kzalloc(dev, ARRAY_SIZE(supply) *
- sizeof(res->regul_bulk[0]), GFP_KERNEL);
- if (!res->regul_bulk) {
- ret = -ENOMEM;
- goto fail;
- }
+ res->regul_count = ARRAY_SIZE(supply);
+
+ res->regulators = devm_kzalloc(dev, res->regul_count *
+ sizeof(res->regulators[0]), GFP_KERNEL);
+ if (!res->regulators)
+ return -ENOMEM;
+
for (i = 0; i < ARRAY_SIZE(supply); ++i) {
- res->regul_bulk[i].supply = supply[i];
- res->regul_bulk[i].consumer = NULL;
- }
- ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), res->regul_bulk);
- if (ret) {
- DRM_ERROR("failed to get regulators\n");
- return ret;
+ res->regulators[i] =
+ devm_regulator_get_optional(dev, supply[i]);
+ if (IS_ERR(res->regulators[i])) {
+ DRM_ERROR("fail to get regulator: %s.\n",
+ supply[i]);
+ return -EPROBE_DEFER;
+ }
}
- res->regul_count = ARRAY_SIZE(supply);
- return ret;
+ return 0;
fail:
DRM_ERROR("HDMI resource init - failed\n");
return ret;
--
1.7.9.5
next reply other threads:[~2014-06-18 13:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-18 13:42 Rahul Sharma [this message]
2014-06-19 4:04 ` [PATCH] drm/exynos: defer hdmi probe when fail to get regulators Inki Dae
2014-06-19 4:37 ` Rahul Sharma
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=1403098976-6506-1-git-send-email-rahul.sharma@samsung.com \
--to=rahul.sharma@samsung.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=inki.dae@samsung.com \
--cc=joshi@samsung.com \
--cc=kgene.kim@samsung.com \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=r.sh.open@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.