Is there a way to read/write PMIC registers from user space?

Hi Team,

We are working on a custom board based on apq8016 and Linaro 18.01.

Is there any way we can read/write PMIC registers from the userspace?

Parth Y Shah

The pm8916 is connected to the SPMI bus, and not directly mapped to memory. However the pm8916 driver (qcom-spmi-pmi) creates two regmaps used by subdrivers (watchdog, pon…). You can find them exposed in debugfs: /sys/kernel/debug/regmap/0-00 and /sys/kernel/debug/regmap/0-01 respectively slave USID 0 and slave USID 1 as described in the pm8916 hardware register description.

You can read the registers, but not write them, except if you enable it with #define REGMAP_ALLOW_WRITE_DEBUGFS and recompile your kernel. It’s however not recommended to do that in userspace. Then you should be able to write to the register:
e.g. write 0x42 to register 0x0800:

echo -n "0x0800 0x42" > /sys/kernel/debug/regmap/0-00/registers

Thanks Loic, it worked!

Hi Loic,

Is this for Linux only?
In android, this path does not exist.
Is there a way to access to PMIC registers on 410c running Android please?

What Android are you running? Ancient and unsupported qualcomm? Or recent AOSP? If the latter, then it should work the same, since it should be running basically the same kernel.

Last snapshot available on 96board download page (AOSP snapshot 99)

I found a way using this path:
shell@msm8916_64:/sys/kernel/debug/spmi/spmi-0 # echo 0x00000 > address
shell@msm8916_64:/sys/kernel/debug/spmi/spmi-0 # echo 40> count
shell@msm8916_64:/sys/kernel/debug/spmi/spmi-0 # cat data

but I would like confirmation by experts…

That’s ancient and unsupported qualcomm fork of Android. I’d suggest building AOSP for it.
Build instructions are here;


can you give me details about solving this duplicate path plz?

I don’t understand what he was doing to fix that


After you sync the local_manifests, go into that directory and edit the file “linaro.xml” and add these two lines above the lines adding the dragonboard projects;

  <remove-project name="device/linaro/dragonboard" />
  <remove-project name="device/linaro/dragonboard-kernel" />

What those will do is just remove the db845c projects that are causing the path collisions.

You could also try my pinned manifests, which might work for db410c. I haven’t had the chance to work at all on the 410 except just for adding the files to the repository. I’m planning to work on that one after I get the db820c straightened out fully.

And note that despite my focus on automotive, it will create “normal” builds for all targets except “db820c_car”.

thanks man, really appreciate your support.