From patchwork Thu Feb 20 12:57:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 213567 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.9 required=3.0 tests=DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E31DC11D05 for ; Thu, 20 Feb 2020 12:59:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C72A924672 for ; Thu, 20 Feb 2020 12:59:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="ttI43cW5" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726959AbgBTM7C (ORCPT ); Thu, 20 Feb 2020 07:59:02 -0500 Received: from mailout2.w1.samsung.com ([210.118.77.12]:55272 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727705AbgBTM7C (ORCPT ); Thu, 20 Feb 2020 07:59:02 -0500 Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200220125900euoutp026f1ea4ed33c40ecbe89021312f5c3c2e~1HbzJmADK3243332433euoutp02- for ; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200220125900euoutp026f1ea4ed33c40ecbe89021312f5c3c2e~1HbzJmADK3243332433euoutp02- DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1582203540; bh=tZrGDaCqzHWhmHLZdoo3aAV9VY8K36ZSu/4KWQRAcjs=; h=From:To:Cc:Subject:Date:References:From; b=ttI43cW539949HGhwbTKCjVs2cniZWb4UKn0xRrZ+BbD/gyNFXRUmi1lhHDAAmNZL ex3atI91oyjuhHe5kmYsJZ4DGW82f41WFPKGEr080Lvn25bqstvFOwnhfaIr5v42aT Hok7a2kw42NDRkKzL/ZLNT+lQ4Ete8+OgE/wWKYU= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200220125900eucas1p108d93fb5b79f1f8a380ff03955e297c2~1Hby6-IkA0194901949eucas1p1g; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id 24.1B.60698.4928E4E5; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200220125900eucas1p11f6e56f11c8fcf25acf28b082107c89d~1HbydkUQY0196101961eucas1p1R; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200220125900eusmtrp1297724b237974fd3dd718825160ddbdd~1Hbyc0Ua61290212902eusmtrp1Y; Thu, 20 Feb 2020 12:59:00 +0000 (GMT) X-AuditID: cbfec7f5-a29ff7000001ed1a-0c-5e4e82945ae5 Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 78.87.07950.3928E4E5; Thu, 20 Feb 2020 12:58:59 +0000 (GMT) Received: from AMDC2765.digital.local (unknown [106.120.51.73]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200220125859eusmtip1db2444ebb034b0a9c6ee0a8cc550e663~1HbyBB1IH1117411174eusmtip1U; Thu, 20 Feb 2020 12:58:59 +0000 (GMT) From: Marek Szyprowski To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Bartlomiej Zolnierkiewicz , Seung-Woo Kim , Inki Dae , Andrzej Hajda Subject: [PATCH] drm/exynos: hdmi: don't leak enable HDMI_EN regulator if probe fails Date: Thu, 20 Feb 2020 13:57:26 +0100 Message-Id: <20200220125726.19442-1-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCIsWRmVeSWpSXmKPExsWy7djPc7pTmvziDE6uFrO4te4cq8XGGetZ La58fc9mMen+BBaLGef3MVmsPXKX3WLG5JdsDuwe97uPM3n0bVnF6PF5k1wAcxSXTUpqTmZZ apG+XQJXxs7266wFbfIV1zsbWRsYv0l1MXJySAiYSCzZPosVxBYSWMEosXVBBIT9hVHi18SQ LkYuIPszo8T3Y7cZYRpendzCDpFYzijx8dxiNggHqGPPk4tsIFVsAoYSXW+7wGwRATeJpsMz WUGKmAWuM0p8+7GIHSQhLBAucaFhKVARBweLgKpEy3ZTkDCvgC3Qhi9sENvkJVZvOMAM0ish cIBNYlP7fRaIhIvE/pY+JghbWOLV8S3sELaMxOnJPSwQDc2MEg/PrWWHcHoYJS43zYB6wlri zrlfYJuZBTQl1u/Shwg7Sqx/2MwMEpYQ4JO48VYQJMwMZE7aNh0qzCvR0SYEUa0mMev4Ori1 By9cYoawPSSeXnvMDAnGWInN+1rYJjDKzULYtYCRcRWjeGppcW56arFxXmq5XnFibnFpXrpe cn7uJkZg3J/+d/zrDsZ9f5IOMQpwMCrx8FY0+MUJsSaWFVfmHmKU4GBWEuFV4wEK8aYkVlal FuXHF5XmpBYfYpTmYFES5zVe9DJWSCA9sSQ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-Generator: CA X-RootMTR: 20200220125900eucas1p11f6e56f11c8fcf25acf28b082107c89d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200220125900eucas1p11f6e56f11c8fcf25acf28b082107c89d References: Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Move enabling and disabling HDMI_EN optional regulator to probe() function to keep track on the regulator status. This fixes following warning if probe() fails (for example when I2C DDC adapter cannot be yet gathered due to the missing driver). This fixes following warning observed on Arndale5250 board with multi_v7_defconfig: [drm] Failed to get ddc i2c adapter by node ------------[ cut here ]------------ WARNING: CPU: 0 PID: 214 at drivers/regulator/core.c:2051 _regulator_put+0x16c/0x184 Modules linked in: ... CPU: 0 PID: 214 Comm: systemd-udevd Not tainted 5.6.0-rc2-next-20200219-00040-g38af1dfafdbb #7570 Hardware name: Samsung Exynos (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0xcc/0xe0) [] (dump_stack) from [] (__warn+0xe0/0xf8) [] (__warn) from [] (warn_slowpath_fmt+0xb0/0xb8) [] (warn_slowpath_fmt) from [] (_regulator_put+0x16c/0x184) [] (_regulator_put) from [] (regulator_put+0x1c/0x2c) [] (regulator_put) from [] (release_nodes+0x17c/0x200) [] (release_nodes) from [] (really_probe+0x10c/0x350) [] (really_probe) from [] (driver_probe_device+0x60/0x1a0) [] (driver_probe_device) from [] (device_driver_attach+0x58/0x60) [] (device_driver_attach) from [] (__driver_attach+0x80/0xbc) [] (__driver_attach) from [] (bus_for_each_dev+0x68/0xb4) [] (bus_for_each_dev) from [] (bus_add_driver+0x130/0x1e8) [] (bus_add_driver) from [] (driver_register+0x78/0x110) [] (driver_register) from [] (exynos_drm_init+0xe8/0x11c [exynosdrm]) [] (exynos_drm_init [exynosdrm]) from [] (do_one_initcall+0x50/0x220) [] (do_one_initcall) from [] (do_init_module+0x60/0x210) [] (do_init_module) from [] (load_module+0x1c0c/0x2310) [] (load_module) from [] (sys_finit_module+0xac/0xbc) [] (sys_finit_module) from [] (ret_fast_syscall+0x0/0x54) Exception stack(0xecca3fa8 to 0xecca3ff0) ... ---[ end trace 276c91214635905c ]--- Signed-off-by: Marek Szyprowski --- drivers/gpu/drm/exynos/exynos_hdmi.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 9ff921f43a93..f141916eade6 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -1805,18 +1805,10 @@ static int hdmi_resources_init(struct hdmi_context *hdata) hdata->reg_hdmi_en = devm_regulator_get_optional(dev, "hdmi-en"); - if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) { + if (PTR_ERR(hdata->reg_hdmi_en) != -ENODEV) if (IS_ERR(hdata->reg_hdmi_en)) return PTR_ERR(hdata->reg_hdmi_en); - ret = regulator_enable(hdata->reg_hdmi_en); - if (ret) { - DRM_DEV_ERROR(dev, - "failed to enable hdmi-en regulator\n"); - return ret; - } - } - return hdmi_bridge_init(hdata); } @@ -2023,6 +2015,15 @@ static int hdmi_probe(struct platform_device *pdev) } } + if (!IS_ERR(hdata->reg_hdmi_en)) { + ret = regulator_enable(hdata->reg_hdmi_en); + if (ret) { + DRM_DEV_ERROR(dev, + "failed to enable hdmi-en regulator\n"); + goto err_hdmiphy; + } + } + pm_runtime_enable(dev); audio_infoframe = &hdata->audio.infoframe; @@ -2047,7 +2048,8 @@ static int hdmi_probe(struct platform_device *pdev) err_rpm_disable: pm_runtime_disable(dev); - + if (!IS_ERR(hdata->reg_hdmi_en)) + regulator_disable(hdata->reg_hdmi_en); err_hdmiphy: if (hdata->hdmiphy_port) put_device(&hdata->hdmiphy_port->dev);