Lines Matching +full:gpio +full:- +full:leds
1 // SPDX-License-Identifier: ISC
3 * Copyright (c) 2005-2011 Atheros Communications Inc.
4 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5 * Copyright (c) 2018 Sebastian Gottschall <s.gottschall@dd-wrt.com>
9 #include <linux/leds.h>
13 #include "wmi-ops.h"
15 #include "leds.h"
21 leds.cdev); in ath10k_leds_set_brightness_blocking()
22 struct gpio_led *led = &ar->leds.wifi_led; in ath10k_leds_set_brightness_blocking()
24 mutex_lock(&ar->conf_mutex); in ath10k_leds_set_brightness_blocking()
26 if (ar->state != ATH10K_STATE_ON) in ath10k_leds_set_brightness_blocking()
29 ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low; in ath10k_leds_set_brightness_blocking()
30 ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin); in ath10k_leds_set_brightness_blocking()
33 mutex_unlock(&ar->conf_mutex); in ath10k_leds_set_brightness_blocking()
40 if (ar->hw_params.led_pin == 0) in ath10k_leds_start()
41 /* leds not supported */ in ath10k_leds_start()
44 /* under some circumstances, the gpio pin gets reconfigured in ath10k_leds_start()
49 ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0, in ath10k_leds_start()
51 ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1); in ath10k_leds_start()
60 if (ar->hw_params.led_pin == 0) in ath10k_leds_register()
61 /* leds not supported */ in ath10k_leds_register()
64 snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s", in ath10k_leds_register()
65 wiphy_name(ar->hw->wiphy)); in ath10k_leds_register()
66 ar->leds.wifi_led.active_low = 1; in ath10k_leds_register()
67 ar->leds.wifi_led.gpio = ar->hw_params.led_pin; in ath10k_leds_register()
68 ar->leds.wifi_led.name = ar->leds.label; in ath10k_leds_register()
69 ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP; in ath10k_leds_register()
71 ar->leds.cdev.name = ar->leds.label; in ath10k_leds_register()
72 ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking; in ath10k_leds_register()
73 ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger; in ath10k_leds_register()
75 ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev); in ath10k_leds_register()
84 if (ar->hw_params.led_pin == 0) in ath10k_leds_unregister()
85 /* leds not supported */ in ath10k_leds_unregister()
88 led_classdev_unregister(&ar->leds.cdev); in ath10k_leds_unregister()