From patchwork Wed Jun 18 13:42:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rahul Sharma X-Patchwork-Id: 4376161 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 48FB49F1C4 for ; Wed, 18 Jun 2014 13:44:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8563220357 for ; Wed, 18 Jun 2014 13:44:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0918E20375 for ; Wed, 18 Jun 2014 13:44:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751888AbaFRNok (ORCPT ); Wed, 18 Jun 2014 09:44:40 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:42716 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751312AbaFRNoj (ORCPT ); Wed, 18 Jun 2014 09:44:39 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N7D00CMDA6D8BC0@mailout2.samsung.com> for linux-samsung-soc@vger.kernel.org; Wed, 18 Jun 2014 22:44:37 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr4.samsung.com (EPCPMTA) with SMTP id D8.57.13369.5C791A35; Wed, 18 Jun 2014 22:44:37 +0900 (KST) X-AuditID: cbfee690-b7fb56d000003439-38-53a197c56d99 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id E1.B4.07139.5C791A35; Wed, 18 Jun 2014 22:44:37 +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 <0N7D007D7A4YEG30@mmp1.samsung.com>; Wed, 18 Jun 2014 22:44:37 +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] drm/exynos: defer hdmi probe when fail to get regulators Date: Wed, 18 Jun 2014 19:12:56 +0530 Message-id: <1403098976-6506-1-git-send-email-rahul.sharma@samsung.com> X-Mailer: git-send-email 1.7.9.5 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrJLMWRmVeSWpSXmKPExsWyRsSkVvfo9IXBBrsXK1lc+fqezWLS/Qks Ft93fWG36F1wlc1ixvl9TBYLX8RbTFl0mNWB3WPnrLvsHve7jzN59G1ZxejxeZNcAEsUl01K ak5mWWqRvl0CV8b+5y8ZC6bIVXw5co2xgfG1RBcjJ4eEgInEq/W9TBC2mMSFe+vZuhi5OIQE ljJK7H59mxmmaN+XI8wQiUWMEheWP2GCcNqZJNqePgarYhPQlZh98BkjiC0ioCzxd+IqRpAi ZoHljBIvN7ewgSSEBTwlvp97BFbEIqAq0TVlNpjNK+AucaX5G1ANB9A6BYk5k2xAeiUEfrNJ NHbOY4aoF5D4NvkQC0SNrMSmA1DXSUocXHGDZQKj4AJGhlWMoqkFyQXFSelFJnrFibnFpXnp esn5uZsYgcF6+t+zCTsY7x2wPsSYDDRuIrOUaHI+MNjzSuINjc2MLExNTI2NzC3NSBNWEudV e5QUJCSQnliSmp2aWpBaFF9UmpNafIiRiYNTqoFRye2FgWTQ3/Mfa7suy+hu+LIllU+vk/dN QovSnckCx5/KTJ13yPjmj3O/mgRPLYgz2szCscNj/8S/N14H286oYb7B5+Lz98X1z/KXDv05 6izNwFbn0G7+5ESukpHCnk6PoA8qJn8aBDO5dh525q6ZzTix0+fxssnW0jtvKKmdvH2meFtq dIaZEktxRqKhFnNRcSIAIjpHx2wCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrGIsWRmVeSWpSXmKPExsVy+t9jAd2j0xcGG7Q9lbC48vU9m8Wk+xNY LL7v+sJu0bvgKpvFjPP7mCwWvoi3mLLoMKsDu8fOWXfZPe53H2fy6NuyitHj8ya5AJaoBkab jNTElNQihdS85PyUzLx0WyXv4HjneFMzA0NdQ0sLcyWFvMTcVFslF58AXbfMHKALlBTKEnNK gUIBicXFSvp2mCaEhrjpWsA0Ruj6hgTB9RgZoIGENYwZ+5+/ZCyYIlfx5cg1xgbG1xJdjJwc EgImEvu+HGGGsMUkLtxbz9bFyMUhJLCIUeLC8idMEE47k0Tb08dgVWwCuhKzDz5jBLFFBJQl /k5cxQhSxCywnFHi5eYWNpCEsICnxPdzj8CKWARUJbqmzAazeQXcJa40fwOq4QBapyAxZ5LN BEbuBYwMqxhFUwuSC4qT0nON9IoTc4tL89L1kvNzNzGCY+GZ9A7GVQ0WhxgFOBiVeHg5chcE C7EmlhVX5h5ilOBgVhLhPVa8MFiINyWxsiq1KD++qDQntfgQYzLQ8onMUqLJ+cA4zSuJNzQ2 MTc1NrU0sTAxsyRNWEmc92CrdaCQQHpiSWp2ampBahHMFiYOTqkGxq5WxzjZNQovQ6y+sL2Z e0xI+ZLkpW9r7p7YVRn9RObGYvEfz3xvyX/WvuGzjLVrrsz/vUc5NnqKL2xwW6E1WUS24PLb leUvnH1qOjI/VqfPNmjt6w5qvP6MV4tN5FC0YNsHjbB1WkZPvb8JNm+JU39wo6Ou6LmR6hK+ pYV9+kpJNr1Prp/hUGIpzkg01GIuKk4EAAwreGPJAgAA 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 --- 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;