The Rockchip SARADC path is a 10-bit successive-approximation ADC. On the PinePhone Pro it reads the volume-button resistor divider on channel
- On PineTab2 the imported Linux DTS uses RK3566/RK3568 SARADC channel
0 for the same VOL+ / VOL- role. Both halves of that path — the SARADC
provider and the
adc-keysconsumer — are local to this tree.
Identity
| Property | Value |
|---|---|
| Block | RK3399 / RK356x SARADC |
| MMIO base | PPP: 0xff100000; PineTab2: inherited RK356x fe720000 |
| Channels | 6 (10-bit each) |
| Reference | 1.8 V (RK_SARADC_DEFAULT_VREF_UV = 1800000) |
| Clock rate | 1 MHz (RK_SARADC_CLK_RATE) |
| DTS compatible | rockchip,rk3399-saradc, rockchip,rk3568-saradc |
| Linux driver | drivers/iio/adc/rockchip_saradc.c |
PinePhone Pro channel map:
| Channel | Function |
|---|---|
| 1 | Volume button divider (VOL+ / VOL-) |
| others | Unused on PPP |
PineTab2 channel map:
| Channel | Function |
|---|---|
| 0 | Volume button divider (VOL+ / VOL-) |
Live capture from KEY_VOLUMEUP / KEY_VOLUMEDOWN:
| Press | Voltage |
|---|---|
| VOLUMEUP | 0–21 mV |
| VOLUMEDOWN | 0.30–0.63 V |
| Idle (no press) | ≈1.79 V |
Driver
● workingTwo cooperating drivers live under our overlay:
src/sys/arm64/rockchip/rk_saradc.c— 276 lines. Polled, blocking-style channel reads behind a microsecond delay loop (RK_SARADC_POLL_DELAY_US = 1,RK_SARADC_POLL_RETRIES = 2000). Exposes a kobj method (headerrk_saradc.h) so consumers in the same kld can request a channel conversion synchronously.src/sys/arm64/rockchip/rk_adc_keys.c—adc-keysconsumer. Iterates child OFW nodes for thresholds and keycodes, polls the SARADC every 100 ms by default, and emits evdev events. Sysctl debug knobs landed in2612871Add ADC keys debug sysctls .
The whole stack is local because mainline FreeBSD has no SARADC ADC framework consumer to plug into; we wired the two-driver pair against each other directly via a kobj method rather than waiting for an in-tree IIO/ADC abstraction.
Bring-up started in 32e626d Add PPP SARADC volume keys and refresh status docs . The PineTab2 speculative
step adds the RK3568-compatible provider match and richer rk_adc_keys
debug sysctls so the tablet’s channel-0 ladder can be verified without
guesswork.
Verification
# Sway volume OSD reacts to VOL+ / VOL-, and:
sysctl dev.rk_saradc.0
sysctl dev.rk_adc_keys.0
The OSD path is documented in the Status essay; volume buttons are listed there as one of the resolved input items.
Open work
- Confirm PineTab2
rockchip,rk3568-saradcattach and channel-0 readings on hardware. - No DMA or interrupt-driven mode — polled is fine at 10 Hz, would need rework for higher-rate analog work (none planned).
Related
- Status essay (14) — where the volume buttons sit in the working-input inventory.
- Hardware reference — Input and sensors row.
HARDWARE.md— SARADC is checked off under Input & Sensors → Done.