diff mbox series

[v2,1/1] power: supply: cpcap-charger: Add usleep to cpcap charger to avoid usb plug bounce

Message ID 20201230150218.d5ae76983e6dde68dcebff09@uvos.xyz
State New
Headers show
Series [v2,1/1] power: supply: cpcap-charger: Add usleep to cpcap charger to avoid usb plug bounce | expand

Commit Message

Carl Philipp Klemm Dec. 30, 2020, 2:02 p.m. UTC
Adds 40000 ms sleep before cpcap_charger_enable to hopfully avoid the bounce on 
plug in

Signed-off-by: Carl Philipp Klemm <philipp@uvos.xyz>
---
 drivers/power/supply/cpcap-charger.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Sebastian Reichel Jan. 3, 2021, 2:07 a.m. UTC | #1
Hi,

On Wed, Dec 30, 2020 at 03:02:18PM +0100, Carl Philipp Klemm wrote:
> Adds 40000 ms sleep before cpcap_charger_enable to hopfully avoid

> the bounce on plug in

> 

> Signed-off-by: Carl Philipp Klemm <philipp@uvos.xyz>

> ---


This is before cpcap_charger_disable() and I do not follow why you
want to add a delay in this position. Please add a comment before
the usleep providing some information which bounce effect is being
mitigated.

Thanks,

-- Sebastian

>  drivers/power/supply/cpcap-charger.c | 2 ++

>  1 file changed, 2 insertions(+)

> 

> diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c

> index c0d452e3dc8b..130c61a9f267 100644

> --- a/drivers/power/supply/cpcap-charger.c

> +++ b/drivers/power/supply/cpcap-charger.c

> @@ -631,6 +631,8 @@ static void cpcap_usb_detect(struct work_struct *work)

>  		return;

>  	}

>  

> +	usleep_range(40000, 60000);

> +

>  	/* Throttle chrgcurr2 interrupt for charger done and retry */

>  	switch (ddata->state) {

>  	case CPCAP_CHARGER_CHARGING:

> -- 

> 2.29.2
diff mbox series

Patch

diff --git a/drivers/power/supply/cpcap-charger.c b/drivers/power/supply/cpcap-charger.c
index c0d452e3dc8b..130c61a9f267 100644
--- a/drivers/power/supply/cpcap-charger.c
+++ b/drivers/power/supply/cpcap-charger.c
@@ -631,6 +631,8 @@  static void cpcap_usb_detect(struct work_struct *work)
 		return;
 	}
 
+	usleep_range(40000, 60000);
+
 	/* Throttle chrgcurr2 interrupt for charger done and retry */
 	switch (ddata->state) {
 	case CPCAP_CHARGER_CHARGING: