All of lore.kernel.org
 help / color / mirror / Atom feed
From: hvaibhav@ti.com
To: tomi.valkeinen@nokia.com
Cc: linux-omap@vger.kernel.org, Vaibhav Hiremath <hvaibhav@ti.com>
Subject: [PATCH-RESEND 2/2] OMAP: OMAP3EVM: Add LCD Backlight brightness hookup function
Date: Thu, 15 Apr 2010 19:30:01 +0530	[thread overview]
Message-ID: <1271340001-19831-2-git-send-email-hvaibhav@ti.com> (raw)
In-Reply-To: <hvaibhav@ti.com>

From: Vaibhav Hiremath <hvaibhav@ti.com>


Signed-off-by: Vaibhav Hiremath <hvaibhav@ti.com>
---
 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


             reply	other threads:[~2010-04-15 14:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-15 14:00 hvaibhav [this message]
2010-04-15 14:14 ` [PATCH-RESEND 2/2] OMAP: OMAP3EVM: Add LCD Backlight brightness hookup function Tomi Valkeinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1271340001-19831-2-git-send-email-hvaibhav@ti.com \
    --to=hvaibhav@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tomi.valkeinen@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.