Skip to contentSkip to conversation

Add Anbernic RG Vita-Pro

PATCH Applied Chris Morgan 4 participants 9 messages Jul 28 – Jul 29

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v10 cover Add Anbernic RG Vita-Pro

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG Vita-Pro, based on the Rockchip RK3576 SoC.

Changes Since V1:
- Updated documentation filename to matche compatible string.
- Corrected order of allocating IRQ in charger driver and switched
to using devm managed function to allocate work queue.
Changes Since V2:
- Corrected issue with naming of panel binding document and added
fallback compatible string.
- Switched to devm helpers in panel driver. Note that
devm_drm_panel_add() is currently only in the drm-next branch.
- Optimized setting GPIOs for panel driver.
Changes Since V3:
- Fixed numerous issues identifed by Sashiko bot, mainly relating
to unclamped or improperly clamped values from within the
charger driver.
- Corrected hard-coded values in the panel driver unprepare routine
as well as correcting an improperly checked return condition.
Changes Since V4:
- Fixed errors identified by Sashiko bot on charger driver that could
result in an improper value being written to the registers.
- Corrected some error handling in the panel driver.
Changes Since V5:
- Corrected minor errors in documentation and added default values.
- Further corrected clamping behavior in charger driver.
Changes Since V6:
- Additional corrections as suggested by Sashiko bot to fix potential
edge cases during probe for sgm41542.
- Corrected an improperly shifted value being written to register for
sgm41542.
- Changed a MV value to UV in sgm41542 driver to simplify function.
Changes Since V7:
- Added PM functions to sgm41542 driver per request from Sashiko,
which stops the hardware watchdog during suspend.
- Switched from device_init_wakeup() to devm_device_init_wakeup().
- Confirmed a state change in IRQ handler for sgm41542 to ensure we
don't update input current limit except when the vbus goes from
not okay to okay.
- Removed panel patches, which have already been accepted upstream.
Please note that this *may* cause an error about missing bindings.
See commit 0fd6ead8270270d859a28d0196a4b47e7d6845b8 in linux-next.
Changes Since V8:
- Added linux/bitfield.h header to prevent compile errors on certain
platforms.
- Added regulator to Kconfig as a dependency.
- Added mutex to IRQ handling function.
- Added update to watchdog enable field in suspend routine to ensure
watchdog status "goes back to the way it was" after resume.
- Sashiko complains of an issue if userspace updates values after devm_power_supply_register() is called but before the hardware
limits are set from the device tree. While this is possible the
threat of a problem should be very low given that the hardware
limits are set immediately afterward and would overwrite any
wrong values from userspace (should happen within a few
milliseconds). Unfortunately, given that the function to get these
limits requires the power supply be registered in order to read
the battery node, it's not something that can be easily fixed at
this time. Since it's an *extremely* unlikely edge case, I think
that's acceptable.
Changes Since V9:
- Made a few minor tweaks as suggested by sashiko.dev.
- Adopted new init function for __power_supply_register() so that I
can have the proper min and max values from the firmware prior to
exposing the charger to userspace. New init function is part of
this series here: https://lore.kernel.org/all/[email protected]/

Chris Morgan (4):
dt-bindings: power: supply: sgm41542: document sgm41542
power: supply: sgm41542: Add SG Micro sgm41542 charger
dt-bindings: arm: rockchip: Add Anbernic RG Vita-Pro
arm64: dts: rockchip: Add Anbernic RG Vita-Pro

 .../devicetree/bindings/arm/rockchip.yaml     |    6 +
 .../power/supply/sgmicro,sgm41542.yaml        |   96 ++
 arch/arm64/boot/dts/rockchip/Makefile         |    1 +
 .../rockchip/rk3576-anbernic-rg-vita-pro.dts  | 1327 +++++++++++++++++
 drivers/power/supply/Kconfig                  |    9 +
 drivers/power/supply/Makefile                 |    1 +
 drivers/power/supply/sgm41542_charger.c       | 1127 ++++++++++++++
 7 files changed, 2567 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/sgmicro,sgm41542.yaml
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3576-anbernic-rg-vita-pro.dts
 create mode 100644 drivers/power/supply/sgm41542_charger.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH v10 1/4 dt-bindings: power: supply: sgm41542: document sgm41542

From: Chris Morgan <[email protected]>

Document the SG Micro sgm41542 battery charger/boost converter. The parameters of input-current-limit-microamp and input-voltage-limit-microvolt are defined as such since they are in common use among multiple bindings currently.

---
 .../power/supply/sgmicro,sgm41542.yaml        | 96 +++++++++++++++++++
 1 file changed, 96 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/supply/sgmicro,sgm41542.yaml
Documentation/devicetree/bindings/power/supply/sgmicro,sgm41542.yaml new file +96 -0
new file mode 100644
index 000000000000..af80fe528505
@@ -0,0 +1,96 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/power/supply/sgmicro,sgm41542.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: SGM41542 Battery Charger
+
+description:
+  The SGMicro SGM41542 is a single cell battery charger/boost controller.
+
+maintainers:
+  - Chris Morgan <[email protected]>
+  - Xu Shengfei <[email protected]>
+
+allOf:
+  - $ref: power-supply.yaml#
+
+properties:
+  compatible:
+    const: sgmicro,sgm41542
+
+  input-current-limit-microamp:
+    default: 2400000
+    minimum: 100000
+    maximum: 3800000
+
+  input-voltage-limit-microvolt:
+    default: 4500000
+    minimum: 3900000
+    maximum: 12000000
+
+  interrupts:
+    maxItems: 1
+
+  monitored-battery:
+    description: |
+        The charger uses the following battery properties
+        constant-charge-current-max-microamp (default 2040000)
+        constant-charge-voltage-max-microvolt (default 4208000)
+        charge-term-current-microamp (default 180000)
+        precharge-current-microamp (default 180000)
+
+  reg:
+    maxItems: 1
+
+  regulators:
+    type: object
+    properties:
+      otg-vbus:
+        type: object
+        description: OTG boost regulator
+        $ref: /schemas/regulator/regulator.yaml
+        unevaluatedProperties: false
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/interrupt-controller/irq.h>
+
+    battery: battery {
+      compatible = "simple-battery";
+      constant-charge-current-max-microamp = <10000000>;
+      constant-charge-voltage-max-microvolt = <4350000>;
+      precharge-current-microamp = <180000>;
+      charge-term-current-microamp = <300000>;
+    };
+
+    i2c {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      charger@3b {
+        compatible = "sgmicro,sgm41542";
+        reg = <0x3b>;
+        input-current-limit-microamp = <3000000>;
+        input-voltage-limit-microvolt = <4500000>;
+        interrupt-parent = <&gpio0>;
+        interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
+        monitored-battery = <&battery>;
+
+        regulators {
+          otg-vbus {
+            regulator-max-microvolt = <5000000>;
+            regulator-min-microvolt = <5000000>;
+          };
+        };
+      };
+    };
Signature · 1 line
2.43.0
#2 lore raw

PATCH v10 2/4 power: supply: sgm41542: Add SG Micro sgm41542 charger

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the SG Micro SGM41542 charger/boost converter. Driver was adapted from Rockchip BSP driver [1] and confirmed with vendor datasheet [2].

[1] https://github.com/rockchip-linux/kernel/blob/develop-6.6/drivers/power/supply/sgm41542_charger.c
[2] https://www.sg-micro.de/rect/assets/1e8de70b-657e-4156-be68-a64fdbe8e418/SGM41541_SGM41542.pdf

---
 drivers/power/supply/Kconfig            |    9 +
 drivers/power/supply/Makefile           |    1 +
 drivers/power/supply/sgm41542_charger.c | 1127 +++++++++++++++++++++++
 3 files changed, 1137 insertions(+)
 create mode 100644 drivers/power/supply/sgm41542_charger.c
drivers/power/supply/Kconfig +9 -0
index f0ede1cecb6a..6b2f755f97f3 100644
@@ -866,6 +866,15 @@ config CHARGER_S2M
 	  devices provide USB power supply information and also required
 	  for USB OTG role switching.
 
+config CHARGER_SGM41542
+	tristate "SGM41542 charger driver"
+	depends on I2C
+	depends on GPIOLIB || COMPILE_TEST
+	depends on REGULATOR
+	select REGMAP_I2C
+	help
+	  Say Y to enable support for the SGM41542 battery charger.
+
 config CHARGER_SMB347
 	tristate "Summit Microelectronics SMB3XX Battery Charger"
 	depends on I2C
drivers/power/supply/Makefile +1 -0
index 31fe4a145929..25d23ea3fcbd 100644
@@ -108,6 +108,7 @@ obj-$(CONFIG_CHARGER_BQ25980)	+= bq25980_charger.o
 obj-$(CONFIG_CHARGER_BQ256XX)	+= bq256xx_charger.o
 obj-$(CONFIG_CHARGER_RK817)	+= rk817_charger.o
 obj-$(CONFIG_CHARGER_S2M)	+= s2m-charger.o
+obj-$(CONFIG_CHARGER_SGM41542)	+= sgm41542_charger.o
 obj-$(CONFIG_CHARGER_SMB347)	+= smb347-charger.o
 obj-$(CONFIG_CHARGER_TPS65090)	+= tps65090-charger.o
 obj-$(CONFIG_CHARGER_TPS65217)	+= tps65217_charger.o
drivers/power/supply/sgm41542_charger.c new file +1127 -0

1,127 lines not on this page · raw message

Signature · 1 line
2.43.0
#3 lore raw

Re: [PATCH V10 2/4] power: supply: sgm41542: Add SG Micro sgm41542 charger

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider: - [High] `sgm4154x_charger_get_property()` silently overwrites `sgm->state`, destroying the edge detection…

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] sgm4154x_charger_get_property() silently overwrites sgm->state, destroying the edge detection history required by the IRQ handler.
- [Low] Build failure and missing hardware initialization due to non-existent .init field in struct power_supply_desc
- [Low] sgm4154x_resume() unconditionally queues the watchdog worker even when the watchdog is disabled.
--

--- Patch [2]: [PATCH V10 2/4] power: supply: sgm41542: Add SG Micro sgm41542 charger --- commit 55bbb1d289f7a6f8202dd62e6767e32f2ffb138b
Author: Chris Morgan <[email protected]>

power: supply: sgm41542: Add SG Micro sgm41542 charger

Adds support for the SG Micro SGM41542 charger/boost converter. Driver was adapted from Rockchip BSP driver and confirmed with vendor datasheet.

[1] https://github.com/rockchip-linux/kernel/blob/develop-6.6/drivers/power/supply/sgm41542_charger.c
[2] https://www.sg-micro.de/rect/assets/1e8de70b-657e-4156-be68-a64fdbe8e418/SGM41541_SGM41542.pdf

Quoted 4 lines
drivers/power/supply/sgm41542_charger.c new file +0 -0
new file mode 100644

[ ... ]

Quoted 5 lines
drivers/power/supply/sgm41542_charger.c new file +5 -0
+static int sgm4154x_charger_get_property(struct power_supply *psy,
+					 enum power_supply_property psp,
+					 union power_supply_propval *val)
+{
+	struct sgm4154x_device *sgm = power_supply_get_drvdata(psy);

drivers/power/supply/sgm41542_charger.c line 644

Quoted 10 lines
drivers/power/supply/sgm41542_charger.c new file +10 -0
+	struct sgm4154x_state state;
+	int ret;
+
+	scoped_guard(mutex, &sgm->lock) {
+		ret = sgm4154x_get_state(sgm, &state);
+		if (ret) {
+			dev_err(sgm->dev, "get state error!\n");
+			return ret;
+		}
+		sgm->state = state;

[Severity: High]
Does this sysfs property read overwrite the state history needed by the IRQ handler?

If userspace reads a property (like status) after a hardware state change but before the IRQ handler thread runs and acquires sgm->lock, this will overwrite the global sgm->state.

[ ... ]

Quoted 9 lines
drivers/power/supply/sgm41542_charger.c new file +9 -0
+static irqreturn_t sgm4154x_irq_handler_thread(int irq, void *private)
+{
+	struct sgm4154x_device *sgm = private;
+	struct sgm4154x_state oldstate, state;
+	int ret;
+
+	guard(mutex)(&sgm->lock);
+
+	oldstate = sgm->state;

drivers/power/supply/sgm41542_charger.c line 733

Quoted 10 lines
drivers/power/supply/sgm41542_charger.c new file +10 -0
+
+	ret = sgm4154x_get_state(sgm, &state);
+	if (ret) {
+		dev_err(sgm->dev, "get state error!\n");
+		return IRQ_NONE;
+	}
+
+	sgm->state = state;
+
+	if (state.vbus_gd && !oldstate.vbus_gd) {

Because oldstate was prematurely updated by the sysfs read above, this edge detection will evaluate to false. Will this bypass the input limit restoration logic entirely?

[ ... ]

drivers/power/supply/sgm41542_charger.c line 882

Quoted 4 lines
drivers/power/supply/sgm41542_charger.c new file +4 -0
+static struct power_supply_desc sgm4154x_power_supply_desc = {
+	.name = "sgm4154x-charger",
+	.type = POWER_SUPPLY_TYPE_USB,
+	.init = sgm4154x_hw_init,

[Severity: Low]
Will this cause a build failure?

The struct power_supply_desc in the mainline kernel does not have an .init field.

If this assignment is removed to fix the build, the hardware initialization function sgm4154x_hw_init() will be completely orphaned, leaving the watchdog, limits, and defaults unconfigured. Should this initialization be called manually from the probe function instead?

[ ... ]

Quoted 4 lines
drivers/power/supply/sgm41542_charger.c new file +4 -0
+static int __maybe_unused sgm4154x_resume(struct device *dev)
+{
+	struct i2c_client *client = to_i2c_client(dev);
+	struct sgm4154x_device *sgm = i2c_get_clientdata(client);

drivers/power/supply/sgm41542_charger.c line 1095

Quoted 10 lines
drivers/power/supply/sgm41542_charger.c new file +10 -0
+	int ret;
+
+	if (sgm->watchdog_enable) {
+		ret = sgm4154x_set_watchdog_timer(sgm, SGM4154X_WDT_TIMER_40S);
+		if (ret)
+			return ret;
+	}
+
+	queue_delayed_work(sgm->sgm_monitor_wq,
+			   &sgm->sgm_delay_work, 0);

[Severity: Low]
Does this unconditionally queue the watchdog worker even when the watchdog is disabled?

If the watchdog was disabled prior to suspend, queue_delayed_work() will still execute immediately upon resume. This causes an unnecessary I2C transaction to reset a disabled watchdog timer before the worker terminates itself. Should this queue call be moved inside the if block?

Quoted 2 lines
drivers/power/supply/sgm41542_charger.c new file +2 -0
+	return 0;
+}
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2
#4 lore raw

PATCH v10 3/4 dt-bindings: arm: rockchip: Add Anbernic RG Vita-Pro

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add compatible string for the Anbernic RG Vita-Pro.

---
 Documentation/devicetree/bindings/arm/rockchip.yaml | 6 ++++++
 1 file changed, 6 insertions(+)
Documentation/devicetree/bindings/arm/rockchip.yaml +6 -0
index 1a9dde18626d..b8babe9d3a26 100644
@@ -66,6 +66,12 @@ properties:
               - anbernic,rg-ds
           - const: rockchip,rk3568
 
+      - description: Anbernic RK3576 Handheld Gaming Console
+        items:
+          - enum:
+              - anbernic,rg-vita-pro
+          - const: rockchip,rk3576
+
       - description: Ariaboard Photonicat
         items:
           - const: ariaboard,photonicat
Signature · 1 line
2.43.0
#5 lore raw

PATCH v10 4/4 arm64: dts: rockchip: Add Anbernic RG Vita-Pro

In reply to Chris Morgan

From: Chris Morgan <[email protected]>

Add device tree for the Anbernic RG Vita-Pro, based on the Rockchip RK3576. All hardware is currently working except for the accelerometer, the touchscreen, the battery monitor, and DisplayPort over USB-C. PWM is also missing currently, and as a result the LEDs and panel backlight are currently controlled via GPIO but will be changed to PWM once supported.

The Anbernic RG Vita-Pro includes the following hardware:
- A 1080x1920 DSI display with touch.
- 21 buttons.
- 3 LEDs.
- 64GB eMMC, 2 SDMMC slots.
- RTL8852BE WiFi (with Bluetooth via UART)
- 1 USB 3.0 USB-C port in OTG mode.
- 3.5mm headphone jack with play button support.
- 5000mAH battery

The following hardware has incomplete driver support and is not yet working:
- An Invensense icm42607p accelerometer.
- A Cellwise cw221x battery monitor.
- A Synaptics i2c touchscreen.
- DisplayPort over USB-C alt-mode.
- PWM controller.
- 2 Analog joysticks with LED controllers.

---
 arch/arm64/boot/dts/rockchip/Makefile         |    1 +
 .../rockchip/rk3576-anbernic-rg-vita-pro.dts  | 1327 +++++++++++++++++
 2 files changed, 1328 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3576-anbernic-rg-vita-pro.dts
arch/arm64/boot/dts/rockchip/Makefile +1 -0
index 761d82b4f4f2..7b003bc45dea 100644
@@ -165,6 +165,7 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-wolfvision-pf5.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-wolfvision-pf5-display-vz.dtbo
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3568-wolfvision-pf5-io-expander.dtbo
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-100ask-dshanpi-a1.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-anbernic-rg-vita-pro.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-armsom-sige5.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-armsom-sige5-v1.2-wifibt.dtbo
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3576-evb1-v10.dtb
arch/arm64/boot/dts/rockchip/rk3576-anbernic-rg-vita-pro.dts new file +1327 -0

1,327 lines not on this page · raw message

Signature · 1 line
2.43.0
#6 lore raw

Re: [PATCH V10 4/4] arm64: dts: rockchip: Add Anbernic RG Vita-Pro

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider: - [Medium] The 'vdd_lcd' regulator is marked as 'regulator-always-on', which prevents the panel driver from…

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [Medium] The 'vdd_lcd' regulator is marked as 'regulator-always-on', which prevents the panel driver from turning off the power during runtime screen blanking.
- [Low] The R1 button is incorrectly labeled as 'T2' instead of 'TR'.
--

--- Patch [4]: [PATCH V10 4/4] arm64: dts: rockchip: Add Anbernic RG Vita-Pro --- commit a452f1bd14e3a6fffeb75a59d2f85e2015412c25
Author: Chris Morgan <[email protected]>

arm64: dts: rockchip: Add Anbernic RG Vita-Pro

This commit adds the device tree for the Anbernic RG Vita-Pro handset, based on the Rockchip RK3576 SoC. It configures the hardware that is currently functional, such as the DSI display, buttons, LEDs, and WiFi.

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3576-anbernic-rg-vita-pro.dts new file +0 -0
new file mode 100644

[ ... ]

arch/arm64/boot/dts/rockchip/rk3576-anbernic-rg-vita-pro.dts line 188

Quoted 5 lines
arch/arm64/boot/dts/rockchip/rk3576-anbernic-rg-vita-pro.dts new file +5 -0
+		button-r1 {
+			gpios = <&gpio3 RK_PC2 GPIO_ACTIVE_LOW>;
+			label = "T2";
+			linux,code = <BTN_TR>;
+		};

[Severity: Low]
This isn't a bug, but should the label for button-r1 be "TR" instead of "T2"? L1 is labeled "TL", L2 is "TL2", and R2 is "TR2", so "T2" looks like it might be a typo.

[ ... ]

arch/arm64/boot/dts/rockchip/rk3576-anbernic-rg-vita-pro.dts line 389

Quoted 4 lines
arch/arm64/boot/dts/rockchip/rk3576-anbernic-rg-vita-pro.dts new file +4 -0
+	vdd_lcd: regulator-vdd-lcd {
+		compatible = "regulator-fixed";
+		regulator-name = "vdd_lcd";
+		regulator-always-on;

[Severity: Medium]
Does marking this regulator as 'regulator-always-on' prevent the panel driver from powering down the display during screen blanking? If the driver attempts to call regulator_disable() on idle timeout, the regulator core will ignore it, which might lead to unnecessary battery drain on this handset.

Quoted 2 lines
arch/arm64/boot/dts/rockchip/rk3576-anbernic-rg-vita-pro.dts new file +2 -0
+		enable-active-high;
+		gpios = <&gpio0 RK_PB0 GPIO_ACTIVE_HIGH>;

[ ... ]

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
#7 lore raw

Re: (subset) [PATCH V10 0/4] Add Anbernic RG Vita-Pro

In reply to Chris Morgan
Quoted 68 lines · Chris Morgan

From: Chris Morgan <[email protected]>

Add support for the Anbernic RG Vita-Pro, based on the Rockchip RK3576 SoC.

Changes Since V1:
- Updated documentation filename to matche compatible string.
- Corrected order of allocating IRQ in charger driver and switched
to using devm managed function to allocate work queue.
Changes Since V2:
- Corrected issue with naming of panel binding document and added
fallback compatible string.
- Switched to devm helpers in panel driver. Note that
devm_drm_panel_add() is currently only in the drm-next branch.
- Optimized setting GPIOs for panel driver.
Changes Since V3:
- Fixed numerous issues identifed by Sashiko bot, mainly relating
to unclamped or improperly clamped values from within the
charger driver.
- Corrected hard-coded values in the panel driver unprepare routine
as well as correcting an improperly checked return condition.
Changes Since V4:
- Fixed errors identified by Sashiko bot on charger driver that could
result in an improper value being written to the registers.
- Corrected some error handling in the panel driver.
Changes Since V5:
- Corrected minor errors in documentation and added default values.
- Further corrected clamping behavior in charger driver.
Changes Since V6:
- Additional corrections as suggested by Sashiko bot to fix potential
edge cases during probe for sgm41542.
- Corrected an improperly shifted value being written to register for
sgm41542.
- Changed a MV value to UV in sgm41542 driver to simplify function.
Changes Since V7:
- Added PM functions to sgm41542 driver per request from Sashiko,
which stops the hardware watchdog during suspend.
- Switched from device_init_wakeup() to devm_device_init_wakeup().
- Confirmed a state change in IRQ handler for sgm41542 to ensure we
don't update input current limit except when the vbus goes from
not okay to okay.
- Removed panel patches, which have already been accepted upstream.
Please note that this *may* cause an error about missing bindings.
See commit 0fd6ead8270270d859a28d0196a4b47e7d6845b8 in linux-next.
Changes Since V8:
- Added linux/bitfield.h header to prevent compile errors on certain
platforms.
- Added regulator to Kconfig as a dependency.
- Added mutex to IRQ handling function.
- Added update to watchdog enable field in suspend routine to ensure
watchdog status "goes back to the way it was" after resume.
- Sashiko complains of an issue if userspace updates values after devm_power_supply_register() is called but before the hardware
limits are set from the device tree. While this is possible the
threat of a problem should be very low given that the hardware
limits are set immediately afterward and would overwrite any
wrong values from userspace (should happen within a few
milliseconds). Unfortunately, given that the function to get these
limits requires the power supply be registered in order to read
the battery node, it's not something that can be easily fixed at
this time. Since it's an *extremely* unlikely edge case, I think
that's acceptable.
Changes Since V9:
- Made a few minor tweaks as suggested by sashiko.dev.
- Adopted new init function for __power_supply_register() so that I
can have the proper min and max values from the firmware prior to
exposing the charger to userspace. New init function is part of
this series here: https://lore.kernel.org/all/[email protected]/

Quoted 1 line

[...]

Applied, thanks!

[1/4] dt-bindings: power: supply: sgm41542: document sgm41542

      commit: 15c53209e67ad450fb791aff5e0bd3dcc4349e36
[2/4] power: supply: sgm41542: Add SG Micro sgm41542 charger
      commit: 5584ad5706e594c7648655171785aa4fffdd3db5

Best regards,

Signature · 1 line
Sebastian Reichel <[email protected]>
maintainer Applied
#8 lore raw

Re: (subset) [PATCH V10 0/4] Add Anbernic RG Vita-Pro

In reply to Chris Morgan
Quoted 66 lines · Chris Morgan

Add support for the Anbernic RG Vita-Pro, based on the Rockchip RK3576 SoC.

Changes Since V1:
- Updated documentation filename to matche compatible string.
- Corrected order of allocating IRQ in charger driver and switched
to using devm managed function to allocate work queue.
Changes Since V2:
- Corrected issue with naming of panel binding document and added
fallback compatible string.
- Switched to devm helpers in panel driver. Note that
devm_drm_panel_add() is currently only in the drm-next branch.
- Optimized setting GPIOs for panel driver.
Changes Since V3:
- Fixed numerous issues identifed by Sashiko bot, mainly relating
to unclamped or improperly clamped values from within the
charger driver.
- Corrected hard-coded values in the panel driver unprepare routine
as well as correcting an improperly checked return condition.
Changes Since V4:
- Fixed errors identified by Sashiko bot on charger driver that could
result in an improper value being written to the registers.
- Corrected some error handling in the panel driver.
Changes Since V5:
- Corrected minor errors in documentation and added default values.
- Further corrected clamping behavior in charger driver.
Changes Since V6:
- Additional corrections as suggested by Sashiko bot to fix potential
edge cases during probe for sgm41542.
- Corrected an improperly shifted value being written to register for
sgm41542.
- Changed a MV value to UV in sgm41542 driver to simplify function.
Changes Since V7:
- Added PM functions to sgm41542 driver per request from Sashiko,
which stops the hardware watchdog during suspend.
- Switched from device_init_wakeup() to devm_device_init_wakeup().
- Confirmed a state change in IRQ handler for sgm41542 to ensure we
don't update input current limit except when the vbus goes from
not okay to okay.
- Removed panel patches, which have already been accepted upstream.
Please note that this *may* cause an error about missing bindings.
See commit 0fd6ead8270270d859a28d0196a4b47e7d6845b8 in linux-next.
Changes Since V8:
- Added linux/bitfield.h header to prevent compile errors on certain
platforms.
- Added regulator to Kconfig as a dependency.
- Added mutex to IRQ handling function.
- Added update to watchdog enable field in suspend routine to ensure
watchdog status "goes back to the way it was" after resume.
- Sashiko complains of an issue if userspace updates values after devm_power_supply_register() is called but before the hardware
limits are set from the device tree. While this is possible the
threat of a problem should be very low given that the hardware
limits are set immediately afterward and would overwrite any
wrong values from userspace (should happen within a few
milliseconds). Unfortunately, given that the function to get these
limits requires the power supply be registered in order to read
the battery node, it's not something that can be easily fixed at
this time. Since it's an *extremely* unlikely edge case, I think
that's acceptable.
Changes Since V9:
- Made a few minor tweaks as suggested by sashiko.dev.
- Adopted new init function for __power_supply_register() so that I
can have the proper min and max values from the firmware prior to
exposing the charger to userspace. New init function is part of
this series here: https://lore.kernel.org/all/[email protected]/

Quoted 1 line

[...]

Applied, thanks!

[3/4] dt-bindings: arm: rockchip: Add Anbernic RG Vita-Pro

      commit: 74aab5a3042e56681eb8170bad84789fb42eae60
[4/4] arm64: dts: rockchip: Add Anbernic RG Vita-Pro
      commit: aaed846aa94076aa670c60089a7143a0f43327b4

Best regards,

Signature · 1 line
Heiko Stuebner <[email protected]>