Hi, here's two patches attached to the mail: First one adds resume handler to the pwm driver. Without it pwm setup is broken after resume. Second one fixes pwm configuration sequence: tcmp and tcnt registers should be updated after manual_update flag is set. With these patches I've got pwm-bl driver working flawlessly on my iPAQ rx1950 (s3c2442-based pda) Regards Vasily
From d41c37b5cbc2ae7ad2e27e904e093b0ebac4d874 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick <anarsoul@xxxxxxxxx> Date: Tue, 20 Jan 2009 18:56:17 +0200 Subject: [PATCH 01/02] s3c24xx pwm fix - add resume handler Signed-off-by: Vasily Khoruzhick <anarsoul@xxxxxxxxx> --- arch/arm/plat-s3c24xx/pwm.c | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/arch/arm/plat-s3c24xx/pwm.c b/arch/arm/plat-s3c24xx/pwm.c index ec56b88..b7963d2 100644 --- a/arch/arm/plat-s3c24xx/pwm.c +++ b/arch/arm/plat-s3c24xx/pwm.c @@ -240,6 +240,8 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) } else tin_ns = NS_IN_HZ / clk_get_rate(pwm->clk); + pwm->duty_ns = duty_ns; + /* Note, counters count down */ tcmp = duty_ns / tin_ns; @@ -372,6 +374,38 @@ static int s3c_pwm_remove(struct platform_device *pdev) return 0; } +static int s3c_pwm_resume(struct platform_device *pdev) +{ + struct pwm_device *pwm = platform_get_drvdata(pdev); + unsigned char running; + unsigned int period_ns, duty_ns; + unsigned long tcon, flags; + + period_ns = pwm->period_ns; + duty_ns = pwm->duty_ns; + running = pwm->running; + + pwm->period_ns = 0; + pwm->duty_ns = 0; + + local_irq_save(flags); + + tcon = __raw_readl(S3C2410_TCON); + tcon |= pwm_tcon_invert(pwm); + __raw_writel(tcon, S3C2410_TCON); + + local_irq_restore(flags); + + pwm_config(pwm, duty_ns, period_ns); + + if (running) + pwm_enable(pwm); + else + pwm_disable(pwm); + + return 0; +} + static struct platform_driver s3c_pwm_driver = { .driver = { .name = "s3c24xx-pwm", @@ -379,6 +413,7 @@ static struct platform_driver s3c_pwm_driver = { }, .probe = s3c_pwm_probe, .remove = __devexit_p(s3c_pwm_remove), + .resume = s3c_pwm_resume, }; static int __init pwm_init(void) -- 1.6.1
From 26c9a0b7617e87b806ff8e34751c22867508f801 Mon Sep 17 00:00:00 2001 From: Vasily Khoruzhick <anarsoul@xxxxxxxxx> Date: Fri, 23 Jan 2009 18:42:11 +0200 Subject: [PATCH 02/02] s3c24xx pwm fix: tcnt and tcmp should be updated _after_ manual_update flag is set Signed-off-by: Vasily Khoruzhick <anarsoul@xxxxxxxxx> --- arch/arm/plat-s3c24xx/pwm.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/plat-s3c24xx/pwm.c b/arch/arm/plat-s3c24xx/pwm.c index b7963d2..b2c0981 100644 --- a/arch/arm/plat-s3c24xx/pwm.c +++ b/arch/arm/plat-s3c24xx/pwm.c @@ -256,13 +256,13 @@ int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns) local_irq_save(flags); - __raw_writel(tcmp, S3C2410_TCMPB(pwm->pwm_id)); - __raw_writel(tcnt, S3C2410_TCNTB(pwm->pwm_id)); tcon = __raw_readl(S3C2410_TCON); tcon |= pwm_tcon_manulupdate(pwm); tcon |= pwm_tcon_autoreload(pwm); __raw_writel(tcon, S3C2410_TCON); + __raw_writel(tcmp, S3C2410_TCMPB(pwm->pwm_id)); + __raw_writel(tcnt, S3C2410_TCNTB(pwm->pwm_id)); tcon &= ~pwm_tcon_manulupdate(pwm); __raw_writel(tcon, S3C2410_TCON); -- 1.6.1
Attachment:
signature.asc
Description: This is a digitally signed message part.
------------------------------------------------------------------- List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm FAQ: http://www.arm.linux.org.uk/mailinglists/faq.php Etiquette: http://www.arm.linux.org.uk/mailinglists/etiquette.php
- Prev by Date: USB HUB problem
- Next by Date: ixp4xx ethernet driver issues
- Previous by thread: USB HUB problem
- Next by thread: ixp4xx ethernet driver issues
- Index(es):