From 64f096935947315ce6fd800aeae527f51048fa91 Mon Sep 17 00:00:00 2001 From: Mario Haustein Date: Wed, 21 Sep 2016 18:46:58 +0200 Subject: add LED support for AVR32 Grasshopper board --- .../patches/4.7.3/0002-grasshopper-led-pwm.patch | 118 +++++++++++++++++++++ target/avr32/systems/grasshopper | 1 + target/linux/config/Config.in.leds | 16 +++ 3 files changed, 135 insertions(+) create mode 100644 target/avr32/grasshopper/patches/4.7.3/0002-grasshopper-led-pwm.patch (limited to 'target') diff --git a/target/avr32/grasshopper/patches/4.7.3/0002-grasshopper-led-pwm.patch b/target/avr32/grasshopper/patches/4.7.3/0002-grasshopper-led-pwm.patch new file mode 100644 index 000000000..977c91523 --- /dev/null +++ b/target/avr32/grasshopper/patches/4.7.3/0002-grasshopper-led-pwm.patch @@ -0,0 +1,118 @@ +diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/Kconfig linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Kconfig +--- linux-4.7.3/arch/avr32/boards/grasshopper/Kconfig 2016-09-21 17:42:47.405315973 +0200 ++++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Kconfig 2016-09-21 18:02:11.184236423 +0200 +@@ -2,4 +2,37 @@ + + if BOARD_GRASSHOPPER + ++config BOARD_GRASSHOPPER_LEDS ++ bool "Enable LED1 through 8" ++ depends on NEW_LEDS ++ depends on LEDS_GPIO ++ default y ++ help ++ Enabling this option will provide access to the LED trough ++ Linux LED API. ++ ++config BOARD_GRASSHOPPER_PWM0 ++ bool "Enable PWM0" ++ depends on PWM_ATMEL ++ depends on BOARD_GRASSHOPPER_LEDS ++ default n ++ help ++ Enabling PWM channel 0 will exclude LED6 from LED API. ++ ++config BOARD_GRASSHOPPER_PWM1 ++ bool "Enable PWM1" ++ depends on PWM_ATMEL ++ depends on BOARD_GRASSHOPPER_LEDS ++ default n ++ help ++ Enabling PWM channel 1 will exclude LED7 from LED API. ++ ++config BOARD_GRASSHOPPER_PWM3 ++ bool "Enable PWM3" ++ depends on PWM_ATMEL ++ depends on BOARD_GRASSHOPPER_LEDS ++ default n ++ help ++ Enabling PWM channel 3 will exclude the power LED from LED API. ++ + endif # BOARD_GRASSHOPPER +diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/led.c linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/led.c +--- linux-4.7.3/arch/avr32/boards/grasshopper/led.c 2016-09-21 17:42:47.405315973 +0200 ++++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/led.c 2016-09-21 17:43:33.144940844 +0200 +@@ -19,7 +19,7 @@ + + // LEDs + static struct gpio_led grasshopper_led[] = { +-#ifndef CONFIG_BOARD_GRASSHOPPER_PWM0 ++#ifndef CONFIG_BOARD_GRASSHOPPER_PWM3 + { + .name = "pwrled:red", + .gpio = GPIO_PIN_PA(22), +@@ -78,7 +78,7 @@ + }; + + /* PWM */ +-#ifdef CONFIG_LEDS_ATMEL_PWM ++#ifdef CONFIG_PWM_ATMEL + static struct gpio_led pwm_led[] = { + /* here the "gpio" is actually a PWM channel */ + #ifdef CONFIG_BOARD_GRASSHOPPER_PWM0 +@@ -93,12 +93,6 @@ + .gpio = 1, + }, + #endif +-#ifdef CONFIG_BOARD_GRASSHOPPER_PWM2 +- { +- .name = "pwm2", +- .gpio = 2, +- }, +-#endif + #ifdef CONFIG_BOARD_GRASSHOPPER_PWM3 + { + .name = "pwm3", +@@ -123,13 +117,15 @@ + + static int __init grasshopper_setup_leds(void) + { ++ unsigned int i; ++ + printk("Grasshopper: Setting up %d LEDs\n", grasshopper_led_data.num_leds); +- //for (i=0; i