linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wenli Looi <wlooi@ucalgary.ca>
To: "Toke Høiland-Jørgensen" <toke@toke.dk>
Cc: Kalle Valo <kvalo@kernel.org>,
	linux-wireless@vger.kernel.org, ath9k-devel@qca.qualcomm.com,
	Wenli Looi <wlooi@ucalgary.ca>
Subject: [PATCH 6/9] ath9k: group some ar9300 eeprom functions at the top
Date: Mon, 18 Apr 2022 00:13:10 -0700	[thread overview]
Message-ID: <20220418071313.882179-7-wlooi@ucalgary.ca> (raw)
In-Reply-To: <20220418071313.882179-1-wlooi@ucalgary.ca>

These functions will be part of an abstraction layer that works with
both old and new AR9300 eeprom formats.

Signed-off-by: Wenli Looi <wlooi@ucalgary.ca>
---
 .../net/wireless/ath/ath9k/ar9003_eeprom.c    | 90 +++++++++----------
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
index 49be3a315..6257d74c6 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
@@ -2970,6 +2970,51 @@ static int interpolate(int x, int xa, int xb, int ya, int yb)
 	return ya + factor + plus;
 }
 
+/* XXX: review hardware docs */
+static int ath9k_hw_ar9300_get_eeprom_ver(struct ath_hw *ah)
+{
+	return ah->eeprom.ar9300_eep.eepromVersion;
+}
+
+/* XXX: could be read from the eepromVersion, not sure yet */
+static int ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw *ah)
+{
+	return 0;
+}
+
+static struct ar9300_modal_eep_header *ar9003_modal_header(struct ath_hw *ah,
+							   bool is2ghz)
+{
+	struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
+
+	if (is2ghz)
+		return &eep->modalHeader2G;
+	else
+		return &eep->modalHeader5G;
+}
+
+static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah, int chain,
+					bool is2ghz)
+{
+	__le16 val = ar9003_modal_header(ah, is2ghz)->antCtrlChain[chain];
+	return le16_to_cpu(val);
+}
+
+u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz)
+{
+	return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon);
+}
+
+u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz)
+{
+	return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon2);
+}
+
+static u16 ar9003_switch_com_spdt_get(struct ath_hw *ah, bool is2ghz)
+{
+	return le16_to_cpu(ar9003_modal_header(ah, is2ghz)->switchcomspdt);
+}
+
 static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
 				      enum eeprom_param param)
 {
@@ -3578,29 +3623,6 @@ static u32 ath9k_hw_ar9003_dump_eeprom(struct ath_hw *ah, bool dump_base_hdr,
 }
 #endif
 
-/* XXX: review hardware docs */
-static int ath9k_hw_ar9300_get_eeprom_ver(struct ath_hw *ah)
-{
-	return ah->eeprom.ar9300_eep.eepromVersion;
-}
-
-/* XXX: could be read from the eepromVersion, not sure yet */
-static int ath9k_hw_ar9300_get_eeprom_rev(struct ath_hw *ah)
-{
-	return 0;
-}
-
-static struct ar9300_modal_eep_header *ar9003_modal_header(struct ath_hw *ah,
-							   bool is2ghz)
-{
-	struct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;
-
-	if (is2ghz)
-		return &eep->modalHeader2G;
-	else
-		return &eep->modalHeader5G;
-}
-
 static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
 {
 	int bias = ar9003_modal_header(ah, is2ghz)->xpaBiasLvl;
@@ -3622,28 +3644,6 @@ static void ar9003_hw_xpa_bias_level_apply(struct ath_hw *ah, bool is2ghz)
 	}
 }
 
-static u16 ar9003_switch_com_spdt_get(struct ath_hw *ah, bool is2ghz)
-{
-	return le16_to_cpu(ar9003_modal_header(ah, is2ghz)->switchcomspdt);
-}
-
-u32 ar9003_hw_ant_ctrl_common_get(struct ath_hw *ah, bool is2ghz)
-{
-	return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon);
-}
-
-u32 ar9003_hw_ant_ctrl_common_2_get(struct ath_hw *ah, bool is2ghz)
-{
-	return le32_to_cpu(ar9003_modal_header(ah, is2ghz)->antCtrlCommon2);
-}
-
-static u16 ar9003_hw_ant_ctrl_chain_get(struct ath_hw *ah, int chain,
-					bool is2ghz)
-{
-	__le16 val = ar9003_modal_header(ah, is2ghz)->antCtrlChain[chain];
-	return le16_to_cpu(val);
-}
-
 static void ar9003_hw_ant_ctrl_apply(struct ath_hw *ah, bool is2ghz)
 {
 	struct ath_common *common = ath9k_hw_common(ah);
-- 
2.25.1


  parent reply	other threads:[~2022-04-18  7:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-18  7:13 [PATCH 0/9] ath9k: add support for QCN550x Wenli Looi
2022-04-18  7:13 ` [PATCH 1/9] ath9k: add QCN550x device IDs Wenli Looi
2022-04-20 12:00   ` Kalle Valo
2022-04-18  7:13 ` [PATCH 2/9] ath9k: basic support for QCN550x Wenli Looi
2022-04-20 12:01   ` Kalle Valo
2022-04-18  7:13 ` [PATCH 3/9] ath9k: add QCN550x initvals Wenli Looi
2022-04-18  7:13 ` [PATCH 4/9] ath9k: implement QCN550x rx Wenli Looi
2022-04-18  7:13 ` [PATCH 5/9] ath9k: implement QCN550x tx Wenli Looi
2022-04-18  7:13 ` Wenli Looi [this message]
2022-04-18  7:13 ` [PATCH 7/9] ath9k: add abstractions over ar9300 eeprom Wenli Looi
2022-04-18  7:13 ` [PATCH 8/9] ath9k: rename ar9300_eeprom to ar9300_eeprom_v1 Wenli Looi
2022-04-18  7:13 ` [PATCH 9/9] ath9k: add ar9300_eeprom_v2 Wenli Looi
2022-05-10 18:39 ` [PATCH 0/9] ath9k: add support for QCN550x Wenli Looi
2022-05-11  4:39   ` Kalle Valo
2022-05-11  9:54     ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220418071313.882179-7-wlooi@ucalgary.ca \
    --to=wlooi@ucalgary.ca \
    --cc=ath9k-devel@qca.qualcomm.com \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=toke@toke.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).