linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: How to completely switch off LCD backlight
       [not found] <0617A24A-1BF3-40E0-B36E-017423BB5DF1@mac.com>
@ 2011-02-06 17:30 ` Grant Erickson
       [not found]   ` <4732E696-B597-4BCE-A0E9-E60E30A7F94D@mac.com>
  0 siblings, 1 reply; 3+ messages in thread
From: Grant Erickson @ 2011-02-06 17:30 UTC (permalink / raw)
  To: Elvis Dowson; +Cc: linux-omap Mailing List

On 2/6/11 9:09 AM, Elvis Dowson wrote:
>        I've got LCD backlight brightness control working with a custom
> beagleboard design, with the LCD backlight pwm control signal connected to
> OMAP3503's gpt9_pwm_evt timer.
> 
> GPIO 96 is connected to the LCD LED enable pin for controlling the on/off for
> the LCD backlight.
> 
> I also see a bl_power file in /sys/class/backlight/beagleboard/ folder.
> 
> # ls /sys/class/backlight/beagleboard
> uevent
> subsystem
> bl_power
> brightness
> actual_brightness
> max_brightness
> boost
> pwm_fq
> min_duty
> power
> 
> I want to be able to fully turn the LCD backlight on and off. How do I map
> GPIO 96 to bl_power?
> 
> Right now, if I blank the LCD using the following command, it gives me a white
> screen, but the backlight doesn't turn off
> 
> $ echo 1 > /sys/class/graphics/fb0/blank

Elvis:

The following script should be instructive:

    device="/sys/devices/platform/pwm-backlight.0/backlight/pwm-backlight.0"
    power="${device}/bl_power"
    brightness="${device}/brightness"
    max="${device}/max_brightness"

    usage () {
        echo "Usage `basename ${0}` [[ --enable | --disable ] | --max | [
brightness ]]"
    
        exit ${1}
    }

    get_brightness () {
        cat ${brightness}
    }

    set_brightness () {
        echo ${1} > ${brightness}
    }

    max_brightness () {
        cat ${max}
    }

    disable_backlight () {
        echo 1 > ${power}
    }

    enable_backlight () {
        echo 0 > ${power}
    }

    if [ $# -eq 1 ]; then
        if [ "${1}" = "--enable" ]; then
            enable_backlight
        elif [ "${1}" = "--disable" ]; then
            disable_backlight
        elif [ "${1}" = "--max" ]; then
            max_brightness
        else
            set_brightness ${1}
        fi
    else
        get_brightness
    fi

Best,

Grant



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to completely switch off LCD backlight
       [not found]   ` <4732E696-B597-4BCE-A0E9-E60E30A7F94D@mac.com>
@ 2011-02-06 18:41     ` Gregoire Gentil
  2011-02-06 18:58     ` Grant Erickson
  1 sibling, 0 replies; 3+ messages in thread
From: Gregoire Gentil @ 2011-02-06 18:41 UTC (permalink / raw)
  To: Elvis Dowson; +Cc: Grant Erickson, linux-omap Mailing List

If you are not using it, put .reset_gpio = 96 in your board file for the
DSS2 structure. Then echo 1/0 > .../fb0/blank will do the trick to turn
on/off your screen,

Grégoire

On Sun, 2011-02-06 at 21:53 +0400, Elvis Dowson wrote:
> Hi Grant,
>                     Thanks for the reply. 
> 
> On Feb 6, 2011, at 9:30 PM, Grant Erickson wrote:
> > 
> > The following script should be instructive:
> > 
> >    device="/sys/devices/platform/pwm-backlight.0/backlight/pwm-backlight.0"
> 
> For me, this is located in /sys/class/backlight/beagleboard
> 
> and bl_power is located in /sys/class/backlight/beagleboard
> 
> >    power="${device}/bl_power"
> >    brightness="${device}/brightness"
> >    max="${device}/max_brightness"
> > 
> > 
> >    disable_backlight () {
> >        echo 1 > ${power}
> >    }
> > 
> >    enable_backlight () {
> >        echo 0 > ${power}
> >    }
> 
> I did try
> 
> echo 1 > bl_power
> 
> but there was no effect. GPIO 96 from the OMAP3503 is physically connected to LCD LED backlight enable, which I think is what would be used to turn the backlight on/off. 
> 
> Where can I specify the mapping of GPIO 96 to the bl_power file, so that the LCD backlight can be switched off?
> 
> Elvis
> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to completely switch off LCD backlight
       [not found]   ` <4732E696-B597-4BCE-A0E9-E60E30A7F94D@mac.com>
  2011-02-06 18:41     ` Gregoire Gentil
@ 2011-02-06 18:58     ` Grant Erickson
  1 sibling, 0 replies; 3+ messages in thread
From: Grant Erickson @ 2011-02-06 18:58 UTC (permalink / raw)
  To: Elvis Dowson; +Cc: linux-omap Mailing List

On 2/6/11 9:53 AM, Elvis Dowson wrote:
> On Feb 6, 2011, at 9:30 PM, Grant Erickson wrote:
>> The following script should be instructive:
>> 
>>    device="/sys/devices/platform/pwm-backlight.0/backlight/pwm-backlight.0"
> 
> For me, this is located in /sys/class/backlight/beagleboard
> 
> and bl_power is located in /sys/class/backlight/beagleboard
> 
>>    power="${device}/bl_power"
>>    brightness="${device}/brightness"
>>    max="${device}/max_brightness"
>> 
>> 
>>    disable_backlight () {
>>        echo 1 > ${power}
>>    }
>> 
>>    enable_backlight () {
>>        echo 0 > ${power}
>>    }
> 
> I did try
> 
> echo 1 > bl_power
> 
> but there was no effect. GPIO 96 from the OMAP3503 is physically connected to
> LCD LED backlight enable, which I think is what would be used to turn the
> backlight on/off.
> 
> Where can I specify the mapping of GPIO 96 to the bl_power file, so that the
> LCD backlight can be switched off?

Elvis:

If you are using the generic pwm-bl.c driver and you are using something
akin to:

    http://www.mail-archive.com/linux-omap@vger.kernel.org/msg38559.html

handle the PWM, then you likely need to perform gpio_set_value in your
platform-specific notify callback.

When using the pwm-bl.c driver (or likely any other than uses the generic
backlight class), bl_power toggles the on/off state of the backlight YET
preserves the current brightness level of the backlight.

So, if your backlight is on at 50% and you turn it off with bl_power, when
you turn it back on again with bl_power, it'll return to 50%.

In the pwm-bl.c driver, this all happens with pwm-config(). So, in your
notify callback, when you get a brightness value of zero, you'll call
gpio_set_value(96, 0)--assuming your enable signal is active high. Likewise,
when you get a brightness value of non-zero, you'll call gpio_set_value(96,
1)--again, assuming your enable signal is active high.

The generic PWM device is then handling the level then the enable GPIO is
asserted (which, again, you are controlling in your notify callback).

Best,

Grant

> 
> Elvis
> 
> 
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-06 18:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <0617A24A-1BF3-40E0-B36E-017423BB5DF1@mac.com>
2011-02-06 17:30 ` How to completely switch off LCD backlight Grant Erickson
     [not found]   ` <4732E696-B597-4BCE-A0E9-E60E30A7F94D@mac.com>
2011-02-06 18:41     ` Gregoire Gentil
2011-02-06 18:58     ` Grant Erickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).