devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Philippe Simons <simons.philippe@gmail.com>
To: Chris Morgan <macroalpha82@gmail.com>, linux-sunxi@lists.linux.dev
Cc: devicetree@vger.kernel.org, linux-pm@vger.kernel.org,
	lee@kernel.org, samuel@sholland.org, jernej.skrabec@gmail.com,
	wens@csie.org, conor+dt@kernel.org, krzk+dt@kernel.org,
	robh@kernel.org, sre@kernel.org,
	Chris Morgan <macromorgan@hotmail.com>
Subject: Re: [PATCH V2 3/4] power: supply: axp20x_battery: Update temp sensor for AXP717 from device tree
Date: Tue, 11 Feb 2025 22:02:12 +0100	[thread overview]
Message-ID: <fc9e1b15-ed1a-4d7f-aee7-7687e4deaa91@gmail.com> (raw)
In-Reply-To: <20250204155835.161973-4-macroalpha82@gmail.com>

Tested on Allwinner H700 devices.

Tested-by: Philippe Simons <simons.philippe@gmail.com>

On 04/02/2025 16:58, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
>
> Allow a boolean property of "x-powers,no-thermistor" to specify devices
> where the ts pin is not connected to anything. This works around an
> issue found with some devices where the efuse is not programmed
> correctly from the factory or when the register gets set erroneously.
>
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> ---
>   drivers/power/supply/axp20x_battery.c | 21 +++++++++++++++++++++
>   1 file changed, 21 insertions(+)
>
> diff --git a/drivers/power/supply/axp20x_battery.c b/drivers/power/supply/axp20x_battery.c
> index 3c3158f31a48..f4cf129a0b68 100644
> --- a/drivers/power/supply/axp20x_battery.c
> +++ b/drivers/power/supply/axp20x_battery.c
> @@ -89,6 +89,8 @@
>   #define AXP717_BAT_CC_MIN_UA		0
>   #define AXP717_BAT_CC_MAX_UA		3008000
>   
> +#define AXP717_TS_PIN_DISABLE		BIT(4)
> +
>   struct axp20x_batt_ps;
>   
>   struct axp_data {
> @@ -117,6 +119,7 @@ struct axp20x_batt_ps {
>   	/* Maximum constant charge current */
>   	unsigned int max_ccc;
>   	const struct axp_data	*data;
> +	bool ts_disable;
>   };
>   
>   static int axp20x_battery_get_max_voltage(struct axp20x_batt_ps *axp20x_batt,
> @@ -984,6 +987,24 @@ static void axp717_set_battery_info(struct platform_device *pdev,
>   	int ccc = info->constant_charge_current_max_ua;
>   	int val;
>   
> +	axp_batt->ts_disable = (device_property_read_bool(axp_batt->dev,
> +							  "x-powers,no-thermistor"));
> +
> +	/*
> +	 * Under rare conditions an incorrectly programmed efuse for
> +	 * the temp sensor on the PMIC may trigger a fault condition.
> +	 * Allow users to hard-code if the ts pin is not used to work
> +	 * around this problem. Note that this requires the battery
> +	 * be correctly defined in the device tree with a monitored
> +	 * battery node.
> +	 */
> +	if (axp_batt->ts_disable) {
> +		regmap_update_bits(axp_batt->regmap,
> +				   AXP717_TS_PIN_CFG,
> +				   AXP717_TS_PIN_DISABLE,
> +				   AXP717_TS_PIN_DISABLE);
> +	}
> +
>   	if (vmin > 0 && axp717_set_voltage_min_design(axp_batt, vmin))
>   		dev_err(&pdev->dev,
>   			"couldn't set voltage_min_design\n");

  reply	other threads:[~2025-02-11 21:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-04 15:58 [PATCH V2 0/4] Fix RG35XX Battery Charging Issues Chris Morgan
2025-02-04 15:58 ` [PATCH V2 1/4] dt-bindings: power: supply: axp20x-battery: Add x-powers,no-thermistor Chris Morgan
2025-02-19 23:23   ` Sebastian Reichel
2025-02-04 15:58 ` [PATCH V2 2/4] mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs Chris Morgan
2025-02-11 13:42   ` (subset) " Lee Jones
2025-02-19 23:26     ` Sebastian Reichel
2025-02-20 16:07       ` Lee Jones
2025-02-04 15:58 ` [PATCH V2 3/4] power: supply: axp20x_battery: Update temp sensor for AXP717 from device tree Chris Morgan
2025-02-11 21:02   ` Philippe Simons [this message]
2025-02-19 23:24   ` Sebastian Reichel
2025-02-04 15:58 ` [PATCH V2 4/4] arm64: dts: allwinner: rg35xx: Add no-thermistor property for battery Chris Morgan
2025-02-21 18:17   ` Jernej Škrabec
2025-02-21  1:23 ` (subset) [PATCH V2 0/4] Fix RG35XX Battery Charging Issues Sebastian Reichel
2025-02-22 13:25 ` Chen-Yu Tsai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc9e1b15-ed1a-4d7f-aee7-7687e4deaa91@gmail.com \
    --to=simons.philippe@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jernej.skrabec@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=macroalpha82@gmail.com \
    --cc=macromorgan@hotmail.com \
    --cc=robh@kernel.org \
    --cc=samuel@sholland.org \
    --cc=sre@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).