Kernel: 4.9.11
CPU: iMX7D
Backgound: I have a gpio pin controlling the enable pin for a regulator IC. In my device tree I have this declared using the [compatible = "regulator-fixed"] framework. I am also exporting this regulator to user-space (so have a consumer) using the [compatible = "reg-userspace-consumer"] framework, with its default state as enabled (regulator-boot-on). I have initialized this gpio in uBoot to enable the regulator.
Problem: When the kernel boots it probes the "regulator-fixed" driver. Because, at this stage, there is no 'consumer' the kernel's default state is to disable the regulator. A little time later, the kernel probes the "reg-userspace-consumer" driver which attaches to the regulator and correctly configures its state as enabled. The result is that the my regulator IC is 'blipped off' for a very short time during boot. I could set 'regulator-always-on' in my device-tree which avoids the issue by keeping the regulator enabled, BUT, I no longer have user-space control of the enable line.
Question: How can I prevent the kernel from 'disabling' a regulator at boot, and still maintain user-space control?
Hello dh29,
See my suggestions for you, please!
----------------------------------
Now that you have configured this GPIO output in u-boot, don't reconfigure it in Linux again, but keep it's state in the u-boot.
According to your descriptions, it's state change will happen during loading probe function in "userspace-consumer.c", so you can find a way to avoid running "enable" in probe.
----------------------------------
Try it , please!
Have a nice day!
NXP TIC Weidong Sun
Hi weidong.sun,
Thanks for your reply.
My original question was to find out if I was missing something (maybe a patch) within the 'fixed-regulator' / 'regulator' framework that would direct the kernel to set-up the regulator, but not configure it during boot. This requirement seems like a common feature for a lot of h/w designs. However, It seems that this is not possible within the regulator framework.
Your suggestion will provide a solution.
Thanks, dh29