Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp6628937rwl; Mon, 9 Jan 2023 10:45:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXus/sAoKeSNPICraora5seWS0YxCAzfqcIm9gDeBjefjUdodu2Jq52CS7e+ZuCtWDGr5Vyx X-Received: by 2002:a17:906:9255:b0:7c0:d4fa:3151 with SMTP id c21-20020a170906925500b007c0d4fa3151mr57283043ejx.17.1673289942841; Mon, 09 Jan 2023 10:45:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673289942; cv=none; d=google.com; s=arc-20160816; b=lt9xdZVmZEkSi1ZNzzrOANf8Ra9tRvguGeTJHgYMJV/Pavnnv4onV/usy27vjf9o3P LxqkzBUKp/OxvyD9zIjzUBGKLemU/Uoaq1TlR1+Dofn0PDxhmG0szAHFTFyqIi7MRAd9 LnWiXOT/PLb2L2T+0B2/LjN4hhgl8NBEVmTR3J2CkuP3ReNglpo/vo1gV3WOcCS+tbOA BF/ZDAu8+HG4e8TOfEZedKn4GMeZ4MY1MXZong9R36L3CBRiAdLb5EqOdmftzkv7d7+/ apJ6EPtZmwgBBQci6QpQvMD7M4ycCLknG1EGoTZYDTRNvnLDYlklYC3kgTalkBMol/y4 Irrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=SXXAJ3DUbtkoovXuYo+KyTb41EHZPfFvK143Ru7TRh0=; b=lRLfju7XcihiHyQMMaSHcnh1UFm4nI42pkMtSdro1x+fuczyKswIacT/fXnAyw+6j6 PlI2BmyN1o1wdTZ/MTGrhbI8SgFNh4jh6JORPLWnzmQtcHHYO3TBc1Z74Qhb9KWnNRby g76iG9SsWf3Xfi6wbCbABNRvFJh6rCusbo3/VTDtHqgMvxQ0B0iuPw9w7HoiH8P89j7S 2VJ46PFeru0Im2Lp1D6VUAg5Nh85BonBy7Ut3LObSU0dJ3+uA9FGXdzgVDr958IqAyie 68U/6HlINw1z2SjgM71bpDZnsi+BMGD28H38Mssl4QgaGPRgLdripWTExW3c9+hO0Ceo ejMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Y3YgV25O; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du10-20020a17090772ca00b0079330b37fb5si9370837ejc.564.2023.01.09.10.45.29; Mon, 09 Jan 2023 10:45:42 -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=Y3YgV25O; 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 S237277AbjAISeX (ORCPT + 53 others); Mon, 9 Jan 2023 13:34:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55258 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237809AbjAISdh (ORCPT ); Mon, 9 Jan 2023 13:33:37 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE292AE67 for ; Mon, 9 Jan 2023 10:31:06 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id co23so9141955wrb.4 for ; Mon, 09 Jan 2023 10:31:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SXXAJ3DUbtkoovXuYo+KyTb41EHZPfFvK143Ru7TRh0=; b=Y3YgV25OfF4n3rHemKxGZcfAeio40Dp6qtvOjQWf913+9nWH4KqVyHdHIkMkUsAwXG 93CXGcSSc6sfg5XBZJ59/TRBU/9vyU3+m6ECVJFZliFy4OOw37gA/swtHHzS46FmyYtO 2kaPopgHHI8DZIFkD2sqHY1FZhHGfgeF5u92IDOtcoCrKiefVUZAgBDI7o2pQOXPJ+Xb cqUX0qfSTCRgoGVFyPlYlbRY7FDuwtfqCKa4UCJgkJurzhyAOsCefsf/nt8FXdd5/qqS r4jRzTw9IGfuVnNp06Bqd6jb//rWFYDqTkSPfYnfcZDZh8Hbtc1hN3JevPbwvxiTs25I 2c4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=SXXAJ3DUbtkoovXuYo+KyTb41EHZPfFvK143Ru7TRh0=; b=d6C8lf3SC/44FiAdLqtiVc+kcoxuUkddRvr8s4KDtq+ggoWGUn1iYG7sXO//NmhP8c LLqSaariP66VAtVPyG6scWIaqRqJdW9BedwygemebOkuTzgu7+q+D6bTyI1v7GuQ2sAC uVffB80Olp2mRG92mXmQF+YcSXbkBWIGMWwRwTYkEzBtTybyeWb+BY50GAJbZaDURX1z fPvbWmAWwdyRwZO45Mdtn+WWjMXSeIK+gMX3x0TxIaCS95DwTqw4KjfkFGRfms9XAgU7 M69HWtje9tAvVCH8LKe2UsXuG+ufTl5E2LrWi6GOUmd7OC4kpNILvWKXmWBUjT5VZ8VU 4sHw== X-Gm-Message-State: AFqh2krUkIJDjUfeB6Ch88rmd6aqP8a0rjVKJyc2e2GjPG7nuvzO7hZ9 scybDMbOX4KltHiH3Wj3g+yncZHf6WYfk4IZK5Q= X-Received: by 2002:a5d:6451:0:b0:28b:905d:a0b5 with SMTP id d17-20020a5d6451000000b0028b905da0b5mr1043980wrw.451.1673289065282; Mon, 09 Jan 2023 10:31:05 -0800 (PST) MIME-Version: 1.0 References: <6c865dd8-b6c3-4491-48ca-df3e3fa45a2d@samsung.com> <0ef85cba-fa9b-6d72-ca44-48c4d6cf2752@linaro.org> In-Reply-To: <0ef85cba-fa9b-6d72-ca44-48c4d6cf2752@linaro.org> From: Matti Vaittinen Date: Mon, 9 Jan 2023 20:30:54 +0200 Message-ID: Subject: Re: [RESEND2,v4,2/2] drm/meson: dw-hdmi: Use devm_regulator_*get_enable*() To: neil.armstrong@linaro.org Cc: Marek Szyprowski , Matti Vaittinen , Martin Blumenstingl , Kevin Hilman , Liam Girdwood , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Mark Brown , linux-amlogic@lists.infradead.org, linux-arm-kernel@lists.infradead.org, Jerome Brunet Content-Type: text/plain; charset="UTF-8" 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 > >> Martin Blumenstingl > >> --- > >> 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 -- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~ Discuss - Estimate - Plan - Report and finally accomplish this: void do_work(int time) __attribute__ ((const));