linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC][PATCH 0/5] PM / shmobile: Specify PM domain and device latency information directly
@ 2012-07-21 21:49 Rafael J. Wysocki
  2012-07-21 21:53 ` [RFC][PATCH 1/5] PM / shmobile: Set SH7372 PM domain on/off latencies directly Rafael J. Wysocki
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-07-21 21:49 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Magnus Damm, Arnd Bergmann, Linux-sh list, Olof Johansson

Hi all,

The following patchset is on top of the previous one at:

https://lkml.org/lkml/2012/7/16/399

Generally speaking, it adds code for the direct specification of various
PM domain and device latencies used by PM QoS to the SH7372 SoC and
Mackerel board and suggests a mechanism for reading that information from
device trees.

Thanks,
Rafael

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC][PATCH 1/5] PM / shmobile: Set SH7372 PM domain on/off latencies directly
  2012-07-21 21:49 [RFC][PATCH 0/5] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
@ 2012-07-21 21:53 ` Rafael J. Wysocki
  2012-07-21 21:54 ` [RFC][PATCH 2/5] PM / shmobile: Allow device latencies to be specified directly Rafael J. Wysocki
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-07-21 21:53 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Magnus Damm, Arnd Bergmann, Linux-sh list, Olof Johansson


The results of adaptive latency computations in __pm_genpd_poweron()
and pm_genpd_poweroff() show that the power on/power off latencies
of all power domains in SH7372 are a little below 250 us.  Therefore,
if 250 us is used as the common initial value of the latency fields
in struct generic_pm_domain for all domains, the latency values
will never have to change at run time and there won't be any overhead
related to re-computation of the corresponding PM QoS data.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/pm-sh7372.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -71,6 +71,8 @@
 
 #ifdef CONFIG_PM
 
+#define PM_DOMAIN_ON_OFF_LATENCY_NS	250000
+
 static int sh7372_a4r_pd_suspend(void)
 {
 	sh7372_intcs_suspend();
@@ -99,32 +101,46 @@ static int sh7372_a3sp_pd_suspend(void)
 static struct rmobile_pm_domain sh7372_pm_domains[] = {
 	{
 		.genpd.name = "A4LC",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 1,
 	},
 	{
 		.genpd.name = "A4MP",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 2,
 	},
 	{
 		.genpd.name = "D4",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 3,
 	},
 	{
 		.genpd.name = "A4R",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 5,
 		.suspend = sh7372_a4r_pd_suspend,
 		.resume = sh7372_intcs_resume,
 	},
 	{
 		.genpd.name = "A3RV",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 6,
 	},
 	{
 		.genpd.name = "A3RI",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 8,
 	},
 	{
 		.genpd.name = "A4S",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 10,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -132,6 +148,8 @@ static struct rmobile_pm_domain sh7372_p
 	},
 	{
 		.genpd.name = "A3SP",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 11,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -139,6 +157,8 @@ static struct rmobile_pm_domain sh7372_p
 	},
 	{
 		.genpd.name = "A3SG",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 13,
 	},
 };


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC][PATCH 2/5] PM / shmobile: Allow device latencies to be specified directly
  2012-07-21 21:49 [RFC][PATCH 0/5] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
  2012-07-21 21:53 ` [RFC][PATCH 1/5] PM / shmobile: Set SH7372 PM domain on/off latencies directly Rafael J. Wysocki
@ 2012-07-21 21:54 ` Rafael J. Wysocki
  2012-07-21 21:54 ` [RFC][PATCH 3/5] PM / shmobile: Specify device latencies for SH7372 devices directly Rafael J. Wysocki
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-07-21 21:54 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Magnus Damm, Arnd Bergmann, Linux-sh list, Olof Johansson


Make it possible to specify device start/stop and save/restore
state latencies directy when adding devices to PM domains.  For
this purpose, introduce rmobile_add_device_to_domain_td() whose
third argument is a pointer to a struct gpd_timing_data object
containing device latency data.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/include/mach/pm-rmobile.h |   14 ++++++++++++--
 arch/arm/mach-shmobile/pm-rmobile.c              |    7 ++++---
 2 files changed, 16 insertions(+), 5 deletions(-)

Index: linux/arch/arm/mach-shmobile/pm-rmobile.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/pm-rmobile.c
+++ linux/arch/arm/mach-shmobile/pm-rmobile.c
@@ -152,14 +152,15 @@ static void rmobile_init_pm_domain(struc
 	__rmobile_pd_power_up(rmobile_pd, false);
 }
 
-void rmobile_add_device_to_domain(const char *domain_name,
-				 struct platform_device *pdev)
+void rmobile_add_device_to_domain_td(const char *domain_name,
+				     struct platform_device *pdev,
+				     struct gpd_timing_data *td)
 {
 	struct device *dev = &pdev->dev;
 	int ret;
 
 	do
-		ret = pm_genpd_name_add_device(domain_name, dev);
+		ret = __pm_genpd_name_add_device(domain_name, dev, td);
 	while (ret == -EAGAIN);
 	if (pm_clk_no_clocks(dev))
 		pm_clk_add(dev, NULL);
Index: linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
===================================================================
--- linux.orig/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
+++ linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
@@ -31,10 +31,20 @@ struct rmobile_pm_domain *to_rmobile_pd(
 
 #ifdef CONFIG_PM
 extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
-extern void rmobile_add_device_to_domain(const char *domain_name,
-					struct platform_device *pdev);
+extern void rmobile_add_device_to_domain_td(const char *domain_name,
+					    struct platform_device *pdev,
+					    struct gpd_timing_data *td);
+
+static inline void rmobile_add_device_to_domain(const char *domain_name,
+						struct platform_device *pdev)
+{
+	rmobile_add_device_to_domain_td(domain_name, pdev, NULL);
+}
+
 #else
+
 #define rmobile_init_domains(domains, num) do { } while (0)
+#define rmobile_add_device_to_domain_td(name, pdev, td) do { } while (0)
 #define rmobile_add_device_to_domain(name, pdev) do { } while (0)
 #endif /* CONFIG_PM */
 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC][PATCH 3/5] PM / shmobile: Specify device latencies for SH7372 devices directly
  2012-07-21 21:49 [RFC][PATCH 0/5] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
  2012-07-21 21:53 ` [RFC][PATCH 1/5] PM / shmobile: Set SH7372 PM domain on/off latencies directly Rafael J. Wysocki
  2012-07-21 21:54 ` [RFC][PATCH 2/5] PM / shmobile: Allow device latencies to be specified directly Rafael J. Wysocki
@ 2012-07-21 21:54 ` Rafael J. Wysocki
  2012-07-21 21:55 ` [RFC][PATCH 4/5] PM / shmobile: Specify device latencies for Mackerel " Rafael J. Wysocki
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-07-21 21:54 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Magnus Damm, Arnd Bergmann, Linux-sh list, Olof Johansson


The results of adaptive latency computations in
GENPD_DEV_TIMED_CALLBACK() show that the start/stop and save/restore
state latencies of all devices on SH7372 I have tried are a little
below 250 us.  Therefore, if the 250 us is used as the common initial
value of the latency fields in struct gpd_timing_data for all devices
on SH7372, the latency values will never have to change at run time
and there won't be any overhead related to re-computation of the
corresponding PM QoS data.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/setup-sh7372.c |   57 +++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 24 deletions(-)

Index: linux/arch/arm/mach-shmobile/setup-sh7372.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/setup-sh7372.c
+++ linux/arch/arm/mach-shmobile/setup-sh7372.c
@@ -999,8 +999,17 @@ static struct platform_device *sh7372_la
 	&spu1_device,
 };
 
+#define DEV_LATENCY_NS	250000
+
 void __init sh7372_add_standard_devices(void)
 {
+	struct gpd_timing_data latencies = {
+		.stop_latency_ns = DEV_LATENCY_NS,
+		.start_latency_ns = DEV_LATENCY_NS,
+		.save_state_latency_ns = DEV_LATENCY_NS,
+		.restore_state_latency_ns = DEV_LATENCY_NS,
+	};
+
 	sh7372_init_pm_domains();
 
 	platform_add_devices(sh7372_early_devices,
@@ -1009,30 +1018,30 @@ void __init sh7372_add_standard_devices(
 	platform_add_devices(sh7372_late_devices,
 			    ARRAY_SIZE(sh7372_late_devices));
 
-	rmobile_add_device_to_domain("A3RV", &vpu_device);
-	rmobile_add_device_to_domain("A4MP", &spu0_device);
-	rmobile_add_device_to_domain("A4MP", &spu1_device);
-	rmobile_add_device_to_domain("A3SP", &scif0_device);
-	rmobile_add_device_to_domain("A3SP", &scif1_device);
-	rmobile_add_device_to_domain("A3SP", &scif2_device);
-	rmobile_add_device_to_domain("A3SP", &scif3_device);
-	rmobile_add_device_to_domain("A3SP", &scif4_device);
-	rmobile_add_device_to_domain("A3SP", &scif5_device);
-	rmobile_add_device_to_domain("A3SP", &scif6_device);
-	rmobile_add_device_to_domain("A3SP", &iic1_device);
-	rmobile_add_device_to_domain("A3SP", &dma0_device);
-	rmobile_add_device_to_domain("A3SP", &dma1_device);
-	rmobile_add_device_to_domain("A3SP", &dma2_device);
-	rmobile_add_device_to_domain("A3SP", &usb_dma0_device);
-	rmobile_add_device_to_domain("A3SP", &usb_dma1_device);
-	rmobile_add_device_to_domain("A4R", &iic0_device);
-	rmobile_add_device_to_domain("A4R", &veu0_device);
-	rmobile_add_device_to_domain("A4R", &veu1_device);
-	rmobile_add_device_to_domain("A4R", &veu2_device);
-	rmobile_add_device_to_domain("A4R", &veu3_device);
-	rmobile_add_device_to_domain("A4R", &jpu_device);
-	rmobile_add_device_to_domain("A4R", &tmu00_device);
-	rmobile_add_device_to_domain("A4R", &tmu01_device);
+	rmobile_add_device_to_domain_td("A3RV", &vpu_device, &latencies);
+	rmobile_add_device_to_domain_td("A4MP", &spu0_device, &latencies);
+	rmobile_add_device_to_domain_td("A4MP", &spu1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif0_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif2_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif3_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif4_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif5_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif6_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &iic1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &dma0_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &dma1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &dma2_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &usb_dma0_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &usb_dma1_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &iic0_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &veu0_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &veu1_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &veu2_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &veu3_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &jpu_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &tmu00_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &tmu01_device, &latencies);
 }
 
 static void __init sh7372_earlytimer_init(void)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC][PATCH 4/5] PM / shmobile: Specify device latencies for Mackerel devices directly
  2012-07-21 21:49 [RFC][PATCH 0/5] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
                   ` (2 preceding siblings ...)
  2012-07-21 21:54 ` [RFC][PATCH 3/5] PM / shmobile: Specify device latencies for SH7372 devices directly Rafael J. Wysocki
@ 2012-07-21 21:55 ` Rafael J. Wysocki
  2012-07-21 21:56 ` [RFC][PATCH 5/5] PM / shmobile: Allow device latencies to be read from a DT Rafael J. Wysocki
  2012-08-07 22:26 ` [PATCH 0/4] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
  5 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-07-21 21:55 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Magnus Damm, Arnd Bergmann, Linux-sh list, Olof Johansson


The results of adaptive latency computations in
GENPD_DEV_TIMED_CALLBACK() show that the start/stop and save/restore
state latencies of all devices on the Mackerel board I have tried are
a little below 250 us.  Therefore, if the 250 us is used as the
common initial value of the latency fields in struct gpd_timing_data
for all devices on Mackerel, the latency values will never have to
change at run time and there won't be any overhead related to
re-computation of the corresponding PM QoS data.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/board-mackerel.c |   31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

Index: linux/arch/arm/mach-shmobile/board-mackerel.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/board-mackerel.c
+++ linux/arch/arm/mach-shmobile/board-mackerel.c
@@ -1407,8 +1407,15 @@ static struct i2c_board_info i2c1_device
 #define GPIO_PORT168CR	0xE60520A8
 #define SRCR4		0xe61580bc
 #define USCCR1		0xE6058144
+#define DEV_LATENCY_NS	250000
 static void __init mackerel_init(void)
 {
+	struct gpd_timing_data latencies = {
+		.stop_latency_ns = DEV_LATENCY_NS,
+		.start_latency_ns = DEV_LATENCY_NS,
+		.save_state_latency_ns = DEV_LATENCY_NS,
+		.restore_state_latency_ns = DEV_LATENCY_NS,
+	};
 	u32 srcr4;
 	struct clk *clk;
 
@@ -1623,20 +1630,20 @@ static void __init mackerel_init(void)
 
 	platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
 
-	rmobile_add_device_to_domain("A4LC", &lcdc_device);
-	rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
-	rmobile_add_device_to_domain("A4LC", &meram_device);
-	rmobile_add_device_to_domain("A4MP", &fsi_device);
-	rmobile_add_device_to_domain("A3SP", &usbhs0_device);
-	rmobile_add_device_to_domain("A3SP", &usbhs1_device);
-	rmobile_add_device_to_domain("A3SP", &nand_flash_device);
-	rmobile_add_device_to_domain("A3SP", &sh_mmcif_device);
-	rmobile_add_device_to_domain("A3SP", &sdhi0_device);
+	rmobile_add_device_to_domain_td("A4LC", &lcdc_device, &latencies);
+	rmobile_add_device_to_domain_td("A4LC", &hdmi_lcdc_device, &latencies);
+	rmobile_add_device_to_domain_td("A4LC", &meram_device, &latencies);
+	rmobile_add_device_to_domain_td("A4MP", &fsi_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &usbhs0_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &usbhs1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &nand_flash_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &sh_mmcif_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &sdhi0_device, &latencies);
 #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
-	rmobile_add_device_to_domain("A3SP", &sdhi1_device);
+	rmobile_add_device_to_domain_td("A3SP", &sdhi1_device, &latencies);
 #endif
-	rmobile_add_device_to_domain("A3SP", &sdhi2_device);
-	rmobile_add_device_to_domain("A4R", &ceu_device);
+	rmobile_add_device_to_domain_td("A3SP", &sdhi2_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &ceu_device, &latencies);
 
 	hdmi_init_pm_clock();
 	sh7372_pm_init();


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [RFC][PATCH 5/5] PM / shmobile: Allow device latencies to be read from a DT
  2012-07-21 21:49 [RFC][PATCH 0/5] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
                   ` (3 preceding siblings ...)
  2012-07-21 21:55 ` [RFC][PATCH 4/5] PM / shmobile: Specify device latencies for Mackerel " Rafael J. Wysocki
@ 2012-07-21 21:56 ` Rafael J. Wysocki
  2012-08-07 22:26 ` [PATCH 0/4] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
  5 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-07-21 21:56 UTC (permalink / raw)
  To: Linux PM list
  Cc: LKML, Magnus Damm, Arnd Bergmann, Linux-sh list, Olof Johansson


Modify rmobile_read_domain_from_dt() so that it can read device
latency information from the device tree along with the PM
domain name and make it use rmobile_add_device_to_domain_td()
for adding the device to the PM domain along with the device latency
data.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/pm-rmobile.c |   24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

Index: linux/arch/arm/mach-shmobile/pm-rmobile.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/pm-rmobile.c
+++ linux/arch/arm/mach-shmobile/pm-rmobile.c
@@ -170,14 +170,34 @@ void rmobile_add_device_to_domain_td(con
 
 static void rmobile_read_domain_from_dt(struct device *dev)
 {
+	struct gpd_timing_data latencies = { 0 };
 	const char *domain_name;
+	u64 val;
 	int ret;
 
 	ret = of_property_read_string(dev->of_node, "renesas,pmdomain",
 				      &domain_name);
+	if (ret)
+		return;
+
+	ret = of_property_read_u64(dev->of_node, "pm-stop-latency", &val);
+	if (!ret)
+		latencies.stop_latency_ns = val;
+
+	ret = of_property_read_u64(dev->of_node, "pm-start-latency", &val);
+	if (!ret)
+		latencies.start_latency_ns = val;
+
+	ret = of_property_read_u64(dev->of_node, "pm-save-latency", &val);
+	if (!ret)
+		latencies.save_state_latency_ns = val;
+
+	ret = of_property_read_u64(dev->of_node, "pm-restore-latency", &val);
 	if (!ret)
-		rmobile_add_device_to_domain(domain_name,
-					     to_platform_device(dev));
+		latencies.restore_state_latency_ns = val;
+
+	rmobile_add_device_to_domain_td(domain_name, to_platform_device(dev),
+					&latencies);
 }
 
 static void rmobile_remove_from_domain(struct device *dev)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 0/4] PM / shmobile: Specify PM domain and device latency information directly
  2012-07-21 21:49 [RFC][PATCH 0/5] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
                   ` (4 preceding siblings ...)
  2012-07-21 21:56 ` [RFC][PATCH 5/5] PM / shmobile: Allow device latencies to be read from a DT Rafael J. Wysocki
@ 2012-08-07 22:26 ` Rafael J. Wysocki
  2012-08-07 22:27   ` [PATCH 1/4] PM / shmobile: Set PM domain on/off latencies directly Rafael J. Wysocki
                     ` (3 more replies)
  5 siblings, 4 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-08-07 22:26 UTC (permalink / raw)
  To: Linux-sh list; +Cc: Linux PM list, LKML, Magnus Damm

Hi all,

On Saturday, July 21, 2012, Rafael J. Wysocki wrote:
> Hi all,
> 
> The following patchset is on top of the previous one at:
> 
> https://lkml.org/lkml/2012/7/16/399
> 
> Generally speaking, it adds code for the direct specification of various
> PM domain and device latencies used by PM QoS to the SH7372 SoC and
> Mackerel board and suggests a mechanism for reading that information from
> device trees.

Since I haven't received any comments, I suppose everyone is OK with these
patches, except for the DT one that depended on another DT patch that was
rejected.  Thus, a regular (non-RFC) submission follows.

The patches are on top of this patch series posted yesterday:

http://marc.info/?l=linux-pm&m=134429494917435&w=4

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/4] PM / shmobile: Set PM domain on/off latencies directly
  2012-08-07 22:26 ` [PATCH 0/4] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
@ 2012-08-07 22:27   ` Rafael J. Wysocki
  2012-08-07 22:27   ` [PATCH 2/4] PM / shmobile: Allow device latencies to be specified directly Rafael J. Wysocki
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-08-07 22:27 UTC (permalink / raw)
  To: Linux-sh list; +Cc: Linux PM list, LKML, Magnus Damm


The results of adaptive latency computations in __pm_genpd_poweron()
and pm_genpd_poweroff() show that the power on/power off latencies
of all power domains in SH7372 are a little below 250 us.  Therefore,
if 250 us is used as the common initial value of the latency fields
in struct generic_pm_domain for all domains, the latency values
will never have to change at run time and there won't be any overhead
related to re-computation of the corresponding PM QoS data.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/pm-sh7372.c |   20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

Index: linux/arch/arm/mach-shmobile/pm-sh7372.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/pm-sh7372.c
+++ linux/arch/arm/mach-shmobile/pm-sh7372.c
@@ -71,6 +71,8 @@
 
 #ifdef CONFIG_PM
 
+#define PM_DOMAIN_ON_OFF_LATENCY_NS	250000
+
 static int sh7372_a4r_pd_suspend(void)
 {
 	sh7372_intcs_suspend();
@@ -110,32 +112,46 @@ static int sh7372_a3sp_pd_suspend(void)
 static struct rmobile_pm_domain sh7372_pm_domains[] = {
 	{
 		.genpd.name = "A4LC",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 1,
 	},
 	{
 		.genpd.name = "A4MP",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 2,
 	},
 	{
 		.genpd.name = "D4",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 3,
 	},
 	{
 		.genpd.name = "A4R",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 5,
 		.suspend = sh7372_a4r_pd_suspend,
 		.resume = sh7372_intcs_resume,
 	},
 	{
 		.genpd.name = "A3RV",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 6,
 	},
 	{
 		.genpd.name = "A3RI",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 8,
 	},
 	{
 		.genpd.name = "A4S",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 10,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -144,6 +160,8 @@ static struct rmobile_pm_domain sh7372_p
 	},
 	{
 		.genpd.name = "A3SP",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 11,
 		.gov = &pm_domain_always_on_gov,
 		.no_debug = true,
@@ -151,6 +169,8 @@ static struct rmobile_pm_domain sh7372_p
 	},
 	{
 		.genpd.name = "A3SG",
+		.genpd.power_on_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
+		.genpd.power_off_latency_ns = PM_DOMAIN_ON_OFF_LATENCY_NS,
 		.bit_shift = 13,
 	},
 };


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/4] PM / shmobile: Allow device latencies to be specified directly
  2012-08-07 22:26 ` [PATCH 0/4] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
  2012-08-07 22:27   ` [PATCH 1/4] PM / shmobile: Set PM domain on/off latencies directly Rafael J. Wysocki
@ 2012-08-07 22:27   ` Rafael J. Wysocki
  2012-08-07 22:28   ` [PATCH 3/4] PM / shmobile: Specify device latencies for SH7372 devices directly Rafael J. Wysocki
  2012-08-07 22:29   ` [PATCH 4/4] PM / shmobile: Specify device latencies for Mackerel " Rafael J. Wysocki
  3 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-08-07 22:27 UTC (permalink / raw)
  To: Linux-sh list; +Cc: Linux PM list, LKML, Magnus Damm


Make it possible to specify device start/stop and save/restore
state latencies directy when adding devices to PM domains.  For
this purpose, introduce rmobile_add_device_to_domain_td() whose
third argument is a pointer to a struct gpd_timing_data object
containing device latency data.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/include/mach/pm-rmobile.h |   14 ++++++++++++--
 arch/arm/mach-shmobile/pm-rmobile.c              |    7 ++++---
 2 files changed, 16 insertions(+), 5 deletions(-)

Index: linux/arch/arm/mach-shmobile/pm-rmobile.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/pm-rmobile.c
+++ linux/arch/arm/mach-shmobile/pm-rmobile.c
@@ -157,12 +157,13 @@ void rmobile_init_domains(struct rmobile
 		rmobile_init_pm_domain(&domains[j]);
 }
 
-void rmobile_add_device_to_domain(const char *domain_name,
-				 struct platform_device *pdev)
+void rmobile_add_device_to_domain_td(const char *domain_name,
+				     struct platform_device *pdev,
+				     struct gpd_timing_data *td)
 {
 	struct device *dev = &pdev->dev;
 
-	pm_genpd_name_add_device(domain_name, dev);
+	__pm_genpd_name_add_device(domain_name, dev, td);
 	if (pm_clk_no_clocks(dev))
 		pm_clk_add(dev, NULL);
 }
Index: linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
===================================================================
--- linux.orig/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
+++ linux/arch/arm/mach-shmobile/include/mach/pm-rmobile.h
@@ -31,10 +31,20 @@ struct rmobile_pm_domain *to_rmobile_pd(
 
 #ifdef CONFIG_PM
 extern void rmobile_init_domains(struct rmobile_pm_domain domains[], int num);
-extern void rmobile_add_device_to_domain(const char *domain_name,
-					struct platform_device *pdev);
+extern void rmobile_add_device_to_domain_td(const char *domain_name,
+					    struct platform_device *pdev,
+					    struct gpd_timing_data *td);
+
+static inline void rmobile_add_device_to_domain(const char *domain_name,
+						struct platform_device *pdev)
+{
+	rmobile_add_device_to_domain_td(domain_name, pdev, NULL);
+}
+
 #else
+
 #define rmobile_init_domains(domains, num) do { } while (0)
+#define rmobile_add_device_to_domain_td(name, pdev, td) do { } while (0)
 #define rmobile_add_device_to_domain(name, pdev) do { } while (0)
 #endif /* CONFIG_PM */
 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/4] PM / shmobile: Specify device latencies for SH7372 devices directly
  2012-08-07 22:26 ` [PATCH 0/4] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
  2012-08-07 22:27   ` [PATCH 1/4] PM / shmobile: Set PM domain on/off latencies directly Rafael J. Wysocki
  2012-08-07 22:27   ` [PATCH 2/4] PM / shmobile: Allow device latencies to be specified directly Rafael J. Wysocki
@ 2012-08-07 22:28   ` Rafael J. Wysocki
  2012-08-07 22:29   ` [PATCH 4/4] PM / shmobile: Specify device latencies for Mackerel " Rafael J. Wysocki
  3 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-08-07 22:28 UTC (permalink / raw)
  To: Linux-sh list; +Cc: Linux PM list, LKML, Magnus Damm


The results of adaptive latency computations in
GENPD_DEV_TIMED_CALLBACK() show that the start/stop and save/restore
state latencies of all devices on SH7372 I have tried are a little
below 250 us.  Therefore, if the 250 us is used as the common initial
value of the latency fields in struct gpd_timing_data for all devices
on SH7372, the latency values will never have to change at run time
and there won't be any overhead related to re-computation of the
corresponding PM QoS data.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/setup-sh7372.c |   57 +++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 24 deletions(-)

Index: linux/arch/arm/mach-shmobile/setup-sh7372.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/setup-sh7372.c
+++ linux/arch/arm/mach-shmobile/setup-sh7372.c
@@ -999,8 +999,17 @@ static struct platform_device *sh7372_la
 	&spu1_device,
 };
 
+#define DEV_LATENCY_NS	250000
+
 void __init sh7372_add_standard_devices(void)
 {
+	struct gpd_timing_data latencies = {
+		.stop_latency_ns = DEV_LATENCY_NS,
+		.start_latency_ns = DEV_LATENCY_NS,
+		.save_state_latency_ns = DEV_LATENCY_NS,
+		.restore_state_latency_ns = DEV_LATENCY_NS,
+	};
+
 	sh7372_init_pm_domains();
 
 	platform_add_devices(sh7372_early_devices,
@@ -1009,30 +1018,30 @@ void __init sh7372_add_standard_devices(
 	platform_add_devices(sh7372_late_devices,
 			    ARRAY_SIZE(sh7372_late_devices));
 
-	rmobile_add_device_to_domain("A3RV", &vpu_device);
-	rmobile_add_device_to_domain("A4MP", &spu0_device);
-	rmobile_add_device_to_domain("A4MP", &spu1_device);
-	rmobile_add_device_to_domain("A3SP", &scif0_device);
-	rmobile_add_device_to_domain("A3SP", &scif1_device);
-	rmobile_add_device_to_domain("A3SP", &scif2_device);
-	rmobile_add_device_to_domain("A3SP", &scif3_device);
-	rmobile_add_device_to_domain("A3SP", &scif4_device);
-	rmobile_add_device_to_domain("A3SP", &scif5_device);
-	rmobile_add_device_to_domain("A3SP", &scif6_device);
-	rmobile_add_device_to_domain("A3SP", &iic1_device);
-	rmobile_add_device_to_domain("A3SP", &dma0_device);
-	rmobile_add_device_to_domain("A3SP", &dma1_device);
-	rmobile_add_device_to_domain("A3SP", &dma2_device);
-	rmobile_add_device_to_domain("A3SP", &usb_dma0_device);
-	rmobile_add_device_to_domain("A3SP", &usb_dma1_device);
-	rmobile_add_device_to_domain("A4R", &iic0_device);
-	rmobile_add_device_to_domain("A4R", &veu0_device);
-	rmobile_add_device_to_domain("A4R", &veu1_device);
-	rmobile_add_device_to_domain("A4R", &veu2_device);
-	rmobile_add_device_to_domain("A4R", &veu3_device);
-	rmobile_add_device_to_domain("A4R", &jpu_device);
-	rmobile_add_device_to_domain("A4R", &tmu00_device);
-	rmobile_add_device_to_domain("A4R", &tmu01_device);
+	rmobile_add_device_to_domain_td("A3RV", &vpu_device, &latencies);
+	rmobile_add_device_to_domain_td("A4MP", &spu0_device, &latencies);
+	rmobile_add_device_to_domain_td("A4MP", &spu1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif0_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif2_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif3_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif4_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif5_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &scif6_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &iic1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &dma0_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &dma1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &dma2_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &usb_dma0_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &usb_dma1_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &iic0_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &veu0_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &veu1_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &veu2_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &veu3_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &jpu_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &tmu00_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &tmu01_device, &latencies);
 }
 
 static void __init sh7372_earlytimer_init(void)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/4] PM / shmobile: Specify device latencies for Mackerel devices directly
  2012-08-07 22:26 ` [PATCH 0/4] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
                     ` (2 preceding siblings ...)
  2012-08-07 22:28   ` [PATCH 3/4] PM / shmobile: Specify device latencies for SH7372 devices directly Rafael J. Wysocki
@ 2012-08-07 22:29   ` Rafael J. Wysocki
  3 siblings, 0 replies; 11+ messages in thread
From: Rafael J. Wysocki @ 2012-08-07 22:29 UTC (permalink / raw)
  To: Linux-sh list; +Cc: Linux PM list, LKML, Magnus Damm


The results of adaptive latency computations in
GENPD_DEV_TIMED_CALLBACK() show that the start/stop and save/restore
state latencies of all devices on the Mackerel board I have tried are
a little below 250 us.  Therefore, if the 250 us is used as the
common initial value of the latency fields in struct gpd_timing_data
for all devices on Mackerel, the latency values will never have to
change at run time and there won't be any overhead related to
re-computation of the corresponding PM QoS data.

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
---
 arch/arm/mach-shmobile/board-mackerel.c |   31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

Index: linux/arch/arm/mach-shmobile/board-mackerel.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/board-mackerel.c
+++ linux/arch/arm/mach-shmobile/board-mackerel.c
@@ -1407,8 +1407,15 @@ static struct i2c_board_info i2c1_device
 #define GPIO_PORT168CR	0xE60520A8
 #define SRCR4		0xe61580bc
 #define USCCR1		0xE6058144
+#define DEV_LATENCY_NS	250000
 static void __init mackerel_init(void)
 {
+	struct gpd_timing_data latencies = {
+		.stop_latency_ns = DEV_LATENCY_NS,
+		.start_latency_ns = DEV_LATENCY_NS,
+		.save_state_latency_ns = DEV_LATENCY_NS,
+		.restore_state_latency_ns = DEV_LATENCY_NS,
+	};
 	u32 srcr4;
 	struct clk *clk;
 
@@ -1623,20 +1630,20 @@ static void __init mackerel_init(void)
 
 	platform_add_devices(mackerel_devices, ARRAY_SIZE(mackerel_devices));
 
-	rmobile_add_device_to_domain("A4LC", &lcdc_device);
-	rmobile_add_device_to_domain("A4LC", &hdmi_lcdc_device);
-	rmobile_add_device_to_domain("A4LC", &meram_device);
-	rmobile_add_device_to_domain("A4MP", &fsi_device);
-	rmobile_add_device_to_domain("A3SP", &usbhs0_device);
-	rmobile_add_device_to_domain("A3SP", &usbhs1_device);
-	rmobile_add_device_to_domain("A3SP", &nand_flash_device);
-	rmobile_add_device_to_domain("A3SP", &sh_mmcif_device);
-	rmobile_add_device_to_domain("A3SP", &sdhi0_device);
+	rmobile_add_device_to_domain_td("A4LC", &lcdc_device, &latencies);
+	rmobile_add_device_to_domain_td("A4LC", &hdmi_lcdc_device, &latencies);
+	rmobile_add_device_to_domain_td("A4LC", &meram_device, &latencies);
+	rmobile_add_device_to_domain_td("A4MP", &fsi_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &usbhs0_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &usbhs1_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &nand_flash_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &sh_mmcif_device, &latencies);
+	rmobile_add_device_to_domain_td("A3SP", &sdhi0_device, &latencies);
 #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
-	rmobile_add_device_to_domain("A3SP", &sdhi1_device);
+	rmobile_add_device_to_domain_td("A3SP", &sdhi1_device, &latencies);
 #endif
-	rmobile_add_device_to_domain("A3SP", &sdhi2_device);
-	rmobile_add_device_to_domain("A4R", &ceu_device);
+	rmobile_add_device_to_domain_td("A3SP", &sdhi2_device, &latencies);
+	rmobile_add_device_to_domain_td("A4R", &ceu_device, &latencies);
 
 	hdmi_init_pm_clock();
 	sh7372_pm_init();


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2012-08-08  9:03 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-21 21:49 [RFC][PATCH 0/5] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
2012-07-21 21:53 ` [RFC][PATCH 1/5] PM / shmobile: Set SH7372 PM domain on/off latencies directly Rafael J. Wysocki
2012-07-21 21:54 ` [RFC][PATCH 2/5] PM / shmobile: Allow device latencies to be specified directly Rafael J. Wysocki
2012-07-21 21:54 ` [RFC][PATCH 3/5] PM / shmobile: Specify device latencies for SH7372 devices directly Rafael J. Wysocki
2012-07-21 21:55 ` [RFC][PATCH 4/5] PM / shmobile: Specify device latencies for Mackerel " Rafael J. Wysocki
2012-07-21 21:56 ` [RFC][PATCH 5/5] PM / shmobile: Allow device latencies to be read from a DT Rafael J. Wysocki
2012-08-07 22:26 ` [PATCH 0/4] PM / shmobile: Specify PM domain and device latency information directly Rafael J. Wysocki
2012-08-07 22:27   ` [PATCH 1/4] PM / shmobile: Set PM domain on/off latencies directly Rafael J. Wysocki
2012-08-07 22:27   ` [PATCH 2/4] PM / shmobile: Allow device latencies to be specified directly Rafael J. Wysocki
2012-08-07 22:28   ` [PATCH 3/4] PM / shmobile: Specify device latencies for SH7372 devices directly Rafael J. Wysocki
2012-08-07 22:29   ` [PATCH 4/4] PM / shmobile: Specify device latencies for Mackerel " Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).