From patchwork Wed Nov 30 09:22:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13059628 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C0E1BC4321E for ; Wed, 30 Nov 2022 09:23:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3890110E438; Wed, 30 Nov 2022 09:23:20 +0000 (UTC) Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF05310E43D for ; Wed, 30 Nov 2022 09:22:44 +0000 (UTC) Received: by mail-lf1-x136.google.com with SMTP id g12so26000689lfh.3 for ; Wed, 30 Nov 2022 01:22:44 -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=gGvCkJhsGrDGRU0up7It8RIrU+VkoFlEUPGl7kmXIeY=; b=k5W5TLxgDf03r77V1DcSG6YijxnMLnxYltQfx+OsR20+7qR3PeKhho0lzcFr5Fi2ti p+fivdkeVMxwYNqIWmTeFAWpbyq3K6H+QJoBmPRpFpt/weblVJPopeqMjfjGN8kQIR7a vY8FfqpoOJdHmQFglX9SFgUyX+GI7G3Hgazc1dtpq35cEnho9aAl6r06naUDxamMZU0l Q0Rk7KuCcrDVZSw1gV36clFKsvP/LSigKy3jX6Gk1IUPw58pbCJwALGAeIz71BJ2L1Qe dpnT8RlL4aQWxhtXj7tZ/eHlRvO0TB8jLEhu4QoJjL4c9phbDoib8ndFpxd+strTPEea LPdw== 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=gGvCkJhsGrDGRU0up7It8RIrU+VkoFlEUPGl7kmXIeY=; b=upTOQwMS0qPB2Bs9+axdclvt42vSzOHFnHOjgXl0vEXjUcDN8E736MQNrPbJIDya4F 0dd7OnHW9qg5bBbVyAK/8S3+q5J8fU76GwlSMeOD69exCLunqKzyQ2QGWPSYGa6UDa58 Cv5oV19owBGfZ8Ee0upWrF5y4uHK1ZE3cANPhFX3TRqV4lSyaEPqR1UzKZnDh33k9Cv1 2S2VYHhQ+AgLfjSMWvp6LTq6XQpuRhQq6HSYLgQB8SnF7N2yH/gmZ1gEEb80blU6xULw Fvkq9u6Wszr7hXmz/wS7bb40rkhZIAnqK9K2OJRRYICjYVXuMoYkSMjt2Xwpitl/7M0o 496g== X-Gm-Message-State: ANoB5plsZGCO22TuxUQxR158Xw0D7wQuO4JAMdH08BLrEnht0Sv5fog/ cOpk8mHzoGdlFoApJWxh8sDyjkp5T5g= X-Google-Smtp-Source: AA0mqf4yUCD0eY3oDTEWgWnd0jkf0QxzE3/0IccZ6qurtSOamh1gTq4uw3/MtvUj9lsXUcCx73SzPg== X-Received: by 2002:a05:6512:13a5:b0:4ad:70f0:c7c with SMTP id p37-20020a05651213a500b004ad70f00c7cmr18753760lfa.190.1669800162970; Wed, 30 Nov 2022 01:22:42 -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 6-20020ac25f06000000b00498fbec3f8asm186189lfq.129.2022.11.30.01.22.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Nov 2022 01:22:42 -0800 (PST) Date: Wed, 30 Nov 2022 11:22:37 +0200 From: Matti Vaittinen To: Matti Vaittinen , Matti Vaittinen Subject: [PATCH RESEND2 v4 1/2] drm/bridge: sii902x: Use devm_regulator_bulk_get_enable() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , Jonas Karlman , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jernej Skrabec , Robert Foss , Andrzej Hajda , Laurent Pinchart Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Simplify using devm_regulator_bulk_get_enable() Signed-off-by: Matti Vaittinen Acked-by: Robert Foss --- v4 resend 2: Resending unchanged code with commit title prefix adjusted as suggested by Robert 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/bridge/sii902x.c | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/drivers/gpu/drm/bridge/sii902x.c b/drivers/gpu/drm/bridge/sii902x.c index 878fb7d3732b..f6e8b401069b 100644 --- a/drivers/gpu/drm/bridge/sii902x.c +++ b/drivers/gpu/drm/bridge/sii902x.c @@ -171,7 +171,6 @@ struct sii902x { struct drm_connector connector; struct gpio_desc *reset_gpio; struct i2c_mux_core *i2cmux; - struct regulator_bulk_data supplies[2]; bool sink_is_hdmi; /* * Mutex protects audio and video functions from interfering @@ -1072,6 +1071,7 @@ static int sii902x_probe(struct i2c_client *client, struct device *dev = &client->dev; struct device_node *endpoint; struct sii902x *sii902x; + static const char * const supplies[] = {"iovcc", "cvcc12"}; int ret; ret = i2c_check_functionality(client->adapter, @@ -1122,27 +1122,11 @@ static int sii902x_probe(struct i2c_client *client, mutex_init(&sii902x->mutex); - sii902x->supplies[0].supply = "iovcc"; - sii902x->supplies[1].supply = "cvcc12"; - ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(sii902x->supplies), - sii902x->supplies); + ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(supplies), supplies); if (ret < 0) - return ret; - - ret = regulator_bulk_enable(ARRAY_SIZE(sii902x->supplies), - sii902x->supplies); - if (ret < 0) { - dev_err_probe(dev, ret, "Failed to enable supplies"); - return ret; - } + return dev_err_probe(dev, ret, "Failed to enable supplies"); - ret = sii902x_init(sii902x); - if (ret < 0) { - regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies), - sii902x->supplies); - } - - return ret; + return sii902x_init(sii902x); } static void sii902x_remove(struct i2c_client *client) @@ -1152,8 +1136,6 @@ static void sii902x_remove(struct i2c_client *client) i2c_mux_del_adapters(sii902x->i2cmux); drm_bridge_remove(&sii902x->bridge); - regulator_bulk_disable(ARRAY_SIZE(sii902x->supplies), - sii902x->supplies); } static const struct of_device_id sii902x_dt_ids[] = { From patchwork Wed Nov 30 09:23:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matti Vaittinen X-Patchwork-Id: 13059629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4DD3EC433FE for ; Wed, 30 Nov 2022 09:23:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DA9C510E43D; Wed, 30 Nov 2022 09:23:40 +0000 (UTC) Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9531210E43D for ; Wed, 30 Nov 2022 09:23:07 +0000 (UTC) Received: by mail-lj1-x232.google.com with SMTP id x11so1120911ljh.7 for ; 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=wXccriaaqPbJM1QTZy25Tz343p9gqRg3oLPyjgwk4kEnjkgVcxeC+qHT5ovQBdjzKN NKhdhCeYTjp8yBEIRIKyQZrLzq+e1mqcNNfBPTBdjckrgVWw4/O3Fe28CFDRh5vcrDFs k3ZTuKlvaFGXeAEbWyl4bfACPKlQbTunQU+v0EH+bnoiMKpPbNbppZJo/+53F13cZa02 5JA4mgSjK8IOOoGG5zja3eI1giY5kDimm9/vCQrQZTEJ1O+Wr0oEkLwQ6hEfwS6/Hvin NdM+KtNPAQ87ElBmxK29UGy4ohe+l55jBP599HHFJq1wuT71qkuYItrhluD62YYwEKUY RqJw== X-Gm-Message-State: ANoB5pm8coJHuEldI89aeCumJs+yQ21tct61TM6K7ImAn9gO5NTLaan/ SuANI8I5da2lCaqDqaAHTGs= X-Google-Smtp-Source: AA0mqf6QzfIZXii01B5TmgIaVGOx8hXf2IofQ7Fvz/NTck20aLOkGH6AnMjK33uAlAASv3csnyEC7Q== 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 To: Matti Vaittinen , Matti Vaittinen Subject: [PATCH RESEND2 v4 2/2] drm/meson: dw-hdmi: Use devm_regulator_*get_enable*() Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Neil Armstrong , 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 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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) + return ret; meson_dw_hdmi->hdmitx_apb = devm_reset_control_get_exclusive(dev, "hdmitx_apb");