Skip to content

Commit

Permalink
usb: typec: qcom: Update the logic of regulator enable and disable
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Hui Liu authored and Greg Kroah-Hartman committed Oct 2, 2023
1 parent 427694c commit 76750f1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,6 @@ static int qcom_pmic_typec_pdphy_enable(struct pmic_typec_pdphy *pmic_typec_pdph
struct device *dev = pmic_typec_pdphy->dev;
int ret;

ret = regulator_enable(pmic_typec_pdphy->vdd_pdphy);
if (ret)
return ret;

/* PD 2.0, DR=TYPEC_DEVICE, PR=TYPEC_SINK */
ret = regmap_update_bits(pmic_typec_pdphy->regmap,
pmic_typec_pdphy->base + USB_PDPHY_MSG_CONFIG_REG,
Expand Down Expand Up @@ -422,8 +418,6 @@ static int qcom_pmic_typec_pdphy_disable(struct pmic_typec_pdphy *pmic_typec_pdp
ret = regmap_write(pmic_typec_pdphy->regmap,
pmic_typec_pdphy->base + USB_PDPHY_EN_CONTROL_REG, 0);

regulator_disable(pmic_typec_pdphy->vdd_pdphy);

return ret;
}

Expand All @@ -447,6 +441,10 @@ int qcom_pmic_typec_pdphy_start(struct pmic_typec_pdphy *pmic_typec_pdphy,
int i;
int ret;

ret = regulator_enable(pmic_typec_pdphy->vdd_pdphy);
if (ret)
return ret;

pmic_typec_pdphy->tcpm_port = tcpm_port;

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

qcom_pmic_typec_pdphy_reset_on(pmic_typec_pdphy);

regulator_disable(pmic_typec_pdphy->vdd_pdphy);
}

struct pmic_typec_pdphy *qcom_pmic_typec_pdphy_alloc(struct device *dev)
Expand Down

0 comments on commit 76750f1

Please sign in to comment.