0002-grasshopper-led-pwm.patch 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/Kconfig linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Kconfig
  2. --- linux-4.7.3/arch/avr32/boards/grasshopper/Kconfig 2016-09-21 17:42:47.405315973 +0200
  3. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Kconfig 2016-09-21 18:02:11.184236423 +0200
  4. @@ -2,4 +2,37 @@
  5. if BOARD_GRASSHOPPER
  6. +config BOARD_GRASSHOPPER_LEDS
  7. + bool "Enable LED1 through 8"
  8. + depends on NEW_LEDS
  9. + depends on LEDS_GPIO
  10. + default y
  11. + help
  12. + Enabling this option will provide access to the LED trough
  13. + Linux LED API.
  14. +
  15. +config BOARD_GRASSHOPPER_PWM0
  16. + bool "Enable PWM0"
  17. + depends on PWM_ATMEL
  18. + depends on BOARD_GRASSHOPPER_LEDS
  19. + default n
  20. + help
  21. + Enabling PWM channel 0 will exclude LED6 from LED API.
  22. +
  23. +config BOARD_GRASSHOPPER_PWM1
  24. + bool "Enable PWM1"
  25. + depends on PWM_ATMEL
  26. + depends on BOARD_GRASSHOPPER_LEDS
  27. + default n
  28. + help
  29. + Enabling PWM channel 1 will exclude LED7 from LED API.
  30. +
  31. +config BOARD_GRASSHOPPER_PWM3
  32. + bool "Enable PWM3"
  33. + depends on PWM_ATMEL
  34. + depends on BOARD_GRASSHOPPER_LEDS
  35. + default n
  36. + help
  37. + Enabling PWM channel 3 will exclude the power LED from LED API.
  38. +
  39. endif # BOARD_GRASSHOPPER
  40. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/led.c linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/led.c
  41. --- linux-4.7.3/arch/avr32/boards/grasshopper/led.c 2016-09-21 17:42:47.405315973 +0200
  42. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/led.c 2016-09-21 17:43:33.144940844 +0200
  43. @@ -19,7 +19,7 @@
  44. // LEDs
  45. static struct gpio_led grasshopper_led[] = {
  46. -#ifndef CONFIG_BOARD_GRASSHOPPER_PWM0
  47. +#ifndef CONFIG_BOARD_GRASSHOPPER_PWM3
  48. {
  49. .name = "pwrled:red",
  50. .gpio = GPIO_PIN_PA(22),
  51. @@ -78,7 +78,7 @@
  52. };
  53. /* PWM */
  54. -#ifdef CONFIG_LEDS_ATMEL_PWM
  55. +#ifdef CONFIG_PWM_ATMEL
  56. static struct gpio_led pwm_led[] = {
  57. /* here the "gpio" is actually a PWM channel */
  58. #ifdef CONFIG_BOARD_GRASSHOPPER_PWM0
  59. @@ -93,12 +93,6 @@
  60. .gpio = 1,
  61. },
  62. #endif
  63. -#ifdef CONFIG_BOARD_GRASSHOPPER_PWM2
  64. - {
  65. - .name = "pwm2",
  66. - .gpio = 2,
  67. - },
  68. -#endif
  69. #ifdef CONFIG_BOARD_GRASSHOPPER_PWM3
  70. {
  71. .name = "pwm3",
  72. @@ -123,13 +117,15 @@
  73. static int __init grasshopper_setup_leds(void)
  74. {
  75. + unsigned int i;
  76. +
  77. printk("Grasshopper: Setting up %d LEDs\n", grasshopper_led_data.num_leds);
  78. - //for (i=0; i<grasshopper_led_data.num_leds; i++)
  79. - // at32_select_gpio(grasshopper_led[i].gpio, AT32_GPIOF_OUTPUT);
  80. + for (i=0; i<grasshopper_led_data.num_leds; i++)
  81. + at32_select_gpio(grasshopper_led[i].gpio, AT32_GPIOF_OUTPUT);
  82. platform_device_register(&grasshopper_led_dev);
  83. -#ifdef CONFIG_LEDS_ATMEL_PWM
  84. +#ifdef CONFIG_PWM_ATMEL
  85. at32_add_device_pwm(0
  86. #ifdef CONFIG_BOARD_GRASSHOPPER_PWM0
  87. | (1 << 0)
  88. @@ -137,9 +133,6 @@
  89. #ifdef CONFIG_BOARD_GRASSHOPPER_PWM1
  90. | (1 << 1)
  91. #endif
  92. -#ifdef CONFIG_BOARD_GRASSHOPPER_PWM2
  93. - | (1 << 2)
  94. -#endif
  95. #ifdef CONFIG_BOARD_GRASSHOPPER_PWM3
  96. | (1 << 3)
  97. #endif
  98. diff -Naur linux-4.7.3/arch/avr32/boards/grasshopper/Makefile linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Makefile
  99. --- linux-4.7.3/arch/avr32/boards/grasshopper/Makefile 2016-09-21 17:42:47.405315973 +0200
  100. +++ linux-4.7.3.grasshopper/arch/avr32/boards/grasshopper/Makefile 2016-09-21 17:43:04.042543262 +0200
  101. @@ -1,5 +1,5 @@
  102. -obj-y += button.o
  103. -obj-y += flash.o
  104. -obj-y += led.o
  105. -obj-y += mac.o
  106. -obj-y += setup.o
  107. +obj-y += button.o
  108. +obj-y += flash.o
  109. +obj-$(CONFIG_BOARD_GRASSHOPPER_LEDS) += led.o
  110. +obj-y += mac.o
  111. +obj-y += setup.o