Linux backlight subsystem)

Source: Internet
Author: User
(Linux2.6.34) summary the linux backlight subsystem is used to provide interfaces for controlling the backlight brightness of LCD or other display devices in the/sys directory. The brightness here is not bright or off. There are many levels of brightness available, so that the user space can be saved according to energy saving ,...

 

(Linux2.6.34)

 

Overview

=====

The linux backlight subsystem is used to provide interfaces for controlling the backlight brightness of an LCD or other display devices in the/sys directory. The brightness here is not either bright or off. it can have multiple levels of brightness, so that the user space can adjust the brightness of the backlight according to energy saving, visual range, and other requirements.

 

Related code

======

The code of the backlight subsystem is in the/driver/video/backlight directory.

The important files are: generic_bl.c backlight. c LCD. c

 

To support the backlight subsystem, use the following configuration in the kernel:

Device Drives --->

Graphics Support --->

[*] Backlight & LCD device support --->

<*> Platform LCD controls

<*> Lowlevel Backlight controls

 

 

Important data structures

============

Include/linux/backlight. h

----------------------------

/* Word explanation: from the interstellar translation King

<--- Simplified Chinese-English dictionary --->

Intensity

[In 'tensiti]

N. Strong, intense, and intensity brightness

*/

Struct generic_bl_info {

Const char * name; // name character pointer, which will appear in/sys/class/backlight/

Int max_intensity; // maximum brightness

Int default_intensity; // default brightness

Int limit_mask; // brightness value mask, for example, 0xff

Void (* set_bl_intensity) (int intensity); // sets the brightness function.

Void (* kick_battery) (void); // The function called after the brightness is set. it is related to the battery and can be unspecified.

};

 

 

How to use the backlight subsystem

========================

This is an example

Http://lxr.linux.no/linux+v3.1.6/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c#L205

Static void eukrea_mbimx27_bl_set_intensity (int intensity)

{

/* Set the backlight based on the intensity parameter in this function. the PWM or other methods are used to set the backlight based on hardware */

}

 

Static struct generic_bl_info eukrea_mbimx27_bl_info = {

. Name = "eukrea_mbimx27-bl ",

. Max_intensity = 0xff,

. Default_intensity = 0xff,

. Set_bl_intensity = eukrea_mbimx27_bl_set_intensity,

};

 

Static struct platform_device eukrea_mbimx27_bl_dev = {

. Name = "generic-bl", // The name must be "generic-bl"

. Id = 1,

. Dev = {

. Platform_data = & eukrea_mbimx27_bl_info,

},

};

After registering eukrea_mbimx27_bl_dev, you can see the property file of the backlight under/sys/class/backlight/eukrea_mbimx27-bl.

 

Sys file attribute description

====================

The backlight subsystem file is in/sys/class/backlight/XXX/. XXX indicates the name of the backlight device, which is specified during registration.

 

Attribute files under/sys/class/backlight/XXX/are:

Actual_brightness brightness max_brightness subsystem @

Bl_power device @ power/uevent

 

There are two important files:

Max_brightness: maximum brightness

Brightness: the current actual brightness value (value recorded in the kernel)

 

You can use "cat/sys/class/backlight/XXX/brightness" to view the brightness of the current backlight, use "echo _ number_>>/sys/class/backlight/XXX/brightness" to set the backlight brightness.

For example:

[Root @ M3250 zhiyuan_backlight] # pwd

/Sys/class/backlight/zhiyuan_backlight

[Root @ M3250 zhiyuan_backlight] # ls

Actual_brightness brightness max_brightness subsystem @

Bl_power device @ power/uevent

[Root @ M3250 zhiyuan_backlight] # cat brightness

200

[Root @ M3250 zhiyuan_backlight] # echo 255> brightness

[Root @ M3250 zhiyuan_backlight] # cat brightness

255

[Root @ M3250 zhiyuan_backlight] # cat max_brightness

255

[Root @ M3250 zhiyuan_backlight] #

 

From yuanlulu's blog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.