547-ath9k_led_defstate_fix.patch 1.0 KB

1234567891011121314151617181920212223242526272829
  1. From: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  2. Date: Sun, 31 Jan 2016 20:48:49 +0100
  3. Subject: [PATCH v4 2/8] mac80211: ath9k: set default state for platform LEDs
  4. Support default state for platform LEDs connected to ath9k device.
  5. Now LEDs are correctly set on or off at ath9k module initialization.
  6. Very useful if power LED is connected to wireless chip.
  7. Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz@wp.pl>
  8. ---
  9. gpio.c | 7 +++++--
  10. 1 file changed, 5 insertions(+), 2 deletions(-)
  11. --- a/drivers/net/wireless/ath/ath9k/gpio.c
  12. +++ b/drivers/net/wireless/ath/ath9k/gpio.c
  13. @@ -74,8 +74,11 @@ static int ath_add_led(struct ath_softc
  14. ath9k_hw_gpio_request_out(sc->sc_ah, gpio->gpio, gpio->name,
  15. AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
  16. - /* LED off */
  17. - ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  18. + /* Set default LED state */
  19. + if (gpio->default_state == LEDS_GPIO_DEFSTATE_ON)
  20. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, !gpio->active_low);
  21. + else
  22. + ath9k_hw_set_gpio(sc->sc_ah, gpio->gpio, gpio->active_low);
  23. return 0;
  24. }