[PATCH-RESEND 2/2] OMAP: OMAP3EVM: Add LCD Backlight brightness hookup function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Vaibhav Hiremath <hvaibhav@xxxxxx>


Signed-off-by: Vaibhav Hiremath <hvaibhav@xxxxxx>
---
 arch/arm/mach-omap2/board-omap3evm.c |   34 ++++++++++++++++++++++++++++++++++
 1 files changed, 34 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index f2a52c3..1d1956f 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -253,6 +253,38 @@ static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev)
 	lcd_enabled = 0;
 }

+/*
+ * PWMA/B register offsets (TWL4030_MODULE_PWMA)
+ */
+#define TWL_LED_EN	0x0
+#define TWL_LED_PWMON	0x0
+#define TWL_LED_PWMOFF	0x1
+
+static int omap3evm_set_bl_intensity(struct omap_dss_device *dssdev, int level)
+{
+	unsigned char c;
+
+	if (level > 100)
+		return -EINVAL;
+	/*
+	 * Enable LEDA for backlight
+	 */
+	twl_i2c_write_u8(TWL4030_MODULE_LED, 0x11, TWL_LED_EN);
+
+	c = ((125 * (100 - level)) / 100);
+	if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
+		c += 1;
+		twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x7F, TWL_LED_PWMOFF);
+		twl_i2c_write_u8(TWL4030_MODULE_PWMA, c, TWL_LED_PWMON);
+	} else {
+		c += 2;
+		twl_i2c_write_u8(TWL4030_MODULE_PWMA, 0x1, TWL_LED_PWMON);
+		twl_i2c_write_u8(TWL4030_MODULE_PWMA, c, TWL_LED_PWMOFF);
+	}
+
+	return 0;
+}
+
 static struct omap_dss_device omap3_evm_lcd_device = {
 	.name			= "lcd",
 	.driver_name		= "sharp_ls_panel",
@@ -260,6 +292,8 @@ static struct omap_dss_device omap3_evm_lcd_device = {
 	.phy.dpi.data_lines	= 18,
 	.platform_enable	= omap3_evm_enable_lcd,
 	.platform_disable	= omap3_evm_disable_lcd,
+	.max_backlight_level	= 100,
+	.set_backlight		= omap3evm_set_bl_intensity,
 };

 static int omap3_evm_enable_tv(struct omap_dss_device *dssdev)
--
1.6.2.4

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux