Backlight driver for omap3evm
Subsystems (2)
PATCH 1/1 Backlight driver for omap3evm
This patch implements the backlight driver for OMAP3EVM. The mechanism for backlight control is reused from the existing controls in lcd_omap3evm.c.
--- drivers/video/backlight/Kconfig | 7 + drivers/video/backlight/Makefile | 1 + drivers/video/backlight/omap3evm_bl.c | 252 +++++++++++++++++++++++++++++++++ drivers/video/omap/Kconfig | 1 + drivers/video/omap/lcd_omap3evm.c | 25 ---- 5 files changed, 261 insertions(+), 25 deletions(-) create mode 100644 drivers/video/backlight/omap3evm_bl.c
drivers/video/backlight/Kconfig +7 -0
@@ -152,6 +152,13 @@ config BACKLIGHT_OMAP1 the PWL module of OMAP1 processors. Say Y if your board uses this hardware. +config BACKLIGHT_OMAP3EVM + tristate "OMAP3EVM LCD Backlight" + depends on BACKLIGHT_CLASS_DEVICE && MACH_OMAP3EVM + default y + help + This driver controls the LCD backlight for OMAP3EVM. + config BACKLIGHT_HP680 tristate "HP Jornada 680 Backlight Driver" depends on BACKLIGHT_CLASS_DEVICE && SH_HP6XX
drivers/video/backlight/Makefile +1 -0
@@ -15,6 +15,7 @@ obj-$(CONFIG_BACKLIGHT_CORGI) += corgi_bl.o obj-$(CONFIG_BACKLIGHT_HP680) += hp680_bl.o obj-$(CONFIG_BACKLIGHT_LOCOMO) += locomolcd.o obj-$(CONFIG_BACKLIGHT_OMAP1) += omap1_bl.o +obj-$(CONFIG_BACKLIGHT_OMAP3EVM) += omap3evm_bl.o obj-$(CONFIG_BACKLIGHT_PROGEAR) += progear_bl.o obj-$(CONFIG_BACKLIGHT_CARILLO_RANCH) += cr_bllcd.o obj-$(CONFIG_BACKLIGHT_PWM) += pwm_bl.o
drivers/video/backlight/omap3evm_bl.c new file +252 -0
252 lines not on this page · raw message
drivers/video/omap/Kconfig +1 -0
@@ -4,6 +4,7 @@ config FB_OMAP select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT + select FB_BACKLIGHT help Frame buffer driver for OMAP based boards.
drivers/video/omap/lcd_omap3evm.c +0 -25
@@ -94,28 +94,6 @@ static unsigned long omap3evm_panel_get_caps(struct lcd_panel *panel)return 0 ; } -static int omap3evm_bklight_setlevel (struct lcd_panel *panel, -unsigned int level) -{ -u8 c; -if ((level >=0 ) && (level <=100 )) { - c = (125 * (100 - level)) /100 +2 ; -twl4030_i2c_write_u8 (TWL4030_MODULE_PWMA , c,TWL_PWMA_PWMAOFF ); - bklight_level = level; - } -return 0 ; -} - -static unsigned int omap3evm_bklight_getlevel (struct lcd_panel *panel) -{ -return bklight_level; -} - -static unsigned int omap3evm_bklight_getmaxlevel (struct lcd_panel *panel) -{ -return 100 ; -} -struct lcd_panel omap3evm_panel = { .name ="omap3evm" , .config = OMAP_LCDC_PANEL_TFT | OMAP_LCDC_INV_VSYNC |
@@ -139,9 +117,6 @@ struct lcd_panel omap3evm_panel = { .enable = omap3evm_panel_enable, .disable = omap3evm_panel_disable, .get_caps = omap3evm_panel_get_caps, - .set_bklight_level = omap3evm_bklight_setlevel, - .get_bklight_level = omap3evm_bklight_getlevel, - .get_bklight_max = omap3evm_bklight_getmaxlevel, };static int omap3evm_panel_probe (struct platform_device *pdev)
Signature · 1 line
1.5.6
Quoted 3 lines · Sanjeev Premi
This patch implements the backlight driver for OMAP3EVM. The mechanism for backlight control is reused from the existing controls in
lcd_omap3evm.c.
Please see the reply to the email you sent me offlist. What happens when you run this driver on something that isn't an omap3evm?
The problem is that this bit:
omap_backlight_dev = platform_device_alloc(OMAPBL_DEVNAME, -1);
should be done in the platform code for the board, not in the general driver. If you do that, you should be able to reuse most of the generic-bl device code.
Regards,
Richard
Quoted 8 lines
-----Original Message-----
From: Richard Purdie [mailto:[email protected]]
Sent: Wednesday, January 07, 2009 8:37 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Backlight driver for omap3evm
Quoted 7 lines
Quoted 3 lines · Sanjeev Premi
This patch implements the backlight driver for OMAP3EVM. The mechanism for backlight control is reused from the existing controls in
lcd_omap3evm.c.Please see the reply to the email you sent me offlist. What happens when you run this driver on something that isn't an omap3evm?
The driver implementation depends upon CONFIG_MACH_OMAP3EVM.
Quoted 5 lines
The problem is that this bit:
omap_backlight_dev=platform_device_alloc(OMAPBL_DEVNAME, -1);
Ah, this bit can be moved to board specific file in "mach-omap2" directory.
Quoted 3 lines
should be done in the platform code for the board, not in the general driver. If you do that, you should be able to reuse most of the generic-bl device code.
I tried so, but wasn't able to get the Kconfig dependencies right to get 'generic-bl' into my build. Hence, removed the code that I believed to be generic (since yesterday's mail) and created the patch.
Will give another try.
Quoted 7 lines
Regards,
Richard
Thanks,
Vaibhav Hiremath
Quoted 21 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Premi, Sanjeev
Sent: Wednesday, January 07, 2009 8:52 PM
To: Richard Purdie
Cc: [email protected]
Subject: RE: [PATCH] Backlight driver for omap3evmQuoted 11 lines
-----Original Message-----
From: Richard Purdie [mailto:[email protected]]
Sent: Wednesday, January 07, 2009 8:37 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Backlight driver for omap3evmOn Wed, 2009-01-07 at 20:25 +0530, Sanjeev Premi wrote:
should be done in the platform code for the board, not in the general driver. If you do that, you should be able to reuse most of the generic-bl device code.
Quoted 7 lines
I tried so, but wasn't able to get the
Kconfigdependencies right to get 'generic-bl' into my build. Hence, removed the code that I believed to be generic (since yesterday's mail) and created the patch.Will give another try.
[Hiremath, Vaibhav] Now I will be following up for OMAP3EVM backlight driver patch initiated/posted by Sanjeev. I was just referring to the backlight drives currently available under Linux tree, and observed that almost all drivers have been implemented in different way. I could not able to get one driver to which I can refer to for adding support for OMAP3EVM backlight driver.
Can anybody tell me the expected way of implementation for backlight driver is?
I have some questions here,
- If I understand correctly (and as mentioned and pointed out by Richard in the mail-chain), platform_device should get added in platform file where it registers the pointer to the structure "struct generic_bl_info".
This I believe should be standard way everybody should follow, which is not the case.
Am I missing something here?
- The below question may sound foolish, but to is important for me to understand the framework.
If I have simple and straight control of backlight, do I really required to have separate backlight driver for my platform? Can I make use of generic-bl driver? The only difference (atleast to my platform) would be the SYSFS entry, the entry will get created something like /sys/class/backlight/generic-bl/
Is it required to make driver, Power aware and differentiate from generic driver?
Do we have any document on backlight driver framework?
Quoted 11 lines
Quoted 7 lines
Regards,
Richard
--
To unsubscribe from this list: send the line "unsubscribe linux- omap" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 21 lines · Vaibhav
[Hiremath, Vaibhav] Now I will be following up for OMAP3EVM backlight driver patch initiated/posted by Sanjeev. I was just referring to the backlight drives currently available under Linux tree, and observed that almost all drivers have been implemented in different way. I could not able to get one driver to which I can refer to for adding support for OMAP3EVM backlight driver.
Can anybody tell me the expected way of implementation for backlight driver is?
I have some questions here,
- If I understand correctly (and as mentioned and pointed out by
Richard in the mail-chain),platform_deviceshould get added in platform file where it registers the pointer to the structure "structgeneric_bl_info".
This I believe should be standard way everybody should follow, which is not the case.
Am I missing something here?- The below question may sound foolish, but to is important for me to understand the framework.
Quoted 8 lines
If I have simple and straight control of backlight, do I really required to have separate backlight driver for my platform? Can I make use of generic-bl driver?
The only difference (atleast to my platform) would be the SYSFS entry, the entry will get created something like/sys/class/backlight/generic-bl/Is it required to make driver, Power aware and differentiate from generic driver?
You should be able to make the driver power aware and still use the generic driver.
The basic idea is that your platform would register a platform device and some code to control the backlight, e.g.:
void omap_set_bl_intensity(int X)
{
/* Code to set backlight intensity to X */
}static struct generic_bl_info bl_platform_data = {
.name = "omap-bl",
.max_intensity = 5,
.default_intensity = 2,
.set_bl_intensity = omap_set_bl_intensity,
};static struct platform_device backlight_device = {
.name = "generic-bl",
.id = -1,
.dev.platform_data = &bl_platform_data,
};and that should be all you need as the core class and generic-bl code will take care of most other things for you. The code above would go somewhere in arch/arm/mach-omap*/.
If any improvements are needed to generic-bl to make it useful, please let me know (set_bl_intensity could maybe do with being passed more information).
Regards,
Richard
Signature · 10 lines
Richard Purdie Intel Open Source Technology Centre ------------------------------------------------------------------------------ Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise -Strategies to boost innovation and cut costs with open source participation -Receive a $600 discount off the registration fee with the source code: SFAD http://p.sf.net/sfu/XcvMzF8H