Problem with s3c24xx pwm driver
Hi,
I'm encountering very strange problem with s3c24xx pwm driver. I'm using it with pwm-bl driver. When backlight level is 0, pwm-bl calls pwm_config(0, period); pwm_disable(), otherwise it calls pwm_config(duty, period); pwm_enable().
Problem is that after pwm was disabled, it can't be enabled with pwm_config(duty, period); pwm_enable() for some (but not all) _valid_ duty/period combinations.
pwm-bl works fine if pwm_disable() call is commented out.
Does anybody know how to solve this problem? Any suggestions?
Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20090923/436b5290/attachment.sig>
Quoted 7 lines · Vasily Khoruzhick
Hi,
I'm encountering very strange problem with s3c24xx pwm driver. I'm using it with pwm-bl driver. When backlight level is 0, pwm-bl calls
pwm_config(0, period);pwm_disable(), otherwise it callspwm_config(duty, period);pwm_enable().
Quoted 8 lines
Problem is that after pwm was disabled, it can't be enabled with
pwm_config(duty, period);pwm_enable()for some (but not all) _valid_ duty/period combinations.pwm-bl works fine if
pwm_disable()call is commented out.Does anybody know how to solve this problem? Any suggestions?
Sounds like there are cases where the pwm_enable() and pwm_disable() are not paired? You may want to print out the reference count each time to see if this is true.
? ????????? ?? 23 ???????? 2009 22:03:17 ????? Eric Miao ???????:
Quoted 3 lines
Sounds like there are cases where the
pwm_enable()andpwm_disable()are not paired? You may want to print out the reference count each time to see if this is true.
I'm pretty sure they are paired, it's unlikely that it's pwm-bl bug.
Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20090923/7afea097/attachment.sig>
? ????????? ?? 23 ???????? 2009 22:03:17 ????? Eric Miao ???????:
Quoted 3 lines
Sounds like there are cases where the
pwm_enable()andpwm_disable()are not paired? You may want to print out the reference count each time to see if this is true.
And, btw, pwm_enable()/pwm_disable for s3c24xx just sets/clears one bit. It doesn't harm to set same bit twice, does it?
Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20090923/1c740fa4/attachment.sig>
Quoted 8 lines · Vasily Khoruzhick
? ????????? ?? 23 ???????? 2009 22:03:17 ????? Eric Miao ???????:
Quoted 3 lines
Sounds like there are cases where the
pwm_enable()andpwm_disable()are not paired? You may want to print out the reference count each time to see if this is true.And, btw, pwm_enable()/pwm_disable for s3c24xx just sets/clears one bit. It doesn't harm to set same bit twice, does it?
No, it doesn't.
So my suggestion at the moment is that you may:
1. try dump the registers after pwm_enable() and see if all are setup correctly,
2. and make sure those registers are write-able at that time (some SoC doesn't allow register writing when the controller is disabled).
? ????????? ?? 24 ???????? 2009 01:25:46 ????? Eric Miao ???????:
Quoted 10 lines
No, it doesn't.
So my suggestion at the moment is that you may:
1. try dump the registers after
pwm_enable()and see if all are setup correctly,2. and make sure those registers are write-able at that time (some SoC doesn't allow register writing when the controller is disabled).
Here's a trace with my comments, but I can't see anything wrong in this trace:
/* Configuring backlight level */
pwm_config:271: TCMPB, wrote: 0000010a, read: 0000010a <- Configure duty pwm_config:274: TCNTB, wrote: 0000012a, read: 0000012a <- Configure period pwm_config:281: TCON, wrote: 0051990f, read: 0051990f <- Set manual update flag
pwm_config:286: TCON, wrote: 0051990d, read: 0051990d <- Clear manual update flag
pwm_enable:149: TCON, wrote: 0051990d, read: 0051990d <- Enable called each time if backlight level != 0
/* Configuring backlight level */
pwm_config:271: TCMPB, wrote: 000000a3, read: 000000a3 pwm_config:274: TCNTB, wrote: 0000012a, read: 0000012a pwm_config:281: TCON, wrote: 0051990f, read: 0051990f pwm_config:286: TCON, wrote: 0051990d, read: 0051990d pwm_enable:149: TCON, wrote: 0051990d, read: 0051990d
/* Configuring backlight level */
pwm_config:271: TCMPB, wrote: 00000112, read: 00000112 pwm_config:274: TCNTB, wrote: 0000012a, read: 0000012a pwm_config:281: TCON, wrote: 0051990f, read: 0051990f pwm_config:286: TCON, wrote: 0051990d, read: 0051990d pwm_enable:149: TCON, wrote: 0051990d, read: 0051990d
/* Works fine until next sequence */
/* Disabling backlight */
pwm_config:271: TCMPB, wrote: 00000129, read: 00000129 pwm_config:274: TCNTB, wrote: 0000012a, read: 0000012a pwm_config:281: TCON, wrote: 0051990f, read: 0051990f pwm_config:286: TCON, wrote: 0051990d, read: 0051990d pwm_disable:170: TCON, wrote: 0051990c, read: 0051990c <- Clear start flag
/* Enabling backlight back, but it doesn't work :( */
pwm_config:271: TCMPB, wrote: 00000124, read: 00000124 <- Configure duty
pwm_config:274: TCNTB, wrote: 0000012a, read: 0000012a <- Configure period pwm_config:281: TCON, wrote: 0051990e, read: 0051990e <- Set manual update
flag
pwm_config:286: TCON, wrote: 0051990c, read: 0051990c <- Clear manual update
flag
pwm_enable:149: TCON, wrote: 0051990d, read: 0051990d <- Set start flag
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20090924/cd49e4b9/attachment.sig>
? ????????? ?? 24 ???????? 2009 01:25:46 ?? ????????:
Quoted 9 lines
No, it doesn't.
So my suggestion at the moment is that you may:
1. try dump the registers after
pwm_enable()and see if all are setup correctly,2. and make sure those registers are write-able at that time (some SoC doesn't allow register writing when the controller is disabled).
Ok, I've found source of problem: it seems to be some issue with backlight LED driver (hardware, not software) with selected PWM clock. It seems that part of period with "1" is not long enought to charge capacitor, or something like this. PWM itself works fine.
Sorry for buzz.
Regards
Vasily
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20090924/3da13106/attachment.sig>
Quoted 4 lines · Vasily Khoruzhick
Ok, I've found source of problem: it seems to be some issue with backlight LED driver (hardware, not software) with selected PWM clock. It seems that part of period with "1" is not long enought to charge capacitor, or something like this. PWM itself works fine.
Is it LED or is it CCFL? If it's CCFL, it needs to be 'struck' and then you can reduce the intensity level - by going to max brightness when you turn it on and then back the intensity down.
That's fairly normal for CCFL stuff.
? ????????? ?? 24 ???????? 2009 23:34:37 ????? Russell King - ARM Linux ???????:
Quoted 5 lines
Is it LED or is it CCFL? If it's CCFL, it needs to be 'struck' and then you can reduce the intensity level - by going to max brightness when you turn it on and then back the intensity down.
That's fairly normal for CCFL stuff.
I'm not sure, and I don't know how to check it without disassembling PDA.
Anyway, thanks for suggestion, let's assume that backlight is CCFL.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20090925/0528c02a/attachment.sig>