[openwrt/openwrt] mac80211: ath9k: remove gpio buttons support

LEDE Commits lede-commits at lists.infradead.org
Wed Apr 9 03:43:37 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/d70f8dea1ec5d5de34cf294d42520747247de387

commit d70f8dea1ec5d5de34cf294d42520747247de387
Author: Rosen Penev <rosenp at gmail.com>
AuthorDate: Tue Dec 31 14:37:45 2024 -0800

    mac80211: ath9k: remove gpio buttons support
    
    This is only used by mach files, which are no longer used in OpenWrt.
    
    Allows removing a custon ath9k_platform.h file.
    
    Signed-off-by: Rosen Penev <rosenp at gmail.com>
    Link: https://github.com/openwrt/openwrt/pull/17445
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 .../ath9k/549-ath9k_enable_gpio_buttons.patch      | 131 ---------------------
 .../generic/files/include/linux/ath9k_platform.h   |  55 ---------
 2 files changed, 186 deletions(-)

diff --git a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch b/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch
deleted file mode 100644
index 5a8c057b31..0000000000
--- a/package/kernel/mac80211/patches/ath9k/549-ath9k_enable_gpio_buttons.patch
+++ /dev/null
@@ -1,131 +0,0 @@
-From: Michal Cieslakiewicz <michal.cieslakiewicz at wp.pl>
-Subject: [PATCH v5 5/8] mac80211: ath9k: enable GPIO buttons
-
-Enable platform-defined GPIO button support for ath9k device.
-Key poller is activated for attached platform buttons.
-Requires ath9k GPIO chip access.
-
-Signed-off-by: Michal Cieslakiewicz <michal.cieslakiewicz at wp.pl>
-Signed-off-by: Felix Fietkau <nbd at nbd.name>
----
---- a/drivers/net/wireless/ath/ath9k/ath9k.h
-+++ b/drivers/net/wireless/ath/ath9k/ath9k.h
-@@ -1051,6 +1051,7 @@ struct ath_softc {
- #ifdef CONFIG_GPIOLIB
- 	struct gpio_chip *gpiochip;
- 	struct gpio_desc *gpiodesc;
-+	struct platform_device *btnpdev;	/* gpio-keys-polled */
- #endif
- #endif
- 
---- a/drivers/net/wireless/ath/ath9k/gpio.c
-+++ b/drivers/net/wireless/ath/ath9k/gpio.c
-@@ -15,6 +15,9 @@
-  */
- 
- #include "ath9k.h"
-+#include <linux/ath9k_platform.h>
-+#include <linux/platform_device.h>
-+#include <linux/gpio_keys.h>
- 
- #ifdef CPTCFG_MAC80211_LEDS
- 
-@@ -114,6 +117,67 @@ static void ath9k_unregister_gpio_chip(s
- 	kfree(gc);
- }
- 
-+/******************/
-+/*  GPIO Buttons  */
-+/******************/
-+
-+/* add GPIO buttons */
-+static void ath9k_init_buttons(struct ath_softc *sc)
-+{
-+	struct ath9k_platform_data *pdata = sc->dev->platform_data;
-+	struct platform_device *pdev;
-+	struct gpio_keys_platform_data gkpdata;
-+	struct gpio_keys_button *bt;
-+	int i;
-+
-+	if (!sc->gpiochip)
-+		return;
-+
-+	if (!pdata || !pdata->btns || !pdata->num_btns)
-+		return;
-+
-+	bt = devm_kmemdup(sc->dev, pdata->btns,
-+			  pdata->num_btns * sizeof(struct gpio_keys_button),
-+			  GFP_KERNEL);
-+	if (!bt)
-+		return;
-+
-+	for (i = 0; i < pdata->num_btns; i++) {
-+		if (pdata->btns[i].gpio == sc->sc_ah->led_pin)
-+				sc->sc_ah->led_pin = -1;
-+
-+		ath9k_hw_gpio_request_in(sc->sc_ah, pdata->btns[i].gpio,
-+					 "ath9k-gpio");
-+		bt[i].gpio = sc->gpiochip->base + pdata->btns[i].gpio;
-+	}
-+
-+	memset(&gkpdata, 0, sizeof(struct gpio_keys_platform_data));
-+	gkpdata.buttons = bt;
-+	gkpdata.nbuttons = pdata->num_btns;
-+	gkpdata.poll_interval = pdata->btn_poll_interval;
-+
-+	pdev = platform_device_register_data(sc->dev, "gpio-keys-polled",
-+					     PLATFORM_DEVID_AUTO, &gkpdata,
-+					     sizeof(gkpdata));
-+	if (!IS_ERR_OR_NULL(pdev))
-+		sc->btnpdev = pdev;
-+	else {
-+		sc->btnpdev = NULL;
-+		devm_kfree(sc->dev, bt);
-+	}
-+}
-+
-+/* remove GPIO buttons */
-+static void ath9k_deinit_buttons(struct ath_softc *sc)
-+{
-+	if (!sc->gpiochip || !sc->btnpdev)
-+		return;
-+
-+	platform_device_unregister(sc->btnpdev);
-+
-+	sc->btnpdev = NULL;
-+}
-+
- #else /* CONFIG_GPIOLIB */
- 
- static inline void ath9k_register_gpio_chip(struct ath_softc *sc)
-@@ -124,6 +188,14 @@ static inline void ath9k_unregister_gpio
- {
- }
- 
-+static inline void ath9k_init_buttons(struct ath_softc *sc)
-+{
-+}
-+
-+static inline void ath9k_deinit_buttons(struct ath_softc *sc)
-+{
-+}
-+
- #endif /* CONFIG_GPIOLIB */
- 
- /********************************/
-@@ -229,6 +301,7 @@ void ath_deinit_leds(struct ath_softc *s
- {
- 	struct ath_led *led;
- 
-+	ath9k_deinit_buttons(sc);
- 	while (!list_empty(&sc->leds)) {
- 		led = list_first_entry(&sc->leds, struct ath_led, list);
- #ifdef CONFIG_GPIOLIB
-@@ -266,6 +339,7 @@ void ath_init_leds(struct ath_softc *sc)
- 	}
- 
- 	ath_fill_led_pin(sc);
-+	ath9k_init_buttons(sc);
- 
- 	snprintf(led_name, sizeof(led_name), "ath9k-%s",
- 		 wiphy_name(sc->hw->wiphy));
diff --git a/target/linux/generic/files/include/linux/ath9k_platform.h b/target/linux/generic/files/include/linux/ath9k_platform.h
deleted file mode 100644
index c4389b7e6c..0000000000
--- a/target/linux/generic/files/include/linux/ath9k_platform.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2008 Atheros Communications Inc.
- * Copyright (c) 2009 Gabor Juhos <juhosg at openwrt.org>
- * Copyright (c) 2009 Imre Kaloz <kaloz at openwrt.org>
- *
- * 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 _LINUX_ATH9K_PLATFORM_H
-#define _LINUX_ATH9K_PLATFORM_H
-
-#define ATH9K_PLAT_EEP_MAX_WORDS	2048
-
-struct ath9k_platform_data {
-	const char *eeprom_name;
-
-	u16 eeprom_data[ATH9K_PLAT_EEP_MAX_WORDS];
-	u8 *macaddr;
-
-	int led_pin;
-	u32 gpio_mask;
-	u32 gpio_val;
-
-	u32 bt_active_pin;
-	u32 bt_priority_pin;
-	u32 wlan_active_pin;
-
-	bool endian_check;
-	bool is_clk_25mhz;
-	bool tx_gain_buffalo;
-	bool disable_2ghz;
-	bool disable_5ghz;
-	bool led_active_high;
-
-	int (*get_mac_revision)(void);
-	int (*external_reset)(void);
-
-	bool use_eeprom;
-
-	unsigned num_btns;
-	const struct gpio_keys_button *btns;
-	unsigned btn_poll_interval;
-};
-
-#endif /* _LINUX_ATH9K_PLATFORM_H */




More information about the lede-commits mailing list