From patchwork Mon Apr 12 11:50:27 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vaibhav Hiremath X-Patchwork-Id: 92033 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 o3CBoduU021061 for ; Mon, 12 Apr 2010 11:50:39 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753689Ab0DLLuj (ORCPT ); Mon, 12 Apr 2010 07:50:39 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:51986 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753414Ab0DLLui (ORCPT ); Mon, 12 Apr 2010 07:50:38 -0400 Received: from dbdp31.itg.ti.com ([172.24.170.98]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id o3CBoVKY025861 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 12 Apr 2010 06:50:33 -0500 Received: from localhost.localdomain (localhost [127.0.0.1]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id o3CBoR9X027391; Mon, 12 Apr 2010 17:20:30 +0530 (IST) From: hvaibhav@ti.com To: linux-omap@vger.kernel.org Cc: tomi.valkeinen@nokia.com, tony@atomide.com, Vaibhav Hiremath Subject: [PATCH-V2 2/2] OMAP: OMAP3EVM: Add LCD Backlight brightness hookup function Date: Mon, 12 Apr 2010 17:20:27 +0530 Message-Id: <1271073027-2628-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]); Mon, 12 Apr 2010 11:50:44 +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)