-
Notifications
You must be signed in to change notification settings - Fork 31
DTB Elements
The bat_low_gpio property in this RK817 charger node (for RK3326-based devices) specifies the GPIO line that the RK817 PMIC uses to signal a low-battery condition to the SoC.
- The RK817 PMIC monitors battery voltage internally.
- When the voltage drops below a configured low-battery threshold (usually set via
bat-low-thresholdin the companionrk817,batterynode, e.g.<0x1e>= 30 in some units), the PMIC asserts this GPIO. - This GPIO acts as a hardware interrupt/signal to the Linux kernel’s
rk817_chargerdriver (indrivers/power/supply/rk817_charger.c). - The kernel then uses it to trigger low-battery events: on-screen warnings, notifications, power-saving actions, or a safe shutdown to protect the battery and prevent data loss/crashes.
The value <0x66 0x0d 0x00> follows the standard Rockchip GPIO binding format:
-
0x66→ phandle to the GPIO controller (usually the SoC’s GPIO bank). -
0x0d→ pin number within that bank. -
0x00→ flags (active-high/low, etc.).
It is wired (or configured via the PMIC) to the RK817’s low-battery output pin, similar to how dc_det_gpio detects DC/charger plug-in.
In most RK3326 + RK817 device trees (e.g. R36S/RG351 handhelds, Quartz64, etc.), it appears either in the charger node (as in your snippet) or the battery sub-node under the RK817 PMIC. It works together with the OCV table (ocv_table) and other battery properties to give accurate fuel-gauge and low-battery behavior.
In short: it’s the hardware low-battery alert pin — essential for proper battery management and user notifications on these devices. If it’s missing or points to the wrong pin, you often get incorrect battery reporting or no low-battery warnings.
otg_switch-supply is a Device Tree property that belongs inside the charger sub-node of the RK817 PMIC.
It tells the Linux kernel driver (rk817-charger) which regulator is responsible for controlling the USB OTG boost converter.
On these RK3326 handhelds, the RK817 PMIC has a built-in boost regulator (usually called boost) that can generate 5 V from the main 3.3 V / 3.8 V rail. This 5 V is needed when the device acts as a USB host (OTG mode) to power external devices (controllers, keyboards, etc.).
The rk817-charger driver always tries to enable/disable the OTG boost regulator at boot and during USB events.
- If the driver cannot find the regulator via
otg_switch-supply, it falls back to a dummy path. - It still calls
regulator_disable()internally. - The kernel’s regulator core sees a disable without a matching enable → “unbalanced disables for otg_switch” warning.
This is exactly the warning you see in your dmesg:
rk817-charger rk817-charger: Looking up otg_switch-supply property ... failed
unbalanced disables for otg_switch
WARNING: at ... (regulator core)
**Phandle are dependent on the BOOST node.
- BOOST regulator → phandle
<0x67>
Add this single line inside the charger node:
charger {
compatible = "rk817,charger";
...
dc_det_gpio = <0x68 0x05 0x00>;
extcon = <0x69>;
/* === ADD THIS LINE === */
otg_switch-supply = <0x67>; // points to the BOOST regulator in your DTB
};
Full corrected charger block (copy-paste ready):
charger {
compatible = "rk817,charger";
min_input_voltage = <0x1194>;
max_input_current = <0x1f4>;
max_chrg_current = <0x1f4>;
max_chrg_voltage = <0x1068>;
chrg_term_mode = <0x00>;
chrg_finish_cur = <0x12c>;
virtual_power = <0x00>;
sample_res = <0x0a>;
dc_det_gpio = <0x68 0x05 0x00>;
extcon = <0x69>;
otg_switch-supply = <0x67>; // ← required for OTG/boost control
};
After adding the line, recompile the DTB and replace it:
dtc -I dts -O dtb -o fixed.dtb current.dts
cp fixed.dtb /boot/dtbs/rockchip/rk3326-r36s-linux.dtb
reboot- Firmware Installation
- Firmware Upgrade
- Audio and Screen Controls
- EmulationStation
- Retroarch Hotkeys
- Kodi
- PortMaster
- Customising your Device
- Arcade (arcade)
- CAPCOM Play System 1 (cps1)
- CAPCOM Play System 2 (cps2)
- CAPCOM Play System 3 (cps3)
- MAME 2003 (mame2003)
- MAME 2010 (mame)
- Nintendo 64 (n64)
- Nintendo Entertainment System (nes)
- Nintendo Famicom (famicom)
- Nintendo Famicom Disk System (fds)
- Super Nintendo Entertainment System (snes)
- NEC PCE Engine (pcengine)
- NEC PC Engine CD (pcenginecd)
- NEC Turbografx 16 (turbografx)
- NEC Turbografx 16 CD (turbografxcd)
- Nintendo Super Famicom (sfc)
- Sega Master System (mastersystem)
- Sega Megadrive (megadrive)
- Sega Genesis (genesis)
- Sega CD (segacd)
- Sega 32x (sega32x)
- Sega Dreamcast (dc)
- Sega Saturn (saturn)
- Sony Playstation (psx)
- SNK Neo Geo (neogeo)
- SNK Neo Geo CD (neogeocd)
- Nintendo DS (nds)
- Nintendo GameBoy (gb)
- Nintendo Gameboy Color (gbc)
- Nintendo Gameboy Advanced (gba)
- Sega Game Gear (gamegear)
- Sony Playstation Portable (psp)
The guides below are for ArkOS-G80CA; once they are above this marker, they are relevant.
- Commodore 64 (c64)
- Amiga (amiga)
- Amiga CD32 (amigacd32)
- ZX Spectrum (zxspectrum)
- Doom (doom)
- SNK Neo Geo Pocket (ngp)
- SNK Neo Geo Pocket Color (ngpc)
- MSX (msx)
- MSX2 (msx2)
- Atari ST (atarist}
- Atari 2600 (atari2600)
- Atari 5200 (atari5200)
- Atari 7800 (atari7800)
- Mattel Intellivision (intellivision)
- Sega SG‐1000 (sg‐1000)
- Atari Lynx (atarilynx}
- Bandai WonderSwan (wonderswan)
- Bandai WonderSwan Color (wonderswancolor)
- Amstrad CPC (amstradcpc)
- Apple II (apple2)
- Atari 800 (atari800)
- BBC Micro (bbcmicro)
- Ports (ports)