Appendix · reference

SGMicro SGM3140 (camera flash driver)

Two-GPIO flash / torch driver; trivial as `/dev/led/flash` even without a camera

Identity

PartSGMicro SGM3140 (1.5 A LED flash / torch driver)
RoleHigh-side current driver for the rear camera flash LED
Bus / addressGPIO-controlled, no bus interface
GPIO / IRQFLASH_EN = gpio4 RK_PC6 (bank 4 pin 22), FLASH_TORCH = gpio1 RK_PA3 (bank 1 pin 3), both active-high; pinctrl group flash_pins
DatasheetSGMicro SGM3140
Pine64 wikiPinePhone Pro — Cameras
Schematicsheet 13 (rear camera area)

Status — ● working

DTS overlay in tree (src/sys/dts/arm64/overlays/sgm3140.dtso) wires both FLASH_EN and FLASH_TORCH as gpioled(4) consumers via a sibling compatible = "gpio-leds" node — FreeBSD has no driver for the upstream sgmicro,sgm3140 compatible string, so we reuse the existing two GPIOs through the standard gpio-leds binding instead.

Verified live on 2026-05-03 (kernel #140+, head b7ec39b): /dev/led/flash and /dev/led/torch exist; echo 1 > /dev/led/flash turns the rear flashlight on continuously (torch mode), and /dev/led/flash + /dev/led/torch together produce a visible camera strobe at 250 ms (the bench’s 80 ms pulse is real but too brief for the eye). The overlay had to be added to sys/modules/dtb/rockchip/Makefile ( b7ec39b dtb: build sgm3140 overlay as part of the rockchip dtb modules ) so buildkernel actually emits sgm3140.dtbo, and the phone’s fdt_overlays line in /boot/loader.conf had to grow sgm3140 beyond the original bcm-hostwake.

The part itself is a two-GPIO state machine, not a sensor. Linux’s leds-sgm3140 driver treats the GPIO named enable as the chip enable and the GPIO named flash as the mode/strobe line: torch/brightness mode is enable=1, flash=0; flash/strobe mode is enable=1, flash=1. Our gpioled overlay exposes those two raw lines as /dev/led/flash (enable) and /dev/led/torch (flash/mode), which makes this useful as a flashlight even though the cameras themselves are person-years out.

Driver

No I2C, no clocks, no regulators beyond what the rest of the camera area already provides; the base DTS already has the flash_pins pinctrl group, which our overlay reuses.

Parity verification

Open work