diff mbox series

[v4] usb: typec: qcom: Update the logic of regulator enable and disable

Message ID 20230830-qcom-tcpc-v4-1-c19b0984879b@quicinc.com
State Superseded
Headers show
Series [v4] usb: typec: qcom: Update the logic of regulator enable and disable | expand

Commit Message

Hui Liu via B4 Relay Aug. 30, 2023, 3 a.m. UTC
From: Hui Liu <quic_huliu@quicinc.com>

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.

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 v4:
- Removed regulator_enable and regulator_diable from
pmic_typec_pdphy_reset function. And enable regulator in
qcom_pmic_typec_pdphy_start function and disable it in
qcom_pmic_typec_pdphy_stop function.
- Link to v3: https://lore.kernel.org/r/20230828-qcom-tcpc-v3-1-e95b7afa34d9@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(-)


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

Best regards,

Comments

Guenter Roeck Aug. 30, 2023, 6:25 a.m. UTC | #1
On 8/29/23 20:00, Hui Liu via B4 Relay wrote:
> From: Hui Liu <quic_huliu@quicinc.com>
> 
> 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.
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>

Please drop.

> 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 v4:
> - Removed regulator_enable and regulator_diable from
> pmic_typec_pdphy_reset function. And enable regulator in

... because I do not see the above change, and way too much changed
in the code since I sent a Reviewed-by: to make it appropriate
to keep it.

Actually, I don't see a difference between v3 and v4 of your patch.

Guenter

> qcom_pmic_typec_pdphy_start function and disable it in
> qcom_pmic_typec_pdphy_stop function.
> - Link to v3: https://lore.kernel.org/r/20230828-qcom-tcpc-v3-1-e95b7afa34d9@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 Aug. 30, 2023, 6:37 a.m. UTC | #2
On 8/30/2023 2:25 PM, Guenter Roeck wrote:
> On 8/29/23 20:00, Hui Liu via B4 Relay wrote:
>> From: Hui Liu <quic_huliu@quicinc.com>
>>
>> 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.
>>
>> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> 
> Please drop.
I didn't get your mean. would you please explain it?
> 
>> 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 v4:
>> - Removed regulator_enable and regulator_diable from
>> pmic_typec_pdphy_reset function. And enable regulator in
> 
> ... because I do not see the above change, and way too much changed
> in the code since I sent a Reviewed-by: to make it appropriate
> to keep it.
> 
> Actually, I don't see a difference between v3 and v4 of your patch.
> 
> Guenter
Yes, The codes are same between V3 and V4, I just update the commit log 
as Bryan said. How about I resend the V4 and update the cover letter 
like "Fixed the commit log"
> 
>> qcom_pmic_typec_pdphy_start function and disable it in
>> qcom_pmic_typec_pdphy_stop function.
>> - Link to v3: 
>> https://lore.kernel.org/r/20230828-qcom-tcpc-v3-1-e95b7afa34d9@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,
>
Guenter Roeck Aug. 30, 2023, 8:33 a.m. UTC | #3
On 8/29/23 23:37, hui liu wrote:
> 
> 
> On 8/30/2023 2:25 PM, Guenter Roeck wrote:
>> On 8/29/23 20:00, Hui Liu via B4 Relay wrote:
>>> From: Hui Liu <quic_huliu@quicinc.com>
>>>
>>> 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.
>>>
>>> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>>
>> Please drop.
> I didn't get your mean. would you please explain it?

You kept my Reviewed-by: tag even though the current version
of the patch is completely different to the patch I reviewed.
This is inappropriate. Please drop my Reviewed-by: tag.

Guenter
diff mbox series

Patch

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)