大家好,我們產品是android7.1+msm8937方案,按鍵驅動里我增加休眠和喚醒的處理函式tca8418_keypad_suspend()和tca8418_keypad_resume,但測驗確認沒有呼叫,除了這里需要增加的,是否還是需要在設備樹種增加對應的,或是是哪里有問題?請教大家了。
#ifdef CONFIG_PM
static int tca8418_keypad_suspend(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);;
disable_irq(client->irq);
dev_err(dev, "tca8418_keypad_suspend()\n");
return 0;
}
static int tca8418_keypad_resume(struct device *dev)
{
struct i2c_client *client = to_i2c_client(dev);
dev_err(dev, "tca8418_keypad_resume()\n");
enable_irq(client->irq);
return 0;
}
static const struct dev_pm_ops tca8418_dev_pm_ops = {
.suspend = tca8418_keypad_suspend,
.resume = tca8418_keypad_resume,
};
#endif
static struct i2c_driver tca8418_keypad_driver = {
.driver = {
.name = TCA8418_NAME,
.owner = THIS_MODULE,
#ifdef CONFIG_PM
.pm = &tca8418_dev_pm_ops,
#endif
.of_match_table = of_match_ptr(tca8418_dt_ids),
},
.probe = tca8418_keypad_probe,
.id_table = tca8418_id,,
};
uj5u.com熱心網友回復:
用notifier機制應該可以把uj5u.com熱心網友回復:
同意樓上的。我在Rockchip平臺suspend和resume也不會呼叫,是通過notifier解決的uj5u.com熱心網友回復:
使用early suspend試試Android平臺可能配置early suspend,suspend和resume不會被呼叫,走的是early suspend的流程,之前在Rockchip 3188芯片碰到過這個問題,是3.0.104 kernel.
uj5u.com熱心網友回復:
怎么配置為early suspend,請教了。uj5u.com熱心網友回復:
檢查Kernel配置是否有打開
Power management options
[ * ] Early supend
如果有打開,應該就是走了early suspend的流程,如果沒有,那要查找其他原因
uj5u.com熱心網友回復:
如果使用early suspend,用下面的代碼片段注冊callback:/* declare it to somewhere properly */
#ifdef CONFIG_HAS_EARLYSUSPEND
struct early_suspend early_suspend;
#endif
/* setup early suspend */
#ifdef CONFIG_HAS_EARLYSUSPEND
early_suspend.level = EARLY_SUSPEND_LEVEL_XXX;
early_suspend.suspend = xxx_early_suspend;
early_suspend.resume = xxx_late_resume;
register_early_suspend(&early_suspend);
#endif
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/102082.html
標籤:驅動開發/核心開發
上一篇:Unity通過NDK、JNI實作C#、java、C/C++之間的相互呼叫
下一篇:網站如何被百度快速收錄呢?
