Commit 22ad4f99 authored by Hans de Goede's avatar Hans de Goede Committed by Sebastian Reichel
Browse files

power: supply: bq25890: Fix initial setting of the F_CONV_RATE field



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: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarSebastian Reichel <sebastian.reichel@collabora.com>
parent d01363da
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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;
	}