Message ID | df0096b5aea2a18d1540cde379c5abf589ccd7c4.1669799805.git.mazziesaccount@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp822234wrr; Wed, 30 Nov 2022 01:34:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf5JXodotzTIAuIhAnm9inHdCqbtEfP+0aVlEue12qA5EIqtfQcEAHHIZGbpPxu6RsR7Q1Vu X-Received: by 2002:a17:907:2a82:b0:7ab:9952:9452 with SMTP id fl2-20020a1709072a8200b007ab99529452mr53534456ejc.142.1669800895882; Wed, 30 Nov 2022 01:34:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669800895; cv=none; d=google.com; s=arc-20160816; b=yBtAjVV3mTawgzVL1zqQHER/XrVSn1g0zWbdEaYLDFW9w13747U3RcyTt500YKal8/ ETzqgCia1XHs/Dm+ALj17pEcmL0fCc21ImjJgDcd0LUpUS12EpEIqPH2WXyoHypGnfbh JAydOlvERUyWNCgVZZ9vIqXT8COLkLVwOL977+ovI0QIDchTT/HXE+bLQWa/vKpboDjN wCsbaLeIgNHqXfPDP8GpI6h2G3M4Pj3Lr+8H0Lvyh0hYjNc0oKdOG8y3ItW0K4CrC3s4 voOlWxL6aiTwC2s85zY891c5GjDg9afi26bVDsMWZT+1Xr3z12jF+nCgocYtfUEQWdlB 6wnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=yGai96t0pVD49z2Oe24kTckJ4TAh6OnuSc06LTgbBHs=; b=R5Yar18J//VSLVc8+y04/fBunzRb/5dEBs0wIFVKntEnLva2WuA7QXKKJRc1KB0+4B WRE8b0km7vhR5z6sxLjjEBnLd43OQfa/k3DwZmiT6Uhqrjdkwgc7C5asGFj4QEiaCqqm hBk3/R8TQ5bgobQi1Rzj5b+t9GpV5HuhRMhehGIPQc4BdhMSG92DqJ4uBtTxHAboXarU WmaEYNJhGI+LYEkciJVp3pR57d4BOSPl/rvVa09RqZqPb+64nCN1WpM4rPWoal/I8z5h CsWA7pEp/EFV2mt1mlfLDJ5citB4J46vRb5MZy0UkPw3FWO9bu6cfllZ4s6dicZLYyVH HZGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=go472kIN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i18-20020a1709064fd200b007adf9d69424si891944ejw.586.2022.11.30.01.34.32; Wed, 30 Nov 2022 01:34:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=go472kIN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233081AbiK3JXb (ORCPT <rfc822;heyuhang3455@gmail.com> + 99 others); Wed, 30 Nov 2022 04:23:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233139AbiK3JXM (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 30 Nov 2022 04:23:12 -0500 Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D4A02F3A2 for <linux-kernel@vger.kernel.org>; Wed, 30 Nov 2022 01:23:07 -0800 (PST) Received: by mail-lj1-x232.google.com with SMTP id l8so20155216ljh.13 for <linux-kernel@vger.kernel.org>; Wed, 30 Nov 2022 01:23:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=yGai96t0pVD49z2Oe24kTckJ4TAh6OnuSc06LTgbBHs=; b=go472kIN5B1Uc+NA0wAic0hCbPCGr8DEEK4Ux8xipfXkD91wky5WY40pHPX1jcHOI5 JhBAR8KL+7g1Q5ubS7962T/ToIxdQA9IZoFbZknAOflR3Mm6ojHloqIGWj4FTEBLkIdt p47glaUsIVE69a/LkSVoX2BZ6IlIQICilLCIP1p61fedXPHQP8u4UK0+J7AcuXsP4kbB msDLcrBd+bY/I1IOMpPpO0C3sM2YKO2GwqzJ7bkaBUEfFo4rsIq5aU4/eBh94ip1fiOR /NiCJFfXEE1uS6WJf2oi3KxHZ+p9jU4B/t9g2NIW0kLQAUKAir2ezlU1w9DvKsAhuGFr C9FQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=yGai96t0pVD49z2Oe24kTckJ4TAh6OnuSc06LTgbBHs=; b=sORXzGNSVeBjfWjn0QwHF2F/mQeRYVfTt67+7zz7qaR4OYE/hKUp1V97TwcjEzEgK/ en7TqcrSNAUjt11nTf7Cq2qv7R/BCwDA/JaY4RBol+KWKQ1GwFQXOQw+FOJ5LnNOryxM UtGZEFgqoONdD0EvVFH51KTp0KHai/9M3s8ydcy8UcRmbuXiBL4lZ6VUaMP4oiA09GZT kopTqI1rHgdBxdvIF5NETv+XATAdXxFDjLXZLH7GUoTnEjQD8V8PQnu9FlGxObwdWHvm 0OKIBjNZTwfcKdHu/oQxOyqQE8HNtupzU4CFCrXIfVKUUZignb23B4/WDhzbiZGaB601 VYFA== X-Gm-Message-State: ANoB5plIxBZovSQZaPo56MDTtRYSVfL64nZIjaBV9Fvk0DyFgKLCIwmF oeltcGaBeNQHRJ8mqIaW0Sg= X-Received: by 2002:a2e:8750:0:b0:279:9466:9355 with SMTP id q16-20020a2e8750000000b0027994669355mr7804106ljj.253.1669800185798; Wed, 30 Nov 2022 01:23:05 -0800 (PST) Received: from dc75zzyyyyyyyyyyyyygt-3.rev.dnainternet.fi (dc75zzyyyyyyyyyyyyygt-3.rev.dnainternet.fi. [2001:14ba:16f3:4a00::b]) by smtp.gmail.com with ESMTPSA id t27-20020ac2549b000000b0049a4862966fsm182793lfk.146.2022.11.30.01.23.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 01:23:04 -0800 (PST) Date: Wed, 30 Nov 2022 11:23:00 +0200 From: Matti Vaittinen <mazziesaccount@gmail.com> To: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>, Matti Vaittinen <mazziesaccount@gmail.com> Cc: Neil Armstrong <neil.armstrong@linaro.org>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Kevin Hilman <khilman@baylibre.com>, Jerome Brunet <jbrunet@baylibre.com>, Martin Blumenstingl <martin.blumenstingl@googlemail.com>, Liam Girdwood <lgirdwood@gmail.com>, Mark Brown <broonie@kernel.org>, dri-devel@lists.freedesktop.org, linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RESEND2 v4 2/2] drm/meson: dw-hdmi: Use devm_regulator_*get_enable*() Message-ID: <df0096b5aea2a18d1540cde379c5abf589ccd7c4.1669799805.git.mazziesaccount@gmail.com> References: <cover.1669799805.git.mazziesaccount@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="+FpHG9ThwonLOArJ" Content-Disposition: inline In-Reply-To: <cover.1669799805.git.mazziesaccount@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1750913144044228653?= X-GMAIL-MSGID: =?utf-8?q?1750913144044228653?= |
Series |
Use devm helpers for regulator get and enable
|
|
Commit Message
Matti Vaittinen
Nov. 30, 2022, 9:23 a.m. UTC
Simplify using the devm_regulator_get_enable_optional(). Also drop the
now unused struct member 'hdmi_supply'.
Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com>
Martin Blumenstingl <martin.blumenstingl@googlemail.com>
---
v4 resend 2:
Respinning unchanged code with the commit title changed as wa suggested
by Robert Foss and commit message changed as was suggested by Martin.
I am doing a clean-up for my local git and encountered this one.
Respinning as it seems this one fell through the cracks.
---
drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++--------------------
1 file changed, 3 insertions(+), 20 deletions(-)
Comments
On 30/11/2022 10:23, Matti Vaittinen wrote: > Simplify using the devm_regulator_get_enable_optional(). Also drop the > now unused struct member 'hdmi_supply'. > > Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> > Martin Blumenstingl <martin.blumenstingl@googlemail.com> Missing Acked-by, I'll add it while applying. Neil > > --- > v4 resend 2: > Respinning unchanged code with the commit title changed as wa suggested > by Robert Foss and commit message changed as was suggested by Martin. > > I am doing a clean-up for my local git and encountered this one. > Respinning as it seems this one fell through the cracks. > --- > drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++-------------------- > 1 file changed, 3 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c > index 5cd2b2ebbbd3..7642f740272b 100644 > --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c > +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c > @@ -140,7 +140,6 @@ struct meson_dw_hdmi { > struct reset_control *hdmitx_apb; > struct reset_control *hdmitx_ctrl; > struct reset_control *hdmitx_phy; > - struct regulator *hdmi_supply; > u32 irq_stat; > struct dw_hdmi *hdmi; > struct drm_bridge *bridge; > @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) > > } > > -static void meson_disable_regulator(void *data) > -{ > - regulator_disable(data); > -} > - > static void meson_disable_clk(void *data) > { > clk_disable_unprepare(data); > @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, > meson_dw_hdmi->data = match; > dw_plat_data = &meson_dw_hdmi->dw_plat_data; > > - meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi"); > - if (IS_ERR(meson_dw_hdmi->hdmi_supply)) { > - if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER) > - return -EPROBE_DEFER; > - meson_dw_hdmi->hdmi_supply = NULL; > - } else { > - ret = regulator_enable(meson_dw_hdmi->hdmi_supply); > - if (ret) > - return ret; > - ret = devm_add_action_or_reset(dev, meson_disable_regulator, > - meson_dw_hdmi->hdmi_supply); > - if (ret) > - return ret; > - } > + ret = devm_regulator_get_enable_optional(dev, "hdmi"); > + if (ret != -ENODEV) > + return ret; > > meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev, > "hdmitx_apb");
On 12/1/22 10:38, Neil Armstrong wrote: > On 30/11/2022 10:23, Matti Vaittinen wrote: >> Simplify using the devm_regulator_get_enable_optional(). Also drop the >> now unused struct member 'hdmi_supply'. >> >> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> >> Martin Blumenstingl <martin.blumenstingl@googlemail.com> > > Missing Acked-by, I'll add it while applying. Oh, well spotted. I should've been more careful.. Sorry and thanks for sorting it out! --Matti
Hi Matti, On 30.11.2022 10:23, Matti Vaittinen wrote: > Simplify using the devm_regulator_get_enable_optional(). Also drop the > now unused struct member 'hdmi_supply'. > > Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> > Martin Blumenstingl <martin.blumenstingl@googlemail.com> > --- > v4 resend 2: > Respinning unchanged code with the commit title changed as wa suggested > by Robert Foss and commit message changed as was suggested by Martin. > > I am doing a clean-up for my local git and encountered this one. > Respinning as it seems this one fell through the cracks. > --- > drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++-------------------- > 1 file changed, 3 insertions(+), 20 deletions(-) > > diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c > index 5cd2b2ebbbd3..7642f740272b 100644 > --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c > +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c > @@ -140,7 +140,6 @@ struct meson_dw_hdmi { > struct reset_control *hdmitx_apb; > struct reset_control *hdmitx_ctrl; > struct reset_control *hdmitx_phy; > - struct regulator *hdmi_supply; > u32 irq_stat; > struct dw_hdmi *hdmi; > struct drm_bridge *bridge; > @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) > > } > > -static void meson_disable_regulator(void *data) > -{ > - regulator_disable(data); > -} > - > static void meson_disable_clk(void *data) > { > clk_disable_unprepare(data); > @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, > meson_dw_hdmi->data = match; > dw_plat_data = &meson_dw_hdmi->dw_plat_data; > > - meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi"); > - if (IS_ERR(meson_dw_hdmi->hdmi_supply)) { > - if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER) > - return -EPROBE_DEFER; > - meson_dw_hdmi->hdmi_supply = NULL; > - } else { > - ret = regulator_enable(meson_dw_hdmi->hdmi_supply); > - if (ret) > - return ret; > - ret = devm_add_action_or_reset(dev, meson_disable_regulator, > - meson_dw_hdmi->hdmi_supply); > - if (ret) > - return ret; > - } > + ret = devm_regulator_get_enable_optional(dev, "hdmi"); > + if (ret != -ENODEV) The above line should be "if (ret < 0)", otherwise it breaks hdmi support. I've noticed this once this change has been merged to linux-next and all my Amlogic Meson based boards failed to initialize HDMI. Is it possible to fix this in drm tree or do I need to send the incremental fixup? > + return ret; > > meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev, > "hdmitx_apb"); Best regards
On 09/01/2023 14:46, Marek Szyprowski wrote: > Hi Matti, > > On 30.11.2022 10:23, Matti Vaittinen wrote: >> Simplify using the devm_regulator_get_enable_optional(). Also drop the >> now unused struct member 'hdmi_supply'. >> >> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> >> Martin Blumenstingl <martin.blumenstingl@googlemail.com> >> --- >> v4 resend 2: >> Respinning unchanged code with the commit title changed as wa suggested >> by Robert Foss and commit message changed as was suggested by Martin. >> >> I am doing a clean-up for my local git and encountered this one. >> Respinning as it seems this one fell through the cracks. >> --- >> drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++-------------------- >> 1 file changed, 3 insertions(+), 20 deletions(-) >> >> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c >> index 5cd2b2ebbbd3..7642f740272b 100644 >> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c >> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c >> @@ -140,7 +140,6 @@ struct meson_dw_hdmi { >> struct reset_control *hdmitx_apb; >> struct reset_control *hdmitx_ctrl; >> struct reset_control *hdmitx_phy; >> - struct regulator *hdmi_supply; >> u32 irq_stat; >> struct dw_hdmi *hdmi; >> struct drm_bridge *bridge; >> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) >> >> } >> >> -static void meson_disable_regulator(void *data) >> -{ >> - regulator_disable(data); >> -} >> - >> static void meson_disable_clk(void *data) >> { >> clk_disable_unprepare(data); >> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, >> meson_dw_hdmi->data = match; >> dw_plat_data = &meson_dw_hdmi->dw_plat_data; >> >> - meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi"); >> - if (IS_ERR(meson_dw_hdmi->hdmi_supply)) { >> - if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER) >> - return -EPROBE_DEFER; >> - meson_dw_hdmi->hdmi_supply = NULL; >> - } else { >> - ret = regulator_enable(meson_dw_hdmi->hdmi_supply); >> - if (ret) >> - return ret; >> - ret = devm_add_action_or_reset(dev, meson_disable_regulator, >> - meson_dw_hdmi->hdmi_supply); >> - if (ret) >> - return ret; >> - } >> + ret = devm_regulator_get_enable_optional(dev, "hdmi"); >> + if (ret != -ENODEV) > > The above line should be "if (ret < 0)", otherwise it breaks hdmi support. > > I've noticed this once this change has been merged to linux-next and all > my Amlogic Meson based boards failed to initialize HDMI. Is it possible > to fix this in drm tree or do I need to send the incremental fixup? Nop, please send an incremental fix and I'll apply it asap. Thanks, Neil > >> + return ret; >> >> meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev, >> "hdmitx_apb"); > > Best regards
Hi Marek & All, ma 9. tammik. 2023 klo 17.23 Neil Armstrong (neil.armstrong@linaro.org) kirjoitti: > > On 09/01/2023 14:46, Marek Szyprowski wrote: > > Hi Matti, > > > > On 30.11.2022 10:23, Matti Vaittinen wrote: > >> Simplify using the devm_regulator_get_enable_optional(). Also drop the > >> now unused struct member 'hdmi_supply'. > >> > >> Signed-off-by: Matti Vaittinen <mazziesaccount@gmail.com> > >> Martin Blumenstingl <martin.blumenstingl@googlemail.com> > >> --- > >> v4 resend 2: > >> Respinning unchanged code with the commit title changed as wa suggested > >> by Robert Foss and commit message changed as was suggested by Martin. > >> > >> I am doing a clean-up for my local git and encountered this one. > >> Respinning as it seems this one fell through the cracks. > >> --- > >> drivers/gpu/drm/meson/meson_dw_hdmi.c | 23 +++-------------------- > >> 1 file changed, 3 insertions(+), 20 deletions(-) > >> > >> diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c > >> index 5cd2b2ebbbd3..7642f740272b 100644 > >> --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c > >> +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c > >> @@ -140,7 +140,6 @@ struct meson_dw_hdmi { > >> struct reset_control *hdmitx_apb; > >> struct reset_control *hdmitx_ctrl; > >> struct reset_control *hdmitx_phy; > >> - struct regulator *hdmi_supply; > >> u32 irq_stat; > >> struct dw_hdmi *hdmi; > >> struct drm_bridge *bridge; > >> @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) > >> > >> } > >> > >> -static void meson_disable_regulator(void *data) > >> -{ > >> - regulator_disable(data); > >> -} > >> - > >> static void meson_disable_clk(void *data) > >> { > >> clk_disable_unprepare(data); > >> @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, > >> meson_dw_hdmi->data = match; > >> dw_plat_data = &meson_dw_hdmi->dw_plat_data; > >> > >> - meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi"); > >> - if (IS_ERR(meson_dw_hdmi->hdmi_supply)) { > >> - if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER) > >> - return -EPROBE_DEFER; > >> - meson_dw_hdmi->hdmi_supply = NULL; > >> - } else { > >> - ret = regulator_enable(meson_dw_hdmi->hdmi_supply); > >> - if (ret) > >> - return ret; > >> - ret = devm_add_action_or_reset(dev, meson_disable_regulator, > >> - meson_dw_hdmi->hdmi_supply); > >> - if (ret) > >> - return ret; > >> - } > >> + ret = devm_regulator_get_enable_optional(dev, "hdmi"); > >> + if (ret != -ENODEV) > > > > The above line should be "if (ret < 0)", otherwise it breaks hdmi support. > > Sorry for the trouble and thanks for pointing this out! I believe the condition I was looking for was if (ret && ret != -ENODEV). At least in my eyes the use of regulator_get_optional() sounds like the -ENODEV should not be treated as an error. The obvious mistake is regarding return value 0 as such. Thanks for spotting this! > > I've noticed this once this change has been merged to linux-next and all > > my Amlogic Meson based boards failed to initialize HDMI. Is it possible > > to fix this in drm tree or do I need to send the incremental fixup? > > Nop, please send an incremental fix and I'll apply it asap. Thanks for cleaning-up the mess I caused Marek! Please, let me know if you want me to cook the fix. Yours, - -Matti
diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index 5cd2b2ebbbd3..7642f740272b 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -140,7 +140,6 @@ struct meson_dw_hdmi { struct reset_control *hdmitx_apb; struct reset_control *hdmitx_ctrl; struct reset_control *hdmitx_phy; - struct regulator *hdmi_supply; u32 irq_stat; struct dw_hdmi *hdmi; struct drm_bridge *bridge; @@ -665,11 +664,6 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi) } -static void meson_disable_regulator(void *data) -{ - regulator_disable(data); -} - static void meson_disable_clk(void *data) { clk_disable_unprepare(data); @@ -723,20 +717,9 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master, meson_dw_hdmi->data = match; dw_plat_data = &meson_dw_hdmi->dw_plat_data; - meson_dw_hdmi->hdmi_supply = devm_regulator_get_optional(dev, "hdmi"); - if (IS_ERR(meson_dw_hdmi->hdmi_supply)) { - if (PTR_ERR(meson_dw_hdmi->hdmi_supply) == -EPROBE_DEFER) - return -EPROBE_DEFER; - meson_dw_hdmi->hdmi_supply = NULL; - } else { - ret = regulator_enable(meson_dw_hdmi->hdmi_supply); - if (ret) - return ret; - ret = devm_add_action_or_reset(dev, meson_disable_regulator, - meson_dw_hdmi->hdmi_supply); - if (ret) - return ret; - } + ret = devm_regulator_get_enable_optional(dev, "hdmi"); + if (ret != -ENODEV) + return ret; meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev, "hdmitx_apb");