Android led_class Led驱动

Android led_class Led驱动

在平台文件mach-xxx.c 中添加一下代码
static struct gpio_led gpio_leds[] = {
    {
        .name = "ledr",
        .default_trigger = "timer", // 设置触发方式 "default" "none" "heartbeat" 
        .gpio = S5PV210_GPJ3(2),
        .active_low = true,
        .default_state = LEDS_GPIO_DEFSTATE_OFF,
    },
    {
        .name = "ledg",
        .default_trigger = "timer",
        .gpio = S5PV210_GPJ3(1),
        .active_low = true,
        .default_state = LEDS_GPIO_DEFSTATE_OFF,
    },
    {
        .name = "ledb",
        .default_trigger = "timer",
        .gpio = S5PV210_GPJ3(0),
        .active_low = true,
        .default_state = LEDS_GPIO_DEFSTATE_OFF,
    },
};

static struct gpio_led_platform_data gpio_led_info = {
    .leds = gpio_leds,
    .num_leds = ARRAY_SIZE(gpio_leds),
};
static struct platform_device leds_gpio = {
    .name = "leds-gpio",
    .id = -1,
    .dev = {
        .platform_data = &gpio_led_info,
    },
};


在static struct platform_device *smdkv210_devices[] 数组中添加
              &leds_gpio,

你可能感兴趣的:(linux,android)