ath9k: Fix LED configuration
On some x86 platforms, the LED gpio is active high instead of active low. Identify such cards and modify the GPIO usage to make sure LED works properly. Cc: Russell Hu <rhu@qca.qualcomm.com> Signed-off-by: Sujith Manoharan <c_manoha@qca.qualcomm.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:

committed by
John W. Linville

parent
46270d077a
commit
aeeb206579
@@ -25,7 +25,12 @@ static void ath_led_brightness(struct led_classdev *led_cdev,
|
||||
enum led_brightness brightness)
|
||||
{
|
||||
struct ath_softc *sc = container_of(led_cdev, struct ath_softc, led_cdev);
|
||||
ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, (brightness == LED_OFF));
|
||||
u32 val = (brightness == LED_OFF);
|
||||
|
||||
if (sc->sc_ah->config.led_active_high)
|
||||
val = !val;
|
||||
|
||||
ath9k_hw_set_gpio(sc->sc_ah, sc->sc_ah->led_pin, val);
|
||||
}
|
||||
|
||||
void ath_deinit_leds(struct ath_softc *sc)
|
||||
@@ -82,7 +87,7 @@ void ath_fill_led_pin(struct ath_softc *sc)
|
||||
ath9k_hw_cfg_output(ah, ah->led_pin, AR_GPIO_OUTPUT_MUX_AS_OUTPUT);
|
||||
|
||||
/* LED off, active low */
|
||||
ath9k_hw_set_gpio(ah, ah->led_pin, 1);
|
||||
ath9k_hw_set_gpio(ah, ah->led_pin, (ah->config.led_active_high) ? 0 : 1);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user