From patchwork Thu Apr 15 14:00:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 92754 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o3FE0Br4017786 for ; Thu, 15 Apr 2010 14:00:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754195Ab0DOOAO (ORCPT ); Thu, 15 Apr 2010 10:00:14 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:59178 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754146Ab0DOOAN (ORCPT ); Thu, 15 Apr 2010 10:00:13 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id o3FE04gi001233 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 15 Apr 2010 09:00:07 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o3FE01RJ012810; Thu, 15 Apr 2010 19:30:03 +0530 (IST) From: hvaibhav@ti.com To: tomi.valkeinen@nokia.com Cc: linux-omap@vger.kernel.org, Vaibhav Hiremath Subject: [PATCH-RESEND 2/2] OMAP: OMAP3EVM: Add LCD Backlight brightness hookup function Date: Thu, 15 Apr 2010 19:30:01 +0530 Message-Id: <1271340001-19831-2-git-send-email-hvaibhav@ti.com> X-Mailer: git-send-email 1.6.2.4 In-Reply-To: References: Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 15 Apr 2010 14:00:50 +0000 (UTC) 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)