Amlogic: update patches

This commit is contained in:
spycat88 2024-04-08 21:24:47 +01:00
parent 4699da73db
commit 9950af27e3
49 changed files with 414 additions and 363 deletions

View file

@ -1,7 +1,7 @@
From 9058f0c2d21afec161396389db9c3889bf36e745 Mon Sep 17 00:00:00 2001
From 801ce8505a73f0b9f1e66ca84b1ae8a0e56d212c Mon Sep 17 00:00:00 2001
From: Neil Armstrong <neil.armstrong@linaro.org>
Date: Wed, 3 Apr 2024 09:46:33 +0200
Subject: [PATCH 01/47] clk: meson: add vclk driver
Subject: [PATCH 01/44] clk: meson: add vclk driver
The VCLK and VCLK_DIV clocks have supplementary bits.

View file

@ -1,7 +1,7 @@
From d4b89f1669315dfc1bbdcb532413e56e6fcc9797 Mon Sep 17 00:00:00 2001
From 024103a845d9efb602225f975175ed2b678578e7 Mon Sep 17 00:00:00 2001
From: Neil Armstrong <neil.armstrong@linaro.org>
Date: Wed, 3 Apr 2024 09:46:34 +0200
Subject: [PATCH 02/47] clk: meson: g12a: make VCLK2 and ENCL clock path
Subject: [PATCH 02/44] clk: meson: g12a: make VCLK2 and ENCL clock path
configurable by CCF
In order to setup the DSI clock, let's make the unused VCLK2 clock path

View file

@ -1,7 +1,7 @@
From 7e7f66e6a99d15aea19872fe035ca46a9983baff Mon Sep 17 00:00:00 2001
From c69702647174a36a3bbaa928d4879f4562123372 Mon Sep 17 00:00:00 2001
From: Neil Armstrong <neil.armstrong@linaro.org>
Date: Wed, 3 Apr 2024 09:46:35 +0200
Subject: [PATCH 03/47] drm/meson: gate px_clk when setting rate
Subject: [PATCH 03/44] drm/meson: gate px_clk when setting rate
Disable the px_clk when setting the rate to recover a fully
configured and correctly reset VCLK clock tree after the rate

View file

@ -1,7 +1,7 @@
From d59484cd5ebda635b1dda3a06c2ffc8b12811b26 Mon Sep 17 00:00:00 2001
From b584fdbb6a339fdf28ab8c1eb031262c0c66b5e2 Mon Sep 17 00:00:00 2001
From: Neil Armstrong <neil.armstrong@linaro.org>
Date: Wed, 3 Apr 2024 09:46:36 +0200
Subject: [PATCH 04/47] arm64: meson: g12-common: add the MIPI DSI nodes
Subject: [PATCH 04/44] arm64: meson: g12-common: add the MIPI DSI nodes
Add the MIPI DSI Analog & Digital PHY nodes and the DSI control
nodes with proper port endpoint to the VPU.

View file

@ -1,7 +1,7 @@
From e2efb7410f7d5284c14928b5b40a4754efd0433f Mon Sep 17 00:00:00 2001
From ee573e00af321704d2bd093efd8d7cb3976b11a3 Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Tue, 23 Jan 2024 23:28:55 +0000
Subject: [PATCH 05/47] drm: panel: st7701: add odroid-go-ultra panel support
Subject: [PATCH 05/44] drm: panel: st7701: add odroid-go-ultra panel support
---
drivers/gpu/drm/panel/panel-sitronix-st7701.c | 162 +++++++++++++++++-

View file

@ -1,7 +1,7 @@
From 5461fd6e602b29c04c527c60e648ad19ca296ba2 Mon Sep 17 00:00:00 2001
From 157e64dad5bd6b9965089b764850930404c88e8e Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Tue, 23 Jan 2024 23:41:40 +0000
Subject: [PATCH 06/47] arm64: meson: odroid-go-ultra: add DSI panel
Subject: [PATCH 06/44] arm64: meson: odroid-go-ultra: add DSI panel
---
.../amlogic/meson-g12b-odroid-go-ultra.dts | 66 +++++++++++++++++++

View file

@ -1,7 +1,7 @@
From e1ed80a968a8d76b49c32200093a452dd63b062c Mon Sep 17 00:00:00 2001
From 263c479a06698696adc7ababb97bf312022fcdaf Mon Sep 17 00:00:00 2001
From: "Mauro (mdrjr) Ribeiro" <mauro.ribeiro@hardkernel.com>
Date: Tue, 23 Jan 2024 23:53:24 +0000
Subject: [PATCH 07/47] arm64: meson: odroid-go-ultra: correct voltages
Subject: [PATCH 07/44] arm64: meson: odroid-go-ultra: correct voltages
---
.../dts/amlogic/meson-g12b-odroid-go-ultra.dts | 16 +++++++---------

View file

@ -1,18 +1,19 @@
From ec681bf5c90f5a8c3fbc9331146658e01abb5056 Mon Sep 17 00:00:00 2001
From: "Mauro (mdrjr) Ribeiro" <mauro.ribeiro@hardkernel.com>
Date: Wed, 24 Jan 2024 10:56:00 +0000
Subject: [PATCH 08/47] arm64: meson: odroid-go-ultra: add over-clocking
frequencies
From 0869f9c56b47e2c63be274d72c97c51e227c18e4 Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Wed, 24 Jan 2024 11:37:48 +0000
Subject: [PATCH 08/44] arm64: meson: odroid-go-ultra: add over-clocking
frequencies, specify as turbo mode so they are disabled by default and
increase vddcpu_a voltage regulator as needed
---
.../amlogic/meson-g12b-odroid-go-ultra.dts | 26 ++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
.../amlogic/meson-g12b-odroid-go-ultra.dts | 31 +++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
index 571a0393e148..1fcfe421ec73 100644
index 571a0393e148..c3af3954a1e7 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
@@ -347,7 +347,11 @@ opp-1896000000 {
@@ -347,7 +347,12 @@ opp-1896000000 {
opp-microvolt = <987500>;
};
opp-1992000000 {
@ -22,10 +23,11 @@ index 571a0393e148..1fcfe421ec73 100644
+ opp-2016000000 {
+ opp-hz = /bits/ 64 <2016000000>;
+ opp-microvolt = <1050000>;
+ turbo-mode;
};
};
@@ -377,6 +381,26 @@ opp-1800000000 {
@@ -377,6 +382,28 @@ opp-1800000000 {
opp-1908000000 {
opp-microvolt = <1025000>;
};
@ -44,14 +46,25 @@ index 571a0393e148..1fcfe421ec73 100644
+ opp-2304000000 {
+ opp-hz = /bits/ 64 <2304000000>;
+ opp-microvolt = <1050000>;
+ turbo-mode;
+ };
+ opp-2400000000 {
+ opp-hz = /bits/ 64 <2400000000>;
+ opp-microvolt = <1050000>;
+ turbo-mode;
+ };
};
&i2c_AO {
@@ -407,7 +434,7 @@ vddcpu_a: DCDC_REG1 {
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <775000>;
- regulator-max-microvolt = <1025000>;
+ regulator-max-microvolt = <1050000>;
regulator-ramp-delay = <6001>;
regulator-state-mem {
regulator-on-in-suspend;
--
2.34.1

View file

@ -1,38 +0,0 @@
From 00e37983d1a7995ea7ade8a42e5597b18e5087c9 Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Wed, 24 Jan 2024 11:37:48 +0000
Subject: [PATCH 09/47] arm64: meson: odroid-go-ultra: specify overclocking
frequencies as turbo mode
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts | 3 +++
1 file changed, 3 insertions(+)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
index 1fcfe421ec73..74e1a315bfb1 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
@@ -352,6 +352,7 @@ opp-1992000000 {
opp-2016000000 {
opp-hz = /bits/ 64 <2016000000>;
opp-microvolt = <1050000>;
+ turbo-mode;
};
};
@@ -396,10 +397,12 @@ opp-2208000000 {
opp-2304000000 {
opp-hz = /bits/ 64 <2304000000>;
opp-microvolt = <1050000>;
+ turbo-mode;
};
opp-2400000000 {
opp-hz = /bits/ 64 <2400000000>;
opp-microvolt = <1050000>;
+ turbo-mode;
};
};
--
2.34.1

View file

@ -1,7 +1,7 @@
From f60b0441c4c5dfc29373473409d9da3111a136c9 Mon Sep 17 00:00:00 2001
From a2a47a8b3f3235dded76dfc1e10052d1ea8f89fc Mon Sep 17 00:00:00 2001
From: brooksytech <1673861+brooksytech@users.noreply.github.com>
Date: Wed, 24 Jan 2024 22:12:01 +0000
Subject: [PATCH 12/47] gpiolib: of: revert api changes needed for joypad
Subject: [PATCH 09/44] gpiolib: of: revert api changes needed for joypad
driver
---

View file

@ -1,69 +0,0 @@
From 93fb777037c083b8694e61caf869ca8a76cad368 Mon Sep 17 00:00:00 2001
From: "Mauro (mdrjr) Ribeiro" <mauro.ribeiro@hardkernel.com>
Date: Wed, 24 Jan 2024 12:08:19 +0000
Subject: [PATCH 10/47] arm64: meson: odroid-go-ultra: remove adc joystick
---
.../amlogic/meson-g12b-odroid-go-ultra.dts | 46 -------------------
1 file changed, 46 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
index 74e1a315bfb1..30c48311f165 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
@@ -21,52 +21,6 @@ aliases {
rtc0 = &vrtc;
};
- adc-joystick-left {
- compatible = "adc-joystick";
- io-channels = <&saradc 2>, <&saradc 3>;
- poll-interval = <10>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- axis@0 {
- reg = <0>;
- linux,code = <ABS_Y>;
- abs-range = <3150 950>;
- abs-fuzz = <32>;
- abs-flat = <64>;
- };
- axis@1 {
- reg = <1>;
- linux,code = <ABS_X>;
- abs-range = <700 2900>;
- abs-fuzz = <32>;
- abs-flat = <64>;
- };
- };
-
- adc-joystick-right {
- compatible = "adc-joystick";
- io-channels = <&saradc 0>, <&saradc 1>;
- poll-interval = <10>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- axis@0 {
- reg = <0>;
- linux,code = <ABS_RY>;
- abs-range = <3150 950>;
- abs-fuzz = <32>;
- abs-flat = <64>;
- };
- axis@1 {
- reg = <1>;
- linux,code = <ABS_RX>;
- abs-range = <800 3000>;
- abs-fuzz = <32>;
- abs-flat = <64>;
- };
- };
-
chosen {
stdout-path = "serial0:115200n8";
};
--
2.34.1

View file

@ -1,7 +1,7 @@
From fd2667a4ecc5c238e30532e3692224eaafb9941c Mon Sep 17 00:00:00 2001
From 2f3e05182321bd7e6b8ad2335f1ed0751f006918 Mon Sep 17 00:00:00 2001
From: brooksytech <1673861+brooksytech@users.noreply.github.com>
Date: Wed, 24 Jan 2024 21:50:05 +0000
Subject: [PATCH 13/47] input: add input-polldev driver
Subject: [PATCH 10/44] input: add input-polldev driver
---
drivers/input/Kconfig | 13 ++

View file

@ -1,47 +0,0 @@
From f7953ce9ce913f80fd249208c3a8270d38b154f7 Mon Sep 17 00:00:00 2001
From: brooksytech <1673861+brooksytech@users.noreply.github.com>
Date: Wed, 24 Jan 2024 16:18:45 +0000
Subject: [PATCH 11/47] drm: meson: venc: HACK: panic when gamma is not set
correctly
---
drivers/gpu/drm/meson/meson_venc.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/meson/meson_venc.c b/drivers/gpu/drm/meson/meson_venc.c
index 3bf0d6e4fc30..ace2e6c21f69 100644
--- a/drivers/gpu/drm/meson/meson_venc.c
+++ b/drivers/gpu/drm/meson/meson_venc.c
@@ -1590,7 +1590,8 @@ static void meson_encl_set_gamma_table(struct meson_drm *priv, u16 *data,
ret = readl_relaxed_poll_timeout(priv->io_base + _REG(L_GAMMA_CNTL_PORT),
reg, reg & L_GAMMA_CNTL_PORT_ADR_RDY, 10, 10000);
if (ret)
- pr_warn("%s: GAMMA ADR_RDY timeout\n", __func__);
+ //pr_warn("%s: GAMMA ADR_RDY timeout\n", __func__);
+ panic("NOT ENOUGH SALT, GAMMA NOT SET");
writel_relaxed(L_GAMMA_ADDR_PORT_AUTO_INC | rgb_mask |
FIELD_PREP(L_GAMMA_ADDR_PORT_ADDR, 0),
@@ -1601,7 +1602,8 @@ static void meson_encl_set_gamma_table(struct meson_drm *priv, u16 *data,
reg, reg & L_GAMMA_CNTL_PORT_WR_RDY,
10, 10000);
if (ret)
- pr_warn_once("%s: GAMMA WR_RDY timeout\n", __func__);
+ //pr_warn_once("%s: GAMMA WR_RDY timeout\n", __func__);
+ panic("NOT ENOUGH SALT, GAMMA NOT SET");
writel_relaxed(data[i], priv->io_base + _REG(L_GAMMA_DATA_PORT));
}
@@ -1609,7 +1611,8 @@ static void meson_encl_set_gamma_table(struct meson_drm *priv, u16 *data,
ret = readl_relaxed_poll_timeout(priv->io_base + _REG(L_GAMMA_CNTL_PORT),
reg, reg & L_GAMMA_CNTL_PORT_ADR_RDY, 10, 10000);
if (ret)
- pr_warn("%s: GAMMA ADR_RDY timeout\n", __func__);
+ //pr_warn("%s: GAMMA ADR_RDY timeout\n", __func__);
+ panic("NOT ENOUGH SALT, GAMMA NOT SET");
writel_relaxed(L_GAMMA_ADDR_PORT_AUTO_INC | rgb_mask |
FIELD_PREP(L_GAMMA_ADDR_PORT_ADDR, 0x23),
--
2.34.1

View file

@ -1,7 +1,7 @@
From 778159de804d4356e242857bc246d6f369bcd504 Mon Sep 17 00:00:00 2001
From 8321fa2704f8e4a8a916994d3564995034190357 Mon Sep 17 00:00:00 2001
From: brooksytech <1673861+brooksytech@users.noreply.github.com>
Date: Wed, 24 Jan 2024 21:55:38 +0000
Subject: [PATCH 14/47] input: joystick: add odroid-go ultra-joypad driver
Subject: [PATCH 11/44] input: joystick: add odroid-go ultra-joypad driver
---
drivers/input/joystick/Kconfig | 6 +

View file

@ -1,17 +1,70 @@
From aa9698b72b0d961c6dafd491b974d444405dbf11 Mon Sep 17 00:00:00 2001
From 8ec3462157e94af211573c3706d54d225ceec576 Mon Sep 17 00:00:00 2001
From: brooksytech <1673861+brooksytech@users.noreply.github.com>
Date: Wed, 24 Jan 2024 21:57:34 +0000
Subject: [PATCH 15/47] arm64: meson: odroid-go-ultra: add joypad
Subject: [PATCH 12/44] arm64: meson: odroid-go-ultra: add joypad
---
.../amlogic/meson-g12b-odroid-go-ultra.dts | 156 +++++++++++-------
1 file changed, 93 insertions(+), 63 deletions(-)
.../amlogic/meson-g12b-odroid-go-ultra.dts | 202 ++++++++----------
1 file changed, 93 insertions(+), 109 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
index 30c48311f165..005b19251633 100644
index c3af3954a1e7..206044f8456b 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
@@ -34,9 +34,8 @@ codec_clk: codec-clk {
@@ -21,52 +21,6 @@ aliases {
rtc0 = &vrtc;
};
- adc-joystick-left {
- compatible = "adc-joystick";
- io-channels = <&saradc 2>, <&saradc 3>;
- poll-interval = <10>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- axis@0 {
- reg = <0>;
- linux,code = <ABS_Y>;
- abs-range = <3150 950>;
- abs-fuzz = <32>;
- abs-flat = <64>;
- };
- axis@1 {
- reg = <1>;
- linux,code = <ABS_X>;
- abs-range = <700 2900>;
- abs-fuzz = <32>;
- abs-flat = <64>;
- };
- };
-
- adc-joystick-right {
- compatible = "adc-joystick";
- io-channels = <&saradc 0>, <&saradc 1>;
- poll-interval = <10>;
- #address-cells = <1>;
- #size-cells = <0>;
-
- axis@0 {
- reg = <0>;
- linux,code = <ABS_RY>;
- abs-range = <3150 950>;
- abs-fuzz = <32>;
- abs-flat = <64>;
- };
- axis@1 {
- reg = <1>;
- linux,code = <ABS_RX>;
- abs-range = <800 3000>;
- abs-fuzz = <32>;
- abs-flat = <64>;
- };
- };
-
chosen {
stdout-path = "serial0:115200n8";
};
@@ -80,9 +34,8 @@ codec_clk: codec-clk {
gpio-keys {
compatible = "gpio-keys-polled";
@ -23,7 +76,7 @@ index 30c48311f165..005b19251633 100644
volume-up-button {
label = "VOLUME-UP";
@@ -48,95 +47,126 @@ volume-down-button {
@@ -94,95 +47,126 @@ volume-down-button {
linux,code = <KEY_VOLUMEDOWN>;
gpios = <&gpio GPIOX_9 GPIO_ACTIVE_LOW>;
};

View file

@ -1,7 +1,7 @@
From ac16a82047615767f2156b782c6cabc7902d3932 Mon Sep 17 00:00:00 2001
From badcabb07a6e4f056834443039d054072f23d9e1 Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Wed, 24 Jan 2024 22:22:49 +0000
Subject: [PATCH 16/47] arm64: meson: odroid: disable heartbeat
Subject: [PATCH 13/44] arm64: meson: odroid: disable heartbeat
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts | 2 +-
@ -9,7 +9,7 @@ Subject: [PATCH 16/47] arm64: meson: odroid: disable heartbeat
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
index 005b19251633..d3a1521317c3 100644
index 206044f8456b..1d26387776e6 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
@@ -194,7 +194,7 @@ leds {

View file

@ -1,7 +1,7 @@
From f8404960bde38a0f1bdd50a032b1a1bb69ed826c Mon Sep 17 00:00:00 2001
From 1de7a39ee1c2b6ec6c5ce375d6774ac703cc02a7 Mon Sep 17 00:00:00 2001
From: brooksytech <1673861+brooksytech@users.noreply.github.com>
Date: Wed, 24 Jan 2024 23:56:58 +0000
Subject: [PATCH 17/47] arm64: meson: g12-common: add mali to dts
Subject: [PATCH 14/44] arm64: meson: g12-common: add mali to dts
---
.../arm64/boot/dts/amlogic/meson-g12-common.dtsi | 16 +++++++++++-----

View file

@ -1,7 +1,7 @@
From 1a90a6b132f0175e2912559cff94ea2c85534131 Mon Sep 17 00:00:00 2001
From 7d53adc4da9bb4dc992b4247e9cf528e1c6fb288 Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Fri, 26 Jan 2024 17:55:02 +0000
Subject: [PATCH 19/47] arm64: meson: add dt for powkiddy-rgb10-max-3-pro
Subject: [PATCH 15/44] arm64: meson: add dt for powkiddy-rgb10-max-3-pro
---
.../meson-g12b-powkiddy-rgb10-max-3-pro.dts | 54 +++++++++++++++++++

View file

@ -0,0 +1,44 @@
From fff6d5ad0f054463f0fc67485b596e6239e13516 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= <ayufan@ayufan.eu>
Date: Mon, 4 Jan 2021 17:57:49 +0100
Subject: [PATCH 16/44] power: rk818: Configure `rk808-clkout2` function
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
???
Signed-of-by: Kamil Trzciński <ayufan@ayufan.eu>
---
drivers/mfd/rk8xx-core.c | 1 +
include/linux/mfd/rk808.h | 2 ++
2 files changed, 3 insertions(+)
diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c
index b1ffc3b9e2be..2747a296a0a6 100644
--- a/drivers/mfd/rk8xx-core.c
+++ b/drivers/mfd/rk8xx-core.c
@@ -250,6 +250,7 @@ static const struct rk808_reg_data rk818_pre_init_reg[] = {
{ RK818_H5V_EN_REG, BIT(0), RK818_H5V_EN },
{ RK808_VB_MON_REG, MASK_ALL, VB_LO_ACT |
VB_LO_SEL_3500MV },
+ { RK808_CLK32OUT_REG, CLK32KOUT2_FUNC_MASK, CLK32KOUT2_FUNC },
};
static const struct regmap_irq rk805_irqs[] = {
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 78e167a92483..4a44e8744331 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -790,6 +790,8 @@ enum rk806_dvs_mode {
#define VOUT_LO_INT BIT(0)
#define CLK32KOUT2_EN BIT(0)
+#define CLK32KOUT2_FUNC (0 << 1)
+#define CLK32KOUT2_FUNC_MASK BIT(1)
#define TEMP115C 0x0c
#define TEMP_HOTDIE_MSK 0x0c
--
2.34.1

View file

@ -1,7 +1,7 @@
From 7f6e7d9ff60a8c5377a7699d107bd4041d2b75eb Mon Sep 17 00:00:00 2001
From 302adba82133c44efee29d357bab89462d7cd52c Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sun, 11 Jun 2023 18:29:24 +0200
Subject: [PATCH 20/47] power: supply: rk818-battery: Add battery driver for
Subject: [PATCH 17/44] power: supply: rk818-battery: Add battery driver for
RK818
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
@ -11,29 +11,25 @@ This is forward ported driver from Rockchip BSP.
Signed-of-by: Kamil Trzciński <ayufan@ayufan.eu>
---
drivers/mfd/rk8xx-core.c | 6 +-
drivers/mfd/rk8xx-core.c | 2 +
drivers/mfd/rk8xx-i2c.c | 38 +-
drivers/power/supply/Kconfig | 17 +
drivers/power/supply/Kconfig | 8 +
drivers/power/supply/Makefile | 1 +
drivers/power/supply/rk818_battery.c | 3568 ++++++++++++++++++++++++++
drivers/power/supply/rk818_battery.h | 168 ++
include/linux/mfd/rk808.h | 81 +-
7 files changed, 3874 insertions(+), 5 deletions(-)
7 files changed, 3863 insertions(+), 3 deletions(-)
create mode 100644 drivers/power/supply/rk818_battery.c
create mode 100644 drivers/power/supply/rk818_battery.h
diff --git a/drivers/mfd/rk8xx-core.c b/drivers/mfd/rk8xx-core.c
index b1ffc3b9e2be..05175284079e 100644
index 2747a296a0a6..64b6e0e59e15 100644
--- a/drivers/mfd/rk8xx-core.c
+++ b/drivers/mfd/rk8xx-core.c
@@ -109,8 +109,10 @@ static const struct mfd_cell rk817s[] = {
};
@@ -111,6 +111,8 @@ static const struct mfd_cell rk817s[] = {
static const struct mfd_cell rk818s[] = {
- { .name = "rk808-clkout", },
- { .name = "rk808-regulator", },
+ { .name = "rk808-clkout", .id = PLATFORM_DEVID_NONE, },
+ { .name = "rk808-regulator", .id = PLATFORM_DEVID_NONE, },
{ .name = "rk808-clkout", },
{ .name = "rk808-regulator", },
+ { .name = "rk818-battery", .of_compatible = "rockchip,rk818-battery", },
+ { .name = "rk818-charger", .of_compatible = "rockchip,rk818-charger", },
{
@ -94,22 +90,13 @@ index 75b5cf09d5a0..3d9632fb3554 100644
static const struct regmap_config rk805_regmap_config = {
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index 3e31375491d5..339949723ff8 100644
index 3e31375491d5..6ad47fe5f089 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -985,4 +985,21 @@ config FUEL_GAUGE_MM8013
@@ -985,4 +985,12 @@ config FUEL_GAUGE_MM8013
the state of charge, temperature, cycle count, actual and design
capacity, etc.
+config FUEL_GAUGE_MM8013
+ tristate "Mitsumi MM8013 fuel gauge driver"
+ depends on I2C
+ help
+ Say Y here to enable the Mitsumi MM8013 fuel gauge driver.
+ It enables the monitoring of many battery parameters, including
+ the state of charge, temperature, cycle count, actual and design
+ capacity, etc.
+
+config BATTERY_RK818
+ bool "RK818 Battery driver"
+ depends on MFD_RK808
@ -3879,7 +3866,7 @@ index 000000000000..2f4430a98167
+#endif
\ No newline at end of file
diff --git a/include/linux/mfd/rk808.h b/include/linux/mfd/rk808.h
index 78e167a92483..05d61ae8a0f5 100644
index 4a44e8744331..e06ecffaf6bc 100644
--- a/include/linux/mfd/rk808.h
+++ b/include/linux/mfd/rk808.h
@@ -138,6 +138,8 @@ enum rk818_reg {

View file

@ -1,26 +0,0 @@
From ed1968bca88f4040abe8f3f1267cf95655f9640e Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Thu, 25 Jan 2024 00:32:40 +0000
Subject: [PATCH 18/47] arm64: meson: odroid-go-ultra: increase vddcpu_a
voltage for overclock
---
arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
index d3a1521317c3..1d26387776e6 100644
--- a/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
+++ b/arch/arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts
@@ -418,7 +418,7 @@ vddcpu_a: DCDC_REG1 {
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <775000>;
- regulator-max-microvolt = <1025000>;
+ regulator-max-microvolt = <1050000>;
regulator-ramp-delay = <6001>;
regulator-state-mem {
regulator-on-in-suspend;
--
2.34.1

View file

@ -1,7 +1,7 @@
From ce7174bde8ba1437d8e9a0cf2eec7a1d7b5dd983 Mon Sep 17 00:00:00 2001
From aebc99b0f9145bb9d47c73ce64693ef723c63705 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sun, 7 Nov 2021 19:30:07 +0100
Subject: [PATCH 21/47] power: supply: rk818-battery: Use a more propper
Subject: [PATCH 18/44] power: supply: rk818-battery: Use a more propper
compatible string
Prefix with vendor name.

View file

@ -1,7 +1,7 @@
From efcf09f674d45815fef27f5b214b89bf1b648ea9 Mon Sep 17 00:00:00 2001
From e642f1bae35b8ab7f6db133d152e424bb1913e5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sun, 7 Nov 2021 20:09:02 +0100
Subject: [PATCH 22/47] power: supply: rk818-charger: Implement charger driver
Subject: [PATCH 19/44] power: supply: rk818-charger: Implement charger driver
for RK818 PMIC
For now this driver is just meant to watch Type-C power supply
@ -12,15 +12,15 @@ Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/power/supply/Kconfig | 8 +
drivers/power/supply/Makefile | 1 +
drivers/power/supply/rk818_charger.c | 650 +++++++++++++++++++++++++++
3 files changed, 659 insertions(+)
drivers/power/supply/rk818_charger.c | 651 +++++++++++++++++++++++++++
3 files changed, 660 insertions(+)
create mode 100644 drivers/power/supply/rk818_charger.c
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index 339949723ff8..cf9e928acc23 100644
index 6ad47fe5f089..7813b6e057fd 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -1002,4 +1002,12 @@ config BATTERY_RK818
@@ -993,4 +993,12 @@ config BATTERY_RK818
If you say yes here you will get support for the battery of RK818 PMIC.
This driver can give support for Rk818 Battery Charge Interface.
@ -44,10 +44,10 @@ index aa3de47be2c5..5a2480aca754 100644
+obj-$(CONFIG_CHARGER_RK818) += rk818_charger.o
diff --git a/drivers/power/supply/rk818_charger.c b/drivers/power/supply/rk818_charger.c
new file mode 100644
index 000000000000..00fe5d8f4785
index 000000000000..7b4dd9291d3e
--- /dev/null
+++ b/drivers/power/supply/rk818_charger.c
@@ -0,0 +1,650 @@
@@ -0,0 +1,651 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * rk818 usb power driver
@ -57,6 +57,7 @@ index 000000000000..00fe5d8f4785
+#include <linux/delay.h>
+#include <linux/kernel.h>
+#include <linux/mfd/rk808.h>
+#include <linux/mod_devicetable.h>
+#include <linux/module.h>
+#include <linux/of_device.h>
+#include <linux/platform_device.h>

View file

@ -1,7 +1,7 @@
From 76e4dde0fbef5630fde3206947f3dd901aa8e01c Mon Sep 17 00:00:00 2001
From 3c1508046c0054680475d856f461af47e47b7a92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Thu, 13 Jan 2022 13:53:03 +0100
Subject: [PATCH 23/47] power: supply: rk818-charger: Change charger type to
Subject: [PATCH 20/44] power: supply: rk818-charger: Change charger type to
MAINS
To un-confuse userspace.
@ -12,10 +12,10 @@ Signed-off-by: Ondrej Jirman <megi@xff.cz>
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/supply/rk818_charger.c b/drivers/power/supply/rk818_charger.c
index 00fe5d8f4785..6a9f2d1a7086 100644
index 7b4dd9291d3e..27574c061f83 100644
--- a/drivers/power/supply/rk818_charger.c
+++ b/drivers/power/supply/rk818_charger.c
@@ -535,7 +535,7 @@ static enum power_supply_property rk818_charger_props[] = {
@@ -536,7 +536,7 @@ static enum power_supply_property rk818_charger_props[] = {
*/
static const struct power_supply_desc rk818_charger_desc = {
.name = "rk818-charger",

View file

@ -1,7 +1,7 @@
From 191d1a2c1695c6097b09e53c8ccc5046ea333128 Mon Sep 17 00:00:00 2001
From c1f960ec0b5e110aa7029b147d070114902e37ae Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Fri, 21 Jan 2022 11:38:00 +0100
Subject: [PATCH 24/47] power: supply: rk818-battery: Report charging status
Subject: [PATCH 21/44] power: supply: rk818-battery: Report charging status
based on charging current
If the current is positive, battery is charging, if negative the battery

View file

@ -1,7 +1,7 @@
From e5f0f631e113885a04dc982b8a7d26ad9d531634 Mon Sep 17 00:00:00 2001
From 7c930b83aee90136a3061bdd0626f3a75c42a357 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Tue, 17 May 2022 23:30:46 +0200
Subject: [PATCH 25/47] power: supply: rk818-battery: Drop dependency on
Subject: [PATCH 22/44] power: supply: rk818-battery: Drop dependency on
framebuffer
It was bizarre anyway. Framebuffer is barely used on Linux anyway,

View file

@ -1,7 +1,7 @@
From a45b08858342283bf99885fb1a625540ff7ba637 Mon Sep 17 00:00:00 2001
From 6a15e3e0c411654229eef72be04a19a61bc6ef07 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sat, 4 Nov 2023 18:25:03 +0100
Subject: [PATCH 26/47] power: supply: rk818-charger: Unify rk818-charger and
Subject: [PATCH 23/44] power: supply: rk818-charger: Unify rk818-charger and
rk818-battery
The BSP driver is still used, but there is now a one device handling
@ -17,10 +17,10 @@ Signed-off-by: Ondrej Jirman <megi@xff.cz>
4 files changed, 95 insertions(+), 33 deletions(-)
diff --git a/drivers/power/supply/Kconfig b/drivers/power/supply/Kconfig
index cf9e928acc23..d61af21a5bb4 100644
index 7813b6e057fd..f8ef90ef48c0 100644
--- a/drivers/power/supply/Kconfig
+++ b/drivers/power/supply/Kconfig
@@ -994,14 +994,6 @@ config FUEL_GAUGE_MM8013
@@ -985,14 +985,6 @@ config FUEL_GAUGE_MM8013
the state of charge, temperature, cycle count, actual and design
capacity, etc.
@ -145,10 +145,10 @@ index cc409b7aafb5..e0e5ed0e3d2a 100644
}
diff --git a/drivers/power/supply/rk818_charger.c b/drivers/power/supply/rk818_charger.c
index 6a9f2d1a7086..16bc4686b547 100644
index 27574c061f83..9cbb0790fe37 100644
--- a/drivers/power/supply/rk818_charger.c
+++ b/drivers/power/supply/rk818_charger.c
@@ -355,14 +355,36 @@ static int rk818_charger_get_voltage_max(struct rk818_charger *cg, int *val)
@@ -356,14 +356,36 @@ static int rk818_charger_get_voltage_max(struct rk818_charger *cg, int *val)
return 0;
}
@ -185,7 +185,7 @@ index 6a9f2d1a7086..16bc4686b547 100644
switch (psp) {
case POWER_SUPPLY_PROP_ONLINE:
ret = regmap_read(cg->regmap, RK818_CHRG_CTRL_REG1, &reg);
@@ -374,6 +396,20 @@ static int rk818_charger_get_property(struct power_supply *psy,
@@ -375,6 +397,20 @@ static int rk818_charger_get_property(struct power_supply *psy,
val->intval = !!(reg & RK818_CHRG_CTRL_REG1_CHRG_EN);
break;
@ -206,7 +206,7 @@ index 6a9f2d1a7086..16bc4686b547 100644
case POWER_SUPPLY_PROP_STATUS:
ret = regmap_read(cg->regmap, RK818_SUP_STS_REG, &reg);
if (ret)
@@ -480,14 +516,18 @@ static int rk818_charger_set_property(struct power_supply *psy,
@@ -481,14 +517,18 @@ static int rk818_charger_set_property(struct power_supply *psy,
int ret;
switch (psp) {
@ -233,7 +233,7 @@ index 6a9f2d1a7086..16bc4686b547 100644
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
return rk818_charger_set_voltage_max(cg, val->intval);
@@ -506,7 +546,7 @@ static int rk818_charger_prop_writeable(struct power_supply *psy,
@@ -507,7 +547,7 @@ static int rk818_charger_prop_writeable(struct power_supply *psy,
switch (psp) {
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
@ -242,7 +242,7 @@ index 6a9f2d1a7086..16bc4686b547 100644
return 1;
default:
@@ -518,6 +558,7 @@ static enum power_supply_property rk818_charger_props[] = {
@@ -519,6 +559,7 @@ static enum power_supply_property rk818_charger_props[] = {
POWER_SUPPLY_PROP_ONLINE,
POWER_SUPPLY_PROP_HEALTH,
POWER_SUPPLY_PROP_STATUS,
@ -250,7 +250,7 @@ index 6a9f2d1a7086..16bc4686b547 100644
POWER_SUPPLY_PROP_CHARGE_TYPE,
POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT,
POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT,
@@ -525,17 +566,25 @@ static enum power_supply_property rk818_charger_props[] = {
@@ -526,17 +567,25 @@ static enum power_supply_property rk818_charger_props[] = {
POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
POWER_SUPPLY_PROP_PRECHARGE_CURRENT,

View file

@ -1,7 +1,7 @@
From c6d718d63b69a8ffbf441356b3924f6da61ee5f6 Mon Sep 17 00:00:00 2001
From a2d1c9fda708dfae3576bfdf68d296d83525422c Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Fri, 27 May 2022 03:07:54 +0200
Subject: [PATCH 27/47] power: supply: rk818-battery: Speed up battery current
Subject: [PATCH 24/44] power: supply: rk818-battery: Speed up battery current
readout
PMIC does averaging, driver does averaging on top of that averaging,

View file

@ -1,7 +1,7 @@
From e80c768ae162d2d8d3d472047b2784ac5c39c5bd Mon Sep 17 00:00:00 2001
From fc405dd4c01211adc53a264b3a7f36be33164d89 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Tue, 2 Aug 2022 09:37:05 +0200
Subject: [PATCH 28/47] power: supply: rk818-charger: Delay applying input
Subject: [PATCH 25/44] power: supply: rk818-charger: Delay applying input
current limit until first BC detection finishes
When the phone boots for the first time, we only want to react to
@ -18,10 +18,10 @@ Signed-off-by: Ondrej Jirman <megi@xff.cz>
1 file changed, 17 insertions(+)
diff --git a/drivers/power/supply/rk818_charger.c b/drivers/power/supply/rk818_charger.c
index 16bc4686b547..979165c98e5a 100644
index 9cbb0790fe37..41e2cbd5ecc2 100644
--- a/drivers/power/supply/rk818_charger.c
+++ b/drivers/power/supply/rk818_charger.c
@@ -51,6 +51,8 @@ struct rk818_charger {
@@ -52,6 +52,8 @@ struct rk818_charger {
struct power_supply *usb_psy;
struct power_supply *charger_psy;
@ -30,7 +30,7 @@ index 16bc4686b547..979165c98e5a 100644
};
// {{{ USB supply
@@ -72,6 +74,8 @@ static int rk818_usb_set_input_current_max(struct rk818_charger *cg,
@@ -73,6 +75,8 @@ static int rk818_usb_set_input_current_max(struct rk818_charger *cg,
else
reg = 11;
@ -39,7 +39,7 @@ index 16bc4686b547..979165c98e5a 100644
ret = regmap_update_bits(cg->regmap, RK818_USB_CTRL_REG,
RK818_USB_CTRL_USB_ILIM_MASK, reg);
if (ret)
@@ -242,6 +246,19 @@ static void rk818_usb_power_external_power_changed(struct power_supply *psy)
@@ -243,6 +247,19 @@ static void rk818_usb_power_external_power_changed(struct power_supply *psy)
if (ret)
return;

View file

@ -1,7 +1,7 @@
From fdbfacc2ca0a458f9938bc10614c116aa929402b Mon Sep 17 00:00:00 2001
From f869d08e5c748e58cd0a14122d64301dac62b9b2 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Thu, 10 Nov 2022 20:03:47 +0100
Subject: [PATCH 29/47] power: supply: rk818-battery: Don't auto-poweroff the
Subject: [PATCH 26/44] power: supply: rk818-battery: Don't auto-poweroff the
PMIC on low battery
Just raise the interrupt. This avoids undervoltage shutdowns when

View file

@ -1,7 +1,7 @@
From 2e71e65223cea3e7468b4297f2b56afc95989c2e Mon Sep 17 00:00:00 2001
From 2a71f1bbe3a392604aa153853d76df8170800df9 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Thu, 10 Nov 2022 20:05:16 +0100
Subject: [PATCH 30/47] power: supply: rk818-charger: Add support for
Subject: [PATCH 27/44] power: supply: rk818-charger: Add support for
POWER_SUPPLY_PROP_ENERGY_FULL_DESIGN
Report total battery capacity.
@ -12,10 +12,10 @@ Signed-off-by: Ondrej Jirman <megi@xff.cz>
1 file changed, 10 insertions(+)
diff --git a/drivers/power/supply/rk818_charger.c b/drivers/power/supply/rk818_charger.c
index 979165c98e5a..cdef0dcd1f8c 100644
index 41e2cbd5ecc2..7674c6398a4d 100644
--- a/drivers/power/supply/rk818_charger.c
+++ b/drivers/power/supply/rk818_charger.c
@@ -518,6 +518,14 @@ static int rk818_charger_get_property(struct power_supply *psy,
@@ -519,6 +519,14 @@ static int rk818_charger_get_property(struct power_supply *psy,
val->intval = 3000000;
break;
@ -30,7 +30,7 @@ index 979165c98e5a..cdef0dcd1f8c 100644
default:
return -EINVAL;
}
@@ -583,6 +591,8 @@ static enum power_supply_property rk818_charger_props[] = {
@@ -584,6 +592,8 @@ static enum power_supply_property rk818_charger_props[] = {
POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX,
POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX,
POWER_SUPPLY_PROP_PRECHARGE_CURRENT,

View file

@ -1,7 +1,7 @@
From 3cee0f820b5e341e4ba58450112717fd84403337 Mon Sep 17 00:00:00 2001
From a4ca64019fc8d430163729a93cee36fff199492f Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sun, 11 Dec 2022 10:39:22 +0100
Subject: [PATCH 31/47] power: supply: rk818-battery: Don't reset dsoc to 0 on
Subject: [PATCH 28/44] power: supply: rk818-battery: Don't reset dsoc to 0 on
rk818_vb_low_irq
The interrupt fires at 3.4V vbat which is not equivalent to 0% charge.

View file

@ -1,7 +1,7 @@
From e1fb7854dda3acede08194508a58f16e58756524 Mon Sep 17 00:00:00 2001
From f8588c99783f2aa80679d1b47f058a80994efb38 Mon Sep 17 00:00:00 2001
From: Alexander Warnecke <awarnecke002@hotmail.com>
Date: Thu, 29 Jun 2023 19:52:42 +1000
Subject: [PATCH 32/47] supply: rk817: Fix battery capacity sanity check
Subject: [PATCH 29/44] supply: rk817: Fix battery capacity sanity check
calculation
If the nvram variable is corrupted in a way that multiplying it by 1000 causes an integer overflow and wraps around to a number within or below the sanity check bounds, the check fails and capacity is reported incorrectly.

View file

@ -1,7 +1,7 @@
From 2292a1e68b1c69500a0f6269357f6b51cf25c1a8 Mon Sep 17 00:00:00 2001
From 6c89b0c7be95632079c3b63954248bac6190d3bc Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sun, 6 Aug 2023 02:55:22 +0200
Subject: [PATCH 33/47] power: supply: rk817-charger: Add input current limit
Subject: [PATCH 30/44] power: supply: rk817-charger: Add input current limit
setting
This is useful for proper USB input current limiting.

View file

@ -1,7 +1,7 @@
From 20ee4adb35ccf9ff03befec6973f654217c49917 Mon Sep 17 00:00:00 2001
From 3c8b1445f2997c7913609430eee8d30856fa2e13 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Thu, 7 Sep 2023 17:37:59 +0200
Subject: [PATCH 34/47] power: supply: rk817-charger: Take input current limit
Subject: [PATCH 31/44] power: supply: rk817-charger: Take input current limit
from parent supply
This allows automatic input current limit setting based on USB PD.

View file

@ -1,7 +1,7 @@
From ae0469a978dd990118fa3104d4251e24dba7849f Mon Sep 17 00:00:00 2001
From c9413ff87ad76b2384cf9031510f819e586fae71 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Thu, 7 Sep 2023 17:43:00 +0200
Subject: [PATCH 35/47] power: supply: rk817-charger: Propagate proper errors
Subject: [PATCH 32/44] power: supply: rk817-charger: Propagate proper errors
Without propagating the correct error code, defered probe doesn't work.

View file

@ -0,0 +1,167 @@
From b4612269aff943bce08b81ddd72707cbaebb36d9 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sat, 13 Jan 2024 16:41:44 +0100
Subject: [PATCH 33/44] power: supply: rk817-charger: Add support for runtime
change of charger limits
This is useful for speeding up, or slowing down charging or for dealing
with lesser quality PSUs or cabling.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/power/supply/rk817_charger.c | 86 +++++++++++++++++++++++++++-
1 file changed, 85 insertions(+), 1 deletion(-)
diff --git a/drivers/power/supply/rk817_charger.c b/drivers/power/supply/rk817_charger.c
index 241fff9bc2ab..d7acb998a140 100644
--- a/drivers/power/supply/rk817_charger.c
+++ b/drivers/power/supply/rk817_charger.c
@@ -557,6 +557,69 @@ static int rk817_bat_get_prop(struct power_supply *ps,
return 0;
}
+static int rk817_battery_prop_writeable(struct power_supply *psy,
+ enum power_supply_property psp)
+{
+ switch (psp) {
+ case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
+ case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
+ return 1;
+ default:
+ return 0;
+ }
+}
+
+static int rk817_bat_set_prop(struct power_supply *ps,
+ enum power_supply_property prop,
+ const union power_supply_propval *val)
+{
+ struct rk817_charger *charger = power_supply_get_drvdata(ps);
+ int ret, reg;
+
+ switch (prop) {
+ case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT_MAX:
+ reg = rk817_chg_cur_to_reg(val->intval / 1000);
+ if (reg < 0) {
+ dev_err(charger->dev,
+ "invalid max charger current, value %d unsupported\n",
+ val->intval);
+ return -EINVAL;
+ }
+
+ ret = regmap_write_bits(charger->rk808->regmap, RK817_PMIC_CHRG_OUT,
+ RK817_CHRG_CUR_SEL, reg);
+ if (ret) {
+ dev_err(charger->dev,
+ "Unable to set max charger current (%d)\n", ret);
+ return ret;
+ }
+ break;
+ case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE_MAX:
+ reg = (val->intval / 1000 - 4100) / 50;
+ if (reg < 0 || reg > 7) {
+ dev_err(charger->dev,
+ "invalid max charger voltage, value %d unsupported\n",
+ val->intval);
+ return -EINVAL;
+ }
+
+ ret = regmap_write_bits(charger->rk808->regmap, RK817_PMIC_CHRG_OUT,
+ RK817_CHRG_VOL_SEL, (reg << 4));
+ if (ret) {
+ dev_err(charger->dev,
+ "Unable to set max charger voltage (%d)\n", ret);
+ return ret;
+ }
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ cancel_delayed_work_sync(&charger->work);
+ queue_delayed_work(system_wq, &charger->work, msecs_to_jiffies(50));
+ return 0;
+}
+
static const int rk817_usb_input_current_limits[] = {
1, 80000,
0, 450000,
@@ -622,6 +685,7 @@ static int rk817_chg_get_prop(struct power_supply *ps,
union power_supply_propval *val)
{
struct rk817_charger *charger = power_supply_get_drvdata(ps);
+ unsigned int reg;
int ret;
switch (prop) {
@@ -644,6 +708,13 @@ static int rk817_chg_get_prop(struct power_supply *ps,
if (ret)
return ret;
break;
+ case POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT:
+ ret = regmap_read(charger->rk808->regmap, RK817_PMIC_CHRG_IN, &reg);
+ if (ret < 0)
+ return ret;
+
+ val->intval = 4000000 + 100000 * ((reg & RK817_USB_VLIM_SEL) >> 4);
+ break;
/*
* While it's possible that other implementations could use different
* USB types, the current implementation for this PMIC (the Odroid Go
@@ -663,7 +734,7 @@ static int rk817_chg_set_prop(struct power_supply *ps,
const union power_supply_propval *val)
{
struct rk817_charger *charger = power_supply_get_drvdata(ps);
- int ret;
+ int ret, reg;
switch (prop) {
case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
@@ -671,9 +742,18 @@ static int rk817_chg_set_prop(struct power_supply *ps,
if (ret)
return ret;
break;
+ case POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT:
+ // 0 = 4.0V - 7 = 4.7V, 0.1V step
+ reg = (clamp(val->intval, 4000000, 4700000) - 4000000) / 100000;
+ ret = regmap_write_bits(charger->rk808->regmap, RK817_PMIC_CHRG_IN,
+ RK817_USB_VLIM_SEL, (reg << 4));
+ if (ret)
+ return ret;
+ break;
default:
return -EINVAL;
}
+
return 0;
}
@@ -762,6 +842,7 @@ static int rk817_charger_prop_writeable(struct power_supply *psy,
{
switch (psp) {
case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
+ case POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT:
return 1;
default:
return 0;
@@ -792,6 +873,7 @@ static enum power_supply_property rk817_chg_props[] = {
POWER_SUPPLY_PROP_VOLTAGE_MIN_DESIGN,
POWER_SUPPLY_PROP_VOLTAGE_AVG,
POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT,
+ POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT,
};
static enum power_supply_usb_type rk817_usb_type[] = {
@@ -804,7 +886,9 @@ static const struct power_supply_desc rk817_bat_desc = {
.type = POWER_SUPPLY_TYPE_BATTERY,
.properties = rk817_bat_props,
.num_properties = ARRAY_SIZE(rk817_bat_props),
+ .property_is_writeable = rk817_battery_prop_writeable,
.get_property = rk817_bat_get_prop,
+ .set_property = rk817_bat_set_prop,
};
static const struct power_supply_desc rk817_chg_desc = {
--
2.34.1

View file

@ -1,7 +1,7 @@
From 22387a2f7b05ec9e159525bb0b7db52d66cc3649 Mon Sep 17 00:00:00 2001
From 37f568856e1139a8304d975318e8297c7d82a1fe Mon Sep 17 00:00:00 2001
From: "Mauro (mdrjr) Ribeiro" <mauro.ribeiro@hardkernel.com>
Date: Wed, 31 Jan 2024 11:59:50 -0300
Subject: [PATCH 36/47] power: supply: rk818-battery/charger: clear unused
Subject: [PATCH 34/44] power: supply: rk818-battery/charger: clear unused
variables
---
@ -23,10 +23,10 @@ index b62d59a4b228..ac8369f09d3e 100644
di->s2r = true;
di->current_avg = rk818_bat_get_avg_current(di);
diff --git a/drivers/power/supply/rk818_charger.c b/drivers/power/supply/rk818_charger.c
index cdef0dcd1f8c..a081fdfee31d 100644
index 7674c6398a4d..09fe6e02215a 100644
--- a/drivers/power/supply/rk818_charger.c
+++ b/drivers/power/supply/rk818_charger.c
@@ -538,7 +538,6 @@ static int rk818_charger_set_property(struct power_supply *psy,
@@ -539,7 +539,6 @@ static int rk818_charger_set_property(struct power_supply *psy,
const union power_supply_propval *val)
{
struct rk818_charger *cg = power_supply_get_drvdata(psy);

View file

@ -1,7 +1,7 @@
From 85844acb5542a92076af0ff9a8a63ac5b3d3aa8b Mon Sep 17 00:00:00 2001
From 6339706441d1479708df3294877d55b6805cdcc2 Mon Sep 17 00:00:00 2001
From: "Mauro (mdrjr) Ribeiro" <mauro.ribeiro@hardkernel.com>
Date: Wed, 31 Jan 2024 18:36:49 +0000
Subject: [PATCH 37/47] arm64: meson: odroid-go-ultra: add battery and charger
Subject: [PATCH 35/44] arm64: meson: odroid-go-ultra: add battery and charger
nodes
---

View file

@ -1,7 +1,7 @@
From 2a5a071575ad567e1bb7394d9d17a9776165cf4e Mon Sep 17 00:00:00 2001
From 6f4ac5c34912fd8fe6b453e0e402a5dc8f4e64a4 Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Thu, 20 Apr 2023 16:18:40 +0900
Subject: [PATCH 38/47] ASoC: meson: axg-card: limit the volume to prevent
Subject: [PATCH 36/44] ASoC: meson: axg-card: limit the volume to prevent
clipping of output signal
---

View file

@ -1,7 +1,7 @@
From 811cb668282b62dfbd39b2edb6ceeefc45105555 Mon Sep 17 00:00:00 2001
From c21702b1d3506071635539c0fd8bee17ffb272e3 Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Wed, 31 Jan 2024 20:18:22 +0000
Subject: [PATCH 39/47] power: supply: rk818_charger: change syfs node name so
Subject: [PATCH 37/44] power: supply: rk818_charger: change syfs node name so
ES can read battery status
---
@ -9,10 +9,10 @@ Subject: [PATCH 39/47] power: supply: rk818_charger: change syfs node name so
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/supply/rk818_charger.c b/drivers/power/supply/rk818_charger.c
index a081fdfee31d..6956d093c672 100644
index 09fe6e02215a..af9b2efbc94e 100644
--- a/drivers/power/supply/rk818_charger.c
+++ b/drivers/power/supply/rk818_charger.c
@@ -609,7 +609,7 @@ static enum power_supply_property rk818_charger_props[] = {
@@ -610,7 +610,7 @@ static enum power_supply_property rk818_charger_props[] = {
* but not me, not now. :)
*/
static const struct power_supply_desc rk818_charger_desc = {

View file

@ -1,7 +1,7 @@
From 13cd01705c021cfe8fe14a45beed8b9d99c1d3dc Mon Sep 17 00:00:00 2001
From 4b8d36069dbe393e882da689d1816ba241d087c3 Mon Sep 17 00:00:00 2001
From: "Mauro (mdrjr) Ribeiro" <mauro.ribeiro@hardkernel.com>
Date: Wed, 31 Jan 2024 20:56:40 +0000
Subject: [PATCH 40/47] arm64: meson: odroid-go-ultra: add headphone detection
Subject: [PATCH 38/44] arm64: meson: odroid-go-ultra: add headphone detection
---
.../arm64/boot/dts/amlogic/meson-g12b-odroid-go-ultra.dts | 8 ++++++++

View file

@ -1,7 +1,7 @@
From 8179b9a1518b8ba19e2bce4e300defdc36177ed9 Mon Sep 17 00:00:00 2001
From b95234b4178cab46d6eb171c2a7cd56c242a3f74 Mon Sep 17 00:00:00 2001
From: ckkim <changkon12@gmail.com>
Date: Thu, 20 Apr 2023 16:21:09 +0900
Subject: [PATCH 41/47] arm64: dts: amlogic: odroid-go ultra: Improve sound
Subject: [PATCH 39/44] arm64: dts: amlogic: odroid-go ultra: Improve sound
output quality
---

View file

@ -1,7 +1,7 @@
From a1bcc406369cdc0976cafe8987a6ab7224bb513d Mon Sep 17 00:00:00 2001
From 184ec78821692f7a5c5b59f9e16df36d1959c4bd Mon Sep 17 00:00:00 2001
From: brooksytech <1673861+brooksytech@users.noreply.github.com>
Date: Thu, 1 Feb 2024 19:03:03 +0000
Subject: [PATCH 42/47] arm64: meson: g12-common: remove lower freq gpu opps
Subject: [PATCH 40/44] arm64: meson: g12-common: remove lower freq gpu opps
---
arch/arm64/boot/dts/amlogic/meson-g12-common.dtsi | 12 ------------

View file

@ -1,7 +1,7 @@
From 359a5844be35851c12fc85bf2648ecd5f805ef93 Mon Sep 17 00:00:00 2001
From 83b4a5d121788f8ff47794dd945ac82cea346570 Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi.hannula@iki.fi>
Date: Sun, 17 Apr 2022 04:37:48 +0000
Subject: [PATCH 43/47] LOCAL: ALSA: Assign internal PCM chmap/ELD/IEC958 kctls
Subject: [PATCH 41/44] LOCAL: ALSA: Assign internal PCM chmap/ELD/IEC958 kctls
to device 0
On SoC sound devices utilizing codec2codec DAI links with a HDMI codec

View file

@ -1,7 +1,7 @@
From 200926d2e4c4eede5f9ec5f2eb176cddeca78604 Mon Sep 17 00:00:00 2001
From 56283996bde298454c0e83a6d8cafc232343b0f4 Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Sun, 4 Feb 2024 09:48:31 +0000
Subject: [PATCH 44/47] arm64: meson: odroid-n2*: add support for overclocking
Subject: [PATCH 42/44] arm64: meson: odroid-n2*: add support for overclocking
---
.../dts/amlogic/meson-g12b-odroid-n2-plus.dts | 24 ++++++++++++++++++

View file

@ -1,7 +1,7 @@
From 28c9de20e78981e601ffd411bfbc84b9467409a3 Mon Sep 17 00:00:00 2001
From 1ec813703b6ac258893753b9134c1c0856ac119a Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Wed, 6 Mar 2024 19:40:45 +0000
Subject: [PATCH 46/47] power: reset: add the Powkiddy RGB10-Max-3-Pro to the
Subject: [PATCH 43/44] power: reset: add the Powkiddy RGB10-Max-3-Pro to the
Odroid Go Ultra poweroff driver
---

View file

@ -1,7 +1,7 @@
From a0dc5b136ca3a750336f1000a9313009dcd80c21 Mon Sep 17 00:00:00 2001
From 3ee121405282bec089601d521371e9df6409c991 Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Fri, 15 Mar 2024 19:49:19 +0000
Subject: [PATCH 47/47] arm64: dts: amlogic: meson-g12b-odroid-n2: add support
Subject: [PATCH 44/44] arm64: dts: amlogic: meson-g12b-odroid-n2: add support
for gpio power off
---

View file

@ -1,34 +0,0 @@
From 5748c226f2923262a6bfad3c901cb76ba776fc98 Mon Sep 17 00:00:00 2001
From: spycat88 <spycat88@users.noreply.github.com>
Date: Tue, 6 Feb 2024 17:50:09 +0000
Subject: [PATCH 45/47] power: supply: rk818_charger: fix compiling driver on
6.8
---
drivers/power/supply/rk818_charger.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/power/supply/rk818_charger.c b/drivers/power/supply/rk818_charger.c
index 6956d093c672..5cbdc1b46c5c 100644
--- a/drivers/power/supply/rk818_charger.c
+++ b/drivers/power/supply/rk818_charger.c
@@ -8,7 +8,7 @@
#include <linux/kernel.h>
#include <linux/mfd/rk808.h>
#include <linux/module.h>
-#include <linux/of_device.h>
+#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/power_supply.h>
#include <linux/regmap.h>
@@ -705,6 +705,7 @@ static const struct of_device_id rk818_charger_of_match[] = {
{ .compatible = "rockchip,rk818-charger", },
{ },
};
+MODULE_DEVICE_TABLE(of, rk818_charger_of_match);
static struct platform_driver rk818_charger_driver = {
.probe = rk818_charger_probe,
--
2.34.1