video: backlight: tegra: Supporting DC-pwm on Tegra3.
Laxman Dewangan [Wed, 1 Jun 2011 17:46:03 +0000 (22:46 +0530)]
Supporting the dc pwm based backlight control for TEGRA3
SOC.

bug 831073

Original-Change-Id: I21e430e28472285636612b71732a8b94e609bb91
Reviewed-on: http://git-master/r/34734
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-by: Hoang Pham <hopham@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>

Rebase-Id: Re9ee1077cf2c77017472740ac7bc50e4dc7e3ce8

drivers/video/backlight/Kconfig
drivers/video/backlight/tegra_pwm_bl.c

index ddbe783..e61db99 100644 (file)
@@ -239,13 +239,13 @@ config BACKLIGHT_PWM
          this driver.
 
 config BACKLIGHT_TEGRA_PWM
-       bool "Tegra2 PMx based PWM Backlight Driver"
-       depends on ARCH_TEGRA_2x_SOC && TEGRA_DC
+       bool "Tegra PMx based PWM Backlight Driver"
+       depends on TEGRA_DC
        help
          Enable support for Tegra2 DC pwm backlight.
 
          If you have a pwm backlight adjustable by the DC PM0 or PM1 signal
-         control on tegra2, say Y to enable this driver.
+         control on tegra, say Y to enable this driver.
 
 config BACKLIGHT_DA903X
        tristate "Backlight Driver for DA9030/DA9034 using WLED"
index 4c823b5..77d5075 100644 (file)
@@ -45,8 +45,12 @@ static int tegra_pwm_backlight_update_status(struct backlight_device *bl)
                dev_err(&bl->dev, "Invalid brightness value: %d max: %d\n",
                brightness, max);
 
+#if defined(CONFIG_ARCH_TEGRA_2x_SOC)
        /* map API brightness range from (0~255) to hw range (0~128) */
        tbl->params.duty_cycle = (brightness * 128) / 255;
+#else
+       tbl->params.duty_cycle = brightness & 0xFF;
+#endif
 
        /* Call tegra display controller function to update backlight */
        dc = tegra_dc_get_dc(tbl->which_dc);
@@ -141,7 +145,7 @@ static int __init tegra_pwm_backlight_init(void)
 {
        return platform_driver_register(&tegra_pwm_backlight_driver);
 }
-module_init(tegra_pwm_backlight_init);
+late_initcall(tegra_pwm_backlight_init);
 
 static void __exit tegra_pwm_backlight_exit(void)
 {