Skip to content

Commit 76750f1

Browse files
Hui Liugregkh
authored andcommitted
usb: typec: qcom: Update the logic of regulator enable and disable
Removed the call logic of disable and enable regulator in reset function. Enable the regulator in qcom_pmic_typec_start function and disable it in qcom_pmic_typec_stop function to avoid unbalanced regulator disable warnings. Fixes: a4422ff ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver") Cc: stable <stable@kernel.org> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # rb5 Signed-off-by: Hui Liu <quic_huliu@quicinc.com> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://lore.kernel.org/r/20230831-qcom-tcpc-v5-1-5e2661dc6c1d@quicinc.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 427694c commit 76750f1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -381,10 +381,6 @@ static int qcom_pmic_typec_pdphy_enable(struct pmic_typec_pdphy *pmic_typec_pdph
381381
struct device *dev = pmic_typec_pdphy->dev;
382382
int ret;
383383

384-
ret = regulator_enable(pmic_typec_pdphy->vdd_pdphy);
385-
if (ret)
386-
return ret;
387-
388384
/* PD 2.0, DR=TYPEC_DEVICE, PR=TYPEC_SINK */
389385
ret = regmap_update_bits(pmic_typec_pdphy->regmap,
390386
pmic_typec_pdphy->base + USB_PDPHY_MSG_CONFIG_REG,
@@ -422,8 +418,6 @@ static int qcom_pmic_typec_pdphy_disable(struct pmic_typec_pdphy *pmic_typec_pdp
422418
ret = regmap_write(pmic_typec_pdphy->regmap,
423419
pmic_typec_pdphy->base + USB_PDPHY_EN_CONTROL_REG, 0);
424420

425-
regulator_disable(pmic_typec_pdphy->vdd_pdphy);
426-
427421
return ret;
428422
}
429423

@@ -447,6 +441,10 @@ int qcom_pmic_typec_pdphy_start(struct pmic_typec_pdphy *pmic_typec_pdphy,
447441
int i;
448442
int ret;
449443

444+
ret = regulator_enable(pmic_typec_pdphy->vdd_pdphy);
445+
if (ret)
446+
return ret;
447+
450448
pmic_typec_pdphy->tcpm_port = tcpm_port;
451449

452450
ret = pmic_typec_pdphy_reset(pmic_typec_pdphy);
@@ -467,6 +465,8 @@ void qcom_pmic_typec_pdphy_stop(struct pmic_typec_pdphy *pmic_typec_pdphy)
467465
disable_irq(pmic_typec_pdphy->irq_data[i].irq);
468466

469467
qcom_pmic_typec_pdphy_reset_on(pmic_typec_pdphy);
468+
469+
regulator_disable(pmic_typec_pdphy->vdd_pdphy);
470470
}
471471

472472
struct pmic_typec_pdphy *qcom_pmic_typec_pdphy_alloc(struct device *dev)

0 commit comments

Comments
 (0)