xref: /linux/drivers/crypto/ccree/cc_pm.h (revision 3db617e77ae2f8051fd6f5d3fff0e15f086d5b4c)
14c3f9727SGilad Ben-Yossef /* SPDX-License-Identifier: GPL-2.0 */
203963caeSGilad Ben-Yossef /* Copyright (C) 2012-2019 ARM Limited (or its affiliates). */
34c3f9727SGilad Ben-Yossef 
44c3f9727SGilad Ben-Yossef /* \file cc_pm.h
54c3f9727SGilad Ben-Yossef  */
64c3f9727SGilad Ben-Yossef 
74c3f9727SGilad Ben-Yossef #ifndef __CC_POWER_MGR_H__
84c3f9727SGilad Ben-Yossef #define __CC_POWER_MGR_H__
94c3f9727SGilad Ben-Yossef 
104c3f9727SGilad Ben-Yossef #include "cc_driver.h"
114c3f9727SGilad Ben-Yossef 
124c3f9727SGilad Ben-Yossef #define CC_SUSPEND_TIMEOUT 3000
134c3f9727SGilad Ben-Yossef 
144c3f9727SGilad Ben-Yossef #if defined(CONFIG_PM)
154c3f9727SGilad Ben-Yossef 
164c3f9727SGilad Ben-Yossef extern const struct dev_pm_ops ccree_pm;
174c3f9727SGilad Ben-Yossef 
184c3f9727SGilad Ben-Yossef int cc_pm_init(struct cc_drvdata *drvdata);
191358c13aSGilad Ben-Yossef void cc_pm_go(struct cc_drvdata *drvdata);
204c3f9727SGilad Ben-Yossef void cc_pm_fini(struct cc_drvdata *drvdata);
214c3f9727SGilad Ben-Yossef int cc_pm_suspend(struct device *dev);
224c3f9727SGilad Ben-Yossef int cc_pm_resume(struct device *dev);
234c3f9727SGilad Ben-Yossef int cc_pm_get(struct device *dev);
244c3f9727SGilad Ben-Yossef int cc_pm_put_suspend(struct device *dev);
25*3db617e7SOfir Drang bool cc_pm_is_dev_suspended(struct device *dev);
264c3f9727SGilad Ben-Yossef 
274c3f9727SGilad Ben-Yossef #else
284c3f9727SGilad Ben-Yossef 
294c3f9727SGilad Ben-Yossef static inline int cc_pm_init(struct cc_drvdata *drvdata)
304c3f9727SGilad Ben-Yossef {
314c3f9727SGilad Ben-Yossef 	return 0;
324c3f9727SGilad Ben-Yossef }
334c3f9727SGilad Ben-Yossef 
34f1071c3eSGilad Ben-Yossef static inline void cc_pm_go(struct cc_drvdata *drvdata) {}
351358c13aSGilad Ben-Yossef 
364c3f9727SGilad Ben-Yossef static inline void cc_pm_fini(struct cc_drvdata *drvdata) {}
374c3f9727SGilad Ben-Yossef 
384c3f9727SGilad Ben-Yossef static inline int cc_pm_suspend(struct device *dev)
394c3f9727SGilad Ben-Yossef {
404c3f9727SGilad Ben-Yossef 	return 0;
414c3f9727SGilad Ben-Yossef }
424c3f9727SGilad Ben-Yossef 
434c3f9727SGilad Ben-Yossef static inline int cc_pm_resume(struct device *dev)
444c3f9727SGilad Ben-Yossef {
454c3f9727SGilad Ben-Yossef 	return 0;
464c3f9727SGilad Ben-Yossef }
474c3f9727SGilad Ben-Yossef 
484c3f9727SGilad Ben-Yossef static inline int cc_pm_get(struct device *dev)
494c3f9727SGilad Ben-Yossef {
504c3f9727SGilad Ben-Yossef 	return 0;
514c3f9727SGilad Ben-Yossef }
524c3f9727SGilad Ben-Yossef 
534c3f9727SGilad Ben-Yossef static inline int cc_pm_put_suspend(struct device *dev)
544c3f9727SGilad Ben-Yossef {
554c3f9727SGilad Ben-Yossef 	return 0;
564c3f9727SGilad Ben-Yossef }
574c3f9727SGilad Ben-Yossef 
58*3db617e7SOfir Drang static inline bool cc_pm_is_dev_suspended(struct device *dev)
59*3db617e7SOfir Drang {
60*3db617e7SOfir Drang 	/* if PM not supported device is never suspend */
61*3db617e7SOfir Drang 	return false;
62*3db617e7SOfir Drang }
63*3db617e7SOfir Drang 
644c3f9727SGilad Ben-Yossef #endif
654c3f9727SGilad Ben-Yossef 
664c3f9727SGilad Ben-Yossef #endif /*__POWER_MGR_H__*/
67