iMx8-m | control regulator gpio from user space

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

iMx8-m | control regulator gpio from user space

ソリューションへジャンプ
568件の閲覧回数
Harshkumar_Patel
Contributor I

Hello Team,

Trying to control regulator pin (gpiochip3-25) from user space on i.MX 8 with kerel 5.10.0-30-amd64 but it is not allowing to change.

echo enabled > /sys/devices/platform/regulator-lte-on/regulator/regulator.4/state
sh: /sys/devices/platform/regulator-lte-on/regulator/regulator.4/state: Permission denied

Additionally, It is using generic regulator driver "regulator-fixed" and  "CONFIG_REGULATOR_USERSPACE_CONSUMER" kernel config is enabled but still same.

Further there is one doc regulator userspace-consumer - NXP Community which describes to do this with different driver and specific device tree changes.

Question:
Is there any better way to control regulator pin state without following the steps mentioned in above link especially getting special dts changes?

Thanks in advance.

regards,
Patel

0 件の賞賛
返信
1 解決策
431件の閲覧回数
Chavira
NXP TechSupport
NXP TechSupport

Hi @Harshkumar_Patel!

Thanks for confirming the GPIO toggle using the gpio-led driver.

 

Since gpiochip3-25 controls modem power and must remain ON, I recommend using regulator-fixed. It offers better integration with the power management framework and ensures stability during suspend/resume, kernel stalls, or high system load. The gpio-led driver may not reliably maintain the GPIO state in those scenarios.

 

However, if maintaining the power rail only during active mode is sufficient, the gpio-led driver can be used with a pull-up resistor to keep the signal HIGH, and the rail can be turned off when no longer needed.

 

Best regards,
Chavira

元の投稿で解決策を見る

0 件の賞賛
返信
5 返答(返信)
405件の閲覧回数
Harshkumar_Patel
Contributor I

Hi Chavira,

Thanks for the quick and clear response.

Further, in case you are aware,
As controlling regulator from user space is most common need, is there plan to have userspace_regulator patch to be part of next revision of i.MX8 yocto SDK?

Thanks

0 件の賞賛
返信
358件の閲覧回数
Chavira
NXP TechSupport
NXP TechSupport

Hi @Harshkumar_Patel!

Unfortunately, we do not have plans to provide a patch, as we are not responsible for developing the driver in question.

 

Please note that all resources shared in the community are intended for reference purposes only. Officially supported software from NXP is available on GitHub, and we typically provide manuals to guide users on how to use it in each specific case.

 

Best regards,
Chavira

0 件の賞賛
返信
535件の閲覧回数
Harshkumar_Patel
Contributor I

Hi Chavira,

Thank you for super-fast and clear response.
I verified expected gpio toggle using the gpio-led driver but want expert opinion before using this option.

As you may noticed that we are using gpiochi3-25 for enabling modem power and it must remain ON.
Using it as "gpio-led" instead of "regulator-fixed", do you see any issue in case of kernel stall or overloading or latency or low-power-modes?

Thanks




0 件の賞賛
返信
432件の閲覧回数
Chavira
NXP TechSupport
NXP TechSupport

Hi @Harshkumar_Patel!

Thanks for confirming the GPIO toggle using the gpio-led driver.

 

Since gpiochip3-25 controls modem power and must remain ON, I recommend using regulator-fixed. It offers better integration with the power management framework and ensures stability during suspend/resume, kernel stalls, or high system load. The gpio-led driver may not reliably maintain the GPIO state in those scenarios.

 

However, if maintaining the power rail only during active mode is sufficient, the gpio-led driver can be used with a pull-up resistor to keep the signal HIGH, and the rail can be turned off when no longer needed.

 

Best regards,
Chavira

0 件の賞賛
返信
550件の閲覧回数
Chavira
NXP TechSupport
NXP TechSupport

Hi @Harshkumar_Patel,

By default, the regulator-fixed driver does not allow direct control from user space. To enable this functionality, you would typically need to modify the driver or adjust the device tree to include a regulator-userspace-consumer node.

However, a simpler and more flexible alternative is to declare the regulator's enable GPIO using the gpio-led driver. This approach allows you to control the GPIO directly from user space using standard interfaces like sysfs or libgpiod, without needing to modify the regulator framework or device tree extensively.

This method is especially useful when you only need basic on/off control and want to avoid deeper kernel or DTS changes.

Best regards,
Chavira

0 件の賞賛
返信