From patchwork Mon Jun 23 05:37:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 4399391 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 16EEFBEEAA for ; Mon, 23 Jun 2014 05:38:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 32CD8202A1 for ; Mon, 23 Jun 2014 05:38:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B39E020295 for ; Mon, 23 Jun 2014 05:38:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751502AbaFWFia (ORCPT ); Mon, 23 Jun 2014 01:38:30 -0400 Received: from mailout3.samsung.com ([203.254.224.33]:18997 "EHLO mailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751491AbaFWFi3 (ORCPT ); Mon, 23 Jun 2014 01:38:29 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N7L00MNIX03VV10@mailout3.samsung.com> for linux-samsung-soc@vger.kernel.org; Mon, 23 Jun 2014 14:38:27 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.124]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id B7.D2.14704.35DB7A35; Mon, 23 Jun 2014 14:38:27 +0900 (KST) X-AuditID: cbfee68f-b7fef6d000003970-6b-53a7bd530928 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id E2.3B.04943.25DB7A35; Mon, 23 Jun 2014 14:38:26 +0900 (KST) Received: from localhost.localdomain ([107.108.83.245]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N7L0052UWZMUDE0@mmp1.samsung.com>; Mon, 23 Jun 2014 14:38:26 +0900 (KST) From: Rahul Sharma 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 Subject: [PATCH v2] drm/exynos: defer hdmi probe when fail to get regulators Date: Mon, 23 Jun 2014 11:07:18 +0530 Message-id: <1403501838-16530-1-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrBLMWRmVeSWpSXmKPExsWyRsSkRjd47/Jggy3/2SyufH3PZjHp/gQW i++7vrBb9C64ymYx4/w+JouFL+Itpiw6zOrA7rFz1l12j/vdx5k8+rasYvT4vEkugCWKyyYl NSezLLVI3y6BK2PvjRksBS/kKr51zmBqYNws2cXIySEhYCLRfPkaK4QtJnHh3nq2LkYuDiGB pYwSLdtWMcIUXW1cxAKRWMQo0f9/JzuE084kMX3+VCaQKjYBXYnZB5+BdYgIKEv8nQjSzcXB LLCcUeLl5hY2kISwgI/Eh9YtQKM4OFgEVCUuNReBhHkFPCQOfG8GC0sIKEjMmWQD0ioh8J1N 4tHVTcwgNSwCAhLfJh+CqpGV2HSAGeI4SYmDK26wTGAUXMDIsIpRNLUguaA4Kb3IWK84Mbe4 NC9dLzk/dxMjMFRP/3vWv4Px7gHrQ4zJQOMmMkuJJucDQz2vJN7Q2MzIwtTE1NjI3NKMNGEl cd77D5OChATSE0tSs1NTC1KL4otKc1KLDzEycXBKNTCG/2G/v6FjknxapX5C6mOP2EPHn7vb yuXnFfL+//HCZX5Xf/GWCD7zguN5/Zof3zDx6S3VUDpyTfzZmyzvcIZ/X2I/CorGB0yzfKe1 6Nnn7M61a9ZF755RtInltfJ0TR6WPyzR7H03r7WpOxddP7Zs5yWFeRpGQkF/i8T28k+dW3JV Mux38nolluKMREMt5qLiRABmE+KuawIAAA== X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpnkeLIzCtJLcpLzFFi42I5/e+xgG7Q3uXBBrPe21hc+fqezWLS/Qks Ft93fWG36F1wlc1ixvl9TBYLX8RbTFl0mNWB3WPnrLvsHve7jzN59G1ZxejxeZNcAEtUA6NN RmpiSmqRQmpecn5KZl66rZJ3cLxzvKmZgaGuoaWFuZJCXmJuqq2Si0+ArltmDtAFSgpliTml QKGAxOJiJX07TBNCQ9x0LWAaI3R9Q4LgeowM0EDCGsaMvTdmsBS8kKv41jmDqYFxs2QXIyeH hICJxNXGRSwQtpjEhXvr2boYuTiEBBYxSvT/38kO4bQzSUyfP5UJpIpNQFdi9sFnjCC2iICy xN+JqxhBipgFljNKvNzcwgaSEBbwkfjQugVoLAcHi4CqxKXmIpAwr4CHxIHvzWBhCQEFiTmT bCYwci9gZFjFKJpakFxQnJSea6hXnJhbXJqXrpecn7uJERwJz6R2MK5ssDjEKMDBqMTDq+G2 PFiINbGsuDL3EKMEB7OSCG9jA1CINyWxsiq1KD++qDQntfgQoynQ7onMUqLJ+cAozSuJNzQ2 MTc1NrU0sTAxs1QS5z3Qah0oJJCeWJKanZpakFoE08fEwSnVwLjFrGCP6N+Xy77aJU36KeR1 I+PaPUUJ1We+34L2dx0VX2XMFJGpcaDc7Qq3eFJA7H6Zd1ssvvi2d2wWmtMrENZsqqZxUHDf JddarTZG1wDdtCBpkQ/1q840PyuV/pcqxG+4bP93D4t22VNVvFcjmE80r4hz73J86f7fwNHn xs+ERyuc9rdtUWIpzkg01GIuKk4EAO7/bEWaAgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- v2: Return Error code from devm_regulator_get_optional (as it is). 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 c104d0c..d05da3b 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); @@ -2192,24 +2223,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 PTR_ERR(res->regulators[i]); + } } - res->regul_count = ARRAY_SIZE(supply); - return ret; + return 0; fail: DRM_ERROR("HDMI resource init - failed\n"); return ret;