From: Sebastian Gottschall
Adds LED and GPIO Control support for 988x, 9887, 9888, 99x0, 9984 based
chipsets with on chipset connected led's
using WMI Firmware API.
The LED device will get available named as "ath10k-phyX" at sysfs and can be
controlled with various triggers.
adds also debugfs interface for gpio control.
Signed-off-by: Sebastian Gottschall
v2 add correct gpio count per chipset and remove IPQ4019 support since this
chipset does not make use of specific gpios)
v5 fix compiling without LED_CLASS and GPIOLIB support, fix also error by
kbuild test robot which does not occur in standard builds. curious
v6 correct return values and fix comment style
v7 fix ath10k_unregister_led for compiling without LED_CLASS
v8 fix various code design issues reported by reviewers
---
drivers/net/wireless/ath/ath10k/core.c| 221 +-
drivers/net/wireless/ath/ath10k/core.h| 39 +-
drivers/net/wireless/ath/ath10k/debug.c | 146
drivers/net/wireless/ath/ath10k/hw.h | 2 +
drivers/net/wireless/ath/ath10k/mac.c | 5 +
drivers/net/wireless/ath/ath10k/wmi-ops.h | 36 -
drivers/net/wireless/ath/ath10k/wmi-tlv.c | 65 +
drivers/net/wireless/ath/ath10k/wmi.c | 46 +++
drivers/net/wireless/ath/ath10k/wmi.h | 36 +
9 files changed, 593 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/core.c
b/drivers/net/wireless/ath/ath10k/core.c
index f3ec13b80b20..769a246ad0fd 100644
--- a/drivers/net/wireless/ath/ath10k/core.c
+++ b/drivers/net/wireless/ath/ath10k/core.c
@@ -21,6 +21,10 @@
#include
#include
#include
+#include
+#include
+#include
+
#include "core.h"
#include "mac.h"
@@ -65,6 +69,8 @@ static const struct ath10k_hw_params ath10k_hw_params_list[]
= {
.id = QCA988X_HW_2_0_VERSION,
.dev_id = QCA988X_2_0_DEVICE_ID,
.name = "qca988x hw2.0",
+ .led_pin = 1,
+ .gpio_count = 24,
.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
@@ -94,6 +100,8 @@ static const struct ath10k_hw_params ath10k_hw_params_list[]
= {
.id = QCA988X_HW_2_0_VERSION,
.dev_id = QCA988X_2_0_DEVICE_ID_UBNT,
.name = "qca988x hw2.0 ubiquiti",
+ .led_pin = 1,
+ .gpio_count = 24,
.patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
@@ -123,6 +131,8 @@ static const struct ath10k_hw_params
ath10k_hw_params_list[] = {
.id = QCA9887_HW_1_0_VERSION,
.dev_id = QCA9887_1_0_DEVICE_ID,
.name = "qca9887 hw1.0",
+ .led_pin = 1,
+ .gpio_count = 24,
.patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
@@ -267,6 +277,8 @@ static const struct ath10k_hw_params
ath10k_hw_params_list[] = {
.id = QCA99X0_HW_2_0_DEV_VERSION,
.dev_id = QCA99X0_2_0_DEVICE_ID,
.name = "qca99x0 hw2.0",
+ .led_pin = 17,
+ .gpio_count = 35,
.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.otp_exe_param = 0x0700,
@@ -301,6 +313,8 @@ static const struct ath10k_hw_params
ath10k_hw_params_list[] = {
.id = QCA9984_HW_1_0_DEV_VERSION,
.dev_id = QCA9984_1_0_DEVICE_ID,
.name = "qca9984/qca9994 hw1.0",
+ .led_pin = 17,
+ .gpio_count = 35,
.patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
@@ -340,6 +354,8 @@ static const struct ath10k_hw_params
ath10k_hw_params_list[] = {
.id = QCA9888_HW_2_0_DEV_VERSION,
.dev_id = QCA9888_2_0_DEVICE_ID,
.name = "qca9888 hw2.0",
+ .led_pin = 17,
+ .gpio_count = 35,
.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
@@ -2132,6 +2148,199 @@ static int ath10k_core_reset_rx_filter(struct ath10k
*ar)
return 0;
}
+#if IS_ENABLED(CONFIG_GPIOLIB)
+
+static int ath10k_gpio_pin_cfg_input(struct gpio_chip *chip, unsigned offset)
+{
+ struct ath10k_gpiocontrol *gpio = container_of(chip, struct
ath10k_gpiocontrol, gchip);
+ ath10k_wmi_gpio_config(gpio->ar, offset, 1, WMI_GPIO_PULL_NONE,
WMI_GPIO_INTTYPE_DISABLE); /* configure to input */
+