1 From 03253eae0da9a84e343a8f21c65ac07196369420 Mon Sep 17 00:00:00 2001
2 From: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
3 Date: Sun, 21 May 2017 23:08:52 +0900
4 Subject: [PATCH] Add s3ctl hibernation code
6 Signed-off-by: Yuichi Kusakabe <yuichi.kusakabe@jp.fujitsu.com>
8 drv/s3ctl_drv.c | 50 ++++++++++++++++++++++++++++++++++++++------------
9 1 file changed, 38 insertions(+), 12 deletions(-)
11 diff --git a/drv/s3ctl_drv.c b/drv/s3ctl_drv.c
12 index a7b4bee..6640a49 100755
16 #include <linux/ioctl.h>
17 #include <linux/slab.h>
18 #include <linux/dma-mapping.h>
19 +#include <linux/suspend.h>
21 #include "s3ctl_private.h"
23 @@ -332,19 +333,10 @@ static struct miscdevice misc = {
28 -static int s3ctrl_init(void)
29 +static int s3ctl_initialize(void)
32 - unsigned int product;
35 - ret = map_register();
37 - printk(KERN_ERR "S3D map_register() NG\n");
43 product = S3_PRR_PRODUCTMASK & ioread32((void *)top_prr);
44 es = S3_PRR_ESMASK & ioread32((void *)top_prr);
45 if (product == S3_PRR_H2) {
46 @@ -366,11 +358,44 @@ static int s3ctrl_init(void)
47 set_xymodeconf(S3_XYMODE_VAL_NEW);
49 set_xymodeconf(S3_XYMODE_VAL_NEW);
53 +static int s3ctl_cpu_pm_notify(struct notifier_block *self,
54 + unsigned long action, void *hcpu)
56 + if (action == PM_HIBERNATION_PREPARE)
58 + else if (action == PM_POST_HIBERNATION) {
59 + pr_info("%s: hibernation finished: %ld\n", __func__, action);
65 +static struct notifier_block s3ctl_pm_notifier_block = {
66 + .notifier_call = s3ctl_cpu_pm_notify,
69 +static int s3ctrl_init(void)
72 + unsigned int product;
75 + ret = map_register();
77 + printk(KERN_ERR "S3D map_register() NG\n");
84 spin_lock_init(&lock);
86 + register_pm_notifier(&s3ctl_pm_notifier_block);
91 @@ -379,6 +404,7 @@ static void s3ctrl_exit(void)
92 misc_deregister(&misc);
95 + unregister_pm_notifier(&s3ctl_pm_notifier_block);
98 module_init(s3ctrl_init);