add suspend support for loongson2f
cover add suspend support for loongson2f
Loongson2f's cpu frequency is software configurable, when we set its frequency to ZERO, it will go into the suspend mode and can be waked up by the external interrupts.
With this feature and based on the kernel's suspend framework, this patch add the suspend support for loongson2f family machines.
To utilize this support, the machines should provide a necessary external interrupt to wakeup loongson2f from the suspend mode and make sure the interrupt be able to send to the processor directly or indirectly(the interrupt path is not blocked). otherwise, it will suspend there all the time.
And If there is an external timer used, please mask it with IRQF_TIMER, otherwise, the system will fail on resuming from suspend.
The old lemote Fuloong2F mini PC did not provide any method to wakeup the machine from the suspend mode, so, please not try to suspend the machine. But the latest lemote Fuloong2F add an interrupt line from the Power Button to the Processor, If we press the button and release it immediatly, it will work as a wakeup button.
For YeeLoong2F netbook, Since it's easy to setup the keyboard interrupt as the wakeup interrupt, we just setup it and avoid changing the hardware. So the old YeeLoong2F machines can also utilize this support. and in the coming patchset, we will also setup the LID interrupt as the wakeup interrupt.
Thanks & Regards,
Wu Zhangjin
Wu Zhangjin (2):
[loongson] 2f: add suspend support framework [loongson] yeeloong2f: add board specific suspend support
arch/mips/loongson/Kconfig | 5 + arch/mips/loongson/common/Makefile | 6 ++ arch/mips/loongson/common/pm.c | 157 +++++++++++++++++++++++++++++++++ arch/mips/loongson/lemote-2f/Makefile | 6 ++ arch/mips/loongson/lemote-2f/pm.c | 70 +++++++++++++++ 5 files changed, 244 insertions(+), 0 deletions(-) create mode 100644 arch/mips/loongson/common/pm.c create mode 100644 arch/mips/loongson/lemote-2f/pm.c
PATCH 1/2 2f: add suspend support framework
This patch add basic suspend support for loongson2f family machines, loongson2f have a specific feature: when we set it's frequency to ZERO, it will go into a wait mode, and then can be waked up by the external interrupt. so, if we setup suitable interrupts before putting it into wait mode, we will be able wake it up whenever we want via sending the relative interrupts to it.
These interrupts are board-specific, Yeeloong2F use the keyboard interrupt and SCI interrupt, but LingLoong and Fuloong2F use the interrupts connected to the processors directly. and BTW: some old LingLoong and FuLoong2F have no such interrupts connected, so, there is no way to wake them up from suspend mode. and therefore, please do not enable the kernel support for them.
The board-specific support will be added in the coming patches.
--- arch/mips/loongson/Kconfig | 5 + arch/mips/loongson/common/Makefile | 6 ++ arch/mips/loongson/common/pm.c | 157 ++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 0 deletions(-) create mode 100644 arch/mips/loongson/common/pm.c
arch/mips/loongson/Kconfig +5 -0
@@ -61,3 +61,8 @@ endchoice config CS5536 bool + +config LOONGSON_SUSPEND + bool + default y + depends on CPU_SUPPORT_CPUFREQ && SUSPEND
arch/mips/loongson/common/Makefile +6 -0
@@ -16,3 +16,9 @@ obj-$(CONFIG_SERIAL_8250) += serial.o # space # obj-$(CONFIG_CS5536) += cs5536/ + +# +# Suspend Support +# + +obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
arch/mips/loongson/common/pm.c new file +157 -0
157 lines not on this page · raw message
Signature · 1 line
1.6.2.1
PATCH 2/2 yeeloong2f: add board specific suspend support
Lemote loongson2f family machines need an external interrupt to wake up the system from the suspend mode.
For the new Fuloong2f and LingLoong2f, they add a button to send the interrupt to the cpu directly, so, there is no need to setup an interrupt for them.
But for YeeLoong2f and Mengloong2f, there is no hardware change, So, we setup the keyboard interrupt as the wakeup interrupt, this patch does it!
--- arch/mips/loongson/lemote-2f/Makefile | 6 +++ arch/mips/loongson/lemote-2f/pm.c | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 0 deletions(-) create mode 100644 arch/mips/loongson/lemote-2f/pm.c
arch/mips/loongson/lemote-2f/Makefile +6 -0
@@ -3,3 +3,9 @@ # obj-y += irq.o reset.o + +# +# Suspend Support +# + +obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
arch/mips/loongson/lemote-2f/pm.c new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
1.6.2.1
PATCH 2/2 yeeloong2f: add board specific suspend support
In reply to Wu Zhangjin(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
Lemote loongson2f family machines need an external interrupt to wake up the system from the suspend mode.
For the new Fuloong2f and LingLoong2f, they add a button to send the interrupt to the cpu directly, so, there is no need to setup an interrupt for them.
But for YeeLoong2f and Mengloong2f, there is no hardware change, So, we setup the keyboard interrupt as the wakeup interrupt, this patch does it!
--- arch/mips/loongson/lemote-2f/Makefile | 6 +++ arch/mips/loongson/lemote-2f/pm.c | 70 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 0 deletions(-) create mode 100644 arch/mips/loongson/lemote-2f/pm.c
arch/mips/loongson/lemote-2f/Makefile +6 -0
@@ -3,3 +3,9 @@ # obj-y += irq.o reset.o + +# +# Suspend Support +# + +obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
arch/mips/loongson/lemote-2f/pm.c new file +70 -0
70 lines not on this page · raw message
Signature · 1 line
1.6.2.1
Re: [PATCH -queue 2/2] [loongson] yeeloong2f: add board specific suspend support
Quoted 9 lines · Wu Zhangjin
(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
Lemote loongson2f family machines need an external interrupt to wake up the system from the suspend mode.
For the new Fuloong2f and LingLoong2f, they add a button to send the interrupt to the cpu directly, so, there is no need to setup an interrupt for them.
Quoted 5 lines
But for YeeLoong2f and Mengloong2f, there is no hardware change, So, we setup the keyboard interrupt as the wakeup interrupt, this patch does it!
Signed-off-by Wu Zhangjin <[email protected]>
Looks good. ACK.
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH -queue 2/2] [loongson] yeeloong2f: add board specific suspend support
Quoted 7 lines · Pavel Machek
Quoted 7 lines
Lemote loongson2f family machines need an external interrupt to wake up the system from the suspend mode.
For the new Fuloong2f and LingLoong2f, they add a button to send the interrupt to the cpu directly, so, there is no need to setup an interrupt for them.
Quoted 7 lines
Quoted 5 lines
But for YeeLoong2f and Mengloong2f, there is no hardware change, So, we setup the keyboard interrupt as the wakeup interrupt, this patch does it!
Signed-off-by Wu Zhangjin <[email protected]>Looks good. ACK.
Thanks folks. Queued for 2.6.33,
Ralf
Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework
In reply to Wu ZhangjinOn Wed, Nov 11, 2009 at 02:52:36PM +0800, Wu Zhangjin wrote:
Folded into the existing patches
MIPS: Loongson: Register reserved memory pages
MIPS: Loongson: Add basic Loongson 2F support
Thanks,
Ralf
Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework
Quoted 8 lines · Ralf Baechle
On Wed, Nov 11, 2009 at 02:52:36PM +0800, Wu Zhangjin wrote:
Folded into the existing patches
MIPS: Loongson: Register reserved memory pages
MIPS: Loongson: Add basic Loongson 2F supportThanks,
Ignore this mail - I replied to the wrong mail.
Ralf
PATCH 1/2 2f: add suspend support framework
In reply to Wu Zhangjin(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
This patch add basic suspend support for loongson2f family machines, loongson2f have a specific feature: when we set it's frequency to ZERO, it will go into a wait mode, and then can be waked up by the external interrupt. so, if we setup suitable interrupts before putting it into wait mode, we will be able wake it up whenever we want via sending the relative interrupts to it.
These interrupts are board-specific, Yeeloong2F use the keyboard interrupt and SCI interrupt, but LingLoong and Fuloong2F use the interrupts connected to the processors directly. and BTW: some old LingLoong and FuLoong2F have no such interrupts connected, so, there is no way to wake them up from suspend mode. and therefore, please do not enable the kernel support for them.
The board-specific support will be added in the coming patches.
--- arch/mips/loongson/Kconfig | 5 + arch/mips/loongson/common/Makefile | 6 ++ arch/mips/loongson/common/pm.c | 157 ++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 0 deletions(-) create mode 100644 arch/mips/loongson/common/pm.c
arch/mips/loongson/Kconfig +5 -0
@@ -61,3 +61,8 @@ endchoice config CS5536 bool + +config LOONGSON_SUSPEND + bool + default y + depends on CPU_SUPPORT_CPUFREQ && SUSPEND
arch/mips/loongson/common/Makefile +6 -0
@@ -16,3 +16,9 @@ obj-$(CONFIG_SERIAL_8250) += serial.o # space # obj-$(CONFIG_CS5536) += cs5536/ + +# +# Suspend Support +# + +obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
arch/mips/loongson/common/pm.c new file +157 -0
157 lines not on this page · raw message
Signature · 1 line
1.6.2.1
PATCH 1/2 2f: add suspend support framework
In reply to Wu Zhangjin(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
This patch add basic suspend support for loongson2f family machines, loongson2f have a specific feature: when we set it's frequency to ZERO, it will go into a wait mode, and then can be waked up by the external interrupt. so, if we setup suitable interrupts before putting it into wait mode, we will be able wake it up whenever we want via sending the relative interrupts to it.
These interrupts are board-specific, Yeeloong2F use the keyboard interrupt and SCI interrupt, but LingLoong and Fuloong2F use the interrupts connected to the processors directly. and BTW: some old LingLoong and FuLoong2F have no such interrupts connected, so, there is no way to wake them up from suspend mode. and therefore, please do not enable the kernel support for them.
The board-specific support will be added in the coming patches.
--- arch/mips/loongson/Kconfig | 5 + arch/mips/loongson/common/Makefile | 6 ++ arch/mips/loongson/common/pm.c | 157 ++++++++++++++++++++++++++++++++++++ 3 files changed, 168 insertions(+), 0 deletions(-) create mode 100644 arch/mips/loongson/common/pm.c
arch/mips/loongson/Kconfig +5 -0
@@ -61,3 +61,8 @@ endchoice config CS5536 bool + +config LOONGSON_SUSPEND + bool + default y + depends on CPU_SUPPORT_CPUFREQ && SUSPEND
arch/mips/loongson/common/Makefile +6 -0
@@ -16,3 +16,9 @@ obj-$(CONFIG_SERIAL_8250) += serial.o # space # obj-$(CONFIG_CS5536) += cs5536/ + +# +# Suspend Support +# + +obj-$(CONFIG_LOONGSON_SUSPEND) += pm.o
arch/mips/loongson/common/pm.c new file +157 -0
157 lines not on this page · raw message
Signature · 1 line
1.6.2.1
Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework
Quoted 16 lines · Wu Zhangjin
(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
This patch add basic suspend support for loongson2f family machines, loongson2f have a specific feature: when we set it's frequency to ZERO, it will go into a wait mode, and then can be waked up by the external interrupt. so, if we setup suitable interrupts before putting it into wait mode, we will be able wake it up whenever we want via sending the relative interrupts to it.
These interrupts are board-specific, Yeeloong2F use the keyboard interrupt and SCI interrupt, but LingLoong and Fuloong2F use the interrupts connected to the processors directly. and BTW: some old LingLoong and FuLoong2F have no such interrupts connected, so, there is no way to wake them up from suspend mode. and therefore, please do not enable the kernel support for them.
Quoted 3 lines
The board-specific support will be added in the coming patches.
Signed-off-by Wu Zhangjin <[email protected]>
Comments are slighlty "interesting", but otherwise it looks ok.
arch/mips/loongson/common/pm.c line 97
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* stop all perf counters */ +stop_perf_counters ();
This is not exactly useful comment, right?
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific suspend */ +mach_suspend ();
...
arch/mips/loongson/common/pm.c line 128
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific resume */ +mach_resume ();
It is probably ok, but you may want to avoid them in future.
ACK.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework
In reply to Wu ZhangjinQuoted 16 lines · Wu Zhangjin
(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
This patch add basic suspend support for loongson2f family machines, loongson2f have a specific feature: when we set it's frequency to ZERO, it will go into a wait mode, and then can be waked up by the external interrupt. so, if we setup suitable interrupts before putting it into wait mode, we will be able wake it up whenever we want via sending the relative interrupts to it.
These interrupts are board-specific, Yeeloong2F use the keyboard interrupt and SCI interrupt, but LingLoong and Fuloong2F use the interrupts connected to the processors directly. and BTW: some old LingLoong and FuLoong2F have no such interrupts connected, so, there is no way to wake them up from suspend mode. and therefore, please do not enable the kernel support for them.
Quoted 3 lines
The board-specific support will be added in the coming patches.
Signed-off-by Wu Zhangjin <[email protected]>
Comments are slighlty "interesting", but otherwise it looks ok.
arch/mips/loongson/common/pm.c line 97
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* stop all perf counters */ +stop_perf_counters ();
This is not exactly useful comment, right?
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific suspend */ +mach_suspend ();
...
arch/mips/loongson/common/pm.c line 128
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific resume */ +mach_resume ();
It is probably ok, but you may want to avoid them in future.
ACK.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework
Hi,
Quoted 19 lines · Pavel Machek
Quoted 18 lines · Wu Zhangjin
(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
This patch add basic suspend support for loongson2f family machines, loongson2f have a specific feature: when we set it's frequency to ZERO, it will go into a wait mode, and then can be waked up by the external interrupt. so, if we setup suitable interrupts before putting it into wait mode, we will be able wake it up whenever we want via sending the relative interrupts to it.
These interrupts are board-specific, Yeeloong2F use the keyboard interrupt and SCI interrupt, but LingLoong and Fuloong2F use the interrupts connected to the processors directly. and BTW: some old LingLoong and FuLoong2F have no such interrupts connected, so, there is no way to wake them up from suspend mode. and therefore, please do not enable the kernel support for them.
The board-specific support will be added in the coming patches.
Quoted 9 lines
Quoted 1 line
Signed-off-by Wu Zhangjin <[email protected]>Comments are slighlty "interesting", but otherwise it looks ok.
arch/mips/loongson/common/pm.c line 97
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* stop all perf counters */ +stop_perf_counters ();This is not exactly useful comment, right?
Will remove it later ;) the same to the following two.
Quoted 12 lines
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific suspend */ +mach_suspend ();...
arch/mips/loongson/common/pm.c line 128
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific resume */ +mach_resume ();It is probably ok, but you may want to avoid them in future.
ACK.
Pavel
Thanks!
Wu Zhangjin
Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework
In reply to Pavel MachekHi,
Quoted 19 lines · Pavel Machek
Quoted 18 lines · Wu Zhangjin
(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
This patch add basic suspend support for loongson2f family machines, loongson2f have a specific feature: when we set it's frequency to ZERO, it will go into a wait mode, and then can be waked up by the external interrupt. so, if we setup suitable interrupts before putting it into wait mode, we will be able wake it up whenever we want via sending the relative interrupts to it.
These interrupts are board-specific, Yeeloong2F use the keyboard interrupt and SCI interrupt, but LingLoong and Fuloong2F use the interrupts connected to the processors directly. and BTW: some old LingLoong and FuLoong2F have no such interrupts connected, so, there is no way to wake them up from suspend mode. and therefore, please do not enable the kernel support for them.
The board-specific support will be added in the coming patches.
Quoted 9 lines
Quoted 1 line
Signed-off-by Wu Zhangjin <[email protected]>Comments are slighlty "interesting", but otherwise it looks ok.
arch/mips/loongson/common/pm.c line 97
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* stop all perf counters */ +stop_perf_counters ();This is not exactly useful comment, right?
Will remove it later ;) the same to the following two.
Quoted 12 lines
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific suspend */ +mach_suspend ();...
arch/mips/loongson/common/pm.c line 128
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific resume */ +mach_resume ();It is probably ok, but you may want to avoid them in future.
ACK.
Pavel
Thanks!
Wu Zhangjin
Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework
In reply to Pavel MachekQuoted 31 lines · Pavel Machek
Quoted 16 lines · Wu Zhangjin
(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
This patch add basic suspend support for loongson2f family machines, loongson2f have a specific feature: when we set it's frequency to ZERO, it will go into a wait mode, and then can be waked up by the external interrupt. so, if we setup suitable interrupts before putting it into wait mode, we will be able wake it up whenever we want via sending the relative interrupts to it.
These interrupts are board-specific, Yeeloong2F use the keyboard interrupt and SCI interrupt, but LingLoong and Fuloong2F use the interrupts connected to the processors directly. and BTW: some old LingLoong and FuLoong2F have no such interrupts connected, so, there is no way to wake them up from suspend mode. and therefore, please do not enable the kernel support for them.
Quoted 3 lines
The board-specific support will be added in the coming patches.
Signed-off-by Wu Zhangjin <[email protected]>Comments are slighlty "interesting", but otherwise it looks ok.
arch/mips/loongson/common/pm.c line 97
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* stop all perf counters */ +stop_perf_counters ();This is not exactly useful comment, right?
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific suspend */ +mach_suspend ();...
Quoted 7 lines
arch/mips/loongson/common/pm.c line 128
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific resume */ +mach_resume ();It is probably ok, but you may want to avoid them in future.
ACK.
Thanks. Queued for 2.6.33 with the comments cleaned up.
Ralf
Re: [PATCH -queue 1/2] [loongson] 2f: add suspend support framework
In reply to Pavel MachekQuoted 31 lines · Pavel Machek
Quoted 16 lines · Wu Zhangjin
(Add CC to Rafael J. Wysocki, Len Brown and Pavel Machek)
This patch add basic suspend support for loongson2f family machines, loongson2f have a specific feature: when we set it's frequency to ZERO, it will go into a wait mode, and then can be waked up by the external interrupt. so, if we setup suitable interrupts before putting it into wait mode, we will be able wake it up whenever we want via sending the relative interrupts to it.
These interrupts are board-specific, Yeeloong2F use the keyboard interrupt and SCI interrupt, but LingLoong and Fuloong2F use the interrupts connected to the processors directly. and BTW: some old LingLoong and FuLoong2F have no such interrupts connected, so, there is no way to wake them up from suspend mode. and therefore, please do not enable the kernel support for them.
Quoted 3 lines
The board-specific support will be added in the coming patches.
Signed-off-by Wu Zhangjin <[email protected]>Comments are slighlty "interesting", but otherwise it looks ok.
arch/mips/loongson/common/pm.c line 97
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* stop all perf counters */ +stop_perf_counters ();This is not exactly useful comment, right?
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific suspend */ +mach_suspend ();...
Quoted 7 lines
arch/mips/loongson/common/pm.c line 128
Quoted 2 lines
arch/mips/loongson/common/pm.c new file +2
-0+/* mach specific resume */ +mach_resume ();It is probably ok, but you may want to avoid them in future.
ACK.
Thanks. Queued for 2.6.33 with the comments cleaned up.
Ralf