From 5b5a54b60f45e67d647cf6cc0fe2b879b2bb8229 Mon Sep 17 00:00:00 2001 From: Yuichi Kusakabe Date: Sun, 21 May 2017 23:54:46 +0900 Subject: Add s3ctl Hibernation code for porter board. This patch set is a support to Hibernation for a porter board. I've commit with Hibernation Off patch, because it depends strongly on user land. If you can use Hibernation, Please add local.conf agl-porter-hibernate. OVERRIDES .= ":agl-porter-hibernate" DISTRO_FEATURES_append = " agl-porter-hibernate" Change-Id: I06dfe57abf8ff8c79151e4f15432b5445a7811e2 Signed-off-by: Yuichi Kusakabe Reviewed-on: https://gerrit.automotivelinux.org/gerrit/9447 Tested-by: Jenkins Job builder account ci-image-build: Jenkins Job builder account ci-image-boot-test: Jenkins Job builder account Reviewed-by: Jan-Simon Moeller --- .../files/0001-Add-s3ctl-hibernation-code.patch | 101 +++++++++++++++++++++ .../s3ctl-module/s3ctl-kernel-module.bbappend | 4 + 2 files changed, 105 insertions(+) create mode 100644 meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/files/0001-Add-s3ctl-hibernation-code.patch create mode 100644 meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bbappend (limited to 'meta-agl-bsp') diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/files/0001-Add-s3ctl-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/files/0001-Add-s3ctl-hibernation-code.patch new file mode 100644 index 000000000..b5d9050b2 --- /dev/null +++ b/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/files/0001-Add-s3ctl-hibernation-code.patch @@ -0,0 +1,101 @@ +From 03253eae0da9a84e343a8f21c65ac07196369420 Mon Sep 17 00:00:00 2001 +From: Yuichi Kusakabe +Date: Sun, 21 May 2017 23:08:52 +0900 +Subject: [PATCH] Add s3ctl hibernation code + +Signed-off-by: Yuichi Kusakabe +--- + drv/s3ctl_drv.c | 50 ++++++++++++++++++++++++++++++++++++++------------ + 1 file changed, 38 insertions(+), 12 deletions(-) + +diff --git a/drv/s3ctl_drv.c b/drv/s3ctl_drv.c +index a7b4bee..6640a49 100755 +--- a/drv/s3ctl_drv.c ++++ b/drv/s3ctl_drv.c +@@ -66,6 +66,7 @@ + #include + #include + #include ++#include + + #include "s3ctl_private.h" + +@@ -332,19 +333,10 @@ static struct miscdevice misc = { + .fops = &fops, + }; + +- +-static int s3ctrl_init(void) ++static int s3ctl_initialize(void) + { +- int ret; +- unsigned int product; +- unsigned int es; +- +- ret = map_register(); +- if (ret != 0) { +- printk(KERN_ERR "S3D map_register() NG\n"); +- return -1; +- } +- ++ int product; ++ int es; + product = S3_PRR_PRODUCTMASK & ioread32((void *)top_prr); + es = S3_PRR_ESMASK & ioread32((void *)top_prr); + if (product == S3_PRR_H2) { +@@ -366,11 +358,44 @@ static int s3ctrl_init(void) + set_xymodeconf(S3_XYMODE_VAL_NEW); + } else + set_xymodeconf(S3_XYMODE_VAL_NEW); ++ return 0; ++} ++ ++static int s3ctl_cpu_pm_notify(struct notifier_block *self, ++ unsigned long action, void *hcpu) ++{ ++ if (action == PM_HIBERNATION_PREPARE) ++ ; ++ else if (action == PM_POST_HIBERNATION) { ++ pr_info("%s: hibernation finished: %ld\n", __func__, action); ++ s3ctl_initialize(); ++ } ++ return NOTIFY_DONE; ++} ++ ++static struct notifier_block s3ctl_pm_notifier_block = { ++ .notifier_call = s3ctl_cpu_pm_notify, ++}; ++ ++static int s3ctrl_init(void) ++{ ++ int ret; ++ unsigned int product; ++ unsigned int es; ++ ++ ret = map_register(); ++ if (ret != 0) { ++ printk(KERN_ERR "S3D map_register() NG\n"); ++ return -1; ++ } ++ s3ctl_initialize(); + + misc_register(&misc); + + spin_lock_init(&lock); + ++ register_pm_notifier(&s3ctl_pm_notifier_block); ++ + return 0; + } + +@@ -379,6 +404,7 @@ static void s3ctrl_exit(void) + misc_deregister(&misc); + + unmap_register(); ++ unregister_pm_notifier(&s3ctl_pm_notifier_block); + } + + module_init(s3ctrl_init); +-- +1.8.3.1 + diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bbappend b/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bbappend new file mode 100644 index 000000000..172418402 --- /dev/null +++ b/meta-agl-bsp/meta-renesas/recipes-kernel/s3ctl-module/s3ctl-kernel-module.bbappend @@ -0,0 +1,4 @@ +FILESEXTRAPATHS_prepend := '${THISDIR}/files:' +SRC_URI_append_agl-porter-hibernate = " file://0001-Add-s3ctl-hibernation-code.patch \ + " + -- cgit 1.2.3-korg