Skip to contentSkip to conversation

ARM: SAMSUNG: Add idle support

PATCH New Kukjin Kim 4 participants 9 messages Jan 11, 2010 – Jan 13, 2010

Subsystems (2)
lore
Share & tools
lore

Kukjin Kim

author
#0 lore raw

PATCH 3/3 ARM: SAMSUNG: Add idle support

This patch adds common idle functionality for all Samsung SoC's.

---
 arch/arm/plat-samsung/include/mach/idle.h   |   18 +++++++++++++
 arch/arm/plat-samsung/include/mach/system.h |   36 +++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/mach/idle.h
 create mode 100644 arch/arm/plat-samsung/include/mach/system.h
arch/arm/plat-samsung/include/mach/idle.h new file +18 -0
new file mode 100644
index 0000000..f3b5034
@@ -0,0 +1,18 @@
+/* linux/arch/arm/plat-samsung/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Idle support
+ *
+ * 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 __ASM_PLAT_IDLE_H
+#define __ASM_PLAT_IDLE_H __FILE__
+
+extern void (*s3c_idle_fn)(void);
+
+#endif /* __ASM_PLAT_IDLE_H */
arch/arm/plat-samsung/include/mach/system.h new file +36 -0
new file mode 100644
index 0000000..5377792
@@ -0,0 +1,36 @@
+/* linux/arch/arm/plat-samsung/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Idle support
+ *
+ * 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 __ASM_PLAT_SYSTEM_H
+#define __ASM_PLAT_SYSTEM_H __FILE__
+
+void (*s3c_idle_fn)(void);
+
+static void s3c_default_idle(void)
+{
+	/* nothing here yet */
+}
+
+static void arch_idle(void)
+{
+	if (s3c_idle_fn != NULL)
+		(s3c_idle_fn)();
+	else
+		s3c_default_idle();
+}
+
+static void arch_reset(char mode, const char *cmd)
+{
+	/* nothing here yet */
+}
+
+#endif /* __ASM_PLAT_SYSTEM_H */
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH 3/3 ARM: SAMSUNG: Add idle support

Quoted 1 line · Kukjin Kim

This patch adds common idle functionality for all Samsung SoC's.

NAK. Please use the existing support already provided. There's no point in double-indirection - it just makes the code harder to follow.

Just set pm_idle to your idle function.

#2 lore raw

PATCH 3/3 ARM: SAMSUNG: Add idle support

Quoted 7 lines · Russell King - ARM Linux
Quoted 1 line · Kukjin Kim

This patch adds common idle functionality for all Samsung SoC's.

NAK. Please use the existing support already provided. There's no point in double-indirection - it just makes the code harder to follow.

Just set pm_idle to your idle function.

Hmm, the default_idle() function that pm_idle is set to at init time does more than what arch_idle() does. We'd end up having to copy the logic in default_idle() into each of our idle routines. How difficult would it be to change the callers of pm_idle() to check whether it actually needs calling and to re-enable the interrupt state after calling it?

We did this originally as before we issue the WFI co-processor instruction we need to set the sleep mode. A number of the Samsung SoC have the WFI line on the cpu routed via a mux to various functions, such as IDLE or much deeper sleep modes such as the SUSPEND state.

I've no data on whether the write is needed before each sleep or not, so my preference would be to ensure that this mux is setup before each call, but it might be possible to simply ensure that it is setup correctly on init and after suspend/resume.

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#3 lore raw

PATCH 3/3 ARM: SAMSUNG: Add idle support

Quoted 7 lines · Ben Dooks
Quoted 6 lines · Russell King - ARM Linux
Quoted 1 line · Kukjin Kim

This patch adds common idle functionality for all Samsung SoC's.

NAK. Please use the existing support already provided. There's no point in double-indirection - it just makes the code harder to follow.

Quoted 7 lines
Quoted 1 line

Just set pm_idle to your idle function.

Hmm, the default_idle() function that pm_idle is set to at init time does more than what arch_idle() does. We'd end up having to copy the logic in default_idle() into each of our idle routines. How difficult would it be to change the callers of pm_idle() to check whether it actually needs calling and to re-enable the interrupt state after calling it?

Not possible without changing all the other architectures - pm_idle() is the standard interface for hooking into the idle code, and is used by things like cpuidle, APM, ACPI, etc.

Please use the standard cross-architecture pm_idle() hook if you want to dynamically override the default idle code.

#4 lore raw

PATCH 3/3 ARM: SAMSUNG: Add idle support

Quoted 16 lines · Russell King - ARM Linux
Quoted 7 lines · Ben Dooks
Quoted 6 lines · Russell King - ARM Linux
Quoted 1 line · Kukjin Kim

This patch adds common idle functionality for all Samsung SoC's.

NAK. Please use the existing support already provided. There's no point in double-indirection - it just makes the code harder to follow.

Quoted 7 lines
Quoted 1 line

Just set pm_idle to your idle function.

Hmm, the default_idle() function that pm_idle is set to at init time does more than what arch_idle() does. We'd end up having to copy the logic in default_idle() into each of our idle routines. How difficult would it be to change the callers of pm_idle() to check whether it actually needs calling and to re-enable the interrupt state after calling it?

Quoted 6 lines

Not possible without changing all the other architectures - pm_idle() is the standard interface for hooking into the idle code, and is used by things like cpuidle, APM, ACPI, etc.

Please use the standard cross-architecture pm_idle() hook if you want to dynamically override the default idle code.

So basically i've got to copy the default_idle() and the necessary cpu code for each of the cpus that are supported? I'd much rather just do it once and have a pointer to the bits that change thanks.

Signature · 4 lines
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
#5 lore raw

PATCH 3/3 ARM: SAMSUNG: Add idle support

Quoted 3 lines · Ben Dooks

So basically i've got to copy the default_idle() and the necessary cpu code for each of the cpus that are supported? I'd much rather just do it once and have a pointer to the bits that change thanks.

No - default_idle is just:

static void default_idle(void)

{
        if (!need_resched())
                arch_idle();
        local_irq_enable();
}

Rather than indirecting arch_idle(), hook into pm_idle instead, and have:

	if (!need_resched()) {
		your_idle_code_which_may_be_a_call_to_cpu_idle();
	}
	local_irq_enable();

in each of your idle methods instead, completely ignoring arch_idle().

#6 lore raw

PATCH 3/3 ARM: SAMSUNG: Add idle support

In reply to Kukjin Kim
Quoted 6 lines · Kukjin Kim
arch/arm/plat-samsung/include/mach/system.h new file +0 -0
new file mode 100644
index 0000000..5377792
@@ -0,0 +1,36 @@

...

Quoted 1 line

+void (*s3c_idle_fn)(void);

This should include idle.h to ensure consistency and the entire file looks like it ought to be a .c file rather than a .h since it includes function and variable definitions.

#7 lore raw

PATCH 3/3 ARM: SAMSUNG: Add idle support

In reply to Kukjin Kim
Quoted 1 line · Kukjin Kim

This patch adds common idle functionality for all Samsung SoC's.

Kukjin, for expediency please do as Russell suggested and hook the pm_idle call for the s5p6440 case.

Quoted 82 lines
---
 arch/arm/plat-samsung/include/mach/idle.h   |   18 +++++++++++++
 arch/arm/plat-samsung/include/mach/system.h |   36 +++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/mach/idle.h
 create mode 100644 arch/arm/plat-samsung/include/mach/system.h
arch/arm/plat-samsung/include/mach/idle.h new file +18 -0
new file mode 100644
index 0000000..f3b5034
@@ -0,0 +1,18 @@
+/* linux/arch/arm/plat-samsung/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Idle support
+ *
+ * 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 __ASM_PLAT_IDLE_H
+#define __ASM_PLAT_IDLE_H __FILE__
+
+extern void (*s3c_idle_fn)(void);
+
+#endif /* __ASM_PLAT_IDLE_H */
arch/arm/plat-samsung/include/mach/system.h new file +36 -0
new file mode 100644
index 0000000..5377792
@@ -0,0 +1,36 @@
+/* linux/arch/arm/plat-samsung/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Idle support
+ *
+ * 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 __ASM_PLAT_SYSTEM_H
+#define __ASM_PLAT_SYSTEM_H __FILE__
+
+void (*s3c_idle_fn)(void);
+
+static void s3c_default_idle(void)
+{
+	/* nothing here yet */
+}
+
+static void arch_idle(void)
+{
+	if (s3c_idle_fn != NULL)
+		(s3c_idle_fn)();
+	else
+		s3c_default_idle();
+}
+
+static void arch_reset(char mode, const char *cmd)
+{
+	/* nothing here yet */
+}
+
+#endif /* __ASM_PLAT_SYSTEM_H */
Signature · 7 lines
1.6.2.5


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 5 lines
-- 
Ben

Q:      What's a light-year?
A:      One-third less calories than a regular year.
author
#8 lore raw

PATCH 3/3 ARM: SAMSUNG: Add idle support

Quoted 5 lines · Ben Dooks
Quoted 1 line · Kukjin Kim

This patch adds common idle functionality for all Samsung SoC's.

Kukjin, for expediency please do as Russell suggested and hook the pm_idle call for the s5p6440 case.

Ok, I will do it.
Thanks.

Quoted 73 lines
Quoted 4 lines
---
 arch/arm/plat-samsung/include/mach/idle.h   |   18 +++++++++++++
 arch/arm/plat-samsung/include/mach/system.h |   36

+++++++++++++++++++++++++++

arch/arm/plat-

Quoted 5 lines
 2 files changed, 54 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/plat-samsung/include/mach/idle.h
 create mode 100644 arch/arm/plat-samsung/include/mach/system.h
arch/arm/plat- renamed from arch/arm/plat-samsung/include/mach/idle.h +0 -0

samsung/include/mach/idle.h

arch/arm/plat-

Quoted 24 lines

new file mode 100644
index 0000000..f3b5034

arch/arm/plat-samsung/include/mach/idle.h new file +18 -0
@@ -0,0 +1,18 @@
+/* linux/arch/arm/plat-samsung/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Idle support
+ *
+ * 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 __ASM_PLAT_IDLE_H
+#define __ASM_PLAT_IDLE_H __FILE__
+
+extern void (*s3c_idle_fn)(void);
+
+#endif /* __ASM_PLAT_IDLE_H */
arch/arm/plat- renamed from arch/arm/plat-samsung/include/mach/system.h +0 -0

samsung/include/mach/system.h

Quoted 37 lines

new file mode 100644
index 0000000..5377792

arch/arm/plat-samsung/include/mach/system.h new file +32 -0
@@ -0,0 +1,36 @@
+/* linux/arch/arm/plat-samsung/include/mach/idle.h
+ *
+ * Copyright (c) 2009 Samsung Electronics Co., Ltd.
+ *		http://www.samsung.com/
+ *
+ * Idle support
+ *
+ * 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 __ASM_PLAT_SYSTEM_H
+#define __ASM_PLAT_SYSTEM_H __FILE__
+
+void (*s3c_idle_fn)(void);
+
+static void s3c_default_idle(void)
+{
+	/* nothing here yet */
+}
+
+static void arch_idle(void)
+{
+	if (s3c_idle_fn != NULL)
+		(s3c_idle_fn)();
+	else
+		s3c_default_idle();
+}
+
+static void arch_reset(char mode, const char *cmd)
+{
Quoted 8 lines
Quoted 8 lines
arch/arm/plat-samsung/include/mach/system.h new file +4 -1
+	/* nothing here yet */
+}
+
+#endif /* __ASM_PLAT_SYSTEM_H */
--

1.6.2.5

Best regards,
Kgene.
--
Kukjin Kim <[email protected]>, Senior Engineer, System LSI Division, SAMSUNG ELECTRONICS CO., LTD.