From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796527384; b=nWpY17RiNakq8RWtgxDOlipy4qeXbXXvEB40UMJJrQ8y2wJFPm+il4PAbYZ/K2Ge6CAf 2dJRhUWCV/y67dl983fV/SxEJ0JdNgfYvmDBJCJ7wXwYXOMlCxGPdApULA5A3DT7bXoC8 wFiLUKEHi+zS6Kdn/MwWHNEHpmDYypIRrkApjaDGr6cAfa7x0ciIiOe4KDbpqePfFnk1K YlOc+xhQs4lJGN6bEqocnbiL7qV4luJaD98GVVDbMNfi+6Xvjg1pYNHHrb/zvp9+cHv1Q 1VyGcKHHxLfJ0velfjY1SLmrLfrkQ4ucuPM0r+L6Hx6f2V0u1BlLhDeJVWLUI462Qqg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796527384; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=1r1LokVMp5NfI57yDaqkbjIwZ+hu85OzaIV9c4VyytQ=; b=F2gcm+S01omY8WJ5eQfGchPh1x4cCGHNjoM/uNpk8Id6TA4g8rvf816FqsMOrvkno+6z eSvacfOHeqSMZF8hI9S0hN9CQRQv7z0yZUJ0qoJoSdQd4RN6RjJhsID0/dB1UQsQ4OyCI HRNkp1y11jiI3VRA/8/lGjdXE/2cNJQEaiYMfQgDqsBZsOm/lDO1+bV9aBTLt9ezSnHyN 6raD8hgm3Mz6o7TuiHkCNavkVmo22nvQlCd/yV0XS+dlPg1fjsUCoN/MW/z+oT4achx/k xGKTEB1xLetdCXCm20MjqPDsQzbhRH9TNkftC1Q6IrPp5LN2YCGlwCxzK0JPLUyY8Pg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X9XkAi4T; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1767D606A31F; Sun, 6 Dec 2026 03:23:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=X9XkAi4T Received: by smtp.kernel.org (Postfix) with ESMTPSA id 509E91F0092B; Sun, 6 Dec 2026 03:23:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796527383; bh=1r1LokVMp5NfI57yDaqkbjIwZ+hu85OzaIV9c4VyytQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=X9XkAi4TUCrVZk5enFCP15GVMqwhaAesZhL9p4rhPgIm8F5HZ2dUOpVbLZHeBEQgF fx4Uw2JqfrSZl1Z5g5IGE5HHy9e7crQ7knM4th57H1fCWjVn6QtJHlIUUyf48X8hJp QzrwuAizlJNellvUvPvI4xLXn49wa7ACtRZdKpMnqIihJZJn/UsB+0D1DyZl5f9v/z 4yy6IFaZMP3MhMxSBu2W7ZvfHdKUquERNqdDt/PbhbW4SHKl8Nu5qxuMkW8UMRu5y0 ruuY4U0BfYQLXuDn6eshQPoOhtjZPV+zY6b0OvSzbOpBwEQjE9Npy7ZX09VK1Kmnm7 fvR+CyIbxFuNw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v7 5/9] power: axp20x_battery: Support battery status without fuel gauge Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?TW9sbsOhciBNw6F0w6k=?= Cc: devicetree@vger.kernel.org, linux-input@vger.kernel.org, mfd@lists.linux.dev, robh@kernel.org, conor+dt@kernel.org, dmitry.torokhov@gmail.com, lee@kernel.org In-Reply-To: <20261206-axp192-v7-5-0200fc77da53@gmail.com> References: <20261206-axp192-v7-0-0200fc77da53@gmail.com> <20261206-axp192-v7-5-0200fc77da53@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 03:23:02 +0000 X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 3 potential issues to consider: - [Medium] power: axp20x_battery_get_prop() ignores charger enable and battery presence - [Low] power: supply: axp20x_battery: axp717_data omits has_fg flag - [Low] power: axp20x_battery: omit has_fg flag on axp717_data -- commit a493fb18308210a804a2cff64dc6cfb93847bd0d Author: Aidan MacDonald power: axp20x_battery: Support battery status without fuel gauge This commit adds a has_fg flag to struct axp_data and uses battery voltage relative to the maximum charge voltage to determine POWER_SUPPLY_STATUS_FULL when a chip has no fuel gauge. > diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply= /axp20x_battery.c > index f31b735ed6548..f7485ac6a9aca 100644 > --- a/drivers/power/supply/axp20x_battery.c > +++ b/drivers/power/supply/axp20x_battery.c [ ... ] > @@ -323,6 +324,34 @@ static int axp20x_battery_get_prop(struct power_supp= ly *psy, > return 0; > } > =20 > + /* > + * If the chip does not have a fuel gauge, we check battery full status > + * using voltage instead. > + */ > + if (!axp20x_batt->data->has_fg) { > + ret =3D axp20x_batt->data->get_max_voltage(axp20x_batt, &val1); > + if (ret) > + return ret; > + > + ret =3D iio_read_channel_processed(axp20x_batt->batt_v, &val2); > + if (ret) > + return ret; > + > + /* IIO subsystem reports voltage in mV but we need uV */ > + val2 *=3D 1000; > + > + /* > + * According to the AXP192 datasheet, charging will restart if > + * the battery voltage drops below V_rch =3D V_tgt - 0.1 V, so we > + * report the battery is full if its voltage is at least V_rch. > + */ > + if (val2 >=3D val1 - 100000) > + val->intval =3D POWER_SUPPLY_STATUS_FULL; > + else > + val->intval =3D POWER_SUPPLY_STATUS_NOT_CHARGING; > + break; > + } > + > ret =3D regmap_read(axp20x_batt->regmap, AXP20X_FG_RES, &val1); > if (ret) > return ret; [Severity: Medium] Can this report POWER_SUPPLY_STATUS_FULL when charging is disabled or no battery is attached? axp20x_battery_set_prop() allows userspace to disable charging by clearing AXP20X_CHRG_CTRL1_ENABLE, so the recharge threshold no longer holds and a partially charged battery above V_tgt - 0.1 V is reported as full. This path also does not check AXP20X_PWR_OP_BATT_PRESENT before inferring full status from the battery voltage. [ ... ] > @@ -1075,6 +1105,7 @@ static const struct axp_data axp221_data =3D { > .ccc_reg =3D AXP20X_CHRG_CTRL1, > .ccc_mask =3D AXP20X_CHRG_CTRL1_TGT_CURR, > .has_fg_valid =3D true, > + .has_fg =3D true, > .bat_ps_desc =3D &axp209_batt_ps_desc, > .get_max_voltage =3D axp22x_battery_get_max_voltage, > .set_max_voltage =3D axp22x_battery_set_max_voltage, > @@ -1100,6 +1131,7 @@ static const struct axp_data axp813_data =3D { > .ccc_reg =3D AXP20X_CHRG_CTRL1, > .ccc_mask =3D AXP20X_CHRG_CTRL1_TGT_CURR, > .has_fg_valid =3D true, > + .has_fg =3D true, > .bat_ps_desc =3D &axp209_batt_ps_desc, > .get_max_voltage =3D axp813_battery_get_max_voltage, > .set_max_voltage =3D axp20x_battery_set_max_voltage, [Severity: Low] Should axp717_data also set .has_fg =3D true? AXP717 has a hardware fuel gauge (axp717_battery_get_prop() reads AXP717_BATT_PERCENT_DATA). Later in this series, commit "power: axp20x_battery: Estimate AXP192 capacity from the OCV table" gates power_supply_put_battery_info() on has_fg in axp20x_power_probe(), so leaving has_fg false causes AXP717 to retain unused battery_info allocations. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206-axp192-v7-= 0-0200fc77da53@gmail.com?part=3D5