linux系统基于3.4
平台msm8x26
android 4.4.2
linux 中存在众多的子系统,包括led子系统,input子系统等等,那么就先从最简单的led子系统开始分析了。这次要尽量分析彻底。
在andorid中的led系统是在\kernel\drivers\leds,在经常分析代码的过程中,首先需要看的是Kconfig和makefile文件,那好先看Kconfig
menuconfig NEW_LEDS
bool "LED Support"
help
Say Y to enable Linux LED support. This allows control of supported
LEDs from both userspace and optionally, by kernel events (triggers).
This is not related to standard keyboard LEDs which are controlled
via the input system.
if NEW_LEDS
config LEDS_CLASS
tristate "LED Class Support"
help
This option enables the led sysfs class in /sys/class/leds. You'll
need this to do anything useful with LEDs. If unsure, say N.
这类似于在linux系统执行make menuconfig,首先是NEW_LEDS,看注释就是说必须使能LED Support,才能有所谓的平台的led的支持。这些一般是支持的,而且一般的平台也是会使能的,高通平台上有Msm_defconfig (arch\arm\configs),看出来支持新增led以及led的class的。
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y
看到这些的话,应该看出msm平台是支持led的(想想也支持)接下来就是看makefile了
# LED Core
obj-$(CONFIG_NEW_LEDS) += led-core.o
obj-$(CONFIG_LEDS_CLASS) += led-class.o
obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o