From nobody Wed Apr 15 04:16:50 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08470C19F2B for ; Tue, 26 Jul 2022 17:39:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239505AbiGZRjM (ORCPT ); Tue, 26 Jul 2022 13:39:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239572AbiGZRix (ORCPT ); Tue, 26 Jul 2022 13:38:53 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 86CBA3247E for ; Tue, 26 Jul 2022 10:38:43 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so13943531pjf.2 for ; Tue, 26 Jul 2022 10:38:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=65z5UblURAWtS2HSo73KtitpLtnM0+IbS2Ko/ylefao=; b=JKQA2DZRhmMHgWDjn9IqsGd1TVfsl2/RxaGpJxPdD+c34DkWDAWNsu9qO/xRlhSFNz jTRpE4I/X989DPF2x2DVjb248ibAsnZJAf3O+WByNYpcxeOcUzjim7Qd2uty5uDE1x73 d5LtxHUT2N3mk77hhhR51bamkKwqf1Z9L7fP4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=65z5UblURAWtS2HSo73KtitpLtnM0+IbS2Ko/ylefao=; b=YgNC+R0qR+N0i0yV6uoc7nu9gwo3mBEucKx9kw1ECjLK2c5jzsUNZ5L63uBe1BEsF9 YUQDV3gOnhgrAHAo4pdouf/LmQ3wTtQjqGl6uJGzP3L0LmY48MO6FKXCbtLm/rDoUpLc DJOj/gFYrey9qp9uKDaD37x+tu91Gb8qvk0xtjmULGptmdPGGa8AiM5n4xVvljoVYQzs 1eIhqFjkBaCbw1MjnkO7XsINIV5O6sobU1ll4p7EsiZR6OTGBAQmLzSr1VqfoqyCkqWx PFgnzFEAD73cwcpzqH48CBBtZ3gdiVmXH3Rc8opeyxkm8slsPjlxeMZJBJ8ZmuviTPj9 EpEA== X-Gm-Message-State: AJIora98q7h8yJzVtsGAVw8YwFyo6uScqAwXhhjm5wMfQKwkxdiIZRxv 4K1FVUFZQF1dVUkBl/U6URebNQ== X-Google-Smtp-Source: AGRyM1vaj4AnRg3w38ziBsA+HO1alVRbJxT5BFBbzuR9W1nR9nbx4to4YrRPWTU9jI9OfC/TAk1BDg== X-Received: by 2002:a17:902:f541:b0:16d:46f1:bd17 with SMTP id h1-20020a170902f54100b0016d46f1bd17mr18371237plf.18.1658857122699; Tue, 26 Jul 2022 10:38:42 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:8693:e9aa:75c0:5134]) by smtp.gmail.com with ESMTPSA id ik29-20020a170902ab1d00b0016d9ecd71f4sm245884plb.77.2022.07.26.10.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 10:38:42 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Mark Brown Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Douglas Anderson , Archit Taneja , Daniel Vetter , David Airlie , Konrad Dybcio , Loic Poulain , Rajeev Nandan , Sean Paul , linux-kernel@vger.kernel.org Subject: [PATCH v2 1/7] drm/msm/dsi: Fix number of regulators for msm8996_dsi_cfg Date: Tue, 26 Jul 2022 10:38:18 -0700 Message-Id: <20220726103631.v2.1.I1056ee3f77f71287f333279efe4c85f88d403f65@changeid> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog In-Reply-To: <20220726173824.1166873-1-dianders@chromium.org> References: <20220726173824.1166873-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 3 regulators are specified listed but the number 2 is specified. Fix it. Fixes: 3a3ff88a0fc1 ("drm/msm/dsi: Add 8x96 info in dsi_cfg") Signed-off-by: Douglas Anderson --- Changes in v2: - ("Fix number of regulators for msm8996_dsi_cfg") new for v2. drivers/gpu/drm/msm/dsi/dsi_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/ds= i_cfg.c index 2c23324a2296..02000a7b7a18 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c @@ -109,7 +109,7 @@ static const char * const dsi_8996_bus_clk_names[] =3D { static const struct msm_dsi_config msm8996_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, .reg_cfg =3D { - .num =3D 2, + .num =3D 3, .regs =3D { {"vdda", 18160, 1 }, /* 1.25 V */ {"vcca", 17000, 32 }, /* 0.925 V */ --=20 2.37.1.359.gd136c6c3e2-goog From nobody Wed Apr 15 04:16:50 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A78BC19F2A for ; Tue, 26 Jul 2022 17:39:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239217AbiGZRjO (ORCPT ); Tue, 26 Jul 2022 13:39:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239503AbiGZRi4 (ORCPT ); Tue, 26 Jul 2022 13:38:56 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D752326D1 for ; Tue, 26 Jul 2022 10:38:45 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id o20-20020a17090aac1400b001f2da729979so4319538pjq.0 for ; Tue, 26 Jul 2022 10:38:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=nfROAXY/moJLzNsb5FMhoMcqb29l4Ohc3eBLspjd7i8=; b=CdKkn2TAJXxhAQ0zVV/bxvv+NtJ21HCRpY2zDxPmR+AKTLuroLHcxjjFP3IX++SaAY r4web3polSC0tU3jg59fs/V956n/OI3RrS6OndczV+r94MEKeyJyRNkG6Cc0DEM66YY7 BIeGKM4svzgyhiOM6KEphErb3pwFkbUp8wUFs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nfROAXY/moJLzNsb5FMhoMcqb29l4Ohc3eBLspjd7i8=; b=a2aB1uSu5emmZ52EjD22PAUyGqaQnk7948bOPahqS49e+3jq0ABdu7DmnM4f/MIHjH lqRXaLnTWS6xDI9uJuH/tV3rO+QYIK+LQGpX8C8PFgOFvndgDF5gWrZXTW/AFWolu63j SOM2H8CtO16uert/2CbTjXE9SI1yx/OM4y6W2GsUD2pHKcY+8a5xkwGYrkOkzG8oCeX5 jraSNkpqN0kJtlQVMwgEVvuf1IMUwzNS7jLB3PhrI2L+rBA7Xkh6AR0QZ/0piJJGR0Eq hF4yodDQYWwxqGv5191o1E/BAN2BRx//SkvNjVXSlL/+zMR+zXFsQQkAneBQwISV4m6k gIRA== X-Gm-Message-State: AJIora/hNforACHYG3Qa8F51Ehlt4NreGgcLsgH2pmcN3CnQfuKU7G7e CUYbgDmKtTd9AFOS3TfNyQNwng== X-Google-Smtp-Source: AGRyM1v4Qxmej3AUYLBc4E4fc1Qdq3OKx2v7JS9BtYZRthjbwBf3uE93fWlt0LAQ9pq0KRrfZkzpTA== X-Received: by 2002:a17:90b:2407:b0:1ec:dd93:511a with SMTP id nr7-20020a17090b240700b001ecdd93511amr300477pjb.212.1658857124631; Tue, 26 Jul 2022 10:38:44 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:8693:e9aa:75c0:5134]) by smtp.gmail.com with ESMTPSA id ik29-20020a170902ab1d00b0016d9ecd71f4sm245884plb.77.2022.07.26.10.38.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 10:38:43 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Mark Brown Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Douglas Anderson , Daniel Vetter , David Airlie , Konrad Dybcio , Loic Poulain , Rajeev Nandan , Sean Paul , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/7] drm/msm/dsi: Fix number of regulators for SDM660 Date: Tue, 26 Jul 2022 10:38:19 -0700 Message-Id: <20220726103631.v2.2.I94b3c3e412b7c208061349f05659e126483171b1@changeid> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog In-Reply-To: <20220726173824.1166873-1-dianders@chromium.org> References: <20220726173824.1166873-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 1 regulators is specified listed but the number 2 is specified. This presumably means we try to get a regulator with no name. Fix it. Fixes: 033f47f7f121 ("drm/msm/dsi: Add DSI configuration for SDM660") Signed-off-by: Douglas Anderson --- Changes in v2: - ("Fix number of regulators for SDM660") new for v2. drivers/gpu/drm/msm/dsi/dsi_cfg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/ds= i_cfg.c index 02000a7b7a18..72c018e26f47 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c @@ -148,7 +148,7 @@ static const char * const dsi_sdm660_bus_clk_names[] = =3D { static const struct msm_dsi_config sdm660_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, .reg_cfg =3D { - .num =3D 2, + .num =3D 1, .regs =3D { {"vdda", 12560, 4 }, /* 1.2 V */ }, --=20 2.37.1.359.gd136c6c3e2-goog From nobody Wed Apr 15 04:16:50 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07640C00140 for ; Tue, 26 Jul 2022 17:39:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239561AbiGZRjS (ORCPT ); Tue, 26 Jul 2022 13:39:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239586AbiGZRi7 (ORCPT ); Tue, 26 Jul 2022 13:38:59 -0400 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 82ACD326DA for ; Tue, 26 Jul 2022 10:38:47 -0700 (PDT) Received: by mail-pg1-x52a.google.com with SMTP id s206so13743167pgs.3 for ; Tue, 26 Jul 2022 10:38:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UvSYvNuG1zZNgf5lwaC/VfaYfdBFj5iq4D0i1aS1Skw=; b=djfRA0Eg0DUtXyTAWIgvYBh4WrojPtSupPoHdpQ5Jw58cZfSkruu49XB9PEHCYf8Bg huiJa7f1mFnti3f4hoBb1kyUbccQwOrELcqKa6zaYoGKQJXlZ6JSYsjhftiqgqSqhLtq haMSDYXOZewhmtDsBljxk3a/cwgRrTX7KVD8g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=UvSYvNuG1zZNgf5lwaC/VfaYfdBFj5iq4D0i1aS1Skw=; b=T7xVMgmydHe/A7iZU58892D/6Nan7qIlJHCvt6fkpVrUBBNImsX+2U/eFZ2Tqb3dez 6kWeZ7tHGPvlyeSCs0BAovnkGiUsJh1xS/VjkeOB7B2w0AcgF9dV16iRxxtiV724WjsI yk2G+InvwjOfK1KmbvqlIjFcv5bvNzLmXRcNajHgud5RYX5S371CjBaHTNY307HLbEdF fqiqIQnbuPJ15NzFnkpEauqQ1dhji432q7z/CBuA3FYQUUUPapgwBSDyTJoH6NRqIHe5 GCHM53hXUBg7jKvwKzkydiphA9SQb13gR2VWkfdN5K+oZmEIXq7OrKi0/C/KoGwAWKsj 17GQ== X-Gm-Message-State: AJIora/U5WwBxd70XzUVrtjNCFNPZd/ae7cegFpMzV+9Xy7RzpYg/3eI 9ESoAuOPKHhnNKbIOok5SPq8eg== X-Google-Smtp-Source: AGRyM1vFdUiyfeSe/x1TcybAAdxEh0/qd7TQii/r3t1NmylM9ZaZ3xbKNbEYB1xEe2/+LsEbzqQppg== X-Received: by 2002:a05:6a00:1708:b0:52a:ecdd:69d1 with SMTP id h8-20020a056a00170800b0052aecdd69d1mr18515922pfc.75.1658857126859; Tue, 26 Jul 2022 10:38:46 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:8693:e9aa:75c0:5134]) by smtp.gmail.com with ESMTPSA id ik29-20020a170902ab1d00b0016d9ecd71f4sm245884plb.77.2022.07.26.10.38.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 10:38:46 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Mark Brown Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Douglas Anderson , AngeloGioacchino Del Regno , Bjorn Andersson , Daniel Vetter , David Airlie , Jonathan Marek , =?UTF-8?q?Jos=C3=A9=20Exp=C3=B3sito?= , Konrad Dybcio , Loic Poulain , Marijn Suijten , Rajeev Nandan , Sean Paul , Stephen Boyd , Vinod Koul , Vladimir Lypak , linux-kernel@vger.kernel.org Subject: [PATCH v2 3/7] drm/msm/dsi: Don't set a load before disabling a regulator Date: Tue, 26 Jul 2022 10:38:20 -0700 Message-Id: <20220726103631.v2.3.If1f94fbbdb7c1d0fb3961de61483a851ad1971a7@changeid> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog In-Reply-To: <20220726173824.1166873-1-dianders@chromium.org> References: <20220726173824.1166873-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As of commit 5451781dadf8 ("regulator: core: Only count load for enabled consumers"), a load isn't counted for a disabled regulator. That means all the code in the DSI driver to specify and set loads before disabling a regulator is not actually doing anything useful. Let's remove it. It should be noted that all of the loads set that were being specified were pointless noise anyway. The only use for this number is to pick between low power and high power modes of regulators. Regulators appear to do this changeover at loads on the order of 10000 uA. You would a lot of clients of the same rail for that 100 uA number to count for anything. Note that now that we get rid of the setting of the load at disable time, we can just set the load once when we first get the regulator and then forget it. It should also be noted that the regulator functions regulator_bulk_enable() and regulator_set_load() already print error messages when they encounter problems so while moving things around we get rid of some extra error prints. Signed-off-by: Douglas Anderson --- (no changes since v1) drivers/gpu/drm/msm/dsi/dsi.h | 1 - drivers/gpu/drm/msm/dsi/dsi_cfg.c | 52 +++++++++---------- drivers/gpu/drm/msm/dsi/dsi_host.c | 45 ++++------------ drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 46 ++++------------ drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c | 4 +- drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c | 6 +-- drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c | 4 +- drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c | 6 +-- .../gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c | 2 +- drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 6 +-- 10 files changed, 60 insertions(+), 112 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi.h b/drivers/gpu/drm/msm/dsi/dsi.h index 580a1e6358bf..bb6a5bd05cb1 100644 --- a/drivers/gpu/drm/msm/dsi/dsi.h +++ b/drivers/gpu/drm/msm/dsi/dsi.h @@ -37,7 +37,6 @@ enum msm_dsi_phy_usecase { struct dsi_reg_entry { char name[32]; int enable_load; - int disable_load; }; =20 struct dsi_reg_config { diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/ds= i_cfg.c index 72c018e26f47..901d6fd53800 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c @@ -14,9 +14,9 @@ static const struct msm_dsi_config apq8064_dsi_cfg =3D { .reg_cfg =3D { .num =3D 3, .regs =3D { - {"vdda", 100000, 100}, /* 1.2 V */ - {"avdd", 10000, 100}, /* 3.0 V */ - {"vddio", 100000, 100}, /* 1.8 V */ + {"vdda", 100000}, /* 1.2 V */ + {"avdd", 10000}, /* 3.0 V */ + {"vddio", 100000}, /* 1.8 V */ }, }, .bus_clk_names =3D dsi_v2_bus_clk_names, @@ -34,9 +34,9 @@ static const struct msm_dsi_config msm8974_apq8084_dsi_cf= g =3D { .reg_cfg =3D { .num =3D 3, .regs =3D { - {"vdd", 150000, 100}, /* 3.0 V */ - {"vdda", 100000, 100}, /* 1.2 V */ - {"vddio", 100000, 100}, /* 1.8 V */ + {"vdd", 150000}, /* 3.0 V */ + {"vdda", 100000}, /* 1.2 V */ + {"vddio", 100000}, /* 1.8 V */ }, }, .bus_clk_names =3D dsi_6g_bus_clk_names, @@ -54,8 +54,8 @@ static const struct msm_dsi_config msm8916_dsi_cfg =3D { .reg_cfg =3D { .num =3D 2, .regs =3D { - {"vdda", 100000, 100}, /* 1.2 V */ - {"vddio", 100000, 100}, /* 1.8 V */ + {"vdda", 100000}, /* 1.2 V */ + {"vddio", 100000}, /* 1.8 V */ }, }, .bus_clk_names =3D dsi_8916_bus_clk_names, @@ -73,8 +73,8 @@ static const struct msm_dsi_config msm8976_dsi_cfg =3D { .reg_cfg =3D { .num =3D 2, .regs =3D { - {"vdda", 100000, 100}, /* 1.2 V */ - {"vddio", 100000, 100}, /* 1.8 V */ + {"vdda", 100000}, /* 1.2 V */ + {"vddio", 100000}, /* 1.8 V */ }, }, .bus_clk_names =3D dsi_8976_bus_clk_names, @@ -88,12 +88,12 @@ static const struct msm_dsi_config msm8994_dsi_cfg =3D { .reg_cfg =3D { .num =3D 6, .regs =3D { - {"vdda", 100000, 100}, /* 1.25 V */ - {"vddio", 100000, 100}, /* 1.8 V */ - {"vcca", 10000, 100}, /* 1.0 V */ - {"vdd", 100000, 100}, /* 1.8 V */ - {"lab_reg", -1, -1}, - {"ibb_reg", -1, -1}, + {"vdda", 100000}, /* 1.25 V */ + {"vddio", 100000}, /* 1.8 V */ + {"vcca", 10000}, /* 1.0 V */ + {"vdd", 100000}, /* 1.8 V */ + {"lab_reg", -1}, + {"ibb_reg", -1}, }, }, .bus_clk_names =3D dsi_6g_bus_clk_names, @@ -111,9 +111,9 @@ static const struct msm_dsi_config msm8996_dsi_cfg =3D { .reg_cfg =3D { .num =3D 3, .regs =3D { - {"vdda", 18160, 1 }, /* 1.25 V */ - {"vcca", 17000, 32 }, /* 0.925 V */ - {"vddio", 100000, 100 },/* 1.8 V */ + {"vdda", 18160}, /* 1.25 V */ + {"vcca", 17000}, /* 0.925 V */ + {"vddio", 100000},/* 1.8 V */ }, }, .bus_clk_names =3D dsi_8996_bus_clk_names, @@ -131,8 +131,8 @@ static const struct msm_dsi_config msm8998_dsi_cfg =3D { .reg_cfg =3D { .num =3D 2, .regs =3D { - {"vdd", 367000, 16 }, /* 0.9 V */ - {"vdda", 62800, 2 }, /* 1.2 V */ + {"vdd", 367000}, /* 0.9 V */ + {"vdda", 62800}, /* 1.2 V */ }, }, .bus_clk_names =3D dsi_msm8998_bus_clk_names, @@ -150,7 +150,7 @@ static const struct msm_dsi_config sdm660_dsi_cfg =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdda", 12560, 4 }, /* 1.2 V */ + {"vdda", 12560}, /* 1.2 V */ }, }, .bus_clk_names =3D dsi_sdm660_bus_clk_names, @@ -172,7 +172,7 @@ static const struct msm_dsi_config sdm845_dsi_cfg =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdda", 21800, 4 }, /* 1.2 V */ + {"vdda", 21800}, /* 1.2 V */ }, }, .bus_clk_names =3D dsi_sdm845_bus_clk_names, @@ -186,7 +186,7 @@ static const struct msm_dsi_config sc7180_dsi_cfg =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdda", 21800, 4 }, /* 1.2 V */ + {"vdda", 21800}, /* 1.2 V */ }, }, .bus_clk_names =3D dsi_sc7180_bus_clk_names, @@ -204,7 +204,7 @@ static const struct msm_dsi_config sc7280_dsi_cfg =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdda", 8350, 0 }, /* 1.2 V */ + {"vdda", 8350}, /* 1.2 V */ }, }, .bus_clk_names =3D dsi_sc7280_bus_clk_names, @@ -222,7 +222,7 @@ static const struct msm_dsi_config qcm2290_dsi_cfg =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdda", 21800, 4 }, /* 1.2 V */ + {"vdda", 21800}, /* 1.2 V */ }, }, .bus_clk_names =3D dsi_qcm2290_bus_clk_names, diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/d= si_host.c index a95d5df52653..04265ad2fbef 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -259,15 +259,7 @@ static inline struct msm_dsi_host *to_msm_dsi_host(str= uct mipi_dsi_host *host) static void dsi_host_regulator_disable(struct msm_dsi_host *msm_host) { struct regulator_bulk_data *s =3D msm_host->supplies; - const struct dsi_reg_entry *regs =3D msm_host->cfg_hnd->cfg->reg_cfg.regs; int num =3D msm_host->cfg_hnd->cfg->reg_cfg.num; - int i; - - DBG(""); - for (i =3D num - 1; i >=3D 0; i--) - if (regs[i].disable_load >=3D 0) - regulator_set_load(s[i].consumer, - regs[i].disable_load); =20 regulator_bulk_disable(num, s); } @@ -275,35 +267,9 @@ static void dsi_host_regulator_disable(struct msm_dsi_= host *msm_host) static int dsi_host_regulator_enable(struct msm_dsi_host *msm_host) { struct regulator_bulk_data *s =3D msm_host->supplies; - const struct dsi_reg_entry *regs =3D msm_host->cfg_hnd->cfg->reg_cfg.regs; int num =3D msm_host->cfg_hnd->cfg->reg_cfg.num; - int ret, i; - - DBG(""); - for (i =3D 0; i < num; i++) { - if (regs[i].enable_load >=3D 0) { - ret =3D regulator_set_load(s[i].consumer, - regs[i].enable_load); - if (ret < 0) { - pr_err("regulator %d set op mode failed, %d\n", - i, ret); - goto fail; - } - } - } - - ret =3D regulator_bulk_enable(num, s); - if (ret < 0) { - pr_err("regulator enable failed, %d\n", ret); - goto fail; - } =20 - return 0; - -fail: - for (i--; i >=3D 0; i--) - regulator_set_load(s[i].consumer, regs[i].disable_load); - return ret; + return regulator_bulk_enable(num, s); } =20 static int dsi_regulator_init(struct msm_dsi_host *msm_host) @@ -323,6 +289,15 @@ static int dsi_regulator_init(struct msm_dsi_host *msm= _host) return ret; } =20 + for (i =3D 0; i < num; i++) { + if (regs[i].enable_load >=3D 0) { + ret =3D regulator_set_load(s[i].consumer, + regs[i].enable_load); + if (ret < 0) + return ret; + } + } + return 0; } =20 diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/ds= i/phy/dsi_phy.c index a39de3bdc7fa..330c0c4e7f9d 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -529,20 +529,22 @@ static int dsi_phy_regulator_init(struct msm_dsi_phy = *phy) return ret; } =20 + for (i =3D 0; i < num; i++) { + if (regs[i].enable_load >=3D 0) { + ret =3D regulator_set_load(s[i].consumer, + regs[i].enable_load); + if (ret < 0) + return ret; + } + } + return 0; } =20 static void dsi_phy_regulator_disable(struct msm_dsi_phy *phy) { struct regulator_bulk_data *s =3D phy->supplies; - const struct dsi_reg_entry *regs =3D phy->cfg->reg_cfg.regs; int num =3D phy->cfg->reg_cfg.num; - int i; - - DBG(""); - for (i =3D num - 1; i >=3D 0; i--) - if (regs[i].disable_load >=3D 0) - regulator_set_load(s[i].consumer, regs[i].disable_load); =20 regulator_bulk_disable(num, s); } @@ -550,37 +552,9 @@ static void dsi_phy_regulator_disable(struct msm_dsi_p= hy *phy) static int dsi_phy_regulator_enable(struct msm_dsi_phy *phy) { struct regulator_bulk_data *s =3D phy->supplies; - const struct dsi_reg_entry *regs =3D phy->cfg->reg_cfg.regs; - struct device *dev =3D &phy->pdev->dev; int num =3D phy->cfg->reg_cfg.num; - int ret, i; =20 - DBG(""); - for (i =3D 0; i < num; i++) { - if (regs[i].enable_load >=3D 0) { - ret =3D regulator_set_load(s[i].consumer, - regs[i].enable_load); - if (ret < 0) { - DRM_DEV_ERROR(dev, - "regulator %d set op mode failed, %d\n", - i, ret); - goto fail; - } - } - } - - ret =3D regulator_bulk_enable(num, s); - if (ret < 0) { - DRM_DEV_ERROR(dev, "regulator enable failed, %d\n", ret); - goto fail; - } - - return 0; - -fail: - for (i--; i >=3D 0; i--) - regulator_set_load(s[i].consumer, regs[i].disable_load); - return ret; + return regulator_bulk_enable(num, s); } =20 static int dsi_phy_enable_resource(struct msm_dsi_phy *phy) diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c b/drivers/gpu/drm/m= sm/dsi/phy/dsi_phy_10nm.c index 08b015ea1b1e..6a10a1448051 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_10nm.c @@ -1033,7 +1033,7 @@ const struct msm_dsi_phy_cfg dsi_phy_10nm_cfgs =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdds", 36000, 32}, + {"vdds", 36000}, }, }, .ops =3D { @@ -1055,7 +1055,7 @@ const struct msm_dsi_phy_cfg dsi_phy_10nm_8998_cfgs = =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdds", 36000, 32}, + {"vdds", 36000}, }, }, .ops =3D { diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c b/drivers/gpu/drm/m= sm/dsi/phy/dsi_phy_14nm.c index 8199c53567f4..0f3d4c56c333 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_14nm.c @@ -1029,7 +1029,7 @@ const struct msm_dsi_phy_cfg dsi_phy_14nm_cfgs =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vcca", 17000, 32}, + {"vcca", 17000}, }, }, .ops =3D { @@ -1050,7 +1050,7 @@ const struct msm_dsi_phy_cfg dsi_phy_14nm_660_cfgs = =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vcca", 73400, 32}, + {"vcca", 73400}, }, }, .ops =3D { @@ -1071,7 +1071,7 @@ const struct msm_dsi_phy_cfg dsi_phy_14nm_8953_cfgs = =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vcca", 17000, 32}, + {"vcca", 17000}, }, }, .ops =3D { diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c b/drivers/gpu/drm/m= sm/dsi/phy/dsi_phy_20nm.c index ee7c418a1c29..b7c621d94981 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_20nm.c @@ -134,8 +134,8 @@ const struct msm_dsi_phy_cfg dsi_phy_20nm_cfgs =3D { .reg_cfg =3D { .num =3D 2, .regs =3D { - {"vddio", 100000, 100}, /* 1.8 V */ - {"vcca", 10000, 100}, /* 1.0 V */ + {"vddio", 100000}, /* 1.8 V */ + {"vcca", 10000}, /* 1.0 V */ }, }, .ops =3D { diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c b/drivers/gpu/drm/m= sm/dsi/phy/dsi_phy_28nm.c index 48eab80b548e..6beba387640d 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm.c @@ -774,7 +774,7 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_cfgs =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vddio", 100000, 100}, + {"vddio", 100000}, }, }, .ops =3D { @@ -795,7 +795,7 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_hpm_famb_cfgs= =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vddio", 100000, 100}, + {"vddio", 100000}, }, }, .ops =3D { @@ -816,7 +816,7 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_lp_cfgs =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vddio", 100000, 100}, /* 1.8 V */ + {"vddio", 100000}, /* 1.8 V */ }, }, .ops =3D { diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c b/drivers/gpu/= drm/msm/dsi/phy/dsi_phy_28nm_8960.c index fc56cdcc9ad6..2e942b10fffa 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_28nm_8960.c @@ -653,7 +653,7 @@ const struct msm_dsi_phy_cfg dsi_phy_28nm_8960_cfgs =3D= { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vddio", 100000, 100}, /* 1.8 V */ + {"vddio", 100000}, /* 1.8 V */ }, }, .ops =3D { diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c b/drivers/gpu/drm/ms= m/dsi/phy/dsi_phy_7nm.c index 66ed1919a1db..9c7c49ce1200 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c @@ -1041,7 +1041,7 @@ const struct msm_dsi_phy_cfg dsi_phy_7nm_cfgs =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdds", 36000, 32}, + {"vdds", 36000}, }, }, .ops =3D { @@ -1068,7 +1068,7 @@ const struct msm_dsi_phy_cfg dsi_phy_7nm_8150_cfgs = =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdds", 36000, 32}, + {"vdds", 36000}, }, }, .ops =3D { @@ -1090,7 +1090,7 @@ const struct msm_dsi_phy_cfg dsi_phy_7nm_7280_cfgs = =3D { .reg_cfg =3D { .num =3D 1, .regs =3D { - {"vdds", 37550, 0}, + {"vdds", 37550}, }, }, .ops =3D { --=20 2.37.1.359.gd136c6c3e2-goog From nobody Wed Apr 15 04:16:50 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FED0C00140 for ; Tue, 26 Jul 2022 17:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239573AbiGZRjU (ORCPT ); Tue, 26 Jul 2022 13:39:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34114 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239593AbiGZRjA (ORCPT ); Tue, 26 Jul 2022 13:39:00 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23CED32060 for ; Tue, 26 Jul 2022 10:38:49 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id y15so13958019plp.10 for ; Tue, 26 Jul 2022 10:38:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QqvKH6fccVd80baHbnBCY4qodjMiSVmgD5LIGbvU2Z4=; b=B9/WWbhVyNMDG3jI569+7uLqSi0JK9ZiTjxEDD6Fo922/IUX3+iu02/YtEOj+vzgOM WPWEaxVHZ3tk9Ev34/jgvIPK5FRcg3gIqUTJFrjnJ5YMPWW3eshhvBUXlEwD+crvzMgt 8sLLH3atcRYwER1T8/1snBYPojt8tfmuvOdVs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QqvKH6fccVd80baHbnBCY4qodjMiSVmgD5LIGbvU2Z4=; b=bWxkjcoUB2Dai6Ai0FCbmW1kgmCWFwNLaRDZXWVYw3r0kyoLsnKMxBw44OygsyK+6g 2/QusbiZzaIMUvSZ6YURC8ybG4r6+WeCqNXYua4hTXncje+O0qmeYJ6Mg7prrXeE89xK vnsfYqPICQbWPsg3jlqfQihBy5xb3roTxmn3xHGEW/JhmEiXOIe36XZ0kBrbZoweymZO x1cxQxPbOOWXVuPGHz8C5i31xUEmcYMt9wV0K00GoXbDzcjDn3sHxLyN+GRMsA2F17UO tuL2liCiq096n93IXa1bmIy+3qi/l0Ssd0Ze77P3ZBb0FMKFlhnd2jhdqYBgo0BleBgN ZfBg== X-Gm-Message-State: AJIora/ZIV4+++TBmNgf979JFFAM4QzI/0jG2k8v3eGuHfZuyQdmEYFP MqfDE3sgqSu6DlaFToAr5IONMw== X-Google-Smtp-Source: AGRyM1trr98gdklxubSGKVrsW/w7EKhRKIGIQlo+z7UMmwbo6HElyMi5CU7nlM/Xnx3B4vQl7fSzrQ== X-Received: by 2002:a17:902:e841:b0:16c:3053:c7e6 with SMTP id t1-20020a170902e84100b0016c3053c7e6mr17679425plg.163.1658857128631; Tue, 26 Jul 2022 10:38:48 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:8693:e9aa:75c0:5134]) by smtp.gmail.com with ESMTPSA id ik29-20020a170902ab1d00b0016d9ecd71f4sm245884plb.77.2022.07.26.10.38.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 10:38:47 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Mark Brown Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Douglas Anderson , Liam Girdwood , linux-kernel@vger.kernel.org Subject: [PATCH v2 4/7] regulator: core: Allow specifying an initial load w/ the bulk API Date: Tue, 26 Jul 2022 10:38:21 -0700 Message-Id: <20220726103631.v2.4.Ie85f68215ada39f502a96dcb8a1f3ad977e3f68a@changeid> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog In-Reply-To: <20220726173824.1166873-1-dianders@chromium.org> References: <20220726173824.1166873-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" There are a number of drivers that follow a pattern that looks like this: 1. Use the regulator bulk API to get a bunch of regulators. 2. Set the load on each of the regulators to use whenever the regulators are enabled. Let's make this easier by just allowing the drivers to pass the load in. As part of this change we need to move the error printing in regulator_bulk_get() around; let's switch to the new dev_err_probe() to simplify it. Signed-off-by: Douglas Anderson --- Changes in v2: - ("Allow specifying an initial load w/ the bulk API") new for v2. drivers/regulator/core.c | 20 ++++++++++++-------- include/linux/regulator/consumer.h | 12 ++++++++---- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 1e54a833f2cf..17c476fc8adb 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -4783,22 +4783,26 @@ int regulator_bulk_get(struct device *dev, int num_= consumers, consumers[i].consumer =3D regulator_get(dev, consumers[i].supply); if (IS_ERR(consumers[i].consumer)) { - ret =3D PTR_ERR(consumers[i].consumer); consumers[i].consumer =3D NULL; + ret =3D dev_err_probe(dev, PTR_ERR(consumers[i].consumer), + "Failed to get supply '%s'", + consumers[i].supply); goto err; } + + if (consumers[i].init_load_uA > 0) { + ret =3D regulator_set_load(consumers[i].consumer, + consumers[i].init_load_uA); + if (ret) { + i++; + goto err; + } + } } =20 return 0; =20 err: - if (ret !=3D -EPROBE_DEFER) - dev_err(dev, "Failed to get supply '%s': %pe\n", - consumers[i].supply, ERR_PTR(ret)); - else - dev_dbg(dev, "Failed to get supply '%s', deferring\n", - consumers[i].supply); - while (--i >=3D 0) regulator_put(consumers[i].consumer); =20 diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/c= onsumer.h index bbf6590a6dec..5779f4466e62 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -171,10 +171,13 @@ struct regulator; /** * struct regulator_bulk_data - Data used for bulk regulator operations. * - * @supply: The name of the supply. Initialised by the user before - * using the bulk regulator APIs. - * @consumer: The regulator consumer for the supply. This will be managed - * by the bulk API. + * @supply: The name of the supply. Initialised by the user before + * using the bulk regulator APIs. + * @init_load_uA: After getting the regulator, regulator_set_load() will be + * called with this load. Initialised by the user before + * using the bulk regulator APIs. + * @consumer: The regulator consumer for the supply. This will be man= aged + * by the bulk API. * * The regulator APIs provide a series of regulator_bulk_() API calls as * a convenience to consumers which require multiple supplies. This @@ -182,6 +185,7 @@ struct regulator; */ struct regulator_bulk_data { const char *supply; + int init_load_uA; struct regulator *consumer; =20 /* private: Internal use */ --=20 2.37.1.359.gd136c6c3e2-goog From nobody Wed Apr 15 04:16:50 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9160DC00140 for ; Tue, 26 Jul 2022 17:39:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239536AbiGZRj1 (ORCPT ); Tue, 26 Jul 2022 13:39:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239441AbiGZRjA (ORCPT ); Tue, 26 Jul 2022 13:39:00 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8754B2ED6F for ; Tue, 26 Jul 2022 10:38:51 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id q7-20020a17090a7a8700b001f300db8677so1090344pjf.5 for ; Tue, 26 Jul 2022 10:38:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fJDgGsVp/9ym8bVCX4DEK3+iI9mT2ogd+Xryi1JgPAI=; b=Kh87AJklhSGHbjnLYi6JWYNUx2pSx4cl7szgvn8ecj57yYy/kDlcZRplDlDfTYEQeD VeOBmELL2x+VZtbXQl1HJsHWW97OevB9j0uYetTvCvznTRNUGnVpz+YsDZxMKMRKUS7b Ol1oRoWylsF/kXc/l31Y5qUVh9tgo5947EuPk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fJDgGsVp/9ym8bVCX4DEK3+iI9mT2ogd+Xryi1JgPAI=; b=LUDQ/iRABfx8ofFH+d7QjcPCY/C1eM9JXFTwpf3QBgL8UU5k0IC3aLqCh7kGYOLQnL lZa0Rzhj3vkvEZyqJzttEsl/Ekam3Z7F/izs1MUXYxxi/UFrmPVmUBpPGUIZ/u5EjOfr 09pgDictM7jmNWjre48DlSgSIqydko5Yqbcv8KHYxDLTzMdXEJo6qPU7NBUks8gv1OU4 Xr2SNpCsXyekIxnt9roDLx6TkcV1Hulzf/BBi48fFt6Kj3l+NvWgUj2Tf2Wb2JYZ1Abu 3QlIA+1QbraqJdqDmApCDgNRrkSppBcAI0jcdFAGHqwgZZgB0AwlQW/HG+JuauvzY96B o2cA== X-Gm-Message-State: AJIora+vW2LAy/Fh3CM4BEzuR87jCesqH2d5ndGQ8jaSuPeADJzo8qP9 WSV8Xl/Z4LIG2SM/eFyCjLXgAQ== X-Google-Smtp-Source: AGRyM1tK5CVcyHdW+12ue/Q8sK3OVVAYgnuYyRdNJt8CWfhB2C2YLXNxFl4ZmN8vVRUHRpLhGnvE/w== X-Received: by 2002:a17:902:d581:b0:16b:e6b8:4080 with SMTP id k1-20020a170902d58100b0016be6b84080mr17779542plh.146.1658857130908; Tue, 26 Jul 2022 10:38:50 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:8693:e9aa:75c0:5134]) by smtp.gmail.com with ESMTPSA id ik29-20020a170902ab1d00b0016d9ecd71f4sm245884plb.77.2022.07.26.10.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 10:38:50 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Mark Brown Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Douglas Anderson , Daniel Vetter , David Airlie , Jonathan Marek , Rajeev Nandan , Sean Paul , Stephen Boyd , Vinod Koul , Vladimir Lypak , linux-kernel@vger.kernel.org Subject: [PATCH v2 5/7] drm/msm/dsi: Use the new regulator bulk feature to specify the load Date: Tue, 26 Jul 2022 10:38:22 -0700 Message-Id: <20220726103631.v2.5.I7b3c72949883846badb073cfeae985c55239da1d@changeid> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog In-Reply-To: <20220726173824.1166873-1-dianders@chromium.org> References: <20220726173824.1166873-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As of the patch ("regulator: core: Allow specifying an initial load w/ the bulk API") we can now specify the initial load in the bulk data rather than having to manually call regulator_set_load() on each regulator. Let's use it. Signed-off-by: Douglas Anderson --- Changes in v2: - ("Use the new regulator bulk feature to specify the load") new for v2. drivers/gpu/drm/msm/dsi/dsi_host.c | 13 +++---------- drivers/gpu/drm/msm/dsi/phy/dsi_phy.c | 13 +++---------- 2 files changed, 6 insertions(+), 20 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/d= si_host.c index 04265ad2fbef..dec7a94cf819 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -279,8 +279,10 @@ static int dsi_regulator_init(struct msm_dsi_host *msm= _host) int num =3D msm_host->cfg_hnd->cfg->reg_cfg.num; int i, ret; =20 - for (i =3D 0; i < num; i++) + for (i =3D 0; i < num; i++) { s[i].supply =3D regs[i].name; + s[i].init_load_uA =3D regs[i].enable_load; + } =20 ret =3D devm_regulator_bulk_get(&msm_host->pdev->dev, num, s); if (ret < 0) { @@ -289,15 +291,6 @@ static int dsi_regulator_init(struct msm_dsi_host *msm= _host) return ret; } =20 - for (i =3D 0; i < num; i++) { - if (regs[i].enable_load >=3D 0) { - ret =3D regulator_set_load(s[i].consumer, - regs[i].enable_load); - if (ret < 0) - return ret; - } - } - return 0; } =20 diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c b/drivers/gpu/drm/msm/ds= i/phy/dsi_phy.c index 330c0c4e7f9d..f42ff57861da 100644 --- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c +++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy.c @@ -515,8 +515,10 @@ static int dsi_phy_regulator_init(struct msm_dsi_phy *= phy) int num =3D phy->cfg->reg_cfg.num; int i, ret; =20 - for (i =3D 0; i < num; i++) + for (i =3D 0; i < num; i++) { s[i].supply =3D regs[i].name; + s[i].init_load_uA =3D regs[i].enable_load; + } =20 ret =3D devm_regulator_bulk_get(dev, num, s); if (ret < 0) { @@ -529,15 +531,6 @@ static int dsi_phy_regulator_init(struct msm_dsi_phy *= phy) return ret; } =20 - for (i =3D 0; i < num; i++) { - if (regs[i].enable_load >=3D 0) { - ret =3D regulator_set_load(s[i].consumer, - regs[i].enable_load); - if (ret < 0) - return ret; - } - } - return 0; } =20 --=20 2.37.1.359.gd136c6c3e2-goog From nobody Wed Apr 15 04:16:50 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7606C00140 for ; Tue, 26 Jul 2022 17:39:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239643AbiGZRjd (ORCPT ); Tue, 26 Jul 2022 13:39:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239543AbiGZRjA (ORCPT ); Tue, 26 Jul 2022 13:39:00 -0400 Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08D842F01A for ; Tue, 26 Jul 2022 10:38:53 -0700 (PDT) Received: by mail-pj1-x102e.google.com with SMTP id jw17so1697984pjb.0 for ; Tue, 26 Jul 2022 10:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wmvETZN5Ha+yireouc7YVcvDiIVXAJJg/FoKJ92DJjU=; b=MksWHjPQg4rbAGIfFOV3GYEdoFoi5JyDDguOZEgeL+RCBQgPgco2HmMrFOUgzGPoWg IhcI7KjBNIb5SMTaglpPg92MUIaWzAid8OQ0WLOYidBVYnBfsdNEwQLxmKxck3xftLI5 fwCVZ3cEMwKVvXZTJlqZGKrQWBkmucHSRozEA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wmvETZN5Ha+yireouc7YVcvDiIVXAJJg/FoKJ92DJjU=; b=ETtYe6ItjD+lL/mdgGmmEbiMNKmquwwadWgRGx8uvRm7vqYAeo7OcqsqamwUswNiaG Rb4ZpNMH8kTCH56S+M0D/hzaQkfDRouvaO3eonbriT6bJkX4oXe93yH0Fc9VxpyC9ftU GOcVKUD2rjnzYbRM9MRKSlKowSThlF7VEqR5olE09x6r6RKShc3Dsbfpb+eesLTngUBn sjh5O5OUeljnprJiC+Q7mDvX6z7aG4Cdx2ENQKP51QFhyFDcDY8PGuhIUCI+GpOQ16cL LcsmoncGuXS4Y0qV9OJYEjnlSPvWg8Q0uIpAeCdteO18fufbXUvaYLBWNZHOqGd8pcA2 uZ2g== X-Gm-Message-State: AJIora8y7Sbm0aDXmEvGcYNt9lKD1TIHMYvcBkBJ8WsitO1CCQlaNCky R1oB+Oc88kitQDg8JGMJXJloAQ== X-Google-Smtp-Source: AGRyM1u3xzf+HZdNlx0FPajthsuPbfpneKaEGEFjTphXREaGSlyM06EiwS5p9j+HCf/rC2oEpPwDRQ== X-Received: by 2002:a17:902:7c0d:b0:16d:500b:1255 with SMTP id x13-20020a1709027c0d00b0016d500b1255mr16942650pll.98.1658857132520; Tue, 26 Jul 2022 10:38:52 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:8693:e9aa:75c0:5134]) by smtp.gmail.com with ESMTPSA id ik29-20020a170902ab1d00b0016d9ecd71f4sm245884plb.77.2022.07.26.10.38.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 10:38:51 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Mark Brown Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Douglas Anderson , Liam Girdwood , linux-kernel@vger.kernel.org Subject: [PATCH v2 6/7] regulator: core: Allow drivers to define their init data as const Date: Tue, 26 Jul 2022 10:38:23 -0700 Message-Id: <20220726103631.v2.6.I38fc508a73135a5c1b873851f3553ff2a3a625f5@changeid> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog In-Reply-To: <20220726173824.1166873-1-dianders@chromium.org> References: <20220726173824.1166873-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Drivers tend to want to define the names of their regulators somewhere in their source file as "static const". This means, inevitable, that every driver out there open codes something like this: static const char * const supply_names[] =3D { "vcc", "vccl", }; static int get_regulators(struct my_data *data) { int i; data->supplies =3D devm_kzalloc(...) if (!data->supplies) return -ENOMEM; for (i =3D 0; i < ARRAY_SIZE(supply_names); i++) data->supplies[i].supply =3D supply_names[i]; return devm_regulator_bulk_get(data->dev, ARRAY_SIZE(supply_names), data->supplies); } Let's make this more convenient by doing providing a helper that does the copy. I have chosen to have the "const" input structure here be the exact same structure as the normal one passed to devm_regulator_bulk_get(). This is slightly inefficent since the input data can't possibly have anything useful for "ret" or consumer and thus we waste 8 bytes per structure. This seems an OK tradeoff for not introducing an extra structure. Signed-off-by: Douglas Anderson --- Changes in v2: - ("Allow drivers to define their init data as const") new for v2. drivers/regulator/devres.c | 28 ++++++++++++++++++++++++++++ include/linux/regulator/consumer.h | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c index 9113233f41cd..32823a87fd40 100644 --- a/drivers/regulator/devres.c +++ b/drivers/regulator/devres.c @@ -166,6 +166,34 @@ int devm_regulator_bulk_get(struct device *dev, int nu= m_consumers, } EXPORT_SYMBOL_GPL(devm_regulator_bulk_get); =20 +/** + * devm_regulator_bulk_get_const - devm_regulator_bulk_get() w/ const data + * + * @dev: device to supply + * @num_consumers: number of consumers to register + * @in_consumers: const configuration of consumers + * @out_consumers: in_consumers is copied here and this is passed to + * devm_regulator_bulk_get(). + * + * This is a convenience function to allow bulk regulator configuration + * to be stored "static const" in files. + * + * Return: 0 on success, an errno on failure. + */ +int devm_regulator_bulk_get_const(struct device *dev, int num_consumers, + const struct regulator_bulk_data *in_consumers, + struct regulator_bulk_data **out_consumers) +{ + *out_consumers =3D devm_kmemdup(dev, in_consumers, + num_consumers * sizeof(*in_consumers), + GFP_KERNEL); + if (*out_consumers =3D=3D NULL) + return -ENOMEM; + + return devm_regulator_bulk_get(dev, num_consumers, *out_consumers); +} +EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_const); + static void devm_rdev_release(struct device *dev, void *res) { regulator_unregister(*(struct regulator_dev **)res); diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/c= onsumer.h index 5779f4466e62..bc6cda706d1f 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -244,6 +244,10 @@ int __must_check regulator_bulk_get(struct device *dev= , int num_consumers, struct regulator_bulk_data *consumers); int __must_check devm_regulator_bulk_get(struct device *dev, int num_consu= mers, struct regulator_bulk_data *consumers); +int __must_check devm_regulator_bulk_get_const( + struct device *dev, int num_consumers, + const struct regulator_bulk_data *in_consumers, + struct regulator_bulk_data **out_consumers); int __must_check regulator_bulk_enable(int num_consumers, struct regulator_bulk_data *consumers); int regulator_bulk_disable(int num_consumers, --=20 2.37.1.359.gd136c6c3e2-goog From nobody Wed Apr 15 04:16:50 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35209C00144 for ; Tue, 26 Jul 2022 17:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239605AbiGZRj3 (ORCPT ); Tue, 26 Jul 2022 13:39:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239550AbiGZRjB (ORCPT ); Tue, 26 Jul 2022 13:39:01 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2373F2F013 for ; Tue, 26 Jul 2022 10:38:55 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id v16-20020a17090abb9000b001f25244c65dso10560943pjr.2 for ; Tue, 26 Jul 2022 10:38:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=K0kI1Jv+w1hmGLF3xtO2oXTT7wqxRY+foeGCCnL9AjA=; b=T8/qC+6srgVHTfRFG2w3KUAoBN6VLIzzpZbAeztmNvkmsXTnA5PKwRmipASZpYED0z I87WgNvf/uUqjJuLyM+Mi6E+70SIk7irxOx/e5gblOaorXfDfroYuho817EeBocZzerM FWyQb3qO1T4WRRzV5vizZfUXe6VKu9rNnZcv4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=K0kI1Jv+w1hmGLF3xtO2oXTT7wqxRY+foeGCCnL9AjA=; b=y9ABDosfahaarhmha0uZDF3hLFQPc8u3rWs84XrpgBQ8mHp5xLhBfkcJZWg23JJ3m6 l6uHr0tGjYDOonlXr+boUBaI3kPCPP8Ag87XpSHg1hqvoyOjKOd7tHx5jC6LagR2+Jqo xERAqPj4dBnwwHl27B2EAiDalv14VdBdhsams2QyhkUBzQaGhDQ8rynqZKoV0mE/Pwvs sTN9U5Nnyv7EnBtaElA8YXOZVDGa2CMvhE6N2T0wrS7TXI4Ej05jmWJ0NXDGlP7iNMpw xQOYIY/SK1mXZ9b4qq5LQ0ITbGSPjLG2Tt/2HbPEItm8LSoaiXkKG3JgLhCBq6PAxp5V rFgQ== X-Gm-Message-State: AJIora9a9fjV7yT4P6h+IMHLJnE4PgQoBBYm/V9sNiv+hIeL0V5laftN UtiPGjaCWrPLecdGfjhkCsaQZA== X-Google-Smtp-Source: AGRyM1ufD662+ThVauOZCyZ7KHWQfXWbOlLf/kR+URMihVCr62EbCNVmkYFQ0+JEW5z1xTuqhR6foA== X-Received: by 2002:a17:90b:164d:b0:1f0:31c1:9e88 with SMTP id il13-20020a17090b164d00b001f031c19e88mr304501pjb.206.1658857134609; Tue, 26 Jul 2022 10:38:54 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:8693:e9aa:75c0:5134]) by smtp.gmail.com with ESMTPSA id ik29-20020a170902ab1d00b0016d9ecd71f4sm245884plb.77.2022.07.26.10.38.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Jul 2022 10:38:53 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , Mark Brown Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Douglas Anderson , Daniel Vetter , David Airlie , Jonathan Marek , Konrad Dybcio , Loic Poulain , Rajeev Nandan , Sean Paul , Stephen Boyd , Vinod Koul , linux-kernel@vger.kernel.org Subject: [PATCH v2 7/7] drm/msm/dsi: Take advantage of devm_regulator_bulk_get_const() Date: Tue, 26 Jul 2022 10:38:24 -0700 Message-Id: <20220726103631.v2.7.I55a9e65cb1c22221316629e98768ff473f47a067@changeid> X-Mailer: git-send-email 2.37.1.359.gd136c6c3e2-goog In-Reply-To: <20220726173824.1166873-1-dianders@chromium.org> References: <20220726173824.1166873-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" In the patch ("regulator: core: Allow drivers to define their init data as const") we no longer need to do copying of regulator bulk data from initdata to something dynamic. Let's take advantage of that. In addition to saving some code, this also moves us to using ARRAY_SIZE() to specify how many regulators we have which is less error prone. NOTE: Though I haven't done the math, this is likely an overall savings in terms of "static const" data. We previously always allocated space for 8 supplies. Each of these supplies took up 36 bytes of data (32 for name, 4 for an int). Signed-off-by: Douglas Anderson --- Changes in v2: - ("Take advantage of devm_regulator_bulk_get_const") new for v2. drivers/gpu/drm/msm/dsi/dsi_cfg.c | 172 ++++++++++++++--------------- drivers/gpu/drm/msm/dsi/dsi_cfg.h | 3 +- drivers/gpu/drm/msm/dsi/dsi_host.c | 27 +---- 3 files changed, 94 insertions(+), 108 deletions(-) diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.c b/drivers/gpu/drm/msm/dsi/ds= i_cfg.c index 901d6fd53800..7e97c239ed48 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.c +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.c @@ -9,16 +9,16 @@ static const char * const dsi_v2_bus_clk_names[] =3D { "core_mmss", "iface", "bus", }; =20 +static const struct regulator_bulk_data apq8064_dsi_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 100000 }, /* 1.2 V */ + { .supply =3D "avdd", .init_load_uA =3D 10000 }, /* 3.0 V */ + { .supply =3D "vddio", .init_load_uA =3D 100000 }, /* 1.8 V */ +}; + static const struct msm_dsi_config apq8064_dsi_cfg =3D { .io_offset =3D 0, - .reg_cfg =3D { - .num =3D 3, - .regs =3D { - {"vdda", 100000}, /* 1.2 V */ - {"avdd", 10000}, /* 3.0 V */ - {"vddio", 100000}, /* 1.8 V */ - }, - }, + .regulator_data =3D apq8064_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(apq8064_dsi_regulators), .bus_clk_names =3D dsi_v2_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_v2_bus_clk_names), .io_start =3D { 0x4700000, 0x5800000 }, @@ -29,16 +29,16 @@ static const char * const dsi_6g_bus_clk_names[] =3D { "mdp_core", "iface", "bus", "core_mmss", }; =20 +static const struct regulator_bulk_data msm8974_apq8084_regulators[] =3D { + { .supply =3D "vdd", .init_load_uA =3D 150000 }, /* 3.0 V */ + { .supply =3D "vdda", .init_load_uA =3D 100000 }, /* 1.2 V */ + { .supply =3D "vddio", .init_load_uA =3D 100000 }, /* 1.8 V */ +}; + static const struct msm_dsi_config msm8974_apq8084_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 3, - .regs =3D { - {"vdd", 150000}, /* 3.0 V */ - {"vdda", 100000}, /* 1.2 V */ - {"vddio", 100000}, /* 1.8 V */ - }, - }, + .regulator_data =3D msm8974_apq8084_regulators, + .num_regulators =3D ARRAY_SIZE(msm8974_apq8084_regulators), .bus_clk_names =3D dsi_6g_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_6g_bus_clk_names), .io_start =3D { 0xfd922800, 0xfd922b00 }, @@ -49,15 +49,15 @@ static const char * const dsi_8916_bus_clk_names[] =3D { "mdp_core", "iface", "bus", }; =20 +static const struct regulator_bulk_data msm8916_dsi_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 100000 }, /* 1.2 V */ + { .supply =3D "vddio", .init_load_uA =3D 100000 }, /* 1.8 V */ +}; + static const struct msm_dsi_config msm8916_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 2, - .regs =3D { - {"vdda", 100000}, /* 1.2 V */ - {"vddio", 100000}, /* 1.8 V */ - }, - }, + .regulator_data =3D msm8916_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(msm8916_dsi_regulators), .bus_clk_names =3D dsi_8916_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_8916_bus_clk_names), .io_start =3D { 0x1a98000 }, @@ -68,34 +68,34 @@ static const char * const dsi_8976_bus_clk_names[] =3D { "mdp_core", "iface", "bus", }; =20 +static const struct regulator_bulk_data msm8976_dsi_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 100000 }, /* 1.2 V */ + { .supply =3D "vddio", .init_load_uA =3D 100000 }, /* 1.8 V */ +}; + static const struct msm_dsi_config msm8976_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 2, - .regs =3D { - {"vdda", 100000}, /* 1.2 V */ - {"vddio", 100000}, /* 1.8 V */ - }, - }, + .regulator_data =3D msm8976_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(msm8976_dsi_regulators), .bus_clk_names =3D dsi_8976_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_8976_bus_clk_names), .io_start =3D { 0x1a94000, 0x1a96000 }, .num_dsi =3D 2, }; =20 +static const struct regulator_bulk_data msm8994_dsi_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 100000 }, /* 1.25 V */ + { .supply =3D "vddio", .init_load_uA =3D 100000 }, /* 1.8 V */ + { .supply =3D "vcca", .init_load_uA =3D 10000 }, /* 1.0 V */ + { .supply =3D "vdd", .init_load_uA =3D 100000 }, /* 1.8 V */ + { .supply =3D "lab_reg", .init_load_uA =3D -1 }, + { .supply =3D "ibb_reg", .init_load_uA =3D -1 }, +}; + static const struct msm_dsi_config msm8994_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 6, - .regs =3D { - {"vdda", 100000}, /* 1.25 V */ - {"vddio", 100000}, /* 1.8 V */ - {"vcca", 10000}, /* 1.0 V */ - {"vdd", 100000}, /* 1.8 V */ - {"lab_reg", -1}, - {"ibb_reg", -1}, - }, - }, + .regulator_data =3D msm8994_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(msm8994_dsi_regulators), .bus_clk_names =3D dsi_6g_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_6g_bus_clk_names), .io_start =3D { 0xfd998000, 0xfd9a0000 }, @@ -106,16 +106,16 @@ static const char * const dsi_8996_bus_clk_names[] = =3D { "mdp_core", "iface", "bus", "core_mmss", }; =20 +static const struct regulator_bulk_data msm8996_dsi_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 18160 }, /* 1.25 V */ + { .supply =3D "vcca", .init_load_uA =3D 17000 }, /* 0.925 V */ + { .supply =3D "vddio", .init_load_uA =3D 100000 }, /* 1.8 V */ +}; + static const struct msm_dsi_config msm8996_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 3, - .regs =3D { - {"vdda", 18160}, /* 1.25 V */ - {"vcca", 17000}, /* 0.925 V */ - {"vddio", 100000},/* 1.8 V */ - }, - }, + .regulator_data =3D msm8996_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(msm8996_dsi_regulators), .bus_clk_names =3D dsi_8996_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_8996_bus_clk_names), .io_start =3D { 0x994000, 0x996000 }, @@ -126,15 +126,15 @@ static const char * const dsi_msm8998_bus_clk_names[]= =3D { "iface", "bus", "core", }; =20 +static const struct regulator_bulk_data msm8998_dsi_regulators[] =3D { + { .supply =3D "vdd", .init_load_uA =3D 367000 }, /* 0.9 V */ + { .supply =3D "vdda", .init_load_uA =3D 62800 }, /* 1.2 V */ +}; + static const struct msm_dsi_config msm8998_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 2, - .regs =3D { - {"vdd", 367000}, /* 0.9 V */ - {"vdda", 62800}, /* 1.2 V */ - }, - }, + .regulator_data =3D msm8998_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(msm8998_dsi_regulators), .bus_clk_names =3D dsi_msm8998_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_msm8998_bus_clk_names), .io_start =3D { 0xc994000, 0xc996000 }, @@ -145,14 +145,14 @@ static const char * const dsi_sdm660_bus_clk_names[] = =3D { "iface", "bus", "core", "core_mmss", }; =20 +static const struct regulator_bulk_data sdm660_dsi_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 12560 }, /* 1.2 V */ +}; + static const struct msm_dsi_config sdm660_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 1, - .regs =3D { - {"vdda", 12560}, /* 1.2 V */ - }, - }, + .regulator_data =3D sdm660_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(sdm660_dsi_regulators), .bus_clk_names =3D dsi_sdm660_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_sdm660_bus_clk_names), .io_start =3D { 0xc994000, 0xc996000 }, @@ -167,28 +167,28 @@ static const char * const dsi_sc7180_bus_clk_names[] = =3D { "iface", "bus", }; =20 +static const struct regulator_bulk_data sdm845_dsi_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 21800 }, /* 1.2 V */ +}; + static const struct msm_dsi_config sdm845_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 1, - .regs =3D { - {"vdda", 21800}, /* 1.2 V */ - }, - }, + .regulator_data =3D sdm845_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(sdm845_dsi_regulators), .bus_clk_names =3D dsi_sdm845_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_sdm845_bus_clk_names), .io_start =3D { 0xae94000, 0xae96000 }, .num_dsi =3D 2, }; =20 +static const struct regulator_bulk_data sc7180_dsi_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 21800 }, /* 1.2 V */ +}; + static const struct msm_dsi_config sc7180_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 1, - .regs =3D { - {"vdda", 21800}, /* 1.2 V */ - }, - }, + .regulator_data =3D sc7180_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(sc7180_dsi_regulators), .bus_clk_names =3D dsi_sc7180_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_sc7180_bus_clk_names), .io_start =3D { 0xae94000 }, @@ -199,14 +199,14 @@ static const char * const dsi_sc7280_bus_clk_names[] = =3D { "iface", "bus", }; =20 +static const struct regulator_bulk_data sc7280_dsi_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 8350 }, /* 1.2 V */ +}; + static const struct msm_dsi_config sc7280_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 1, - .regs =3D { - {"vdda", 8350}, /* 1.2 V */ - }, - }, + .regulator_data =3D sc7280_dsi_regulators, + .num_regulators =3D ARRAY_SIZE(sc7280_dsi_regulators), .bus_clk_names =3D dsi_sc7280_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_sc7280_bus_clk_names), .io_start =3D { 0xae94000 }, @@ -217,14 +217,14 @@ static const char * const dsi_qcm2290_bus_clk_names[]= =3D { "iface", "bus", }; =20 +static const struct regulator_bulk_data qcm2290_dsi_cfg_regulators[] =3D { + { .supply =3D "vdda", .init_load_uA =3D 21800 }, /* 1.2 V */ +}; + static const struct msm_dsi_config qcm2290_dsi_cfg =3D { .io_offset =3D DSI_6G_REG_SHIFT, - .reg_cfg =3D { - .num =3D 1, - .regs =3D { - {"vdda", 21800}, /* 1.2 V */ - }, - }, + .regulator_data =3D qcm2290_dsi_cfg_regulators, + .num_regulators =3D ARRAY_SIZE(qcm2290_dsi_cfg_regulators), .bus_clk_names =3D dsi_qcm2290_bus_clk_names, .num_bus_clks =3D ARRAY_SIZE(dsi_qcm2290_bus_clk_names), .io_start =3D { 0x5e94000 }, diff --git a/drivers/gpu/drm/msm/dsi/dsi_cfg.h b/drivers/gpu/drm/msm/dsi/ds= i_cfg.h index fe54a999968b..8f04e685a74e 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_cfg.h +++ b/drivers/gpu/drm/msm/dsi/dsi_cfg.h @@ -32,7 +32,8 @@ =20 struct msm_dsi_config { u32 io_offset; - struct dsi_reg_config reg_cfg; + const struct regulator_bulk_data *regulator_data; + int num_regulators; const char * const *bus_clk_names; const int num_bus_clks; const resource_size_t io_start[DSI_MAX]; diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/d= si_host.c index dec7a94cf819..e159f2006158 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_host.c +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c @@ -106,7 +106,7 @@ struct msm_dsi_host { =20 void __iomem *ctrl_base; phys_addr_t ctrl_size; - struct regulator_bulk_data supplies[DSI_DEV_REGULATOR_MAX]; + struct regulator_bulk_data *supplies; =20 int num_bus_clks; struct clk_bulk_data bus_clks[DSI_BUS_CLK_MAX]; @@ -259,7 +259,7 @@ static inline struct msm_dsi_host *to_msm_dsi_host(stru= ct mipi_dsi_host *host) static void dsi_host_regulator_disable(struct msm_dsi_host *msm_host) { struct regulator_bulk_data *s =3D msm_host->supplies; - int num =3D msm_host->cfg_hnd->cfg->reg_cfg.num; + int num =3D msm_host->cfg_hnd->cfg->num_regulators; =20 regulator_bulk_disable(num, s); } @@ -267,31 +267,16 @@ static void dsi_host_regulator_disable(struct msm_dsi= _host *msm_host) static int dsi_host_regulator_enable(struct msm_dsi_host *msm_host) { struct regulator_bulk_data *s =3D msm_host->supplies; - int num =3D msm_host->cfg_hnd->cfg->reg_cfg.num; + int num =3D msm_host->cfg_hnd->cfg->num_regulators; =20 return regulator_bulk_enable(num, s); } =20 static int dsi_regulator_init(struct msm_dsi_host *msm_host) { - struct regulator_bulk_data *s =3D msm_host->supplies; - const struct dsi_reg_entry *regs =3D msm_host->cfg_hnd->cfg->reg_cfg.regs; - int num =3D msm_host->cfg_hnd->cfg->reg_cfg.num; - int i, ret; - - for (i =3D 0; i < num; i++) { - s[i].supply =3D regs[i].name; - s[i].init_load_uA =3D regs[i].enable_load; - } - - ret =3D devm_regulator_bulk_get(&msm_host->pdev->dev, num, s); - if (ret < 0) { - pr_err("%s: failed to init regulator, ret=3D%d\n", - __func__, ret); - return ret; - } - - return 0; + return devm_regulator_bulk_get_const( + &msm_host->pdev->dev, msm_host->cfg_hnd->cfg->num_regulators, + msm_host->cfg_hnd->cfg->regulator_data, &msm_host->supplies); } =20 int dsi_clk_init_v2(struct msm_dsi_host *msm_host) --=20 2.37.1.359.gd136c6c3e2-goog