All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gabor Juhos <juhosg@openwrt.org>
To: John Linville <linville@tuxdriver.com>
Cc: linux-wireless@vger.kernel.org, users@rt2x00.serialmonkey.com,
	Gabor Juhos <juhosg@openwrt.org>
Subject: [PATCH v2 13/20] rt2x00: rt2800lib: add default_power3 field for three-chain devices
Date: Mon,  1 Jul 2013 09:47:52 +0200	[thread overview]
Message-ID: <1372664879-18474-14-git-send-email-juhosg@openwrt.org> (raw)
In-Reply-To: <1372664879-18474-1-git-send-email-juhosg@openwrt.org>

The actual code uses two default TX power values.
This is enough for 1T and for 2T devices however
on 3T devices another value is needed for the third
chain.

Add a new field to struct channel_info and initialize
it from the 'rt2800_probe_hw_mode' function. Also modify
the 'rt2800_config_channel' to handle the new field as
well.

Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
---
 drivers/net/wireless/rt2x00/rt2800lib.c |   22 ++++++++++++++++++++++
 drivers/net/wireless/rt2x00/rt2x00.h    |    1 +
 2 files changed, 23 insertions(+)

diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index f079d70..bc21a57 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2769,6 +2769,10 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
 						     info->default_power1);
 	info->default_power2 = rt2800_txpower_to_dev(rt2x00dev, rf->channel,
 						     info->default_power2);
+	if (rt2x00dev->default_ant.tx_chain_num > 2)
+		info->default_power3 =
+			rt2800_txpower_to_dev(rt2x00dev, rf->channel,
+					      info->default_power3);
 
 	switch (rt2x00dev->chip.rf) {
 	case RF2020:
@@ -6964,6 +6968,7 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	struct channel_info *info;
 	char *default_power1;
 	char *default_power2;
+	char *default_power3;
 	unsigned int i;
 	u16 eeprom;
 	u32 reg;
@@ -7116,9 +7121,17 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 	default_power1 = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG1);
 	default_power2 = rt2800_eeprom_addr(rt2x00dev, EEPROM_TXPOWER_BG2);
 
+	if (rt2x00dev->default_ant.tx_chain_num > 2)
+		default_power3 = rt2800_eeprom_addr(rt2x00dev,
+						    EEPROM_EXT_TXPOWER_BG3);
+	else
+		default_power3 = NULL;
+
 	for (i = 0; i < 14; i++) {
 		info[i].default_power1 = default_power1[i];
 		info[i].default_power2 = default_power2[i];
+		if (default_power3)
+			info[i].default_power3 = default_power3[i];
 	}
 
 	if (spec->num_channels > 14) {
@@ -7127,9 +7140,18 @@ static int rt2800_probe_hw_mode(struct rt2x00_dev *rt2x00dev)
 		default_power2 = rt2800_eeprom_addr(rt2x00dev,
 						    EEPROM_TXPOWER_A2);
 
+		if (rt2x00dev->default_ant.tx_chain_num > 2)
+			default_power3 =
+				rt2800_eeprom_addr(rt2x00dev,
+						   EEPROM_EXT_TXPOWER_A3);
+		else
+			default_power3 = NULL;
+
 		for (i = 14; i < spec->num_channels; i++) {
 			info[i].default_power1 = default_power1[i - 14];
 			info[i].default_power2 = default_power2[i - 14];
+			if (default_power3)
+				info[i].default_power3 = default_power3[i - 14];
 		}
 	}
 
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index ee3fc57..fe4c572 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -211,6 +211,7 @@ struct channel_info {
 	short max_power;
 	short default_power1;
 	short default_power2;
+	short default_power3;
 };
 
 /*
-- 
1.7.10


  parent reply	other threads:[~2013-07-01  7:48 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-01  7:47 [PATCH v2 00/20] rt2x00: add experimental support for RT3593 Gabor Juhos
2013-07-01  7:47 ` [PATCH v2 01/20] rt2x00: rt2800lib: add MAC register initialization " Gabor Juhos
2013-07-07 14:07   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 02/20] rt2x00: rt2800lib: add BBP " Gabor Juhos
2013-07-07 14:07   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 03/20] rt2x00: rt2800lib: add RFCSR " Gabor Juhos
2013-07-07 14:10   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-08 14:10     ` Gabor Juhos
2013-07-01  7:47 ` [PATCH v2 04/20] rt2x00: rt2800lib: add BBP post " Gabor Juhos
2013-07-07 14:10   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 05/20] rt2x00: rt2800lib: add TX power configuration " Gabor Juhos
2013-07-07 14:14   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 06/20] rt2x00: rt2800lib: fix BBP1_TX_ANTENNA field configuration for 3T devices Gabor Juhos
2013-07-07 14:16   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 07/20] rt2x00: rt2800lib: fix antenna configuration for RT3593 Gabor Juhos
2013-07-07 14:16   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 08/20] rt2x00: rt2800lib: add rt2800_txpower_to_dev helper Gabor Juhos
2013-07-07 14:18   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 09/20] rt2x00: rt2800lib: fix default TX power values for RT3593 Gabor Juhos
2013-07-07 14:20   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 10/20] rt2x00: rt2800lib: introduce rt2800_get_txmixer_gain_{24,5}g helpers Gabor Juhos
2013-07-07 14:15   ` [rt2x00-users] [PATCH v2 10/20] rt2x00: rt2800lib: introduce rt2800_get_txmixer_gain_{24, 5}g helpers Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 11/20] rt2x00: rt2800lib: hardcode TX mixer gain values for RT3593 Gabor Juhos
2013-07-07 14:15   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 12/20] rt2x00: rt2x00lib: fix LNA_A[12] " Gabor Juhos
2013-07-07 14:23   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` Gabor Juhos [this message]
2013-07-07 14:23   ` [rt2x00-users] [PATCH v2 13/20] rt2x00: rt2800lib: add default_power3 field for three-chain devices Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 14/20] rt2x00: rt2800lib: add rf_vals for RF3053 Gabor Juhos
2013-07-07 14:26   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 15/20] rt2x00: rt2800lib: add channel configuration " Gabor Juhos
2013-07-07 14:39   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 16/20] rt2x00: rt2800lib: enable VCO recalibration " Gabor Juhos
2013-07-07 14:40   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-08 14:10     ` Gabor Juhos
2013-07-01  7:47 ` [PATCH v2 17/20] rt2x00: rt2800lib: enable RF3053 support Gabor Juhos
2013-07-07 14:40   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 18/20] rt2x00: rt2800lib: enable RT3593 support Gabor Juhos
2013-07-07 14:40   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 19/20] rt2x00: rt2800usb: use correct [RT]XWI size for RT3593 Gabor Juhos
2013-07-07 14:41   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-01  7:47 ` [PATCH v2 20/20] rt2x00: rt2800usb: add USB device ID for Linksys AE3000 Gabor Juhos
2013-07-07 14:41   ` [rt2x00-users] " Stanislaw Gruszka
2013-07-07 14:42 ` [rt2x00-users] [PATCH v2 00/20] rt2x00: add experimental support for RT3593 Stanislaw Gruszka
2013-07-08 14:08   ` Gabor Juhos

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=1372664879-18474-14-git-send-email-juhosg@openwrt.org \
    --to=juhosg@openwrt.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=users@rt2x00.serialmonkey.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.