mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v3] usb: typec: qcom: check regulator enable status before disabling it
@ 2023-08-28  5:16 Hui Liu via B4 Relay
  2023-08-28  9:50 ` Konrad Dybcio
  2023-08-28 10:11 ` Bryan O'Donoghue
  0 siblings, 2 replies; 4+ messages in thread
From: Hui Liu via B4 Relay @ 2023-08-28  5:16 UTC (permalink / raw)
  To: Bryan O'Donoghue, Guenter Roeck, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Heikki Krogerus, Greg Kroah-Hartman
  Cc: linux-arm-msm, linux-usb, linux-kernel, quic_fenglinw, subbaram, Hui Liu

From: Hui Liu <quic_huliu@quicinc.com>

Check regulator enable status before disabling it to avoid
unbalanced regulator disable warnings.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Hui Liu <quic_huliu@quicinc.com>
---
Changes in v3:
- Take Bryan's proposal to remove enable/disable operation in pdphy
enable and pdphy disable function, then enable regulator in pdphy start
function and disable it in pdphy stop function.
- Link to v2: https://lore.kernel.org/r/20230824-qcom-tcpc-v2-1-3dd8c3424564@quicinc.com

Changes in v2:
- Add Fixes tag
- Link to v1: https://lore.kernel.org/r/20230823-qcom-tcpc-v1-1-fa81a09ca056@quicinc.com
---
 drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
index bb0b8479d80f..52c81378e36e 100644
--- a/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
+++ b/drivers/usb/typec/tcpm/qcom/qcom_pmic_typec_pdphy.c
@@ -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,
@@ -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;
 }
 
@@ -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);
@@ -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)

---
base-commit: bbb9e06d2c6435af9c62074ad7048910eeb2e7bc
change-id: 20230822-qcom-tcpc-d41954ac65fa

Best regards,
-- 
Hui Liu <quic_huliu@quicinc.com>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] usb: typec: qcom: check regulator enable status before disabling it
  2023-08-28  5:16 [PATCH v3] usb: typec: qcom: check regulator enable status before disabling it Hui Liu via B4 Relay
@ 2023-08-28  9:50 ` Konrad Dybcio
  2023-08-28  9:52   ` Dmitry Baryshkov
  2023-08-28 10:11 ` Bryan O'Donoghue
  1 sibling, 1 reply; 4+ messages in thread
From: Konrad Dybcio @ 2023-08-28  9:50 UTC (permalink / raw)
  To: quic_huliu, Bryan O'Donoghue, Guenter Roeck, Andy Gross,
	Bjorn Andersson, Heikki Krogerus, Greg Kroah-Hartman
  Cc: linux-arm-msm, linux-usb, linux-kernel, quic_fenglinw, subbaram

On 28.08.2023 07:16, Hui Liu via B4 Relay wrote:
> From: Hui Liu <quic_huliu@quicinc.com>
> 
> Check regulator enable status before disabling it to avoid
> unbalanced regulator disable warnings.
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Signed-off-by: Hui Liu <quic_huliu@quicinc.com>
> ---
> Changes in v3:
> - Take Bryan's proposal to remove enable/disable operation in pdphy
> enable and pdphy disable function, then enable regulator in pdphy start
> function and disable it in pdphy stop function.
The commit message makes no sense now, it should have been updated
to reflect what you're doing after the logic had changed.

Konrad

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] usb: typec: qcom: check regulator enable status before disabling it
  2023-08-28  9:50 ` Konrad Dybcio
@ 2023-08-28  9:52   ` Dmitry Baryshkov
  0 siblings, 0 replies; 4+ messages in thread
From: Dmitry Baryshkov @ 2023-08-28  9:52 UTC (permalink / raw)
  To: Konrad Dybcio
  Cc: quic_huliu, Bryan O'Donoghue, Guenter Roeck, Andy Gross,
	Bjorn Andersson, Heikki Krogerus, Greg Kroah-Hartman,
	linux-arm-msm, linux-usb, linux-kernel, quic_fenglinw, subbaram

On Mon, 28 Aug 2023 at 12:51, Konrad Dybcio <konrad.dybcio@linaro.org> wrote:
>
> On 28.08.2023 07:16, Hui Liu via B4 Relay wrote:
> > From: Hui Liu <quic_huliu@quicinc.com>
> >
> > Check regulator enable status before disabling it to avoid
> > unbalanced regulator disable warnings.
> >
> > Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> > Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
> > Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> > Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> > Signed-off-by: Hui Liu <quic_huliu@quicinc.com>
> > ---
> > Changes in v3:
> > - Take Bryan's proposal to remove enable/disable operation in pdphy
> > enable and pdphy disable function, then enable regulator in pdphy start
> > function and disable it in pdphy stop function.
> The commit message makes no sense now, it should have been updated
> to reflect what you're doing after the logic had changed.

Not to mention that Reviewed-by and Acked-by tags make little sense
now, as patch contents were heavily modified.

-- 
With best wishes
Dmitry

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v3] usb: typec: qcom: check regulator enable status before disabling it
  2023-08-28  5:16 [PATCH v3] usb: typec: qcom: check regulator enable status before disabling it Hui Liu via B4 Relay
  2023-08-28  9:50 ` Konrad Dybcio
@ 2023-08-28 10:11 ` Bryan O'Donoghue
  1 sibling, 0 replies; 4+ messages in thread
From: Bryan O'Donoghue @ 2023-08-28 10:11 UTC (permalink / raw)
  To: quic_huliu, Guenter Roeck, Andy Gross, Bjorn Andersson,
	Konrad Dybcio, Heikki Krogerus, Greg Kroah-Hartman
  Cc: linux-arm-msm, linux-usb, linux-kernel, quic_fenglinw, subbaram

On 28/08/2023 06:16, Hui Liu via B4 Relay wrote:
> From: Hui Liu <quic_huliu@quicinc.com>
> 
> Check regulator enable status before disabling it to avoid
> unbalanced regulator disable warnings.
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> Fixes: a4422ff22142 ("usb: typec: qcom: Add Qualcomm PMIC Type-C driver")
> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Acked-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
> Signed-off-by: Hui Liu <quic_huliu@quicinc.com>

You can retain my Reviewed-by and Acked-by here but please spin a v4 
with the commit log fixed.

Good work, thanks.

Tested-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> # rb5

---
bod


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-28 10:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-28  5:16 [PATCH v3] usb: typec: qcom: check regulator enable status before disabling it Hui Liu via B4 Relay
2023-08-28  9:50 ` Konrad Dybcio
2023-08-28  9:52   ` Dmitry Baryshkov
2023-08-28 10:11 ` Bryan O'Donoghue

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®