* [patch] Add suspend/resume support to locomo.c
@ 2005-07-21 5:25 Pavel Machek
2005-09-04 10:36 ` Russell King
0 siblings, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2005-07-21 5:25 UTC (permalink / raw)
To: rpurdie, Russell King, lenz, kernel list
From: John Lenz <lenz@cs.wisc.edu>
This adds low-level suspend/resume support to locomo.c.
Signed-off-by: Pavel Machek <pavel@suse.cz>
diff --git a/arch/arm/common/locomo.c b/arch/arm/common/locomo.c
--- a/arch/arm/common/locomo.c
+++ b/arch/arm/common/locomo.c
@@ -541,6 +541,103 @@ locomo_init_one_child(struct locomo *lch
return ret;
}
+#ifdef CONFIG_PM
+
+struct locomo_save_data {
+ u16 LCM_GPO;
+ u16 LCM_SPICT;
+ u16 LCM_GPE;
+ u16 LCM_ASD;
+ u16 LCM_SPIMD;
+};
+
+static int locomo_suspend(struct device *dev, u32 pm_message_t, u32 level)
+{
+ struct locomo *lchip = dev_get_drvdata(dev);
+ struct locomo_save_data *save;
+ unsigned long flags;
+
+ if (level != SUSPEND_DISABLE)
+ return 0;
+
+ save = kmalloc(sizeof(struct locomo_save_data), GFP_KERNEL);
+ if (!save)
+ return -ENOMEM;
+
+ dev->power.saved_state = (void *) save;
+
+ spin_lock_irqsave(&lchip->lock, flags);
+
+ save->LCM_GPO = locomo_readl(lchip->base + LOCOMO_GPO); /* GPIO */
+ locomo_writel(0x00, lchip->base + LOCOMO_GPO);
+ save->LCM_SPICT = locomo_readl(lchip->base + LOCOMO_SPICT); /* SPI */
+ locomo_writel(0x40, lchip->base + LOCOMO_SPICT);
+ save->LCM_GPE = locomo_readl(lchip->base + LOCOMO_GPE); /* GPIO */
+ locomo_writel(0x00, lchip->base + LOCOMO_GPE);
+ save->LCM_ASD = locomo_readl(lchip->base + LOCOMO_ASD); /* ADSTART */
+ locomo_writel(0x00, lchip->base + LOCOMO_ASD);
+ save->LCM_SPIMD = locomo_readl(lchip->base + LOCOMO_SPIMD); /* SPI */
+ locomo_writel(0x3C14, lchip->base + LOCOMO_SPIMD);
+
+ locomo_writel(0x00, lchip->base + LOCOMO_PAIF);
+ locomo_writel(0x00, lchip->base + LOCOMO_DAC);
+ locomo_writel(0x00, lchip->base + LOCOMO_BACKLIGHT + LOCOMO_TC);
+
+ if ( (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT0) & 0x88) && (locomo_readl(lchip->base + LOCOMO_LED + LOCOMO_LPT1) & 0x88) )
+ locomo_writel(0x00, lchip->base + LOCOMO_C32K); /* CLK32 off */
+ else
+ /* 18MHz already enabled, so no wait */
+ locomo_writel(0xc1, lchip->base + LOCOMO_C32K); /* CLK32 on */
+
+ locomo_writel(0x00, lchip->base + LOCOMO_TADC); /* 18MHz clock off*/
+ locomo_writel(0x00, lchip->base + LOCOMO_AUDIO + LOCOMO_ACC); /* 22MHz/24MHz clock off */
+ locomo_writel(0x00, lchip->base + LOCOMO_FRONTLIGHT + LOCOMO_ALS); /* FL */
+
+ spin_unlock_irqrestore(&lchip->lock, flags);
+
+ return 0;
+}
+
+static int locomo_resume(struct device *dev, u32 level)
+{
+ struct locomo *lchip = dev_get_drvdata(dev);
+ struct locomo_save_data *save;
+ unsigned long r;
+ unsigned long flags;
+
+ if (level != RESUME_ENABLE)
+ return 0;
+
+ save = (struct locomo_save_data *) dev->power.saved_state;
+ if (!save)
+ return 0;
+
+ spin_lock_irqsave(&lchip->lock, flags);
+
+ locomo_writel(save->LCM_GPO, lchip->base + LOCOMO_GPO);
+ locomo_writel(save->LCM_SPICT, lchip->base + LOCOMO_SPICT);
+ locomo_writel(save->LCM_GPE, lchip->base + LOCOMO_GPE);
+ locomo_writel(save->LCM_ASD, lchip->base + LOCOMO_ASD);
+ locomo_writel(save->LCM_SPIMD, lchip->base + LOCOMO_SPIMD);
+
+ locomo_writel(0x00, lchip->base + LOCOMO_C32K);
+ locomo_writel(0x90, lchip->base + LOCOMO_TADC);
+
+ locomo_writel(0, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KSC);
+ r = locomo_readl(lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
+ r &= 0xFEFF;
+ locomo_writel(r, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KIC);
+ locomo_writel(0x1, lchip->base + LOCOMO_KEYBOARD + LOCOMO_KCMD);
+
+ spin_unlock_irqrestore(&lchip->lock, flags);
+
+ dev->power.saved_state = NULL;
+ kfree(save);
+
+ return 0;
+}
+#endif
+
/**
* locomo_probe - probe for a single LoCoMo chip.
* @phys_addr: physical address of device.
@@ -707,6 +810,10 @@ static struct device_driver locomo_devic
.bus = &platform_bus_type,
.probe = locomo_probe,
.remove = locomo_remove,
+#ifdef CONFIG_PM
+ .suspend = locomo_suspend,
+ .resume = locomo_resume,
+#endif
};
/*
--
teflon -- maybe it is a trademark, but it should not be.
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [patch] Add suspend/resume support to locomo.c
2005-07-21 5:25 [patch] Add suspend/resume support to locomo.c Pavel Machek
@ 2005-09-04 10:36 ` Russell King
2005-09-06 7:58 ` Pavel Machek
0 siblings, 1 reply; 9+ messages in thread
From: Russell King @ 2005-09-04 10:36 UTC (permalink / raw)
To: Pavel Machek; +Cc: rpurdie, lenz, kernel list
On Thu, Jul 21, 2005 at 07:25:58AM +0200, Pavel Machek wrote:
> From: John Lenz <lenz@cs.wisc.edu>
>
> This adds low-level suspend/resume support to locomo.c.
>
> Signed-off-by: Pavel Machek <pavel@suse.cz>
Shouldn't this be signed off by John himself? Not applied.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Add suspend/resume support to locomo.c
2005-09-04 10:36 ` Russell King
@ 2005-09-06 7:58 ` Pavel Machek
2005-09-08 13:42 ` Russell King
2005-09-08 23:29 ` John Lenz
0 siblings, 2 replies; 9+ messages in thread
From: Pavel Machek @ 2005-09-06 7:58 UTC (permalink / raw)
To: rpurdie, lenz, kernel list
Hi!
> > From: John Lenz <lenz@cs.wisc.edu>
> >
> > This adds low-level suspend/resume support to locomo.c.
> >
> > Signed-off-by: Pavel Machek <pavel@suse.cz>
>
> Shouldn't this be signed off by John himself? Not applied.
Well, it would be nice if it was signed off by him, but John is
nowhere to be reached.
So I signed it off myself, as in:
(b) The contribution is based upon previous work that, to the best
of my knowledge, is covered under an appropriate open source
license and I have the right under that license to submit that
work with modifications, whether created in whole or in part
by me, under the same open source license (unless I am
permitted to submit under a different license), as indicated
in the file; or
; that should be okay.
Pavel
--
if you have sharp zaurus hardware you don't need... you know my address
^ permalink raw reply [flat|nested] 9+ messages in thread* Re: [patch] Add suspend/resume support to locomo.c
2005-09-06 7:58 ` Pavel Machek
@ 2005-09-08 13:42 ` Russell King
2005-09-08 23:29 ` John Lenz
1 sibling, 0 replies; 9+ messages in thread
From: Russell King @ 2005-09-08 13:42 UTC (permalink / raw)
To: Pavel Machek; +Cc: rpurdie, lenz, kernel list
On Tue, Sep 06, 2005 at 09:58:53AM +0200, Pavel Machek wrote:
> Well, it would be nice if it was signed off by him, but John is
> nowhere to be reached.
Hmm, ok, applied.
--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Add suspend/resume support to locomo.c
2005-09-06 7:58 ` Pavel Machek
2005-09-08 13:42 ` Russell King
@ 2005-09-08 23:29 ` John Lenz
2005-09-10 22:38 ` Pavel Machek
1 sibling, 1 reply; 9+ messages in thread
From: John Lenz @ 2005-09-08 23:29 UTC (permalink / raw)
To: Pavel Machek; +Cc: rpurdie, kernel list, Russell King
On Tue, September 6, 2005 2:58 am, Pavel Machek said:
> Hi!
>
>> > From: John Lenz <lenz@cs.wisc.edu>
>> >
>> > This adds low-level suspend/resume support to locomo.c.
>> >
>> > Signed-off-by: Pavel Machek <pavel@suse.cz>
>>
>> Shouldn't this be signed off by John himself? Not applied.
>
> Well, it would be nice if it was signed off by him, but John is
> nowhere to be reached.
Sorry. I have been away from the internet (somewhat unexpectedly) the
past three weeks... so I am not up to date on what has been happening.
For the near future as I try and come back up to speed, patches can be
applied from Pavel.
Pavel, perhaps you could send me an email about what you (and others) have
done the past few weeks? The patches on my site and such are probably a
ways out of date. What/where is the latest code located? What progress
has been made... Hopefully sometime next week I can start working on this
stuff again.
Thanks,
John
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Add suspend/resume support to locomo.c
2005-09-08 23:29 ` John Lenz
@ 2005-09-10 22:38 ` Pavel Machek
2005-09-10 22:53 ` Richard Purdie
2005-09-11 20:34 ` Pavel Machek
0 siblings, 2 replies; 9+ messages in thread
From: Pavel Machek @ 2005-09-10 22:38 UTC (permalink / raw)
To: John Lenz; +Cc: rpurdie, kernel list, Russell King
Hi!
> >> > From: John Lenz <lenz@cs.wisc.edu>
> >> >
> >> > This adds low-level suspend/resume support to locomo.c.
> >> >
> >> > Signed-off-by: Pavel Machek <pavel@suse.cz>
> >>
> >> Shouldn't this be signed off by John himself? Not applied.
> >
> > Well, it would be nice if it was signed off by him, but John is
> > nowhere to be reached.
>
> Sorry. I have been away from the internet (somewhat unexpectedly) the
> past three weeks... so I am not up to date on what has been happening.
> For the near future as I try and come back up to speed, patches can be
> applied from Pavel.
>
> Pavel, perhaps you could send me an email about what you (and others) have
> done the past few weeks? The patches on my site and such are probably a
> ways out of date. What/where is the latest code located? What progress
> has been made... Hopefully sometime next week I can start working on this
> stuff again.
[I have just came back from 3 days horse trip... you'll get replies to
other mails later.]
There's git tree at www.kernel.org/git ... its called linux-z. It
worked for before I got to 2.6.13, but it is now broken (IIRC, maybe
its okay). PCMCIA never worked for me. linux-z is probably good start
for new work. It should have all your patches IIRC.
I started work on battery control, and it does something, but I do not
dare enabling charging juts yet.
Pavel
--
if you have sharp zaurus hardware you don't need... you know my address
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Add suspend/resume support to locomo.c
2005-09-10 22:38 ` Pavel Machek
@ 2005-09-10 22:53 ` Richard Purdie
2005-09-11 20:34 ` Pavel Machek
1 sibling, 0 replies; 9+ messages in thread
From: Richard Purdie @ 2005-09-10 22:53 UTC (permalink / raw)
To: Pavel Machek; +Cc: John Lenz, kernel list, Russell King
On Sun, 2005-09-11 at 00:38 +0200, Pavel Machek wrote:
> [I have just came back from 3 days horse trip... you'll get replies to
> other mails later.]
>
> There's git tree at www.kernel.org/git ... its called linux-z. It
> worked for before I got to 2.6.13, but it is now broken (IIRC, maybe
> its okay). PCMCIA never worked for me. linux-z is probably good start
> for new work. It should have all your patches IIRC.
>
> I started work on battery control, and it does something, but I do not
> dare enabling charging juts yet.
It might be worth looking at:
http://www.rpsys.net/openzaurus/patches/sharpsl_pm-r8.patch
This is a more general and much cleaned up version of the Sharp power
management code. I've not studied the collie specifics so I don't know
how adaptable this would be for your uses. Examples of machine specific
support code are:
http://www.rpsys.net/openzaurus/patches/spitz_pm-r3.patch
http://www.rpsys.net/openzaurus/patches/corgi_pm-r3.patch
I'm still cleaning this up but its getting there...
Richard
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Add suspend/resume support to locomo.c
2005-09-10 22:38 ` Pavel Machek
2005-09-10 22:53 ` Richard Purdie
@ 2005-09-11 20:34 ` Pavel Machek
2005-09-11 22:51 ` Pavel Machek
1 sibling, 1 reply; 9+ messages in thread
From: Pavel Machek @ 2005-09-11 20:34 UTC (permalink / raw)
To: John Lenz; +Cc: rpurdie, kernel list, Russell King
[-- Attachment #1: Type: text/plain, Size: 1660 bytes --]
Hi!
> > >> > From: John Lenz <lenz@cs.wisc.edu>
> > >> >
> > >> > This adds low-level suspend/resume support to locomo.c.
> > >> >
> > >> > Signed-off-by: Pavel Machek <pavel@suse.cz>
> > >>
> > >> Shouldn't this be signed off by John himself? Not applied.
> > >
> > > Well, it would be nice if it was signed off by him, but John is
> > > nowhere to be reached.
> >
> > Sorry. I have been away from the internet (somewhat unexpectedly) the
> > past three weeks... so I am not up to date on what has been happening.
> > For the near future as I try and come back up to speed, patches can be
> > applied from Pavel.
> >
> > Pavel, perhaps you could send me an email about what you (and others) have
> > done the past few weeks? The patches on my site and such are probably a
> > ways out of date. What/where is the latest code located? What progress
> > has been made... Hopefully sometime next week I can start working on this
> > stuff again.
>
> [I have just came back from 3 days horse trip... you'll get replies to
> other mails later.]
>
> There's git tree at www.kernel.org/git ... its called linux-z. It
> worked for before I got to 2.6.13, but it is now broken (IIRC, maybe
> its okay). PCMCIA never worked for me. linux-z is probably good start
> for new work. It should have all your patches IIRC.
Okay, it was really stupid problem, I #if-0ed collie-specific code. No
wonder it did not boot. I'll start push to kernel.org but it will take
a while. FYI, bigdiff against mainline is attached, split version will
appear on kernel.org in few hours.
Pavel
--
if you have sharp zaurus hardware you don't need... you know my address
[-- Attachment #2: delme.gz --]
[-- Type: application/octet-stream, Size: 42822 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [patch] Add suspend/resume support to locomo.c
2005-09-11 20:34 ` Pavel Machek
@ 2005-09-11 22:51 ` Pavel Machek
0 siblings, 0 replies; 9+ messages in thread
From: Pavel Machek @ 2005-09-11 22:51 UTC (permalink / raw)
To: John Lenz; +Cc: rpurdie, kernel list, Russell King
Hi!
> > > Pavel, perhaps you could send me an email about what you (and others) have
> > > done the past few weeks? The patches on my site and such are probably a
> > > ways out of date. What/where is the latest code located? What progress
> > > has been made... Hopefully sometime next week I can start working on this
> > > stuff again.
> >
> > [I have just came back from 3 days horse trip... you'll get replies to
> > other mails later.]
> >
> > There's git tree at www.kernel.org/git ... its called linux-z. It
> > worked for before I got to 2.6.13, but it is now broken (IIRC, maybe
> > its okay). PCMCIA never worked for me. linux-z is probably good start
> > for new work. It should have all your patches IIRC.
>
> Okay, it was really stupid problem, I #if-0ed collie-specific code. No
> wonder it did not boot. I'll start push to kernel.org but it will take
> a while. FYI, bigdiff against mainline is attached, split version will
> appear on kernel.org in few hours.
Okay, I played a bit with Richard's patches, and broke my tree
again. Last good one is
commit 4c8a125f9906fda6a43224ad0bad99a8583eb488
tree 14796040835cd69c635dc4b15430b49e2721630b
parent fc0058795a7bd2a9b87e7368dc30ad6701888c7b
author <pavel@amd.(none)> Sun, 11 Sep 2005 23:30:36 +0200
committer <pavel@amd.(none)> Sun, 11 Sep 2005 23:30:36 +0200
Remove include/asm-arm/arch-sa1100/ucb1x00.h and fix stuff that breaks.
Pavel
--
if you have sharp zaurus hardware you don't need... you know my address
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-09-11 22:52 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-21 5:25 [patch] Add suspend/resume support to locomo.c Pavel Machek
2005-09-04 10:36 ` Russell King
2005-09-06 7:58 ` Pavel Machek
2005-09-08 13:42 ` Russell King
2005-09-08 23:29 ` John Lenz
2005-09-10 22:38 ` Pavel Machek
2005-09-10 22:53 ` Richard Purdie
2005-09-11 20:34 ` Pavel Machek
2005-09-11 22:51 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox