nuvoton980 kernel support leds-gpio (五)

1      Scope of Document

This document describes kernel how to support leds-gpio

2      Requiremen

2.1     Function Requirement

 

2.2     Performance Requirement

NA

3      Method

3.1     Export cross compile

 

3.2     Support  kernel  leds-gpio

 

arch/arm/mach-nuc980/dev.c

 

 

#define SMART_FOURCE_LEDS_GPIO

 

#if defined(SMART_FOURCE_LEDS_GPIO)

#include <linux/leds.h>

#include <linux/gpio.h>

#include <linux/gpio_keys.h>

static struct gpio_led gpio_leds[] = {

        {

                .name                   = "heartbeat",

                .gpio                   = 170,

                .default_trigger        = "heartbeat",

        },

        {

                .name                   = "4g-power",

                .gpio                   = 139,

                .default_state          = 0,

        },

        {

                .name                   = "4g-reset",

                .gpio                   = 140,

                .default_state          = 0,

        },

};

 

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,

        },

};

 

#endif

 

/* USB EHCI Host Controller */

#if defined(CONFIG_USB_EHCI_HCD) || defined(CONFIG_USB_EHCI_HCD_MODULE)

static struct resource nuc980_ehci_resource[] = {

#if defined(CONFIG_BACKLIGHT_PWM)

       &nuc980_pwm_bl,

#endif

+#if defined(SMART_FOURCE_LEDS_GPIO)

+     &leds_gpio

+#endif

};

 

make nuc980_eth2uart_defconfig

 

make uImage

 

4      Output file

../image/980uImage

Guess you like

Origin www.cnblogs.com/lianghong881018/p/12529735.html