diff mbox

[4/4] davinci: da850/omapl138 evm: Platform support for PWM based backlight driver

Message ID 1284968546-17107-1-git-send-email-sugumar@ti.com (mailing list archive)
State Superseded
Headers show

Commit Message

Sugumar Natarajan Sept. 20, 2010, 7:42 a.m. UTC
None
diff mbox

Patch

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index ac2297c..77d0c89 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -28,6 +28,7 @@ 
 #include <linux/regulator/tps6507x.h>
 #include <linux/mfd/tps6507x.h>
 #include <linux/input/tps6507x-ts.h>
+#include <linux/pwm_backlight.h>
 
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
@@ -106,6 +107,24 @@  static struct platform_device da850_pm_device = {
 	.id             = -1,
 };
 
+#define DAVINCI_BACKLIGHT_MAX_BRIGHTNESS	255
+#define DAVINVI_BACKLIGHT_DEFAULT_BRIGHTNESS	255
+#define DAVINCI_PWM_PERIOD_NANO_SECONDS		(1000000 * 10)
+
+static struct platform_pwm_backlight_data da850evm_backlight_data = {
+	.pwm_id		= 0,
+	.max_brightness = DAVINCI_BACKLIGHT_MAX_BRIGHTNESS,
+	.dft_brightness = DAVINVI_BACKLIGHT_DEFAULT_BRIGHTNESS,
+	.pwm_period_ns  = DAVINCI_PWM_PERIOD_NANO_SECONDS,
+};
+
+static struct platform_device da850evm_backlight = {
+	.name	= "pwm-backlight",
+	.dev	= {
+		.platform_data = &da850evm_backlight_data,
+	},
+};
+
 /* DA850/OMAP-L138 EVM includes a 512 MByte large-page NAND flash
  * (128K blocks). It may be used instead of the (default) SPI flash
  * to boot, using TI's tools to install the secondary boot loader
@@ -840,6 +859,19 @@  static __init void da850_evm_init(void)
 	if (ret)
 		pr_warning("da850_evm_init: rtc setup failed: %d\n", ret);
 
+	ret = davinci_cfg_reg(DA850_ECAP2_APWM2);
+	if (ret)
+		pr_warning("da850_evm_init:ecap mux failed ""%d\n", ret);
+
+	ret = da850_register_ecap();
+	if (ret)
+		pr_warning("da850_evm_init: ECAP registration failed:"
+				"%d\n", ret);
+
+	ret = platform_device_register(&da850evm_backlight);
+	if (ret)
+		pr_warning("da850evm_register_backlight_failed:""%d\n", ret);
+
 	ret = da850_register_cpufreq("pll0_sysclk3");
 	if (ret)
 		pr_warning("da850_evm_init: cpufreq registration failed: %d\n",