[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <783bda0f-5d51-43e2-8923-a01577a4296d@oss.qualcomm.com>
Date: Thu, 5 Dec 2024 17:31:42 +0100
From: Konrad Dybcio <konrad.dybcio@....qualcomm.com>
To: Ziyue Zhang <quic_ziyuzhan@...cinc.com>, vkoul@...nel.org,
kishon@...nel.org, dmitry.baryshkov@...aro.org, abel.vesa@...aro.org,
neil.armstrong@...aro.org, manivannan.sadhasivam@...aro.org,
andersson@...nel.org, konradybcio@...nel.org, robh@...nel.org,
krzk+dt@...nel.org, conor+dt@...nel.org
Cc: linux-arm-msm@...r.kernel.org, linux-phy@...ts.infradead.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 2/3] phy: qcom: qmp-pcie: add current load vote/devote for
PCIe PHY
On 4.12.2024 11:52 AM, Ziyue Zhang wrote:
> On some platform (eg.qcs615), the current that phy consumes will exceed
> the maximum current the regulator can provide in LPM mode, leading to
> over current protection and system boot up stuck. Fix this issue by
> setting regulator load to an expected value getting from phy device tree
> node during init so that the regulator can scale up to HPM to allow a
> larger current load.
> This change will also set load to zero during deinit to let regulator
> scale down to LPM mode to reduce itself's power consumptionif PCIe
> suspend.
>
> Signed-off-by: Ziyue Zhang <quic_ziyuzhan@...cinc.com>
> ---
> drivers/phy/qualcomm/phy-qcom-qmp-pcie.c | 35 ++++++++++++++++++++++--
> 1 file changed, 33 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
> index c8e39c147ba4..782d51ab5cf1 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-pcie.c
> @@ -39,6 +39,7 @@
> #include "phy-qcom-qmp-pcie-qhp.h"
>
> #define PHY_INIT_COMPLETE_TIMEOUT 10000
> +#define MAX_PROP_SIZE 32
>
> /* set of registers with offsets different per-PHY */
> enum qphy_reg_layout {
> @@ -2905,6 +2906,7 @@ struct qmp_pcie {
> struct reset_control_bulk_data *resets;
> struct reset_control *nocsr_reset;
> struct regulator_bulk_data *vregs;
> + u32 *max_current_load;
>
> struct phy *phy;
> int mode;
> @@ -4087,6 +4089,17 @@ static int qmp_pcie_init(struct phy *phy)
> const struct qmp_phy_cfg *cfg = qmp->cfg;
> int ret;
>
> + for (int i = 0; i < cfg->num_vregs; i++) {
> + if (qmp->max_current_load[i]) {
> + ret = regulator_set_load(qmp->vregs[i].consumer, qmp->max_current_load[i]);
I think it's better if we just put this info in the driver, like with
e.g. the DSI PHY
Konrad
Powered by blists - more mailing lists