From 11a6af7e4ba3ad21d8effe8a0f40235768781ea3 Mon Sep 17 00:00:00 2001 From: Yuichi Kusakabe Date: Sat, 10 Jun 2017 19:55:26 +0900 Subject: Add hibernation image area This patch set add DDR hibernation image area. 0x40000000 <-> 0x77FFFFFF : kernel 0x78000000 <-> 0x7FFFFFFF : hibernation image area and Fix Black blink correction of display. Change-Id: I286b5291cb2eed22334a95132ba4a137eff298ca Signed-off-by: Yuichi Kusakabe Reviewed-on: https://gerrit.automotivelinux.org/gerrit/9699 Tested-by: Jenkins Job builder account ci-image-build: Jenkins Job builder account Reviewed-by: Jan-Simon Moeller --- .../recipes-kernel/linux/linux-renesas_%.bbappend | 3 + .../0001-Add-shdmac-hibernation-code.patch | 110 +++++++++++++++++++++ ...002-Fix-Black-blink-correction-of-display.patch | 88 +++++++++++++++++ .../0003-Add-hibernation-image-area.patch | 32 ++++++ .../linux/linux/hibernation/hibernation.cfg | 4 +- 5 files changed, 235 insertions(+), 2 deletions(-) create mode 100644 meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-shdmac-hibernation-code.patch create mode 100644 meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Fix-Black-blink-correction-of-display.patch create mode 100644 meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-hibernation-image-area.patch (limited to 'meta-agl-bsp/meta-renesas') diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux-renesas_%.bbappend b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux-renesas_%.bbappend index 35b225354..8a164235e 100755 --- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux-renesas_%.bbappend +++ b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux-renesas_%.bbappend @@ -32,6 +32,9 @@ SRC_URI_append_agl-porter-hibernate = " file://hibernation/0001-Add-Hibernation- file://hibernation/0013-Add-rcar-spi-hibernation-code.patch \ file://hibernation/0014-Add-rcar-sci-hibernation-code.patch \ file://hibernation/0015-Add-rcar-usbphy-hibernation-code.patch \ + file://hibernation/0001-Add-shdmac-hibernation-code.patch \ + file://hibernation/0002-Fix-Black-blink-correction-of-display.patch \ + file://hibernation/0003-Add-hibernation-image-area.patch \ file://hibernation/hibernation.cfg \ " diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-shdmac-hibernation-code.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-shdmac-hibernation-code.patch new file mode 100644 index 000000000..ad4e4bc03 --- /dev/null +++ b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0001-Add-shdmac-hibernation-code.patch @@ -0,0 +1,110 @@ +From dfc07c05c50155420e47f85442d099d433db869b Mon Sep 17 00:00:00 2001 +From: Yuichi Kusakabe +Date: Fri, 9 Jun 2017 20:11:49 +0900 +Subject: [PATCH 1/3] Add shdmac hibernation code + +Signed-off-by: Yuichi Kusakabe +--- + drivers/dma/sh/shdmac.c | 36 ++++++++++++++++++++++++------------ + 1 file changed, 24 insertions(+), 12 deletions(-) + +diff --git a/drivers/dma/sh/shdmac.c b/drivers/dma/sh/shdmac.c +index 1c97cc5..d084437 100644 +--- a/drivers/dma/sh/shdmac.c ++++ b/drivers/dma/sh/shdmac.c +@@ -743,11 +743,20 @@ static int sh_dmae_resume(struct device *dev) + #define sh_dmae_resume NULL + #endif + ++static int sh_dmae_restore(struct device *dev) ++{ ++#ifdef CONFIG_PM ++ return sh_dmae_resume(dev); ++#else ++ return 0; ++#endif ++} ++ + const struct dev_pm_ops sh_dmae_pm = { +- .suspend = sh_dmae_suspend, +- .resume = sh_dmae_resume, +- .runtime_suspend = sh_dmae_runtime_suspend, +- .runtime_resume = sh_dmae_runtime_resume, ++ SET_SYSTEM_SLEEP_PM_OPS(sh_dmae_suspend, sh_dmae_resume) ++ SET_RUNTIME_PM_OPS(sh_dmae_runtime_suspend, sh_dmae_runtime_resume, ++ NULL) ++ .restore_noirq = sh_dmae_restore, + }; + + static dma_addr_t sh_dmae_slave_addr(struct shdma_chan *schan) +@@ -798,7 +807,6 @@ static int sh_dmae_probe(struct platform_device *pdev) + struct sh_dmae_device *shdev; + struct dma_device *dma_dev; + struct resource *chan, *dmars, *errirq_res, *chanirq_res; +- unsigned long flags; + + if (pdev->dev.of_node) + pdata = of_match_device(sh_dmae_of_match, &pdev->dev)->data; +@@ -885,9 +893,9 @@ static int sh_dmae_probe(struct platform_device *pdev) + if (err < 0) + dev_err(&pdev->dev, "%s(): GET = %d\n", __func__, err); + +- spin_lock_irqsave(&sh_dmae_lock, flags); ++ spin_lock_irq(&sh_dmae_lock); + list_add_tail_rcu(&shdev->node, &sh_dmae_devices); +- spin_unlock_irqrestore(&sh_dmae_lock, flags); ++ spin_unlock_irq(&sh_dmae_lock); + + /* reset dma controller - only needed as a test */ + err = sh_dmae_rst(shdev); +@@ -981,6 +989,7 @@ static int sh_dmae_probe(struct platform_device *pdev) + return err; + + edmadevreg: ++ pm_runtime_get(&pdev->dev); + chan_probe_err: + sh_dmae_chan_remove(shdev); + +@@ -988,9 +997,9 @@ chan_probe_err: + eirq_err: + #endif + rst_err: +- spin_lock_irqsave(&sh_dmae_lock, flags); ++ spin_lock_irq(&sh_dmae_lock); + list_del_rcu(&shdev->node); +- spin_unlock_irqrestore(&sh_dmae_lock, flags); ++ spin_unlock_irq(&sh_dmae_lock); + + pm_runtime_put(&pdev->dev); + pm_runtime_disable(&pdev->dev); +@@ -1007,13 +1016,12 @@ static int sh_dmae_remove(struct platform_device *pdev) + { + struct sh_dmae_device *shdev = platform_get_drvdata(pdev); + struct dma_device *dma_dev = &shdev->shdma_dev.dma_dev; +- unsigned long flags; + + dma_async_device_unregister(dma_dev); + +- spin_lock_irqsave(&sh_dmae_lock, flags); ++ spin_lock_irq(&sh_dmae_lock); + list_del_rcu(&shdev->node); +- spin_unlock_irqrestore(&sh_dmae_lock, flags); ++ spin_unlock_irq(&sh_dmae_lock); + + pm_runtime_disable(&pdev->dev); + +@@ -1047,7 +1055,11 @@ static int __init sh_dmae_init(void) + + return platform_driver_probe(&sh_dmae_driver, sh_dmae_probe); + } ++#ifdef MODULE + module_init(sh_dmae_init); ++#else ++subsys_initcall(sh_dmae_init); ++#endif + + static void __exit sh_dmae_exit(void) + { +-- +1.8.3.1 + diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Fix-Black-blink-correction-of-display.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Fix-Black-blink-correction-of-display.patch new file mode 100644 index 000000000..2ef1129ce --- /dev/null +++ b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0002-Fix-Black-blink-correction-of-display.patch @@ -0,0 +1,88 @@ +From 175a91f2068c5cb4a9be5aa1ea5f1e24e2919bbb Mon Sep 17 00:00:00 2001 +From: Yuichi Kusakabe +Date: Fri, 9 Jun 2017 20:13:59 +0900 +Subject: [PATCH 2/3] Fix Black blink correction of display + +Signed-off-by: Yuichi Kusakabe +--- + drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 1 + + drivers/gpu/drm/rcar-du/rcar_du_crtc.h | 1 + + drivers/gpu/drm/rcar-du/rcar_du_drv.c | 13 ++++--------- + drivers/gpu/drm/rcar-du/rcar_du_group.c | 4 ++-- + 4 files changed, 8 insertions(+), 11 deletions(-) + +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +index 262d8a8d..ab3bb09 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.c +@@ -1027,4 +1027,5 @@ void rcar_du_crtc_enable_vblank(struct rcar_du_crtc *rcrtc, bool enable) + } else { + rcar_du_crtc_clr(rcrtc, DIER, DIER_VBE); + } ++ rcrtc->vblank_enable = enable; + } +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h +index 6cdd02e6..19c0d69 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_crtc.h ++++ b/drivers/gpu/drm/rcar-du/rcar_du_crtc.h +@@ -49,6 +49,7 @@ struct rcar_du_crtc { + int lif_enable; + void *vpsd_handle; + #endif ++ bool vblank_enable; + }; + + #define to_rcar_crtc(c) container_of(c, struct rcar_du_crtc, crtc) +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c +index fbb212c..f83501d 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c +@@ -517,7 +517,7 @@ static int rcar_du_pm_resume(struct device *dev) + + return 0; + } +-#ifdef CONFIG_MACH_FTEN ++ + static int rcar_du_pm_freeze(struct device *dev) + { + int ret; +@@ -546,18 +546,13 @@ static int rcar_du_pm_restore(struct device *dev) + return ret; + } + #endif +-#endif ++ + static const struct dev_pm_ops rcar_du_pm_ops = { +-#if defined(CONFIG_MACH_FTEN) && defined(CONFIG_HIBERNATION) && \ +- defined(CONFIG_PM_SLEEP) +- .suspend = rcar_du_pm_suspend, +- .resume = rcar_du_pm_resume, ++ SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, rcar_du_pm_resume) ++#ifdef CONFIG_HIBERNATION + .freeze = rcar_du_pm_freeze, + .thaw = rcar_du_pm_thaw, +- .poweroff = rcar_du_pm_suspend, + .restore = rcar_du_pm_restore, +-#else +- SET_SYSTEM_SLEEP_PM_OPS(rcar_du_pm_suspend, rcar_du_pm_resume) + #endif + }; + +diff --git a/drivers/gpu/drm/rcar-du/rcar_du_group.c b/drivers/gpu/drm/rcar-du/rcar_du_group.c +index 3620040..0e571d4 100644 +--- a/drivers/gpu/drm/rcar-du/rcar_du_group.c ++++ b/drivers/gpu/drm/rcar-du/rcar_du_group.c +@@ -151,8 +151,8 @@ void rcar_du_group_start_stop(struct rcar_du_group *rgrp, bool start) + * when the display controller will have to be restarted. + */ + if (start) { +- if (rgrp->used_crtcs++ != 0) +- __rcar_du_group_start_stop(rgrp, false); ++ rgrp->used_crtcs++; ++ __rcar_du_group_start_stop(rgrp, false); + __rcar_du_group_start_stop(rgrp, true); + } else { + if (--rgrp->used_crtcs == 0) +-- +1.8.3.1 + diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-hibernation-image-area.patch b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-hibernation-image-area.patch new file mode 100644 index 000000000..5901cc2b1 --- /dev/null +++ b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/0003-Add-hibernation-image-area.patch @@ -0,0 +1,32 @@ +From 4d35f60f9bd47aebc104d34b9099e8e4f69fa53a Mon Sep 17 00:00:00 2001 +From: Yuichi Kusakabe +Date: Fri, 9 Jun 2017 20:15:32 +0900 +Subject: [PATCH 3/3] Add hibernation image area + +0x40000000 <-> 0x77FFFFFF : kernel +0x78000000 <-> 0x7FFFFFFF : hibernation image area + +Signed-off-by: Yuichi Kusakabe +--- + arch/arm/boot/dts/r8a7791-porter.dts | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/r8a7791-porter.dts b/arch/arm/boot/dts/r8a7791-porter.dts +index b1acf4a..a0e273e 100644 +--- a/arch/arm/boot/dts/r8a7791-porter.dts ++++ b/arch/arm/boot/dts/r8a7791-porter.dts +@@ -42,7 +42,10 @@ + + memory@40000000 { + device_type = "memory"; +- reg = <0 0x40000000 0 0x40000000>; ++/* reg = <0 0x40000000 0 0x40000000>; */ ++/* 0x40000000 <-> 0x77FFFFFF : kernel */ ++/* 0x78000000 <-> 0x7FFFFFFF : snap */ ++ reg = <0 0x40000000 0 0x38000000>; + }; + + memory@200000000 { +-- +1.8.3.1 + diff --git a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/hibernation.cfg b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/hibernation.cfg index 45521d25d..eddb52ce7 100755 --- a/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/hibernation.cfg +++ b/meta-agl-bsp/meta-renesas/recipes-kernel/linux/linux/hibernation/hibernation.cfg @@ -1,5 +1,5 @@ -CONFIG_SWSUSP_AREA=0x7A000000 -CONFIG_SWSUSP_AREA_SIZE=0x4000000 +CONFIG_SWSUSP_AREA=0x78000000 +CONFIG_SWSUSP_AREA_SIZE=0x8000000 CONFIG_HIBERNATE_CALLBACKS=y CONFIG_HIBERNATION=y CONFIG_PM_STD_PARTITION="" -- cgit 1.2.3-korg