Linux 修改代码以支持LED 控制(board-am335xevm)
Linux 修改代码以支持LED 控制(board-am335xevm)
Note:
All the codes are changed at the file board-am335xevm.c
define led informations
static struct gpio_led am335x_evm_gpio_leds[] = {
{
.name = "omap3evm::leda",
/* normally not visible (board underside) */
.default_trigger = "default-on",
.gpio = GPIO_TO_PIN(1,23), /* gets replaced */
.active_low = true,
},
{
.name = "omap3evm::ledb",
/* normally not visible (board underside) */
.default_trigger = "default-on",
.gpio = GPIO_TO_PIN(1,24), /* gets replaced */
.active_low = true,
},
};
static struct gpio_led_platform_data am335x_evm_gpio_led_info = {
.leds = am335x_evm_gpio_leds,
.num_leds = ARRAY_SIZE(am335x_evm_gpio_leds),
};
static struct platform_device am335x_evm_leds_gpio = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &am335x_evm_gpio_led_info,
},
};
define init function
static void leds_init(int evm_id, int profile)
{
int err;
setup_pin_mux(leds_pin_mux);
err = platform_device_register(&am335x_evm_leds_gpio);
if (err) {
pr_err("failed to register matrix keypad (2x3) device\n");
}
}
add init function
static struct evm_dev_cfg gen_purp_evm_dev_cfg[] = {
...
{leds_init, DEV_ON_BASEBOARD, PROFILE_0},// added by driver monkey
...
}