Setting correct pm_power_off in kernel 3.14.52

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Setting correct pm_power_off in kernel 3.14.52

2,009 Views
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

Labels (2)
0 Kudos
8 Replies

1,619 Views
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 Kudos

1,619 Views
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 Kudos

1,619 Views
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 Kudos

1,620 Views
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 Kudos

1,620 Views
stasgil
Contributor III

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

0 Kudos

1,620 Views
nexy_sm
Contributor II
0 Kudos

1,620 Views
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 Kudos

1,620 Views
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 Kudos