devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2 0/4] Fix RG35XX Battery Charging Issues
@ 2025-02-04 15:58 Chris Morgan
  2025-02-04 15:58 ` [PATCH V2 1/4] dt-bindings: power: supply: axp20x-battery: Add x-powers,no-thermistor Chris Morgan
                   ` (5 more replies)
  0 siblings, 6 replies; 14+ messages in thread
From: Chris Morgan @ 2025-02-04 15:58 UTC (permalink / raw)
  To: linux-sunxi
  Cc: devicetree, linux-pm, lee, samuel, jernej.skrabec, wens, conor+dt,
	krzk+dt, robh, sre, Chris Morgan

From: Chris Morgan <macromorgan@hotmail.com>

The Anbernic RG35XX devices sometimes fail to charge when the register
for the battery temperature sensor is set to the incorrect value either
by user error or an incorrectly programmed efuse. Allow users to
hard-code if a temperature sensor is not present (which is the case for
all Anbernic RGxx series devices) to prevent this issue from causing
problems. Additionally, a bug was identified with the handling of PMU
faults while this fix was being tested.

Note that the MFD updates to the writeable regs are required build
dependencies of the battery fix, as it defines a register that was
previously not defined or writeable.

Changes from V1:
 - Updated cover letter to note that the MFD updates are build
   dependencies.
 - Removed patch for "power: supply: axp20x_battery: Fix fault handling
   for AXP717" as it has already been accepted upstream.
 - Simplified binding documentation with a "not" statement.
 - Corrected writeable regs in MFD driver.
 - Updated comment in driver to note a correctly defined device tree
   with a simple-battery node is required to apply the thermistor fix.

Chris Morgan (4):
  dt-bindings: power: supply: axp20x-battery: Add 
    x-powers,no-thermistor
  mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable  regs
  power: supply: axp20x_battery: Update temp sensor for  AXP717 from
    device tree
  arm64: dts: allwinner: rg35xx: Add no-thermistor property  for battery

 .../x-powers,axp20x-battery-power-supply.yaml | 20 +++++++++++++++---
 .../sun50i-h700-anbernic-rg35xx-2024.dts      |  1 +
 drivers/mfd/axp20x.c                          |  1 +
 drivers/power/supply/axp20x_battery.c         | 21 +++++++++++++++++++
 include/linux/mfd/axp20x.h                    |  1 +
 5 files changed, 41 insertions(+), 3 deletions(-)

-- 
2.43.0


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH V2 1/4] dt-bindings: power: supply: axp20x-battery: Add  x-powers,no-thermistor
  2025-02-04 15:58 [PATCH V2 0/4] Fix RG35XX Battery Charging Issues Chris Morgan
@ 2025-02-04 15:58 ` 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
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Chris Morgan @ 2025-02-04 15:58 UTC (permalink / raw)
  To: linux-sunxi
  Cc: devicetree, linux-pm, lee, samuel, jernej.skrabec, wens, conor+dt,
	krzk+dt, robh, sre, Chris Morgan, Krzysztof Kozlowski

From: Chris Morgan <macromorgan@hotmail.com>

Add the vendor specific boolean property of x-powers,no-thermistor.
This property optionally describes hardware where no thermistor is
present on the battery and is specific to the AXP717. In rare
circumstances this value can be set incorrectly in the efuse of the
PMIC, and if it is not hard-coded the device will fail to charge.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
---
 .../x-powers,axp20x-battery-power-supply.yaml | 20 ++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
index 5ccd375eb294..3504c76a01d8 100644
--- a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
+++ b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
@@ -14,9 +14,6 @@ maintainers:
   - Chen-Yu Tsai <wens@csie.org>
   - Sebastian Reichel <sre@kernel.org>
 
-allOf:
-  - $ref: power-supply.yaml#
-
 properties:
   compatible:
     oneOf:
@@ -35,7 +32,24 @@ properties:
       this gauge.
     $ref: /schemas/types.yaml#/definitions/phandle
 
+  x-powers,no-thermistor:
+    type: boolean
+    description: Indicates that no thermistor is connected to the TS pin
+
 required:
   - compatible
 
+allOf:
+  - $ref: power-supply.yaml#
+  - if:
+      not:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - x-powers,axp717-battery-power-supply
+    then:
+      properties:
+        x-powers,no-thermistor: false
+
 additionalProperties: false
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH V2 2/4] mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable  regs
  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-04 15:58 ` Chris Morgan
  2025-02-11 13:42   ` (subset) " 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
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 14+ messages in thread
From: Chris Morgan @ 2025-02-04 15:58 UTC (permalink / raw)
  To: linux-sunxi
  Cc: devicetree, linux-pm, lee, samuel, jernej.skrabec, wens, conor+dt,
	krzk+dt, robh, sre, Chris Morgan

From: Chris Morgan <macromorgan@hotmail.com>

Add AXP717_TS_PIN_CFG (register 0x50) to the table of writeable
registers so that the temperature sensor can be configured by the
battery driver.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 drivers/mfd/axp20x.c       | 1 +
 include/linux/mfd/axp20x.h | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/mfd/axp20x.c b/drivers/mfd/axp20x.c
index cff56deba24f..e9914e8a29a3 100644
--- a/drivers/mfd/axp20x.c
+++ b/drivers/mfd/axp20x.c
@@ -224,6 +224,7 @@ static const struct regmap_range axp717_writeable_ranges[] = {
 	regmap_reg_range(AXP717_VSYS_V_POWEROFF, AXP717_VSYS_V_POWEROFF),
 	regmap_reg_range(AXP717_IRQ0_EN, AXP717_IRQ4_EN),
 	regmap_reg_range(AXP717_IRQ0_STATE, AXP717_IRQ4_STATE),
+	regmap_reg_range(AXP717_TS_PIN_CFG, AXP717_TS_PIN_CFG),
 	regmap_reg_range(AXP717_ICC_CHG_SET, AXP717_CV_CHG_SET),
 	regmap_reg_range(AXP717_DCDC_OUTPUT_CONTROL, AXP717_CPUSLDO_CONTROL),
 	regmap_reg_range(AXP717_ADC_CH_EN_CONTROL, AXP717_ADC_CH_EN_CONTROL),
diff --git a/include/linux/mfd/axp20x.h b/include/linux/mfd/axp20x.h
index c3df0e615fbf..3c5aecf1d4b5 100644
--- a/include/linux/mfd/axp20x.h
+++ b/include/linux/mfd/axp20x.h
@@ -137,6 +137,7 @@ enum axp20x_variants {
 #define AXP717_IRQ2_STATE		0x4a
 #define AXP717_IRQ3_STATE		0x4b
 #define AXP717_IRQ4_STATE		0x4c
+#define AXP717_TS_PIN_CFG		0x50
 #define AXP717_ICC_CHG_SET		0x62
 #define AXP717_ITERM_CHG_SET		0x63
 #define AXP717_CV_CHG_SET		0x64
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH V2 3/4] power: supply: axp20x_battery: Update temp sensor for  AXP717 from device tree
  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-04 15:58 ` [PATCH V2 2/4] mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs Chris Morgan
@ 2025-02-04 15:58 ` Chris Morgan
  2025-02-11 21:02   ` Philippe Simons
  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
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 14+ messages in thread
From: Chris Morgan @ 2025-02-04 15:58 UTC (permalink / raw)
  To: linux-sunxi
  Cc: devicetree, linux-pm, lee, samuel, jernej.skrabec, wens, conor+dt,
	krzk+dt, robh, sre, Chris Morgan

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");
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [PATCH V2 4/4] arm64: dts: allwinner: rg35xx: Add no-thermistor property for battery
  2025-02-04 15:58 [PATCH V2 0/4] Fix RG35XX Battery Charging Issues Chris Morgan
                   ` (2 preceding siblings ...)
  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-04 15:58 ` 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
  5 siblings, 1 reply; 14+ messages in thread
From: Chris Morgan @ 2025-02-04 15:58 UTC (permalink / raw)
  To: linux-sunxi
  Cc: devicetree, linux-pm, lee, samuel, jernej.skrabec, wens, conor+dt,
	krzk+dt, robh, sre, Chris Morgan

From: Chris Morgan <macromorgan@hotmail.com>

Add the property of x-powers,no-thermistor for the battery of the
Anbernic RG35XX series of H700 devices.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 .../boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts      | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
index a231abf1684a..0c89ccc662a2 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h700-anbernic-rg35xx-2024.dts
@@ -237,6 +237,7 @@ axp_adc: adc {
 		battery_power: battery-power {
 			compatible = "x-powers,axp717-battery-power-supply";
 			monitored-battery = <&battery>;
+			x-powers,no-thermistor;
 		};
 
 		regulators {
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: (subset) [PATCH V2 2/4] mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs
  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   ` Lee Jones
  2025-02-19 23:26     ` Sebastian Reichel
  0 siblings, 1 reply; 14+ messages in thread
From: Lee Jones @ 2025-02-11 13:42 UTC (permalink / raw)
  To: linux-sunxi, Chris Morgan
  Cc: devicetree, linux-pm, lee, samuel, jernej.skrabec, wens, conor+dt,
	krzk+dt, robh, sre, Chris Morgan

On Tue, 04 Feb 2025 09:58:32 -0600, Chris Morgan wrote:
> Add AXP717_TS_PIN_CFG (register 0x50) to the table of writeable
> registers so that the temperature sensor can be configured by the
> battery driver.
> 
> 

Applied, thanks!

[2/4] mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs
      commit: ab797d7faf4c28328d2e45b09991f47a9b8e08aa

--
Lee Jones [李琼斯]


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V2 3/4] power: supply: axp20x_battery: Update temp sensor for AXP717 from device tree
  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
  2025-02-19 23:24   ` Sebastian Reichel
  1 sibling, 0 replies; 14+ messages in thread
From: Philippe Simons @ 2025-02-11 21:02 UTC (permalink / raw)
  To: Chris Morgan, linux-sunxi
  Cc: devicetree, linux-pm, lee, samuel, jernej.skrabec, wens, conor+dt,
	krzk+dt, robh, sre, Chris Morgan

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");

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V2 1/4] dt-bindings: power: supply: axp20x-battery: Add x-powers,no-thermistor
  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
  0 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2025-02-19 23:23 UTC (permalink / raw)
  To: Chris Morgan
  Cc: linux-sunxi, devicetree, linux-pm, lee, samuel, jernej.skrabec,
	wens, conor+dt, krzk+dt, robh, Chris Morgan, Krzysztof Kozlowski

[-- Attachment #1: Type: text/plain, Size: 2130 bytes --]

Hi,

On Tue, Feb 04, 2025 at 09:58:31AM -0600, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add the vendor specific boolean property of x-powers,no-thermistor.
> This property optionally describes hardware where no thermistor is
> present on the battery and is specific to the AXP717. In rare
> circumstances this value can be set incorrectly in the efuse of the
> PMIC, and if it is not hard-coded the device will fail to charge.
> 
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> ---

Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>

-- Sebastian

>  .../x-powers,axp20x-battery-power-supply.yaml | 20 ++++++++++++++++---
>  1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
> index 5ccd375eb294..3504c76a01d8 100644
> --- a/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
> +++ b/Documentation/devicetree/bindings/power/supply/x-powers,axp20x-battery-power-supply.yaml
> @@ -14,9 +14,6 @@ maintainers:
>    - Chen-Yu Tsai <wens@csie.org>
>    - Sebastian Reichel <sre@kernel.org>
>  
> -allOf:
> -  - $ref: power-supply.yaml#
> -
>  properties:
>    compatible:
>      oneOf:
> @@ -35,7 +32,24 @@ properties:
>        this gauge.
>      $ref: /schemas/types.yaml#/definitions/phandle
>  
> +  x-powers,no-thermistor:
> +    type: boolean
> +    description: Indicates that no thermistor is connected to the TS pin
> +
>  required:
>    - compatible
>  
> +allOf:
> +  - $ref: power-supply.yaml#
> +  - if:
> +      not:
> +        properties:
> +          compatible:
> +            contains:
> +              enum:
> +                - x-powers,axp717-battery-power-supply
> +    then:
> +      properties:
> +        x-powers,no-thermistor: false
> +
>  additionalProperties: false
> -- 
> 2.43.0
> 
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V2 3/4] power: supply: axp20x_battery: Update temp sensor for  AXP717 from device tree
  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
@ 2025-02-19 23:24   ` Sebastian Reichel
  1 sibling, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2025-02-19 23:24 UTC (permalink / raw)
  To: Chris Morgan
  Cc: linux-sunxi, devicetree, linux-pm, lee, samuel, jernej.skrabec,
	wens, conor+dt, krzk+dt, robh, Chris Morgan

[-- Attachment #1: Type: text/plain, Size: 2366 bytes --]

Hi,

On Tue, Feb 04, 2025 at 09:58:33AM -0600, 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>
> ---

Acked-by: Sebastian Reichel <sebastian.reichel@collabora.com>

-- Sebastian

>  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");
> -- 
> 2.43.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: (subset) [PATCH V2 2/4] mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs
  2025-02-11 13:42   ` (subset) " Lee Jones
@ 2025-02-19 23:26     ` Sebastian Reichel
  2025-02-20 16:07       ` Lee Jones
  0 siblings, 1 reply; 14+ messages in thread
From: Sebastian Reichel @ 2025-02-19 23:26 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-sunxi, Chris Morgan, devicetree, linux-pm, samuel,
	jernej.skrabec, wens, conor+dt, krzk+dt, robh, Chris Morgan

[-- Attachment #1: Type: text/plain, Size: 667 bytes --]

Hello Lee,

On Tue, Feb 11, 2025 at 01:42:50PM +0000, Lee Jones wrote:
> On Tue, 04 Feb 2025 09:58:32 -0600, Chris Morgan wrote:
> > Add AXP717_TS_PIN_CFG (register 0x50) to the table of writeable
> > registers so that the temperature sensor can be configured by the
> > battery driver.
> > 
> > 
> 
> Applied, thanks!
> 
> [2/4] mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs
>       commit: ab797d7faf4c28328d2e45b09991f47a9b8e08aa

Patch 3/4 has a dependency on this one. As you probably haven't done
an immutable branch for this one, please also pick up 1/4 and 3/4. I
just provided Acked-by to them.

Greetings,

-- Sebastian

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: (subset) [PATCH V2 2/4] mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs
  2025-02-19 23:26     ` Sebastian Reichel
@ 2025-02-20 16:07       ` Lee Jones
  0 siblings, 0 replies; 14+ messages in thread
From: Lee Jones @ 2025-02-20 16:07 UTC (permalink / raw)
  To: Sebastian Reichel
  Cc: linux-sunxi, Chris Morgan, devicetree, linux-pm, samuel,
	jernej.skrabec, wens, conor+dt, krzk+dt, robh, Chris Morgan

On Thu, 20 Feb 2025, Sebastian Reichel wrote:

> Hello Lee,
> 
> On Tue, Feb 11, 2025 at 01:42:50PM +0000, Lee Jones wrote:
> > On Tue, 04 Feb 2025 09:58:32 -0600, Chris Morgan wrote:
> > > Add AXP717_TS_PIN_CFG (register 0x50) to the table of writeable
> > > registers so that the temperature sensor can be configured by the
> > > battery driver.
> > > 
> > > 
> > 
> > Applied, thanks!
> > 
> > [2/4] mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs
> >       commit: ab797d7faf4c28328d2e45b09991f47a9b8e08aa
> 
> Patch 3/4 has a dependency on this one. As you probably haven't done
> an immutable branch for this one, please also pick up 1/4 and 3/4. I
> just provided Acked-by to them.

Here you go: :)

The following changes since commit 2014c95afecee3e76ca4a56956a936e23283f05b:

  Linux 6.14-rc1 (2025-02-02 15:39:26 -0800)

are available in the Git repository at:

  ssh://git@gitolite.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git tags/ib-mfd-power-v6.15

for you to fetch changes up to bfad07fe298bfba0c7ddab87c5b5325970203a1e:

  mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs (2025-02-20 16:05:09 +0000)

----------------------------------------------------------------
Immutable branch between MFD and Power due for the v6.15 merge window

----------------------------------------------------------------
Chris Morgan (1):
      mfd: axp20x: AXP717: Add AXP717_TS_PIN_CFG to writeable regs

 drivers/mfd/axp20x.c       | 1 +
 include/linux/mfd/axp20x.h | 1 +
 2 files changed, 2 insertions(+)

-- 
Lee Jones [李琼斯]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: (subset) [PATCH V2 0/4] Fix RG35XX Battery Charging Issues
  2025-02-04 15:58 [PATCH V2 0/4] Fix RG35XX Battery Charging Issues Chris Morgan
                   ` (3 preceding siblings ...)
  2025-02-04 15:58 ` [PATCH V2 4/4] arm64: dts: allwinner: rg35xx: Add no-thermistor property for battery Chris Morgan
@ 2025-02-21  1:23 ` Sebastian Reichel
  2025-02-22 13:25 ` Chen-Yu Tsai
  5 siblings, 0 replies; 14+ messages in thread
From: Sebastian Reichel @ 2025-02-21  1:23 UTC (permalink / raw)
  To: linux-sunxi, Chris Morgan
  Cc: Sebastian Reichel, devicetree, linux-pm, lee, samuel,
	jernej.skrabec, wens, conor+dt, krzk+dt, robh, sre, Chris Morgan


On Tue, 04 Feb 2025 09:58:30 -0600, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> The Anbernic RG35XX devices sometimes fail to charge when the register
> for the battery temperature sensor is set to the incorrect value either
> by user error or an incorrectly programmed efuse. Allow users to
> hard-code if a temperature sensor is not present (which is the case for
> all Anbernic RGxx series devices) to prevent this issue from causing
> problems. Additionally, a bug was identified with the handling of PMU
> faults while this fix was being tested.
> 
> [...]

Applied, thanks!

[1/4] dt-bindings: power: supply: axp20x-battery: Add x-powers,no-thermistor
      commit: 626006541069d4d595128f03cc3a1b70a482805c
[3/4] power: supply: axp20x_battery: Update temp sensor for AXP717 from device tree
      commit: bbcfe510ecd47f2db4c8653c7dfa9dc7a55b1583

Best regards,
-- 
Sebastian Reichel <sebastian.reichel@collabora.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH V2 4/4] arm64: dts: allwinner: rg35xx: Add no-thermistor property for battery
  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
  0 siblings, 0 replies; 14+ messages in thread
From: Jernej Škrabec @ 2025-02-21 18:17 UTC (permalink / raw)
  To: linux-sunxi, Chris Morgan
  Cc: devicetree, linux-pm, lee, samuel, wens, conor+dt, krzk+dt, robh,
	sre, Chris Morgan

Dne torek, 4. februar 2025 ob 16:58:34 Srednjeevropski standardni čas je Chris Morgan napisal(a):
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> Add the property of x-powers,no-thermistor for the battery of the
> Anbernic RG35XX series of H700 devices.
> 
> Signed-off-by: Chris Morgan <macromorgan@hotmail.com>

Acked-by: Jernej Skrabec <jernej.skrabec@gmail.com>

Best regards,
Jernej




^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: (subset) [PATCH V2 0/4] Fix RG35XX Battery Charging Issues
  2025-02-04 15:58 [PATCH V2 0/4] Fix RG35XX Battery Charging Issues Chris Morgan
                   ` (4 preceding siblings ...)
  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
  5 siblings, 0 replies; 14+ messages in thread
From: Chen-Yu Tsai @ 2025-02-22 13:25 UTC (permalink / raw)
  To: linux-sunxi, Chris Morgan
  Cc: devicetree, linux-pm, lee, samuel, jernej.skrabec, conor+dt,
	krzk+dt, robh, sre, Chris Morgan

On Tue, 04 Feb 2025 09:58:30 -0600, Chris Morgan wrote:
> From: Chris Morgan <macromorgan@hotmail.com>
> 
> The Anbernic RG35XX devices sometimes fail to charge when the register
> for the battery temperature sensor is set to the incorrect value either
> by user error or an incorrectly programmed efuse. Allow users to
> hard-code if a temperature sensor is not present (which is the case for
> all Anbernic RGxx series devices) to prevent this issue from causing
> problems. Additionally, a bug was identified with the handling of PMU
> faults while this fix was being tested.
> 
> [...]

Applied to dt-for-6.15 in git@github.com:linux-sunxi/linux-sunxi.git, thanks!

[4/4] arm64: dts: allwinner: rg35xx: Add no-thermistor property for battery
      commit: c2eedcafb0e2613d44f57d7a8b416d752d76a15f

Best regards,
-- 
Chen-Yu Tsai <wens@csie.org>


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-02-22 13:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).