Initial commit
This commit is contained in:
122
package/kernel/ath10k-ct/Makefile
Normal file
122
package/kernel/ath10k-ct/Makefile
Normal file
@@ -0,0 +1,122 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ath10k-ct
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/greearb/ath10k-ct.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2021-06-03
|
||||
PKG_SOURCE_VERSION:=b44cd7b2e7b0df5995ece18f358d4dfc40834ba1
|
||||
PKG_MIRROR_HASH:=59f961ad425eb1a48fa9c391a325cc0f23845daec9d12673445d3077f9756cf0
|
||||
|
||||
# Build the 5.10 ath10k-ct driver version.
|
||||
# Probably this should match as closely as
|
||||
# possible to whatever mac80211 backports version is being used.
|
||||
CT_KVER="-5.10"
|
||||
|
||||
PKG_MAINTAINER:=Ben Greear <greearb@candelatech.com>
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_EXTMOD_SUBDIRS:=ath10k$(CT_KVER)
|
||||
|
||||
STAMP_CONFIGURED_DEPENDS := $(STAGING_DIR)/usr/include/mac80211-backport/backport/autoconf.h
|
||||
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define KernelPackage/ath10k-ct
|
||||
SUBMENU:=Wireless Drivers
|
||||
TITLE:=ath10k-ct driver optimized for CT ath10k firmware
|
||||
DEPENDS:=+kmod-mac80211 +kmod-ath +@DRIVER_11N_SUPPORT +@DRIVER_11AC_SUPPORT @PCI_SUPPORT +kmod-hwmon-core
|
||||
FILES:=\
|
||||
$(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_pci.ko \
|
||||
$(PKG_BUILD_DIR)/ath10k$(CT_KVER)/ath10k_core.ko
|
||||
AUTOLOAD:=$(call AutoProbe,ath10k_pci)
|
||||
PROVIDES:=kmod-ath10k
|
||||
VARIANT:=regular
|
||||
endef
|
||||
|
||||
define KernelPackage/ath10k-ct/config
|
||||
|
||||
config ATH10K-CT_LEDS
|
||||
bool "Enable LED support"
|
||||
default y
|
||||
depends on PACKAGE_kmod-ath10k-ct || PACKAGE_kmod-ath10k-ct-smallbuffers
|
||||
endef
|
||||
|
||||
define KernelPackage/ath10k-ct-smallbuffers
|
||||
$(call KernelPackage/ath10k-ct)
|
||||
TITLE+= (small buffers for low-RAM devices)
|
||||
VARIANT:=smallbuffers
|
||||
endef
|
||||
|
||||
NOSTDINC_FLAGS := \
|
||||
$(KERNEL_NOSTDINC_FLAGS) \
|
||||
-I$(PKG_BUILD_DIR) \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211-backport \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211/uapi \
|
||||
-I$(STAGING_DIR)/usr/include/mac80211 \
|
||||
-include backport/autoconf.h \
|
||||
-include backport/backport.h
|
||||
|
||||
ifdef CONFIG_PACKAGE_MAC80211_MESH
|
||||
NOSTDINC_FLAGS += -DCONFIG_MAC80211_MESH
|
||||
endif
|
||||
|
||||
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
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_AHB
|
||||
|
||||
NOSTDINC_FLAGS += -DSTANDALONE_CT
|
||||
|
||||
ifdef CONFIG_PACKAGE_MAC80211_DEBUGFS
|
||||
CT_MAKEDEFS += CONFIG_ATH10K_DEBUGFS=y CONFIG_MAC80211_DEBUGFS=y
|
||||
NOSTDINC_FLAGS += -DCONFIG_MAC80211_DEBUGFS
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUGFS
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_ATH_DEBUG
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_DEBUG
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_ATH_DFS
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_DFS_CERTIFIED
|
||||
endif
|
||||
|
||||
ifdef CONFIG_PACKAGE_ATH_SPECTRAL
|
||||
CT_MAKEDEFS += CONFIG_ATH10K_SPECTRAL=y
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_SPECTRAL
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_ATH10K-CT_LEDS),y)
|
||||
CT_MAKEDEFS += CONFIG_ATH10K_LEDS=y
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_LEDS
|
||||
endif
|
||||
|
||||
ifeq ($(BUILD_VARIANT),smallbuffers)
|
||||
NOSTDINC_FLAGS += -DCONFIG_ATH10K_SMALLBUFFERS
|
||||
endif
|
||||
|
||||
define Build/Configure
|
||||
cp $(STAGING_DIR)/usr/include/mac80211/ath/*.h $(PKG_BUILD_DIR)
|
||||
endef
|
||||
|
||||
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
|
||||
CT_MAKEDEFS += V=1
|
||||
endif
|
||||
|
||||
define Build/Compile
|
||||
+$(MAKE) $(CT_MAKEDEFS) $(PKG_JOBS) -C "$(LINUX_DIR)" \
|
||||
$(KERNEL_MAKE_FLAGS) \
|
||||
M="$(PKG_BUILD_DIR)/ath10k$(CT_KVER)" \
|
||||
NOSTDINC_FLAGS="$(NOSTDINC_FLAGS)" \
|
||||
modules
|
||||
endef
|
||||
|
||||
$(eval $(call KernelPackage,ath10k-ct))
|
||||
$(eval $(call KernelPackage,ath10k-ct-smallbuffers))
|
||||
@@ -0,0 +1,598 @@
|
||||
From: Sebastian Gottschall <s.gottschall@newmedia-net.de>
|
||||
|
||||
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.
|
||||
|
||||
This patch is specific for OpenWRt base, as is use old backported package
|
||||
with old wireless source. Support for QCA9984 is removed.
|
||||
Reworked to use ath10k-ct custom source
|
||||
|
||||
|
||||
Signed-off-by: Sebastian Gottschall <s.gottschall@dd-wrt.com>
|
||||
Reviewed-by: Steve deRosier <derosier@cal-sierra.com>
|
||||
[kvalo: major reorg and cleanup]
|
||||
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
---
|
||||
|
||||
v13:
|
||||
|
||||
* only compile tested!
|
||||
|
||||
* fix all checkpatch warnings
|
||||
|
||||
* fix commit log
|
||||
|
||||
* sizeof(struct ath10k_gpiocontrol) -> sizeof(*gpio)
|
||||
|
||||
* unsigned -> unsigned int
|
||||
|
||||
* remove GPIOLIB code, that should be added in a separate patch
|
||||
|
||||
* rename gpio.c to leds.c
|
||||
|
||||
* add leds.h
|
||||
|
||||
* rename some functions:
|
||||
|
||||
ath10k_attach_led() -> ath10k_leds_register()
|
||||
ath10k_unregister_led() -> ath10k_leds_unregister()
|
||||
ath10k_reset_led_pin() -> ath10k_leds_start()
|
||||
|
||||
* call ath10k_leds_unregister() before ath10k_thermal_unregister() to preserve ordering
|
||||
|
||||
* call ath10k_leds_start() only from ath10k_core_start() and not from mac.c
|
||||
|
||||
* rename struct ath10k_gpiocontrol as anonymous function under struct
|
||||
ath10k::leds, no need for memory allocation
|
||||
|
||||
* merge ath10k_add_led() to ath10k_attach_led(), which is it's only caller
|
||||
|
||||
* remove #if IS_ENABLED() checks from most of places, memory savings from those were not worth it
|
||||
|
||||
* Kconfig help text improvement and move it lower in the menu, also don't enable it by default
|
||||
|
||||
* switch to set_brightness_blocking() so that the callback can sleep,
|
||||
then no need to use ath10k_wmi_cmd_send_nowait() and can take mutex
|
||||
to access ar->state
|
||||
|
||||
* don't touch ath10k_wmi_pdev_get_temperature()
|
||||
|
||||
* as QCA6174/QCA9377 are not (yet) supported don't add the command to WMI-TLV interface
|
||||
|
||||
* remove debugfs interface, that should be added in another patch
|
||||
|
||||
* cleanup includes
|
||||
|
||||
ath10k-5.10/Kconfig | 10 +++
|
||||
ath10k-5.10/Makefile | 1 +
|
||||
ath10k-5.10/core.c | 22 +++++++
|
||||
ath10k-5.10/core.h | 9 ++-
|
||||
ath10k-5.10/hw.h | 1 +
|
||||
ath10k-5.10/leds.c | 103 ++++++++++++++++++++++++++++++
|
||||
ath10k-5.10/leds.h | 45 +++++++++++++
|
||||
ath10k-5.10/mac.c | 1 +
|
||||
ath10k-5.10/wmi-ops.h | 32 ++++++++++
|
||||
ath10k-5.10/wmi-tlv.c | 2 +
|
||||
ath10k-5.10/wmi.c | 54 ++++++++++++++++
|
||||
ath10k-5.10/wmi.h | 35 ++++++++++
|
||||
12 files changed, 314 insertions(+), 1 deletion(-)
|
||||
create mode 100644 ath10k-5.10/leds.c
|
||||
create mode 100644 ath10k-5.10/leds.h
|
||||
|
||||
--- a/ath10k-5.10/Kconfig
|
||||
+++ b/ath10k-5.10/Kconfig
|
||||
@@ -65,6 +65,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-5.10/Makefile
|
||||
+++ b/ath10k-5.10/Makefile
|
||||
@@ -20,6 +20,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_ATH10K_CE) += ce.o
|
||||
--- a/ath10k-5.10/core.c
|
||||
+++ b/ath10k-5.10/core.c
|
||||
@@ -26,6 +26,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;
|
||||
@@ -68,6 +69,7 @@ static const struct ath10k_hw_params ath
|
||||
.dev_id = QCA988X_2_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.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
|
||||
.dev_id = QCA9887_1_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.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,
|
||||
@@ -342,6 +345,7 @@ static const struct ath10k_hw_params ath
|
||||
.dev_id = QCA99X0_2_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.name = "qca99x0 hw2.0",
|
||||
+ .led_pin = 17,
|
||||
.patch_load_addr = QCA99X0_HW_2_0_PATCH_LOAD_ADDR,
|
||||
.uart_pin = 7,
|
||||
.otp_exe_param = 0x00000700,
|
||||
@@ -382,6 +386,7 @@ static const struct ath10k_hw_params ath
|
||||
.dev_id = QCA9984_1_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.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,
|
||||
@@ -429,6 +434,7 @@ static const struct ath10k_hw_params ath
|
||||
.dev_id = QCA9888_2_0_DEVICE_ID,
|
||||
.bus = ATH10K_BUS_PCI,
|
||||
.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,
|
||||
@@ -3705,6 +3711,10 @@ int ath10k_core_start(struct ath10k *ar,
|
||||
ath10k_wmi_check_apply_board_power_ctl_table(ar);
|
||||
}
|
||||
|
||||
+ status = ath10k_leds_start(ar);
|
||||
+ if (status)
|
||||
+ goto err_hif_stop;
|
||||
+
|
||||
return 0;
|
||||
|
||||
err_hif_stop:
|
||||
@@ -3963,9 +3973,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:
|
||||
@@ -4025,6 +4044,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-5.10/core.h
|
||||
+++ b/ath10k-5.10/core.h
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <linux/pci.h>
|
||||
#include <linux/uuid.h>
|
||||
#include <linux/time.h>
|
||||
+#include <linux/leds.h>
|
||||
|
||||
#include "htt.h"
|
||||
#include "htc.h"
|
||||
@@ -1557,6 +1558,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 rx_crc_err_drop;
|
||||
u32 fw_crash_counter;
|
||||
--- a/ath10k-5.10/hw.h
|
||||
+++ b/ath10k-5.10/hw.h
|
||||
@@ -521,6 +521,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-5.10/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-5.10/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-5.10/mac.c
|
||||
+++ b/ath10k-5.10/mac.c
|
||||
@@ -25,6 +25,7 @@
|
||||
#include "wmi-tlv.h"
|
||||
#include "wmi-ops.h"
|
||||
#include "wow.h"
|
||||
+#include "leds.h"
|
||||
|
||||
/*********/
|
||||
/* Rates */
|
||||
--- a/ath10k-5.10/wmi-ops.h
|
||||
+++ b/ath10k-5.10/wmi-ops.h
|
||||
@@ -228,7 +228,10 @@ struct wmi_ops {
|
||||
const struct wmi_bb_timing_cfg_arg *arg);
|
||||
struct sk_buff *(*gen_per_peer_per_tid_cfg)(struct ath10k *ar,
|
||||
const struct wmi_per_peer_per_tid_cfg_arg *arg);
|
||||
+ 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);
|
||||
@@ -1147,6 +1150,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-5.10/wmi-tlv.c
|
||||
+++ b/ath10k-5.10/wmi-tlv.c
|
||||
@@ -4594,6 +4594,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-5.10/wmi.c
|
||||
+++ b/ath10k-5.10/wmi.c
|
||||
@@ -8409,6 +8409,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)
|
||||
@@ -10238,6 +10281,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 */
|
||||
@@ -10308,6 +10354,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 */
|
||||
@@ -10387,6 +10435,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 */
|
||||
};
|
||||
|
||||
@@ -10458,6 +10508,8 @@ static const struct wmi_ops wmi_10_2_4_o
|
||||
ath10k_wmi_op_gen_pdev_enable_adaptive_cca,
|
||||
.get_vdev_subtype = ath10k_wmi_10_2_4_op_get_vdev_subtype,
|
||||
.gen_bb_timing = ath10k_wmi_10_2_4_op_gen_bb_timing,
|
||||
+ .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 */
|
||||
@@ -10540,6 +10592,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-5.10/wmi.h
|
||||
+++ b/ath10k-5.10/wmi.h
|
||||
@@ -3133,6 +3133,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;
|
||||
@@ -0,0 +1,53 @@
|
||||
From 79c9d7aabae1d1da9eea97d83b61e1517a8a2221 Mon Sep 17 00:00:00 2001
|
||||
From: Mathias Kresin <dev@kresin.me>
|
||||
Date: Fri, 22 Jun 2018 18:59:44 +0200
|
||||
Subject: [PATCH] ath10k: use tpt LED trigger by default
|
||||
|
||||
Use the tpt LED trigger for each created phy led. Ths way LEDs attached
|
||||
to the ath10k GPIO pins are indicating the phy status and blink on
|
||||
traffic.
|
||||
|
||||
Signed-off-by: Mathias Kresin <dev@kresin.me>
|
||||
---
|
||||
ath10k-5.10/core.h | 4 ++++
|
||||
ath10k-5.10/leds.c | 4 +---
|
||||
ath10k-5.10/mac.c | 2 +-
|
||||
3 files changed, 6 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/ath10k-5.10/core.h
|
||||
+++ b/ath10k-5.10/core.h
|
||||
@@ -1665,6 +1665,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[] __aligned(sizeof(void *));
|
||||
};
|
||||
--- a/ath10k-5.10/leds.c
|
||||
+++ b/ath10k-5.10/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-5.10/mac.c
|
||||
+++ b/ath10k-5.10/mac.c
|
||||
@@ -11403,7 +11403,7 @@ int ath10k_mac_register(struct ath10k *a
|
||||
ar->hw->weight_multiplier = ATH10K_AIRTIME_WEIGHT_MULTIPLIER;
|
||||
|
||||
#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
|
||||
@@ -0,0 +1,42 @@
|
||||
From 22fb5991a44c78ff18ec0082dc90c809356eb893 Mon Sep 17 00:00:00 2001
|
||||
From: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
Date: Sun, 27 Sep 2020 19:23:35 +0200
|
||||
Subject: [PATCH 1/2] ath10k: Try to get mac-address from dts
|
||||
|
||||
Most of embedded device that have the ath10k wifi integrated store the
|
||||
mac-address in nvmem partitions. Try to fetch the mac-address using the
|
||||
standard 'of_get_mac_address' than in all the check also try to fetch the
|
||||
address using the nvmem api searching for a defined 'mac-address' cell.
|
||||
Mac-address defined in the dts have priority than any other address found.
|
||||
|
||||
Tested-on: QCA9984 hw1.0 PCI 10.4
|
||||
|
||||
Signed-off-by: Ansuel Smith <ansuelsmth@gmail.com>
|
||||
---
|
||||
ath10k-5.10/core.c | 10 ++++++++++
|
||||
1 file changed, 10 insertions(+)
|
||||
|
||||
diff --git a/ath10k-5.10/core.c b/ath10k-5.10/core.c
|
||||
index 5f4e12196..9ed7b9883 100644
|
||||
--- a/ath10k-5.10/core.c
|
||||
+++ b/ath10k-5.10/core.c
|
||||
@@ -8,6 +8,7 @@
|
||||
#include <linux/module.h>
|
||||
#include <linux/firmware.h>
|
||||
#include <linux/of.h>
|
||||
+#include <linux/of_net.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/dmi.h>
|
||||
#include <linux/ctype.h>
|
||||
@@ -3062,6 +3068,8 @@ static int ath10k_core_probe_fw(struct ath10k *ar)
|
||||
|
||||
device_get_mac_address(ar->dev, ar->mac_addr, sizeof(ar->mac_addr));
|
||||
|
||||
+ of_get_mac_address(ar->dev->of_node, ar->mac_addr);
|
||||
+
|
||||
ret = ath10k_core_init_firmware_features(ar);
|
||||
if (ret) {
|
||||
ath10k_err(ar, "fatal problem with firmware features: %d\n",
|
||||
--
|
||||
2.27.0
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
--- a/ath10k-5.10/htt.h
|
||||
+++ b/ath10k-5.10/htt.h
|
||||
@@ -237,7 +237,11 @@ enum htt_rx_ring_flags {
|
||||
};
|
||||
|
||||
#define HTT_RX_RING_SIZE_MIN 128
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
#define HTT_RX_RING_SIZE_MAX 2048
|
||||
+#else
|
||||
+#define HTT_RX_RING_SIZE_MAX 512
|
||||
+#endif
|
||||
#define HTT_RX_RING_SIZE HTT_RX_RING_SIZE_MAX
|
||||
#define HTT_RX_RING_FILL_LEVEL (((HTT_RX_RING_SIZE) / 2) - 1)
|
||||
#define HTT_RX_RING_FILL_LEVEL_DUAL_MAC (HTT_RX_RING_SIZE - 1)
|
||||
@@ -0,0 +1,50 @@
|
||||
--- a/ath10k-5.10/pci.c
|
||||
+++ b/ath10k-5.10/pci.c
|
||||
@@ -131,7 +131,11 @@ static const struct ce_attr pci_host_ce_
|
||||
.flags = CE_ATTR_FLAGS,
|
||||
.src_nentries = 0,
|
||||
.src_sz_max = 2048,
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
.dest_nentries = 512,
|
||||
+#else
|
||||
+ .dest_nentries = 128,
|
||||
+#endif
|
||||
.recv_cb = ath10k_pci_htt_htc_rx_cb,
|
||||
},
|
||||
|
||||
@@ -140,7 +144,11 @@ static const struct ce_attr pci_host_ce_
|
||||
.flags = CE_ATTR_FLAGS,
|
||||
.src_nentries = 0,
|
||||
.src_sz_max = 2048,
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
.dest_nentries = 128,
|
||||
+#else
|
||||
+ .dest_nentries = 64,
|
||||
+#endif
|
||||
.recv_cb = ath10k_pci_htc_rx_cb,
|
||||
},
|
||||
|
||||
@@ -167,7 +175,11 @@ static const struct ce_attr pci_host_ce_
|
||||
.flags = CE_ATTR_FLAGS,
|
||||
.src_nentries = 0,
|
||||
.src_sz_max = 512,
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
.dest_nentries = 512,
|
||||
+#else
|
||||
+ .dest_nentries = 128,
|
||||
+#endif
|
||||
.recv_cb = ath10k_pci_htt_rx_cb,
|
||||
},
|
||||
|
||||
@@ -192,7 +204,11 @@ static const struct ce_attr pci_host_ce_
|
||||
.flags = CE_ATTR_FLAGS,
|
||||
.src_nentries = 0,
|
||||
.src_sz_max = 2048,
|
||||
+#ifndef CONFIG_ATH10K_SMALLBUFFERS
|
||||
.dest_nentries = 128,
|
||||
+#else
|
||||
+ .dest_nentries = 96,
|
||||
+#endif
|
||||
.recv_cb = ath10k_pci_pktlog_rx_cb,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user