aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2018-11-25 21:24:05 +0100
committerHauke Mehrtens <hauke@hauke-m.de>2018-12-15 15:25:23 +0100
commit4df3c71cd4c59d80374dceb5267ecee5b91931ad (patch)
treeac2ad70c1fe0b86dbd6d138e61fe0a89d5fcabee /package/kernel
parentaf1aa07b0722a0d3cae0cbaa07a7a9ef46335d4e (diff)
downloadupstream-4df3c71cd4c59d80374dceb5267ecee5b91931ad.tar.gz
upstream-4df3c71cd4c59d80374dceb5267ecee5b91931ad.tar.bz2
upstream-4df3c71cd4c59d80374dceb5267ecee5b91931ad.zip
ath10k-ct: Update to 2018-12-11 and use version based on 4.19
This updates the ath10k-ct driver to the version from 2018-12-11 and selects the ath10k-ct version based on kernel 4.19 by default. CONFIG_ATH10K_CE was introduced between kernel 4.16 and 4.19 and is a mandatory option. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Diffstat (limited to 'package/kernel')
-rw-r--r--package/kernel/ath10k-ct/Makefile12
-rw-r--r--package/kernel/ath10k-ct/patches/100-kernel_compat.patch2
-rw-r--r--package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch8
-rw-r--r--package/kernel/ath10k-ct/patches/201-ath10k-4.16_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch544
-rw-r--r--package/kernel/ath10k-ct/patches/202-ath10k-4.16-use-tpt-trigger-by-default.patch41
5 files changed, 583 insertions, 24 deletions
diff --git a/package/kernel/ath10k-ct/Makefile b/package/kernel/ath10k-ct/Makefile
index d47ab8655c..ae477ab74b 100644
--- a/package/kernel/ath10k-ct/Makefile
+++ b/package/kernel/ath10k-ct/Makefile
@@ -8,14 +8,14 @@ PKG_LICENSE_FILES:=
PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_DATE:=2018-09-29
-PKG_SOURCE_VERSION:=b9989fbd5d6e3269b3e49ab3ec71b4174a02209e
-PKG_MIRROR_HASH:=67bb1c81518aea5880757d521023db25190d9cca21ba67bf1c7e577efd287430
+PKG_SOURCE_DATE:=2018-12-11
+PKG_SOURCE_VERSION:=812d90c08ca8ce8dcbd1b2281e89ff562c7096e1
+PKG_MIRROR_HASH:=986feafd27a828801be96ce4177886204998beea305cda40aafe92a9636db852
-# Build the 4.13 ath10k-ct driver version. Other options are "-4.9", or
+# Build the 4.19 ath10k-ct driver version. Other options are "-4.16", or
# leave un-defined for 4.7 kernel. Probably this should match as closely as
# possible to whatever mac80211 backports version is being used.
-CT_KVER="-4.16"
+CT_KVER="-4.19"
PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
PKG_BUILD_PARALLEL:=1
@@ -58,7 +58,7 @@ ifdef CONFIG_PACKAGE_MAC80211_MESH
NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
endif
-CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m
+CT_MAKEDEFS += CONFIG_ATH10K=m CONFIG_ATH10K_PCI=m CONFIG_ATH10K_CE=y
# This AHB logic is needed for IPQ4019 radios
CT_MAKEDEFS += CONFIG_ATH10K_AHB=m
diff --git a/package/kernel/ath10k-ct/patches/100-kernel_compat.patch b/package/kernel/ath10k-ct/patches/100-kernel_compat.patch
index df7a3b2a86..ea4c849179 100644
--- a/package/kernel/ath10k-ct/patches/100-kernel_compat.patch
+++ b/package/kernel/ath10k-ct/patches/100-kernel_compat.patch
@@ -108,7 +108,7 @@
return;
--- a/ath10k-4.16/wmi.c
+++ b/ath10k-4.16/wmi.c
-@@ -4061,7 +4061,7 @@ static void ath10k_dfs_radar_report(stru
+@@ -4063,7 +4063,7 @@ static void ath10k_dfs_radar_report(stru
ATH10K_DFS_STAT_INC(ar, pulses_detected);
diff --git a/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch b/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch
index 3788b81102..cb7aec06f5 100644
--- a/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch
+++ b/package/kernel/ath10k-ct/patches/160-ath10k-search-all-IEs-for-variant-before-falling-back.patch
@@ -249,7 +249,7 @@ Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
goto success;
--- a/ath10k-4.16/core.c
+++ b/ath10k-4.16/core.c
-@@ -1559,14 +1559,61 @@ out:
+@@ -1560,14 +1560,61 @@ out:
return ret;
}
@@ -314,7 +314,7 @@ Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
ar->normal_mode_fw.board = ath10k_fetch_fw_file(ar,
ar->hw_params.fw.dir,
-@@ -1604,73 +1651,28 @@ static int ath10k_core_fetch_board_data_
+@@ -1605,73 +1652,28 @@ static int ath10k_core_fetch_board_data_
data += magic_len;
len -= magic_len;
@@ -397,7 +397,7 @@ Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
return 0;
err:
-@@ -1679,12 +1681,12 @@ err:
+@@ -1680,12 +1682,12 @@ err:
}
static int ath10k_core_create_board_name(struct ath10k *ar, char *name,
@@ -412,7 +412,7 @@ Origin: backport, https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux
scnprintf(variant, sizeof(variant), ",variant=%s",
ar->id.bdf_ext);
-@@ -1710,21 +1712,31 @@ out:
+@@ -1711,21 +1713,31 @@ out:
static int ath10k_core_fetch_board_file(struct ath10k *ar)
{
diff --git a/package/kernel/ath10k-ct/patches/201-ath10k-4.16_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch b/package/kernel/ath10k-ct/patches/201-ath10k-4.16_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
index 67774dcc15..ae03e5c272 100644
--- a/package/kernel/ath10k-ct/patches/201-ath10k-4.16_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
+++ b/package/kernel/ath10k-ct/patches/201-ath10k-4.16_add-LED-and-GPIO-controlling-support-for-various-chipsets.patch
@@ -161,7 +161,7 @@ v13:
.patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
.uart_pin = 7,
.cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
-@@ -3039,6 +3045,10 @@ int ath10k_core_start(struct ath10k *ar,
+@@ -3040,6 +3046,10 @@ int ath10k_core_start(struct ath10k *ar,
ar->eeprom_overrides.rc_txbf_probe);
}
@@ -172,7 +172,7 @@ v13:
return 0;
err_hif_stop:
-@@ -3285,9 +3295,18 @@ static void ath10k_core_register_work(st
+@@ -3286,9 +3296,18 @@ static void ath10k_core_register_work(st
goto err_spectral_destroy;
}
@@ -191,7 +191,7 @@ v13:
err_spectral_destroy:
ath10k_spectral_destroy(ar);
err_debug_destroy:
-@@ -3345,6 +3364,8 @@ void ath10k_core_unregister(struct ath10
+@@ -3346,6 +3365,8 @@ void ath10k_core_unregister(struct ath10
if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags))
return;
@@ -210,7 +210,7 @@ v13:
#include "htt.h"
#include "htc.h"
-@@ -1229,6 +1230,13 @@ struct ath10k {
+@@ -1245,6 +1246,13 @@ struct ath10k {
} testmode;
struct {
@@ -455,7 +455,7 @@ v13:
static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {
--- a/ath10k-4.16/wmi.c
+++ b/ath10k-4.16/wmi.c
-@@ -7301,6 +7301,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
+@@ -7323,6 +7323,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
return skb;
}
@@ -505,7 +505,7 @@ v13:
static struct sk_buff *
ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id,
enum wmi_sta_ps_mode psmode)
-@@ -8916,6 +8959,9 @@ static const struct wmi_ops wmi_ops = {
+@@ -8938,6 +8981,9 @@ static const struct wmi_ops wmi_ops = {
.fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
.gen_echo = ath10k_wmi_op_gen_echo,
@@ -515,7 +515,7 @@ v13:
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
-@@ -8986,6 +9032,8 @@ static const struct wmi_ops wmi_10_1_ops
+@@ -9008,6 +9054,8 @@ static const struct wmi_ops wmi_10_1_ops
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
.gen_echo = ath10k_wmi_op_gen_echo,
@@ -524,7 +524,7 @@ v13:
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
-@@ -9063,6 +9111,8 @@ static const struct wmi_ops wmi_10_2_ops
+@@ -9085,6 +9133,8 @@ static const struct wmi_ops wmi_10_2_ops
.gen_delba_send = ath10k_wmi_op_gen_delba_send,
.fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
.get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
@@ -533,7 +533,7 @@ v13:
/* .gen_pdev_enable_adaptive_cca not implemented */
};
-@@ -9133,6 +9183,8 @@ static const struct wmi_ops wmi_10_2_4_o
+@@ -9155,6 +9205,8 @@ static const struct wmi_ops wmi_10_2_4_o
.gen_pdev_enable_adaptive_cca =
ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
@@ -542,7 +542,7 @@ v13:
/* .gen_bcn_tmpl not implemented */
/* .gen_prb_tmpl not implemented */
/* .gen_p2p_go_bcn_ie not implemented */
-@@ -9209,6 +9261,8 @@ static const struct wmi_ops wmi_10_4_ops
+@@ -9231,6 +9283,8 @@ static const struct wmi_ops wmi_10_4_ops
.gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
.gen_echo = ath10k_wmi_op_gen_echo,
.gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
@@ -553,7 +553,529 @@ v13:
int ath10k_wmi_attach(struct ath10k *ar)
--- a/ath10k-4.16/wmi.h
+++ b/ath10k-4.16/wmi.h
-@@ -2999,6 +2999,41 @@ enum wmi_10_4_feature_mask {
+@@ -3000,6 +3000,41 @@ enum wmi_10_4_feature_mask {
+
+ };
+
++/* WMI_GPIO_CONFIG_CMDID */
++enum {
++ WMI_GPIO_PULL_NONE,
++ WMI_GPIO_PULL_UP,
++ WMI_GPIO_PULL_DOWN,
++};
++
++enum {
++ WMI_GPIO_INTTYPE_DISABLE,
++ WMI_GPIO_INTTYPE_RISING_EDGE,
++ WMI_GPIO_INTTYPE_FALLING_EDGE,
++ WMI_GPIO_INTTYPE_BOTH_EDGE,
++ WMI_GPIO_INTTYPE_LEVEL_LOW,
++ WMI_GPIO_INTTYPE_LEVEL_HIGH
++};
++
++/* WMI_GPIO_CONFIG_CMDID */
++struct wmi_gpio_config_cmd {
++ __le32 gpio_num; /* GPIO number to be setup */
++ __le32 input; /* 0 - Output/ 1 - Input */
++ __le32 pull_type; /* Pull type defined above */
++ __le32 intr_mode; /* Interrupt mode defined above (Input) */
++} __packed;
++
++/* WMI_GPIO_OUTPUT_CMDID */
++struct wmi_gpio_output_cmd {
++ __le32 gpio_num; /* GPIO number to be setup */
++ __le32 set; /* Set the GPIO pin*/
++} __packed;
++
++/* WMI_GPIO_INPUT_EVENTID */
++struct wmi_gpio_input_event {
++ __le32 gpio_num; /* GPIO number which changed state */
++} __packed;
++
+ struct wmi_ext_resource_config_10_4_cmd {
+ /* contains enum wmi_host_platform_type */
+ __le32 host_platform_config;
+--- a/ath10k-4.19/Kconfig
++++ b/ath10k-4.19/Kconfig
+@@ -64,6 +64,16 @@ config ATH10K_DEBUGFS
+
+ If unsure, say Y to make it easier to debug problems.
+
++config ATH10K_LEDS
++ bool "Atheros ath10k LED support"
++ depends on ATH10K
++ select MAC80211_LEDS
++ select LEDS_CLASS
++ select NEW_LEDS
++ default y
++ ---help---
++ This option is necessary, if you want LED support for chipset connected led pins. If unsure, say N.
++
+ config ATH10K_SPECTRAL
+ bool "Atheros ath10k spectral scan support"
+ depends on ATH10K_DEBUGFS
+--- a/ath10k-4.19/Makefile
++++ b/ath10k-4.19/Makefile
+@@ -19,6 +19,7 @@ ath10k_core-$(CONFIG_ATH10K_SPECTRAL) +=
+ ath10k_core-$(CONFIG_NL80211_TESTMODE) += testmode.o
+ ath10k_core-$(CONFIG_ATH10K_TRACING) += trace.o
+ ath10k_core-$(CONFIG_THERMAL) += thermal.o
++ath10k_core-$(CONFIG_ATH10K_LEDS) += leds.o
+ ath10k_core-$(CONFIG_MAC80211_DEBUGFS) += debugfs_sta.o
+ ath10k_core-$(CONFIG_PM) += wow.o
+ ath10k_core-$(CONFIG_DEV_COREDUMP) += coredump.o
+--- a/ath10k-4.19/core.c
++++ b/ath10k-4.19/core.c
+@@ -35,6 +35,7 @@
+ #include "testmode.h"
+ #include "wmi-ops.h"
+ #include "coredump.h"
++#include "leds.h"
+
+ /* Disable ath10k-ct DBGLOG output by default */
+ unsigned int ath10k_debug_mask = ATH10K_DBG_NO_DBGLOG;
+@@ -72,6 +73,7 @@ static const struct ath10k_hw_params ath
+ .id = QCA988X_HW_2_0_VERSION,
+ .dev_id = QCA988X_2_0_DEVICE_ID,
+ .name = "qca988x hw2.0",
++ .led_pin = 1,
+ .patch_load_addr = QCA988X_HW_2_0_PATCH_LOAD_ADDR,
+ .uart_pin = 7,
+ .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
+@@ -137,6 +139,7 @@ static const struct ath10k_hw_params ath
+ .id = QCA9887_HW_1_0_VERSION,
+ .dev_id = QCA9887_1_0_DEVICE_ID,
+ .name = "qca9887 hw1.0",
++ .led_pin = 1,
+ .patch_load_addr = QCA9887_HW_1_0_PATCH_LOAD_ADDR,
+ .uart_pin = 7,
+ .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_ALL,
+@@ -301,6 +304,7 @@ static const struct ath10k_hw_params ath
+ .id = QCA99X0_HW_2_0_DEV_VERSION,
+ .dev_id = QCA99X0_2_0_DEVICE_ID,
+ .name = "qca99x0 hw2.0",
++ .led_pin = 17,
+ .patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
+ .uart_pin = 7,
+ .otp_exe_param = 0x00000700,
+@@ -339,6 +343,7 @@ static const struct ath10k_hw_params ath
+ .id = QCA9984_HW_1_0_DEV_VERSION,
+ .dev_id = QCA9984_1_0_DEVICE_ID,
+ .name = "qca9984/qca9994 hw1.0",
++ .led_pin = 17,
+ .patch_load_addr = QCA9984_HW_1_0_PATCH_LOAD_ADDR,
+ .uart_pin = 7,
+ .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
+@@ -382,6 +387,7 @@ static const struct ath10k_hw_params ath
+ .id = QCA9888_HW_2_0_DEV_VERSION,
+ .dev_id = QCA9888_2_0_DEVICE_ID,
+ .name = "qca9888 hw2.0",
++ .led_pin = 17,
+ .patch_load_addr = QCA9888_HW_2_0_PATCH_LOAD_ADDR,
+ .uart_pin = 7,
+ .cc_wraparound_type = ATH10K_HW_CC_WRAP_SHIFTED_EACH,
+@@ -3097,6 +3103,10 @@ int ath10k_core_start(struct ath10k *ar,
+ ar->eeprom_overrides.rc_txbf_probe);
+ }
+
++ status = ath10k_leds_start(ar);
++ if (status)
++ goto err_hif_stop;
++
+ return 0;
+
+ err_hif_stop:
+@@ -3351,9 +3361,18 @@ static void ath10k_core_register_work(st
+ goto err_spectral_destroy;
+ }
+
++ status = ath10k_leds_register(ar);
++ if (status) {
++ ath10k_err(ar, "could not register leds: %d\n",
++ status);
++ goto err_thermal_unregister;
++ }
++
+ set_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags);
+ return;
+
++err_thermal_unregister:
++ ath10k_thermal_unregister(ar);
+ err_spectral_destroy:
+ ath10k_spectral_destroy(ar);
+ err_debug_destroy:
+@@ -3411,6 +3430,8 @@ void ath10k_core_unregister(struct ath10
+ if (!test_bit(ATH10K_FLAG_CORE_REGISTERED, &ar->dev_flags))
+ return;
+
++ ath10k_leds_unregister(ar);
++
+ ath10k_thermal_unregister(ar);
+ /* Stop spectral before unregistering from mac80211 to remove the
+ * relayfs debugfs file cleanly. Otherwise the parent debugfs tree
+--- a/ath10k-4.19/core.h
++++ b/ath10k-4.19/core.h
+@@ -25,6 +25,7 @@
+ #include <linux/pci.h>
+ #include <linux/uuid.h>
+ #include <linux/time.h>
++#include <linux/leds.h>
+
+ #include "htt.h"
+ #include "htc.h"
+@@ -1106,7 +1107,6 @@ struct ath10k {
+ u32 low_5ghz_chan;
+ u32 high_5ghz_chan;
+ bool ani_enabled;
+-
+ bool p2p;
+ bool ct_all_pkts_htt; /* CT firmware only: native-wifi for all pkts */
+
+@@ -1355,6 +1355,13 @@ struct ath10k {
+ } testmode;
+
+ struct {
++ struct gpio_led wifi_led;
++ struct led_classdev cdev;
++ char label[48];
++ u32 gpio_state_pin;
++ } leds;
++
++ struct {
+ /* protected by data_lock */
+ u32 fw_crash_counter;
+ u32 fw_warm_reset_counter;
+--- a/ath10k-4.19/hw.h
++++ b/ath10k-4.19/hw.h
+@@ -508,6 +508,7 @@ struct ath10k_hw_params {
+ const char *name;
+ u32 patch_load_addr;
+ int uart_pin;
++ int led_pin;
+ u32 otp_exe_param;
+
+ /* Type of hw cycle counter wraparound logic, for more info
+--- /dev/null
++++ b/ath10k-4.19/leds.c
+@@ -0,0 +1,103 @@
++/*
++ * Copyright (c) 2005-2011 Atheros Communications Inc.
++ * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
++ * Copyright (c) 2018 Sebastian Gottschall <s.gottschall@dd-wrt.com>
++ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++
++#include <linux/leds.h>
++
++#include "core.h"
++#include "wmi.h"
++#include "wmi-ops.h"
++
++#include "leds.h"
++
++static int ath10k_leds_set_brightness_blocking(struct led_classdev *led_cdev,
++ enum led_brightness brightness)
++{
++ struct ath10k *ar = container_of(led_cdev, struct ath10k,
++ leds.cdev);
++ struct gpio_led *led = &ar->leds.wifi_led;
++
++ mutex_lock(&ar->conf_mutex);
++
++ if (ar->state != ATH10K_STATE_ON)
++ goto out;
++
++ ar->leds.gpio_state_pin = (brightness != LED_OFF) ^ led->active_low;
++ ath10k_wmi_gpio_output(ar, led->gpio, ar->leds.gpio_state_pin);
++
++out:
++ mutex_unlock(&ar->conf_mutex);
++
++ return 0;
++}
++
++int ath10k_leds_start(struct ath10k *ar)
++{
++ if (ar->hw_params.led_pin == 0)
++ /* leds not supported */
++ return 0;
++
++ /* under some circumstances, the gpio pin gets reconfigured
++ * to default state by the firmware, so we need to
++ * reconfigure it this behaviour has only ben seen on
++ * QCA9984 and QCA99XX devices so far
++ */
++ ath10k_wmi_gpio_config(ar, ar->hw_params.led_pin, 0,
++ WMI_GPIO_PULL_NONE, WMI_GPIO_INTTYPE_DISABLE);
++ ath10k_wmi_gpio_output(ar, ar->hw_params.led_pin, 1);
++
++ return 0;
++}
++
++int ath10k_leds_register(struct ath10k *ar)
++{
++ int ret;
++
++ if (ar->hw_params.led_pin == 0)
++ /* leds not supported */
++ return 0;
++
++ snprintf(ar->leds.label, sizeof(ar->leds.label), "ath10k-%s",
++ wiphy_name(ar->hw->wiphy));
++ ar->leds.wifi_led.active_low = 1;
++ ar->leds.wifi_led.gpio = ar->hw_params.led_pin;
++ ar->leds.wifi_led.name = ar->leds.label;
++ ar->leds.wifi_led.default_state = LEDS_GPIO_DEFSTATE_KEEP;
++
++ ar->leds.cdev.name = ar->leds.label;
++ ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking;
++
++ /* FIXME: this assignment doesn't make sense as it's NULL, remove it? */
++ ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger;
++
++ ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev);
++ if (ret)
++ return ret;
++
++ return 0;
++}
++
++void ath10k_leds_unregister(struct ath10k *ar)
++{
++ if (ar->hw_params.led_pin == 0)
++ /* leds not supported */
++ return;
++
++ led_classdev_unregister(&ar->leds.cdev);
++}
++
+--- /dev/null
++++ b/ath10k-4.19/leds.h
+@@ -0,0 +1,41 @@
++/*
++ * Copyright (c) 2018, The Linux Foundation. All rights reserved.
++ *
++ * Permission to use, copy, modify, and/or distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ */
++#ifndef _LEDS_H_
++#define _LEDS_H_
++
++#include "core.h"
++
++#ifdef CONFIG_ATH10K_LEDS
++void ath10k_leds_unregister(struct ath10k *ar);
++int ath10k_leds_start(struct ath10k *ar);
++int ath10k_leds_register(struct ath10k *ar);
++#else
++static inline void ath10k_leds_unregister(struct ath10k *ar)
++{
++}
++
++static inline int ath10k_leds_start(struct ath10k *ar)
++{
++ return 0;
++}
++
++static inline int ath10k_leds_register(struct ath10k *ar)
++{
++ return 0;
++}
++
++#endif
++#endif /* _LEDS_H_ */
+--- a/ath10k-4.19/mac.c
++++ b/ath10k-4.19/mac.c
+@@ -34,6 +34,7 @@
+ #include "wmi-tlv.h"
+ #include "wmi-ops.h"
+ #include "wow.h"
++#include "leds.h"
+
+ /*********/
+ /* Rates */
+--- a/ath10k-4.19/wmi-ops.h
++++ b/ath10k-4.19/wmi-ops.h
+@@ -218,7 +218,10 @@ struct wmi_ops {
+ struct sk_buff *(*gen_echo)(struct ath10k *ar, u32 value);
+ struct sk_buff *(*gen_pdev_get_tpc_table_cmdid)(struct ath10k *ar,
+ u32 param);
++ struct sk_buff *(*gen_gpio_config)(struct ath10k *ar, u32 gpio_num,
++ u32 input, u32 pull_type, u32 intr_mode);
+
++ struct sk_buff *(*gen_gpio_output)(struct ath10k *ar, u32 gpio_num, u32 set);
+ };
+
+ int ath10k_wmi_cmd_send(struct ath10k *ar, struct sk_buff *skb, u32 cmd_id);
+@@ -1071,6 +1074,35 @@ ath10k_wmi_force_fw_hang(struct ath10k *
+ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->force_fw_hang_cmdid);
+ }
+
++static inline int ath10k_wmi_gpio_config(struct ath10k *ar, u32 gpio_num,
++ u32 input, u32 pull_type, u32 intr_mode)
++{
++ struct sk_buff *skb;
++
++ if (!ar->wmi.ops->gen_gpio_config)
++ return -EOPNOTSUPP;
++
++ skb = ar->wmi.ops->gen_gpio_config(ar, gpio_num, input, pull_type, intr_mode);
++ if (IS_ERR(skb))
++ return PTR_ERR(skb);
++
++ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_config_cmdid);
++}
++
++static inline int ath10k_wmi_gpio_output(struct ath10k *ar, u32 gpio_num, u32 set)
++{
++ struct sk_buff *skb;
++
++ if (!ar->wmi.ops->gen_gpio_config)
++ return -EOPNOTSUPP;
++
++ skb = ar->wmi.ops->gen_gpio_output(ar, gpio_num, set);
++ if (IS_ERR(skb))
++ return PTR_ERR(skb);
++
++ return ath10k_wmi_cmd_send(ar, skb, ar->wmi.cmd->gpio_output_cmdid);
++}
++
+ static inline int
+ ath10k_wmi_dbglog_cfg(struct ath10k *ar, u64 module_enable, u32 log_level)
+ {
+--- a/ath10k-4.19/wmi-tlv.c
++++ b/ath10k-4.19/wmi-tlv.c
+@@ -3976,6 +3976,8 @@ static const struct wmi_ops wmi_tlv_ops
+ .gen_echo = ath10k_wmi_tlv_op_gen_echo,
+ .gen_vdev_spectral_conf = ath10k_wmi_tlv_op_gen_vdev_spectral_conf,
+ .gen_vdev_spectral_enable = ath10k_wmi_tlv_op_gen_vdev_spectral_enable,
++ /* .gen_gpio_config not implemented */
++ /* .gen_gpio_output not implemented */
+ };
+
+ static const struct wmi_peer_flags_map wmi_tlv_peer_flags_map = {
+--- a/ath10k-4.19/wmi.c
++++ b/ath10k-4.19/wmi.c
+@@ -7843,6 +7843,49 @@ ath10k_wmi_op_gen_peer_set_param(struct
+ return skb;
+ }
+
++static struct sk_buff *ath10k_wmi_op_gen_gpio_config(struct ath10k *ar,
++ u32 gpio_num, u32 input,
++ u32 pull_type, u32 intr_mode)
++{
++ struct wmi_gpio_config_cmd *cmd;
++ struct sk_buff *skb;
++
++ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
++ if (!skb)
++ return ERR_PTR(-ENOMEM);
++
++ cmd = (struct wmi_gpio_config_cmd *)skb->data;
++ cmd->pull_type = __cpu_to_le32(pull_type);
++ cmd->gpio_num = __cpu_to_le32(gpio_num);
++ cmd->input = __cpu_to_le32(input);
++ cmd->intr_mode = __cpu_to_le32(intr_mode);
++
++ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_config gpio_num 0x%08x input 0x%08x pull_type 0x%08x intr_mode 0x%08x\n",
++ gpio_num, input, pull_type, intr_mode);
++
++ return skb;
++}
++
++static struct sk_buff *ath10k_wmi_op_gen_gpio_output(struct ath10k *ar,
++ u32 gpio_num, u32 set)
++{
++ struct wmi_gpio_output_cmd *cmd;
++ struct sk_buff *skb;
++
++ skb = ath10k_wmi_alloc_skb(ar, sizeof(*cmd));
++ if (!skb)
++ return ERR_PTR(-ENOMEM);
++
++ cmd = (struct wmi_gpio_output_cmd *)skb->data;
++ cmd->gpio_num = __cpu_to_le32(gpio_num);
++ cmd->set = __cpu_to_le32(set);
++
++ ath10k_dbg(ar, ATH10K_DBG_WMI, "wmi gpio_output gpio_num 0x%08x set 0x%08x\n",
++ gpio_num, set);
++
++ return skb;
++}
++
+ static struct sk_buff *
+ ath10k_wmi_op_gen_set_psmode(struct ath10k *ar, u32 vdev_id,
+ enum wmi_sta_ps_mode psmode)
+@@ -9567,6 +9610,9 @@ static const struct wmi_ops wmi_ops = {
+ .fw_stats_fill = ath10k_wmi_main_op_fw_stats_fill,
+ .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
+ .gen_echo = ath10k_wmi_op_gen_echo,
++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
++
+ /* .gen_bcn_tmpl not implemented */
+ /* .gen_prb_tmpl not implemented */
+ /* .gen_p2p_go_bcn_ie not implemented */
+@@ -9637,6 +9683,8 @@ static const struct wmi_ops wmi_10_1_ops
+ .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
+ .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
+ .gen_echo = ath10k_wmi_op_gen_echo,
++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
+ /* .gen_bcn_tmpl not implemented */
+ /* .gen_prb_tmpl not implemented */
+ /* .gen_p2p_go_bcn_ie not implemented */
+@@ -9714,6 +9762,8 @@ static const struct wmi_ops wmi_10_2_ops
+ .gen_delba_send = ath10k_wmi_op_gen_delba_send,
+ .fw_stats_fill = ath10k_wmi_10x_op_fw_stats_fill,
+ .get_vdev_subtype = ath10k_wmi_op_get_vdev_subtype,
++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
+ /* .gen_pdev_enable_adaptive_cca not implemented */
+ };
+
+@@ -9784,6 +9834,8 @@ static const struct wmi_ops wmi_10_2_4_o
+ .gen_pdev_enable_adaptive_cca =
+ ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
+ .get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
+ /* .gen_bcn_tmpl not implemented */
+ /* .gen_prb_tmpl not implemented */
+ /* .gen_p2p_go_bcn_ie not implemented */
+@@ -9864,6 +9916,8 @@ static const struct wmi_ops wmi_10_4_ops
+ .gen_pdev_bss_chan_info_req = ath10k_wmi_10_2_op_gen_pdev_bss_chan_info,
+ .gen_echo = ath10k_wmi_op_gen_echo,
+ .gen_pdev_get_tpc_config = ath10k_wmi_10_2_4_op_gen_pdev_get_tpc_config,
++ .gen_gpio_config = ath10k_wmi_op_gen_gpio_config,
++ .gen_gpio_output = ath10k_wmi_op_gen_gpio_output,
+ };
+
+ int ath10k_wmi_attach(struct ath10k *ar)
+--- a/ath10k-4.19/wmi.h
++++ b/ath10k-4.19/wmi.h
+@@ -3038,6 +3038,41 @@ enum wmi_10_4_feature_mask {
};
diff --git a/package/kernel/ath10k-ct/patches/202-ath10k-4.16-use-tpt-trigger-by-default.patch b/package/kernel/ath10k-ct/patches/202-ath10k-4.16-use-tpt-trigger-by-default.patch
index 14ed854663..fb65c80706 100644
--- a/package/kernel/ath10k-ct/patches/202-ath10k-4.16-use-tpt-trigger-by-default.patch
+++ b/package/kernel/ath10k-ct/patches/202-ath10k-4.16-use-tpt-trigger-by-default.patch
@@ -16,7 +16,7 @@ Signed-off-by: Mathias Kresin <dev@kresin.me>
--- a/ath10k-4.16/core.h
+++ b/ath10k-4.16/core.h
-@@ -1320,6 +1320,10 @@ struct ath10k {
+@@ -1336,6 +1336,10 @@ struct ath10k {
u8 csi_data[4096];
u16 csi_data_len;
@@ -42,7 +42,44 @@ Signed-off-by: Mathias Kresin <dev@kresin.me>
if (ret)
--- a/ath10k-4.16/mac.c
+++ b/ath10k-4.16/mac.c
-@@ -9622,7 +9622,7 @@ int ath10k_mac_register(struct ath10k *a
+@@ -9624,7 +9624,7 @@ int ath10k_mac_register(struct ath10k *a
+ wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
+
+ #ifdef CPTCFG_MAC80211_LEDS
+- ieee80211_create_tpt_led_trigger(ar->hw,
++ ar->led_default_trigger = ieee80211_create_tpt_led_trigger(ar->hw,
+ IEEE80211_TPT_LEDTRIG_FL_RADIO, ath10k_tpt_blink,
+ ARRAY_SIZE(ath10k_tpt_blink));
+ #endif
+--- a/ath10k-4.19/core.h
++++ b/ath10k-4.19/core.h
+@@ -1452,6 +1452,10 @@ struct ath10k {
+ u8 csi_data[4096];
+ u16 csi_data_len;
+
++#ifdef CPTCFG_MAC80211_LEDS
++ const char *led_default_trigger;
++#endif
++
+ /* must be last */
+ u8 drv_priv[0] __aligned(sizeof(void *));
+ };
+--- a/ath10k-4.19/leds.c
++++ b/ath10k-4.19/leds.c
+@@ -81,9 +81,7 @@ int ath10k_leds_register(struct ath10k *
+
+ ar->leds.cdev.name = ar->leds.label;
+ ar->leds.cdev.brightness_set_blocking = ath10k_leds_set_brightness_blocking;
+-
+- /* FIXME: this assignment doesn't make sense as it's NULL, remove it? */
+- ar->leds.cdev.default_trigger = ar->leds.wifi_led.default_trigger;
++ ar->leds.cdev.default_trigger = ar->led_default_trigger;
+
+ ret = led_classdev_register(wiphy_dev(ar->hw->wiphy), &ar->leds.cdev);
+ if (ret)
+--- a/ath10k-4.19/mac.c
++++ b/ath10k-4.19/mac.c
+@@ -9768,7 +9768,7 @@ int ath10k_mac_register(struct ath10k *a
wiphy_ext_feature_set(ar->hw->wiphy, NL80211_EXT_FEATURE_CQM_RSSI_LIST);
#ifdef CPTCFG_MAC80211_LEDS