diff mbox series

[04/13] power: supply: bq25890: Fix initial setting of the F_CONV_RATE field

Message ID 20211030182813.116672-5-hdegoede@redhat.com
State Not Applicable
Headers show
Series power-suppy/i2c/extcon: Add support for cht-wc PMIC without USB-PD support | expand

Commit Message

Hans de Goede Oct. 30, 2021, 6:28 p.m. UTC
The code doing the initial setting of the F_CONV_RATE field based
on the bq->state.online flag. In order for this to work properly,
this must be done after the initial bq25890_get_chip_state() call.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/power/supply/bq25890_charger.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

Comments

Sebastian Reichel Nov. 2, 2021, 4:29 p.m. UTC | #1
Hi,

On Sat, Oct 30, 2021 at 08:28:04PM +0200, Hans de Goede wrote:
> The code doing the initial setting of the F_CONV_RATE field based
> on the bq->state.online flag. In order for this to work properly,
> this must be done after the initial bq25890_get_chip_state() call.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/power/supply/bq25890_charger.c | 10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
> index 491d36a3811a..99497fdc73da 100644
> --- a/drivers/power/supply/bq25890_charger.c
> +++ b/drivers/power/supply/bq25890_charger.c
> @@ -682,16 +682,16 @@ static int bq25890_hw_init(struct bq25890_device *bq)
>  		}
>  	}
>  
> -	/* Configure ADC for continuous conversions when charging */
> -	ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online);
> +	ret = bq25890_get_chip_state(bq, &bq->state);
>  	if (ret < 0) {
> -		dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
> +		dev_dbg(bq->dev, "Get state failed %d\n", ret);
>  		return ret;
>  	}
>  
> -	ret = bq25890_get_chip_state(bq, &bq->state);
> +	/* Configure ADC for continuous conversions when charging */
> +	ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online);
>  	if (ret < 0) {
> -		dev_dbg(bq->dev, "Get state failed %d\n", ret);
> +		dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
>  		return ret;
>  	}
>  
> -- 
> 2.31.1
>
diff mbox series

Patch

diff --git a/drivers/power/supply/bq25890_charger.c b/drivers/power/supply/bq25890_charger.c
index 491d36a3811a..99497fdc73da 100644
--- a/drivers/power/supply/bq25890_charger.c
+++ b/drivers/power/supply/bq25890_charger.c
@@ -682,16 +682,16 @@  static int bq25890_hw_init(struct bq25890_device *bq)
 		}
 	}
 
-	/* Configure ADC for continuous conversions when charging */
-	ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online);
+	ret = bq25890_get_chip_state(bq, &bq->state);
 	if (ret < 0) {
-		dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
+		dev_dbg(bq->dev, "Get state failed %d\n", ret);
 		return ret;
 	}
 
-	ret = bq25890_get_chip_state(bq, &bq->state);
+	/* Configure ADC for continuous conversions when charging */
+	ret = bq25890_field_write(bq, F_CONV_RATE, !!bq->state.online);
 	if (ret < 0) {
-		dev_dbg(bq->dev, "Get state failed %d\n", ret);
+		dev_dbg(bq->dev, "Config ADC failed %d\n", ret);
 		return ret;
 	}