Setting correct pm_power_off in kernel 3.14.52

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Setting correct pm_power_off in kernel 3.14.52

2,906 次查看
nexy_sm
Contributor II

Hi all,

i would like to use gpio-poweroff module in order to completely turn the power off. The Kernel is 3.14.52. This module checks if pm_power_off is NULL and when not it assigns it to its own callback implementation. pm_power_off is a function called at the end of the power down procedure. However, this callback function is set by the driver rtc-svns, which means that gpio_poweroff module cant assign its own callback, since it is not NULL at that point. As an ad-hoc solution I changed the source code and commented a part of the rtc-snvs driver, but I would like to know what should be the proper solution. How could I change the order of loading drivers? Or maybe there is some other solution?

Many thanks

标签 (2)
0 项奖励
回复
8 回复数

2,516 次查看
stasgil
Contributor III

I'm struggling with pm_power_off myself, but i imagine you want to maybe disable the snvs driver (CONFIG_POWER_RESET_IMX option ), maybe then it won't override your desired function ?

0 项奖励
回复

2,516 次查看
nexy_sm
Contributor II

Stas Gil wrote:

I'm struggling with pm_power_off myself, but i imagine you want to maybe disable the snvs driver (CONFIG_POWER_RESET_IMX option ), maybe then it won't override your desired function ?

This is true, I did select snvs driver as a module, but I wanted to ovrcome the problem without doing this. Just by loading gpio-poweroff_ driver first.

0 项奖励
回复

2,516 次查看
stasgil
Contributor III

I see.. I think the only way i know would be to change the driver initialization order in do_initcalls() inside the kernel ?

See this: What is the Linux built-in driver load order? - Stack Overflow 

But i'm not sure if snvs and gpio drivers would be the same runlevel.

Also a question for you if you don't mind. At which point does rtc-snvs.c override the pm_power_off function ? I don't seem to be able to find this piece of code, all this driver does for me is suspend clock (kernel 4.1.15)

0 项奖励
回复

2,517 次查看
nexy_sm
Contributor II

Also a question for you if you don't mind. At which point does rtc-snvs.c override the pm_power_off function ? I don't seem to be able to find this piece of code, all this driver does for me is suspend clock (kernel 4.1.15)

In probe function, there is:

if (!pm_power_off){

If the function pointer is not null than it will be set. The same principle you can find in the probe function of the gpio-poweroff module. I can at the moment open the source code, but if you struggle to find it, I can post later/

0 项奖励
回复

2,517 次查看
stasgil
Contributor III

Hmm i see... So is that in rtc-omap.c driver file ? I thought you meant rtc-snvs.c

0 项奖励
回复

2,517 次查看
nexy_sm
Contributor II
0 项奖励
回复

2,517 次查看
stasgil
Contributor III

Huh, i see sorry. I'm on kernel 4.1.15, so i dont have the check for the pm_power_off in that driver.

As i said, i dont think i have any other suggestions, apart from changing init order of the built in modules.

But, you could also change the rtc-snvs driver in menuconfig to M option instead of *, that way you could modprobe this driver on startup in one of the rc scripts. I think that way, your gpio controller might initialize first. This is just an idea.

0 项奖励
回复

2,517 次查看
joanxie
NXP TechSupport
NXP TechSupport

for  how to change the source code and build it, pls refer to the yocto training,  tell you how to build your own source code

https://community.nxp.com/docs/DOC-94849 

0 项奖励
回复