@@ -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)