ARM: EXYNOS4: Support for generic I/O power domains on EXYNOS4210
Subsystems (3)
PATCH v2 1/1 ARM: EXYNOS4: Support for generic I/O power domains on EXYNOS4210
Use the generic power domains support to implement support for power domain on EXYNOS4210.
I refer to the following patch to implement what configure the clock-gating control register for block to turn off/on:
http://git.infradead.org/users/kmpark/linux-2.6-samsung/commit/39a81876d034dcbdc2a4c4c4b847b3b49e38870c
This patch is based on following "pm-domains" branch.
http://git.kernel.org/?p=linux/kernel/git/rafael/suspend-2.6.git;a=shortlog;h=refs/heads/pm-domains
--- arch/arm/mach-exynos4/Kconfig | 1 + arch/arm/mach-exynos4/Makefile | 1 + arch/arm/mach-exynos4/include/mach/pm-exynos4210.h | 69 ++++++++ arch/arm/mach-exynos4/include/mach/regs-clock.h | 8 + arch/arm/mach-exynos4/mach-nuri.c | 20 +++ arch/arm/mach-exynos4/pm-exynos4210.c | 170 ++++++++++++++++++++ arch/arm/plat-samsung/include/plat/pd.h | 3 +- 7 files changed, 271 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-exynos4/include/mach/pm-exynos4210.h create mode 100644 arch/arm/mach-exynos4/pm-exynos4210.c
arch/arm/mach-exynos4/Kconfig +1 -0
@@ -183,6 +183,7 @@ config MACH_NURI select EXYNOS4_SETUP_SDHCI select EXYNOS4_SETUP_USB_PHY select SAMSUNG_DEV_PWM + select PM_GENERIC_DOMAINS help Machine support for Samsung Mobile NURI Board.
arch/arm/mach-exynos4/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_CPU_EXYNOS4210) += setup-i2c0.o irq-eint.o dma.o obj-$(CONFIG_PM) += pm.o sleep.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o +obj-$(CONFIG_CPU_EXYNOS4210) += pm-exynos4210.o obj-$(CONFIG_SMP) += platsmp.o headsmp.o
arch/arm/mach-exynos4/include/mach/pm-exynos4210.h new file +69 -0
69 lines not on this page · raw message
arch/arm/mach-exynos4/include/mach/regs-clock.h +8 -0
@@ -171,6 +171,14 @@#define S5P_CLKDIV_BUS_GPLR_SHIFT (4)#define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) +#define S5P_CLKGATE_BLOCK_CAM (1<<0) +#define S5P_CLKGATE_BLOCK_TV (1<<1) +#define S5P_CLKGATE_BLOCK_MFC (1<<2) +#define S5P_CLKGATE_BLOCK_G3D (1<<3) +#define S5P_CLKGATE_BLOCK_LCD0 (1<<4) +#define S5P_CLKGATE_BLOCK_LCD1 (1<<5) +#define S5P_CLKGATE_BLOCK_GPS (1<<7) +/* Compatibility defines and inclusion */ #include <mach/regs-pmu.h>
arch/arm/mach-exynos4/mach-nuri.c +20 -0
@@ -37,6 +37,7 @@#include <plat/iic.h> #include <mach/map.h> +#include <mach/pm-exynos4210.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \
@@ -376,6 +377,23 @@ static struct platform_device *nuri_devices[] __initdata = { &nuri_backlight_device, }; +static void __init nuri_power_domain_init (void ) +{ +int i; + +for (i =0 ; i <PD_MAX_NUM ; i++) +exynos4210_pd_init (&exynos4210_pd_list[i]); + +/* Add device to power-domain */ +exynos4210_add_device_to_domain (EXYNOS4210_MFC ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_G3D ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_LCD0 , &nuri_lcd_device); +exynos4210_add_device_to_domain (EXYNOS4210_LCD1 ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_TV ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_CAM ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_GPS ,NULL ); +} +static void __init nuri_map_io (void ) {s5p_init_io (NULL ,0 ,S5P_VA_CHIPID );
@@ -398,6 +416,8 @@ static void __init nuri_machine_init(void)/* Last */ platform_add_devices (nuri_devices,ARRAY_SIZE (nuri_devices)); + +nuri_power_domain_init (); }MACHINE_START (NURI ,"NURI" )
arch/arm/mach-exynos4/pm-exynos4210.c new file +170 -0
170 lines not on this page · raw message
arch/arm/plat-samsung/include/plat/pd.h +2 -1
@@ -24,7 +24,8 @@ enum exynos4_pd_block {PD_LCD1 ,PD_TV ,PD_CAM , -PD_GPS +PD_GPS , +PD_MAX_NUM };#endif /* __ASM_PLAT_SAMSUNG_PD_H */
Signature · 1 line
1.7.0.4
Hi,
Quoted 30 lines · Chanwoo Choi
Use the generic power domains support to implement support for power domain on EXYNOS4210.
I refer to the following patch to implement what configure the clock-gating control register for block to turn off/on:
http://git.infradead.org/users/kmpark/linux-2.6-samsung/commit/39a81876d034dcbdc2a4c4c4b847b3b49e38870cThis patch is based on following "pm-domains" branch.
http://git.kernel.org/?p=linux/kernel/git/rafael/suspend-2.6.git;a=shortlog;h=refs/heads/pm-domainsSigned-off-by Chanwoo Choi <[email protected]>Signed-off-by MyungJoo Ham <[email protected]>Signed-off-by Kyungmin.park <[email protected]>--- arch/arm/mach-exynos4/Kconfig | 1 + arch/arm/mach-exynos4/Makefile | 1 + arch/arm/mach-exynos4/include/mach/pm-exynos4210.h | 69 ++++++++ arch/arm/mach-exynos4/include/mach/regs-clock.h | 8 + arch/arm/mach-exynos4/mach-nuri.c | 20 +++ arch/arm/mach-exynos4/pm-exynos4210.c | 170 ++++++++++++++++++++ arch/arm/plat-samsung/include/plat/pd.h | 3 +- 7 files changed, 271 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-exynos4/include/mach/pm-exynos4210.h create mode 100644 arch/arm/mach-exynos4/pm-exynos4210.carch/arm/mach-exynos4/Kconfig +0
-0
arch/arm/mach-exynos4/Kconfig config MACH_NURI · line 186
Quoted 4 lines
arch/arm/mach-exynos4/Kconfig +1
-0@@ -183,6 +183,7 @@ config MACH_NURI select EXYNOS4_SETUP_SDHCI select EXYNOS4_SETUP_USB_PHY select SAMSUNG_DEV_PWM + select PM_GENERIC_DOMAINS
That should be "select PM_GENERIC_DOMAINS if PM". Otherwise it will be selected even for CONFIG_PM unset.
Quoted 130 lines
arch/arm/mach-exynos4/Kconfig +0
-0help Machine support for Samsung Mobile NURI Board.arch/arm/mach-exynos4/Makefile +1
-0@@ -17,6 +17,7 @@ obj-$(CONFIG_CPU_EXYNOS4210) += setup-i2c0.o irq-eint.o dma.o obj-$(CONFIG_PM) += pm.o sleep.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o +obj-$(CONFIG_CPU_EXYNOS4210) += pm-exynos4210.o obj-$(CONFIG_SMP) += platsmp.o headsmp.oarch/arm/mach-exynos4/include/mach/pm-exynos4210.h new file +69
-0@@ -0,0 +1,69 @@ +/* linux/arch/arm/mach-exynos4/include/mach/pm-exynos4.h +* +* Exynos4 Power management support +* +* Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. +* http://www.samsung.com +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __PM_EXYNOS4210_H__ +#define __PM_EXYNOS4210_H__ + +#include <linux/pm_domain.h> +#include <plat/pd.h> + +struct platform_device ; + +struct exynos4210_pm_domain { +struct generic_pm_domain genpd; + +const char *name; +void __iomem *base; +unsigned long gate_mask; +int boot_on; +}; + +static inline struct exynos4210_pm_domain *to_exynos4210_pd ( +struct generic_pm_domain *pd) +{ + return container_of(pd, struct exynos4210_pm_domain, genpd); +} + +#ifdef CONFIG_PM +extern struct exynos4210_pm_domain exynos4210_pd_list[PD_MAX_NUM ]; +#define EXYNOS4210_MFC (&exynos4210_pd_list[PD_MFC]) +#define EXYNOS4210_G3D (&exynos4210_pd_list[PD_G3D]) +#define EXYNOS4210_LCD0 (&exynos4210_pd_list[PD_LCD0]) +#define EXYNOS4210_LCD1 (&exynos4210_pd_list[PD_LCD1]) +#define EXYNOS4210_TV (&exynos4210_pd_list[PD_TV]) +#define EXYNOS4210_CAM (&exynos4210_pd_list[PD_CAM]) +#define EXYNOS4210_GPS (&exynos4210_pd_list[PD_GPS]) + +int exynos4210_pd_init (struct exynos4210_pm_domain *domain); +int exynos4210_add_device_to_domain (struct exynos4210_pm_domain *domain, +struct platform_device *pdev); +#else +#define EXYNOS4210_MFC NULL +#define EXYNOS4210_G3D NULL +#define EXYNOS4210_LCD0 NULL +#define EXYNOS4210_LCD1 NULL +#define EXYNOS4210_TV NULL +#define EXYNOS4210_CAM NULL +#define EXYNOS4210_GPS NULL + +static inline int exynos4210_pd_init (struct exynos4210_pm_domain *domain) +{ +return 0 ; +} +static inline int exynos4_add_device_to_domain (struct exynos4210_pm_domain *domain, +struct platform_device *pdev) +{ +return 0 ; +} +#endif /* CONFIG_PM */ + +#endif /* __PM_EXYNOS4210_H__ */ arch/arm/mach-exynos4/include/mach/regs-clock.h +8
-0@@ -171,6 +171,14 @@#define S5P_CLKDIV_BUS_GPLR_SHIFT (4)#define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) +#define S5P_CLKGATE_BLOCK_CAM (1<<0) +#define S5P_CLKGATE_BLOCK_TV (1<<1) +#define S5P_CLKGATE_BLOCK_MFC (1<<2) +#define S5P_CLKGATE_BLOCK_G3D (1<<3) +#define S5P_CLKGATE_BLOCK_LCD0 (1<<4) +#define S5P_CLKGATE_BLOCK_LCD1 (1<<5) +#define S5P_CLKGATE_BLOCK_GPS (1<<7) +/* Compatibility defines and inclusion */ #include <mach/regs-pmu.h> arch/arm/mach-exynos4/mach-nuri.c +6
-0@@ -37,6 +37,7 @@#include <plat/iic.h> #include <mach/map.h> +#include <mach/pm-exynos4210.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \@@ -376,6 +377,23 @@ static struct platform_device *nuri_devices[] __initdata = { &nuri_backlight_device, }; +static void __init nuri_power_domain_init (void ) +{ +int i; + +for (i =0 ; i <PD_MAX_NUM ; i++)
arch/arm/mach-exynos4/mach-nuri.c static struct platform_device *nuri_devices[] __initdata = { · line 394
Quoted 10 lines
arch/arm/mach-exynos4/mach-nuri.c +10
-0+exynos4210_pd_init (&exynos4210_pd_list[i]); + +/* Add device to power-domain */ +exynos4210_add_device_to_domain (EXYNOS4210_MFC ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_G3D ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_LCD0 , &nuri_lcd_device); +exynos4210_add_device_to_domain (EXYNOS4210_LCD1 ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_TV ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_CAM ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_GPS ,NULL );
It seems the calls with the second NULL argument are redundant.
The rest looks OK to me.
Thanks,
Rafael
Hi,
Quoted 30 lines · Chanwoo Choi
Use the generic power domains support to implement support for power domain on EXYNOS4210.
I refer to the following patch to implement what configure the clock-gating control register for block to turn off/on:
http://git.infradead.org/users/kmpark/linux-2.6-samsung/commit/39a81876d034dcbdc2a4c4c4b847b3b49e38870cThis patch is based on following "pm-domains" branch.
http://git.kernel.org/?p=linux/kernel/git/rafael/suspend-2.6.git;a=shortlog;h=refs/heads/pm-domainsSigned-off-by Chanwoo Choi <[email protected]>Signed-off-by MyungJoo Ham <[email protected]>Signed-off-by Kyungmin.park <[email protected]>--- arch/arm/mach-exynos4/Kconfig | 1 + arch/arm/mach-exynos4/Makefile | 1 + arch/arm/mach-exynos4/include/mach/pm-exynos4210.h | 69 ++++++++ arch/arm/mach-exynos4/include/mach/regs-clock.h | 8 + arch/arm/mach-exynos4/mach-nuri.c | 20 +++ arch/arm/mach-exynos4/pm-exynos4210.c | 170 ++++++++++++++++++++ arch/arm/plat-samsung/include/plat/pd.h | 3 +- 7 files changed, 271 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-exynos4/include/mach/pm-exynos4210.h create mode 100644 arch/arm/mach-exynos4/pm-exynos4210.carch/arm/mach-exynos4/Kconfig +0
-0
arch/arm/mach-exynos4/Kconfig config MACH_NURI · line 186
Quoted 4 lines
arch/arm/mach-exynos4/Kconfig +1
-0@@ -183,6 +183,7 @@ config MACH_NURI select EXYNOS4_SETUP_SDHCI select EXYNOS4_SETUP_USB_PHY select SAMSUNG_DEV_PWM + select PM_GENERIC_DOMAINS
That should be "select PM_GENERIC_DOMAINS if PM". Otherwise it will be selected even for CONFIG_PM unset.
Quoted 130 lines
arch/arm/mach-exynos4/Kconfig +0
-0help Machine support for Samsung Mobile NURI Board.arch/arm/mach-exynos4/Makefile +1
-0@@ -17,6 +17,7 @@ obj-$(CONFIG_CPU_EXYNOS4210) += setup-i2c0.o irq-eint.o dma.o obj-$(CONFIG_PM) += pm.o sleep.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o +obj-$(CONFIG_CPU_EXYNOS4210) += pm-exynos4210.o obj-$(CONFIG_SMP) += platsmp.o headsmp.oarch/arm/mach-exynos4/include/mach/pm-exynos4210.h new file +69
-0@@ -0,0 +1,69 @@ +/* linux/arch/arm/mach-exynos4/include/mach/pm-exynos4.h +* +* Exynos4 Power management support +* +* Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. +* http://www.samsung.com +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __PM_EXYNOS4210_H__ +#define __PM_EXYNOS4210_H__ + +#include <linux/pm_domain.h> +#include <plat/pd.h> + +struct platform_device ; + +struct exynos4210_pm_domain { +struct generic_pm_domain genpd; + +const char *name; +void __iomem *base; +unsigned long gate_mask; +int boot_on; +}; + +static inline struct exynos4210_pm_domain *to_exynos4210_pd ( +struct generic_pm_domain *pd) +{ + return container_of(pd, struct exynos4210_pm_domain, genpd); +} + +#ifdef CONFIG_PM +extern struct exynos4210_pm_domain exynos4210_pd_list[PD_MAX_NUM ]; +#define EXYNOS4210_MFC (&exynos4210_pd_list[PD_MFC]) +#define EXYNOS4210_G3D (&exynos4210_pd_list[PD_G3D]) +#define EXYNOS4210_LCD0 (&exynos4210_pd_list[PD_LCD0]) +#define EXYNOS4210_LCD1 (&exynos4210_pd_list[PD_LCD1]) +#define EXYNOS4210_TV (&exynos4210_pd_list[PD_TV]) +#define EXYNOS4210_CAM (&exynos4210_pd_list[PD_CAM]) +#define EXYNOS4210_GPS (&exynos4210_pd_list[PD_GPS]) + +int exynos4210_pd_init (struct exynos4210_pm_domain *domain); +int exynos4210_add_device_to_domain (struct exynos4210_pm_domain *domain, +struct platform_device *pdev); +#else +#define EXYNOS4210_MFC NULL +#define EXYNOS4210_G3D NULL +#define EXYNOS4210_LCD0 NULL +#define EXYNOS4210_LCD1 NULL +#define EXYNOS4210_TV NULL +#define EXYNOS4210_CAM NULL +#define EXYNOS4210_GPS NULL + +static inline int exynos4210_pd_init (struct exynos4210_pm_domain *domain) +{ +return 0 ; +} +static inline int exynos4_add_device_to_domain (struct exynos4210_pm_domain *domain, +struct platform_device *pdev) +{ +return 0 ; +} +#endif /* CONFIG_PM */ + +#endif /* __PM_EXYNOS4210_H__ */ arch/arm/mach-exynos4/include/mach/regs-clock.h +8
-0@@ -171,6 +171,14 @@#define S5P_CLKDIV_BUS_GPLR_SHIFT (4)#define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) +#define S5P_CLKGATE_BLOCK_CAM (1<<0) +#define S5P_CLKGATE_BLOCK_TV (1<<1) +#define S5P_CLKGATE_BLOCK_MFC (1<<2) +#define S5P_CLKGATE_BLOCK_G3D (1<<3) +#define S5P_CLKGATE_BLOCK_LCD0 (1<<4) +#define S5P_CLKGATE_BLOCK_LCD1 (1<<5) +#define S5P_CLKGATE_BLOCK_GPS (1<<7) +/* Compatibility defines and inclusion */ #include <mach/regs-pmu.h> arch/arm/mach-exynos4/mach-nuri.c +6
-0@@ -37,6 +37,7 @@#include <plat/iic.h> #include <mach/map.h> +#include <mach/pm-exynos4210.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \@@ -376,6 +377,23 @@ static struct platform_device *nuri_devices[] __initdata = { &nuri_backlight_device, }; +static void __init nuri_power_domain_init (void ) +{ +int i; + +for (i =0 ; i <PD_MAX_NUM ; i++)
arch/arm/mach-exynos4/mach-nuri.c static struct platform_device *nuri_devices[] __initdata = { · line 394
Quoted 10 lines
arch/arm/mach-exynos4/mach-nuri.c +10
-0+exynos4210_pd_init (&exynos4210_pd_list[i]); + +/* Add device to power-domain */ +exynos4210_add_device_to_domain (EXYNOS4210_MFC ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_G3D ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_LCD0 , &nuri_lcd_device); +exynos4210_add_device_to_domain (EXYNOS4210_LCD1 ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_TV ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_CAM ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_GPS ,NULL );
It seems the calls with the second NULL argument are redundant.
The rest looks OK to me.
Thanks,
Rafael
Hi,
Quoted 28 lines · Rafael J. Wysocki
Hi,
Quoted 25 lines · Chanwoo Choi
Use the generic power domains support to implement support for power domain on EXYNOS4210.
I refer to the following patch to implement what configure the clock-gating control register for block to turn off/on:
http://git.infradead.org/users/kmpark/linux-2.6-samsung/commit/39a81876d034dcbdc2a4c4c4b847b3b49e38870cThis patch is based on following "pm-domains" branch.
http://git.kernel.org/?p=linux/kernel/git/rafael/suspend-2.6.git;a=shortlog;h=refs/heads/pm-domainsSigned-off-by Chanwoo Choi <[email protected]>Signed-off-by MyungJoo Ham <[email protected]>Signed-off-by Kyungmin.park <[email protected]>--- arch/arm/mach-exynos4/Kconfig | 1 + arch/arm/mach-exynos4/Makefile | 1 + arch/arm/mach-exynos4/include/mach/pm-exynos4210.h | 69 ++++++++ arch/arm/mach-exynos4/include/mach/regs-clock.h | 8 + arch/arm/mach-exynos4/mach-nuri.c | 20 +++ arch/arm/mach-exynos4/pm-exynos4210.c | 170 ++++++++++++++++++++ arch/arm/plat-samsung/include/plat/pd.h | 3 +- 7 files changed, 271 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-exynos4/include/mach/pm-exynos4210.h create mode 100644 arch/arm/mach-exynos4/pm-exynos4210.c
Quoted 12 lines
arch/arm/mach-exynos4/Kconfig config MACH_NURI · line 186
Quoted 9 lines
arch/arm/mach-exynos4/Kconfig +1
-0@@ -183,6 +183,7 @@ config MACH_NURI select EXYNOS4_SETUP_SDHCI select EXYNOS4_SETUP_USB_PHY select SAMSUNG_DEV_PWM + select PM_GENERIC_DOMAINSThat should be "select
PM_GENERIC_DOMAINSif PM". Otherwise it will be selected even forCONFIG_PMunset.
OK, I will modify it.
Quoted 135 lines
Quoted 135 lines
arch/arm/mach-exynos4/Kconfig +0
-0help Machine support for Samsung Mobile NURI Board.arch/arm/mach-exynos4/Makefile +1
-0@@ -17,6 +17,7 @@ obj-$(CONFIG_CPU_EXYNOS4210) += setup-i2c0.o irq-eint.o dma.o obj-$(CONFIG_PM) += pm.o sleep.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o +obj-$(CONFIG_CPU_EXYNOS4210) += pm-exynos4210.o obj-$(CONFIG_SMP) += platsmp.o headsmp.oarch/arm/mach-exynos4/include/mach/pm-exynos4210.h new file +69
-0@@ -0,0 +1,69 @@ +/* linux/arch/arm/mach-exynos4/include/mach/pm-exynos4.h +* +* Exynos4 Power management support +* +* Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. +* http://www.samsung.com +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __PM_EXYNOS4210_H__ +#define __PM_EXYNOS4210_H__ + +#include <linux/pm_domain.h> +#include <plat/pd.h> + +struct platform_device ; + +struct exynos4210_pm_domain { +struct generic_pm_domain genpd; + +const char *name; +void __iomem *base; +unsigned long gate_mask; +int boot_on; +}; + +static inline struct exynos4210_pm_domain *to_exynos4210_pd ( +struct generic_pm_domain *pd) +{ + return container_of(pd, struct exynos4210_pm_domain, genpd); +} + +#ifdef CONFIG_PM +extern struct exynos4210_pm_domain exynos4210_pd_list[PD_MAX_NUM ]; +#define EXYNOS4210_MFC (&exynos4210_pd_list[PD_MFC]) +#define EXYNOS4210_G3D (&exynos4210_pd_list[PD_G3D]) +#define EXYNOS4210_LCD0 (&exynos4210_pd_list[PD_LCD0]) +#define EXYNOS4210_LCD1 (&exynos4210_pd_list[PD_LCD1]) +#define EXYNOS4210_TV (&exynos4210_pd_list[PD_TV]) +#define EXYNOS4210_CAM (&exynos4210_pd_list[PD_CAM]) +#define EXYNOS4210_GPS (&exynos4210_pd_list[PD_GPS]) + +int exynos4210_pd_init (struct exynos4210_pm_domain *domain); +int exynos4210_add_device_to_domain (struct exynos4210_pm_domain *domain, +struct platform_device *pdev); +#else +#define EXYNOS4210_MFC NULL +#define EXYNOS4210_G3D NULL +#define EXYNOS4210_LCD0 NULL +#define EXYNOS4210_LCD1 NULL +#define EXYNOS4210_TV NULL +#define EXYNOS4210_CAM NULL +#define EXYNOS4210_GPS NULL + +static inline int exynos4210_pd_init (struct exynos4210_pm_domain *domain) +{ +return 0 ; +} +static inline int exynos4_add_device_to_domain (struct exynos4210_pm_domain *domain, +struct platform_device *pdev) +{ +return 0 ; +} +#endif /* CONFIG_PM */ + +#endif /* __PM_EXYNOS4210_H__ */ arch/arm/mach-exynos4/include/mach/regs-clock.h +8
-0@@ -171,6 +171,14 @@#define S5P_CLKDIV_BUS_GPLR_SHIFT (4)#define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) +#define S5P_CLKGATE_BLOCK_CAM (1<<0) +#define S5P_CLKGATE_BLOCK_TV (1<<1) +#define S5P_CLKGATE_BLOCK_MFC (1<<2) +#define S5P_CLKGATE_BLOCK_G3D (1<<3) +#define S5P_CLKGATE_BLOCK_LCD0 (1<<4) +#define S5P_CLKGATE_BLOCK_LCD1 (1<<5) +#define S5P_CLKGATE_BLOCK_GPS (1<<7) +/* Compatibility defines and inclusion */ #include <mach/regs-pmu.h> arch/arm/mach-exynos4/mach-nuri.c +10
-0@@ -37,6 +37,7 @@#include <plat/iic.h> #include <mach/map.h> +#include <mach/pm-exynos4210.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \@@ -376,6 +377,23 @@ static struct platform_device *nuri_devices[] __initdata = { &nuri_backlight_device, }; +static void __init nuri_power_domain_init (void ) +{ +int i; + +for (i =0 ; i <PD_MAX_NUM ; i++) +exynos4210_pd_init (&exynos4210_pd_list[i]); + +/* Add device to power-domain */ +exynos4210_add_device_to_domain (EXYNOS4210_MFC ,NULL );
Quoted 9 lines
arch/arm/mach-exynos4/mach-nuri.c static struct platform_device *nuri_devices[] __initdata = { · line 394
Quoted 6 lines
arch/arm/mach-exynos4/mach-nuri.c +6
-0+exynos4210_add_device_to_domain (EXYNOS4210_G3D ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_LCD0 , &nuri_lcd_device); +exynos4210_add_device_to_domain (EXYNOS4210_LCD1 ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_TV ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_CAM ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_GPS ,NULL );It seems the calls with the second NULL argument are redundant.
I will fix it.
Quoted 5 lines
The rest looks OK to me.
Thanks,
Rafael
I will resend the modified patch according to your comment and your "pm-domains" branch.
Thanks,
Chanwoo Choi
Hi,
Quoted 28 lines · Rafael J. Wysocki
Hi,
Quoted 25 lines · Chanwoo Choi
Use the generic power domains support to implement support for power domain on EXYNOS4210.
I refer to the following patch to implement what configure the clock-gating control register for block to turn off/on:
http://git.infradead.org/users/kmpark/linux-2.6-samsung/commit/39a81876d034dcbdc2a4c4c4b847b3b49e38870cThis patch is based on following "pm-domains" branch.
http://git.kernel.org/?p=linux/kernel/git/rafael/suspend-2.6.git;a=shortlog;h=refs/heads/pm-domainsSigned-off-by Chanwoo Choi <[email protected]>Signed-off-by MyungJoo Ham <[email protected]>Signed-off-by Kyungmin.park <[email protected]>--- arch/arm/mach-exynos4/Kconfig | 1 + arch/arm/mach-exynos4/Makefile | 1 + arch/arm/mach-exynos4/include/mach/pm-exynos4210.h | 69 ++++++++ arch/arm/mach-exynos4/include/mach/regs-clock.h | 8 + arch/arm/mach-exynos4/mach-nuri.c | 20 +++ arch/arm/mach-exynos4/pm-exynos4210.c | 170 ++++++++++++++++++++ arch/arm/plat-samsung/include/plat/pd.h | 3 +- 7 files changed, 271 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-exynos4/include/mach/pm-exynos4210.h create mode 100644 arch/arm/mach-exynos4/pm-exynos4210.c
Quoted 12 lines
arch/arm/mach-exynos4/Kconfig config MACH_NURI · line 186
Quoted 9 lines
arch/arm/mach-exynos4/Kconfig +1
-0@@ -183,6 +183,7 @@ config MACH_NURI select EXYNOS4_SETUP_SDHCI select EXYNOS4_SETUP_USB_PHY select SAMSUNG_DEV_PWM + select PM_GENERIC_DOMAINSThat should be "select
PM_GENERIC_DOMAINSif PM". Otherwise it will be selected even forCONFIG_PMunset.
OK, I will modify it.
Quoted 135 lines
Quoted 135 lines
arch/arm/mach-exynos4/Kconfig +0
-0help Machine support for Samsung Mobile NURI Board.arch/arm/mach-exynos4/Makefile +1
-0@@ -17,6 +17,7 @@ obj-$(CONFIG_CPU_EXYNOS4210) += setup-i2c0.o irq-eint.o dma.o obj-$(CONFIG_PM) += pm.o sleep.o obj-$(CONFIG_CPU_FREQ) += cpufreq.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o +obj-$(CONFIG_CPU_EXYNOS4210) += pm-exynos4210.o obj-$(CONFIG_SMP) += platsmp.o headsmp.oarch/arm/mach-exynos4/include/mach/pm-exynos4210.h new file +69
-0@@ -0,0 +1,69 @@ +/* linux/arch/arm/mach-exynos4/include/mach/pm-exynos4.h +* +* Exynos4 Power management support +* +* Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. +* http://www.samsung.com +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License version 2 as +* published by the Free Software Foundation. +*/ + +#ifndef __PM_EXYNOS4210_H__ +#define __PM_EXYNOS4210_H__ + +#include <linux/pm_domain.h> +#include <plat/pd.h> + +struct platform_device ; + +struct exynos4210_pm_domain { +struct generic_pm_domain genpd; + +const char *name; +void __iomem *base; +unsigned long gate_mask; +int boot_on; +}; + +static inline struct exynos4210_pm_domain *to_exynos4210_pd ( +struct generic_pm_domain *pd) +{ + return container_of(pd, struct exynos4210_pm_domain, genpd); +} + +#ifdef CONFIG_PM +extern struct exynos4210_pm_domain exynos4210_pd_list[PD_MAX_NUM ]; +#define EXYNOS4210_MFC (&exynos4210_pd_list[PD_MFC]) +#define EXYNOS4210_G3D (&exynos4210_pd_list[PD_G3D]) +#define EXYNOS4210_LCD0 (&exynos4210_pd_list[PD_LCD0]) +#define EXYNOS4210_LCD1 (&exynos4210_pd_list[PD_LCD1]) +#define EXYNOS4210_TV (&exynos4210_pd_list[PD_TV]) +#define EXYNOS4210_CAM (&exynos4210_pd_list[PD_CAM]) +#define EXYNOS4210_GPS (&exynos4210_pd_list[PD_GPS]) + +int exynos4210_pd_init (struct exynos4210_pm_domain *domain); +int exynos4210_add_device_to_domain (struct exynos4210_pm_domain *domain, +struct platform_device *pdev); +#else +#define EXYNOS4210_MFC NULL +#define EXYNOS4210_G3D NULL +#define EXYNOS4210_LCD0 NULL +#define EXYNOS4210_LCD1 NULL +#define EXYNOS4210_TV NULL +#define EXYNOS4210_CAM NULL +#define EXYNOS4210_GPS NULL + +static inline int exynos4210_pd_init (struct exynos4210_pm_domain *domain) +{ +return 0 ; +} +static inline int exynos4_add_device_to_domain (struct exynos4210_pm_domain *domain, +struct platform_device *pdev) +{ +return 0 ; +} +#endif /* CONFIG_PM */ + +#endif /* __PM_EXYNOS4210_H__ */ arch/arm/mach-exynos4/include/mach/regs-clock.h +8
-0@@ -171,6 +171,14 @@#define S5P_CLKDIV_BUS_GPLR_SHIFT (4)#define S5P_CLKDIV_BUS_GPLR_MASK (0x7 << S5P_CLKDIV_BUS_GPLR_SHIFT) +#define S5P_CLKGATE_BLOCK_CAM (1<<0) +#define S5P_CLKGATE_BLOCK_TV (1<<1) +#define S5P_CLKGATE_BLOCK_MFC (1<<2) +#define S5P_CLKGATE_BLOCK_G3D (1<<3) +#define S5P_CLKGATE_BLOCK_LCD0 (1<<4) +#define S5P_CLKGATE_BLOCK_LCD1 (1<<5) +#define S5P_CLKGATE_BLOCK_GPS (1<<7) +/* Compatibility defines and inclusion */ #include <mach/regs-pmu.h> arch/arm/mach-exynos4/mach-nuri.c +10
-0@@ -37,6 +37,7 @@#include <plat/iic.h> #include <mach/map.h> +#include <mach/pm-exynos4210.h> /* Following are default values for UCON, ULCON and UFCON UART registers */ #define NURI_UCON_DEFAULT (S3C2410_UCON_TXILEVEL | \@@ -376,6 +377,23 @@ static struct platform_device *nuri_devices[] __initdata = { &nuri_backlight_device, }; +static void __init nuri_power_domain_init (void ) +{ +int i; + +for (i =0 ; i <PD_MAX_NUM ; i++) +exynos4210_pd_init (&exynos4210_pd_list[i]); + +/* Add device to power-domain */ +exynos4210_add_device_to_domain (EXYNOS4210_MFC ,NULL );
Quoted 9 lines
arch/arm/mach-exynos4/mach-nuri.c static struct platform_device *nuri_devices[] __initdata = { · line 394
Quoted 6 lines
arch/arm/mach-exynos4/mach-nuri.c +6
-0+exynos4210_add_device_to_domain (EXYNOS4210_G3D ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_LCD0 , &nuri_lcd_device); +exynos4210_add_device_to_domain (EXYNOS4210_LCD1 ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_TV ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_CAM ,NULL ); +exynos4210_add_device_to_domain (EXYNOS4210_GPS ,NULL );It seems the calls with the second NULL argument are redundant.
I will fix it.
Quoted 5 lines
The rest looks OK to me.
Thanks,
Rafael
I will resend the modified patch according to your comment and your "pm-domains" branch.
Thanks,
Chanwoo Choi