Commit d084e13a authored by Govindraj Raja's avatar Govindraj Raja Committed by Herbert Xu

crypto: img-hash - Add suspend resume hooks for img hash

Current img hash claims sys and periph gate clocks
and this can be gated in system suspend scenarios.

Add support for Device pm ops for img hash to gate
the clocks claimed by img hash.
Signed-off-by: default avatarGovindraj Raja <Govindraj.Raja@imgtec.com>
Reviewed-by: default avatarWill Thomas <will.thomas@imgtec.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 302a1bee
...@@ -1016,11 +1016,38 @@ static int img_hash_remove(struct platform_device *pdev) ...@@ -1016,11 +1016,38 @@ static int img_hash_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM_SLEEP
static int img_hash_suspend(struct device *dev)
{
struct img_hash_dev *hdev = dev_get_drvdata(dev);
clk_disable_unprepare(hdev->hash_clk);
clk_disable_unprepare(hdev->sys_clk);
return 0;
}
static int img_hash_resume(struct device *dev)
{
struct img_hash_dev *hdev = dev_get_drvdata(dev);
clk_prepare_enable(hdev->hash_clk);
clk_prepare_enable(hdev->sys_clk);
return 0;
}
#endif /* CONFIG_PM_SLEEP */
static const struct dev_pm_ops img_hash_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(img_hash_suspend, img_hash_resume)
};
static struct platform_driver img_hash_driver = { static struct platform_driver img_hash_driver = {
.probe = img_hash_probe, .probe = img_hash_probe,
.remove = img_hash_remove, .remove = img_hash_remove,
.driver = { .driver = {
.name = "img-hash-accelerator", .name = "img-hash-accelerator",
.pm = &img_hash_pm_ops,
.of_match_table = of_match_ptr(img_hash_match), .of_match_table = of_match_ptr(img_hash_match),
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment