summaryrefslogtreecommitdiff
path: root/arch/arm/mach-tegra/nvrm
diff options
context:
space:
mode:
authorNagesh Penumarty <vpenumarty@nvidia.com>2010-01-12 16:19:41 +0530
committerNagesh Penumarty <vpenumarty@nvidia.com>2010-01-13 10:59:58 +0530
commit8930c80f0ece9edf667f7ad593e15233367cb1dc (patch)
tree3b5215242e4a56ba2d8f13338fdedabbe8fa921f /arch/arm/mach-tegra/nvrm
parent075c532f2940f504549b85f308ee140d80cb1e13 (diff)
tegra RM: Fix PWM scaling calculation in RM for backlight intensity.
Fixed PWM scaling calculation and added boundary check. This is an 8-bit value that was being scaled to a max of 256 instead of 255, causing an overflow in the boundary case of a maximum setting (thereby resulting in 0). Bug 638387 [Harmony] Backlight is broken and there is no display. Bug 627575 [firefly2/Harmony/Display]External display panel not adjusting to Brightness change from display settings. Tested on: Android, Harmony
Diffstat (limited to 'arch/arm/mach-tegra/nvrm')
-rw-r--r--arch/arm/mach-tegra/nvrm/io/ap15/ap15rm_pwm.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/arch/arm/mach-tegra/nvrm/io/ap15/ap15rm_pwm.c b/arch/arm/mach-tegra/nvrm/io/ap15/ap15rm_pwm.c
index dbaf41563bd4..14c58e4e28f3 100644
--- a/arch/arm/mach-tegra/nvrm/io/ap15/ap15rm_pwm.c
+++ b/arch/arm/mach-tegra/nvrm/io/ap15/ap15rm_pwm.c
@@ -316,7 +316,7 @@ void NvRmPwmClose(NvRmPwmHandle hPwm)
NvOsMutexUnlock(s_hPwmMutex);
}
-#define MAX_DUTY_CYCLE 256
+#define MAX_DUTY_CYCLE 255
NvError NvRmPwmConfig(
NvRmPwmHandle hPwm,
@@ -416,7 +416,9 @@ NvError NvRmPwmConfig(
* Convert from percentage unsigned 15.16 fixed point
* format to actual register value
*/
- DCycle = (NvU8)((DutyCycle * MAX_DUTY_CYCLE/100)>>16);
+ DCycle = (DutyCycle * MAX_DUTY_CYCLE/100)>>16;
+ if (DCycle > MAX_DUTY_CYCLE)
+ DCycle = MAX_DUTY_CYCLE;
RegValue = PWM_SETNUM(CSR_0, ENB, PwmMode) |
PWM_SETNUM(CSR_0, PWM_0, DCycle);