日期:2014-05-16  浏览次数:20839 次

Linux下的Backlight子系统(二)

版权所有,转载必须说明转自 http://my.csdn.net/weiqing1981127 

原创作者:南京邮电大学  通信与信息系统专业 研二 魏清

 

 

三.Backlight核心驱动

下面我们讲讲backlight子系统。背光子系统目录在/driver/video/backlight下,其中背光子系统核心代码是backlight.c

先查看/driver/video/backlight/Makefile

obj-$(CONFIG_BACKLIGHT_CLASS_DEVICE) += backlight.o

继续查看/driver/video/backlight/Kconfig

config BACKLIGHT_CLASS_DEVICE

        tristate "Lowlevel Backlight controls"

       depends on BACKLIGHT_LCD_SUPPORT

       default m

所以配置内核make menuconfig时,需要选中这一项。

 

下面看backlight背光的核心代码backlight.c

static int __init backlight_class_init(void)

{

       backlight_class = class_create(THIS_MODULE, "backlight"); //注册backlight

       if (IS_ERR(backlight_class)) {

              printk(KERN_WARNING "Unable to create backlight class; errno = %ld\n",

                            PTR_ERR(backlight_class));

              return PTR_ERR(backlight_class);

       }

       backlight_class->dev_attrs = bl_device_attributes;  //添加类属性

       backlight_class->suspend = backlight_suspend;

       backlight_class->res