Appendix · reference

Rockchip RK817 (PineTab2 PMIC)

Regulators, charger, fuel gauge, codec, RTC, and OTG switch for the RK3566 tablet

Identity

PartRockchip RK817
RoleSystem PMIC: DCDC/LDO regulators, RTC, 5 V charger path, fuel gauge, audio codec, boost/OTG switch
Bus / addressi2c0 addr 0x20
GPIO / IRQGPIO0_A3, level-low PMIC interrupt
PineTab2 battery nodesimple-battery, 6000 mAh design capacity, 4.3 V constant-charge voltage
Linux referencedrivers/power/supply/rk817_charger.c
Register map referenceinclude/linux/mfd/rk808.h
DTS referencerk3566-pinetab2.dtsi

Status — ◐ partial

The FreeBSD RK8xx PMIC core already knows the RK817 family and regulator layout. This repo now adds a PineTab2-safe battery/charger monitor: src/sys/dev/iicbus/pmic/rockchip/rk817_battery.c attaches from the RK8xx PMIC core when the charger child exists, reads the gas-gauge and charger registers, and exposes dev.rk8xx.N.rk817_* sysctls.

This is intentionally read-only. It does not program PMIC_CHRG_OUT, PMIC_CHRG_IN, GG_CON, relax thresholds, coulomb-counter initial state, or NVRAM. Linux does all of that during probe, but on an unbenched tablet the first FreeBSD pass should answer “what did firmware leave us?” before it starts changing charge limits.

Driver Surface

SysctlMeaning
rk817_presentPMIC_CHRG_STS.BAT_EXS
rk817_onlineSYS_STS.PLUG_IN_STS
rk817_statusDecoded charger state string
rk817_capacity_pctQ_PRES / Q_MAX, falling back to the DT design capacity
rk817_voltage_uv / rk817_current_uaBattery voltage/current using Linux’s RK817 calibration math
rk817_usb_voltage_uv / rk817_sys_voltage_uvInput and system rail voltage readouts
rk817_chrg_out, rk817_chrg_in, rk817_chrg_term, rk817_chrg_stsRaw charger control/status registers
rk817_adc_config0, rk817_adc_config1, rk817_gg_con, rk817_gg_stsRaw gas-gauge configuration/status
rk817_dbg_reg / rk817_peekRead-only register peek for bench hypotheses
rk817_dumpWrite non-zero to emit one decoded dmesg line

The patch into FreeBSD’s RK8xx core is deliberately small: patches/sys/dev/iicbus/pmic/rockchip/rk8xx.c.patch includes rk817_battery.h and calls rk817_battery_attach(sc->dev) only when sc->type == RK817. patches/sys/conf/files.arm64.patch builds the new file whenever rk8xx is in the kernel.

First Bench Predicate

After the tablet boots:

dmesg | grep -i rk817
sysctl dev.rk8xx.0 | grep rk817
sysctl dev.rk8xx.0.rk817_dump=1

The useful first proof is not “charging works”; it is:

Only after those are boring should the driver grow write-side support for ADC enables, charger limits, fuel-gauge initialization, and Type-C role handoff.

Open Work