Re: [PATCH v2 1/2] power: supply: bq25980 Apply datasheet revision changes

From: Krzysztof Kozlowski
Date: Thu Feb 11 2021 - 02:37:05 EST


On Wed, Feb 10, 2021 at 04:56:45PM -0600, Ricardo Rivera-Matos wrote:
> The latest datasheet revision for BQ25980, BQ25975, and BQ25960 changed
>
> various register step sizes and offset values.
>
> This patch changes the following header file
>
> values for POWER_SUPPLY_PROP_CURRENT_NOW,
>
> POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
>
> POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE,
>
> POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
>
> POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT, and POWER_SUPPLY_PROP_VOLTAGE_NOW.
>
> Additionally, this patch adjusts bq25980_get_input_curr_lim(),
>
> bq25980_set_input_curr_lim(), bq25980_get_const_charge_curr(), and
>
> bq25980_set_const_charge_curr() to perform the get/set math correctly.

Your formatting is so odd, it is not readable. Please open "git log" and
try to write something similar to existing commits, e.g. without
additional blank line between lines.

>
> Fixes: 5069185fc18e ("power: supply: bq25980: Add support for the BQ259xx family")
> Signed-off-by: Ricardo Rivera-Matos <r-rivera-matos@xxxxxx>
> ---
> drivers/power/supply/bq25980_charger.c | 141 ++++++++++++++++++++-----
> drivers/power/supply/bq25980_charger.h | 77 ++++++++++----
> 2 files changed, 173 insertions(+), 45 deletions(-)
>
> diff --git a/drivers/power/supply/bq25980_charger.c b/drivers/power/supply/bq25980_charger.c
> index 530ff4025b31..7c489a9e8877 100644
> --- a/drivers/power/supply/bq25980_charger.c
> +++ b/drivers/power/supply/bq25980_charger.c
> @@ -52,6 +52,10 @@ struct bq25980_chip_info {
> int busocp_byp_max;
> int busocp_sc_min;
> int busocp_byp_min;
> + int busocp_sc_step;
> + int busocp_byp_step;
> + int busocp_sc_offset;
> + int busocp_byp_offset;

Does not look like related to changing offsets of register values in
header.

>
> int busovp_sc_def;
> int busovp_byp_def;
> @@ -73,6 +77,20 @@ struct bq25980_chip_info {
>
> int batocp_def;
> int batocp_max;
> + int batocp_min;
> + int batocp_step;
> +
> + int vbus_adc_step;
> + int vbus_adc_offset;
> +
> + int ibus_adc_step;
> + int ibus_adc_offset;
> +
> + int vbat_adc_step;
> + int vbat_adc_offset;
> +
> + int ibat_adc_step;
> + int ibat_adc_offset;
> };
>

Does not look like related to changing offsets of register values in
header.

> struct bq25980_init_data {
> @@ -275,13 +293,22 @@ static int bq25980_watchdog_time[BQ25980_NUM_WD_VAL] = {5000, 10000, 50000,
> static int bq25980_get_input_curr_lim(struct bq25980_device *bq)
> {
> unsigned int busocp_reg_code;
> + int offset, step;
> int ret;
>
> + if (bq->state.bypass) {
> + step = bq->chip_info->busocp_byp_step;
> + offset = bq->chip_info->busocp_byp_offset;
> + } else {
> + step = bq->chip_info->busocp_sc_step;
> + offset = bq->chip_info->busocp_sc_offset;
> + }
> +

Does not look like related to changing offsets of register values in
header.

and so on... Fix one thing at a time.

Best regards,
Krzysztof