linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/22] staging: vt6656: rf.c additional power.
@ 2014-05-17  8:50 Malcolm Priestley
  2014-05-17  8:50 ` [PATCH 02/22] staging: vt6656: usbpipe: get rid of in/out debug messages Malcolm Priestley
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: Malcolm Priestley @ 2014-05-17  8:50 UTC (permalink / raw)
  To: gregkh; +Cc: linux-wireless, Malcolm Priestley

Provides extra power on weak RSSI.

The values orginate from the vendors driver.

It is applied later in RFbRawSetPower to simplify and check that it doesn't
exceed the max power.

Vendor driver VT6656_Linux_src_v1.21.03_x86_11.04.zip
http://www.viaembedded.com/servlet/downloadSvl?id=1890&download_file_id=14704
This is GPL-licensed code.

vendors code
...
if (pDevice->byRFType == RF_VT3226D0) {
	if (lRSSI == 0){
		lAdditionalPower = 7;
	}
	else if ((lRSSI < -60) && (lRSSI >= -65)){
		lAdditionalPower = 5;
		//lAdditionalPower = 9;
	}
	else if ((lRSSI < -65) && (lRSSI >= -70)){
		lAdditionalPower = 7;
		//lAdditionalPower = 9;
	}
	else if ((lRSSI < -70) && (lRSSI >= -80)){
		lAdditionalPower = 9;
		}
	else if (lRSSI < -80) {
		lAdditionalPower = 9;
	}
}
else {
	if (lRSSI == 0){
		lAdditionalPower = 7;
	}
	else if ((lRSSI < -70) && (lRSSI >= -75)){
		lAdditionalPower = 5;
	}
	else if ((lRSSI < -75) && (lRSSI >= -80)){
			lAdditionalPower = 7;
		}
		else if (lRSSI < -80) {
			lAdditionalPower = 9;
		}
	}

...

Signed-off-by: Malcolm Priestley <tvboxspy@gmail.com>
---
 drivers/staging/vt6656/rf.c | 30 ++++++++++++++++++++++++++++++
 drivers/staging/vt6656/rf.h |  2 ++
 2 files changed, 32 insertions(+)

diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 1e8f64b..64632e9 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -769,6 +769,32 @@ int RFbSetPower(struct vnt_private *priv, u32 rate, u32 channel)
 	return ret;
 }
 
+static u8 vnt_rf_addpower(struct vnt_private *priv)
+{
+	s32 rssi = -priv->uCurrRSSI;
+
+	if (!rssi)
+		return 7;
+
+	if (priv->byRFType == RF_VT3226D0) {
+		if (rssi < -70)
+			return 9;
+		else if (rssi < -65)
+			return 7;
+		else if (rssi < -60)
+			return 5;
+	} else {
+		if (rssi < -80)
+			return 9;
+		else if (rssi < -75)
+			return 7;
+		else if (rssi < -70)
+			return 5;
+	}
+
+	return 0;
+}
+
 /*
  * Description: Set Tx power
  *
@@ -788,6 +814,10 @@ int RFbRawSetPower(struct vnt_private *priv, u8 power, u32 rate)
 	u32 power_setting = 0;
 	int ret = true;
 
+	power += vnt_rf_addpower(priv);
+	if (power > VNT_RF_MAX_POWER)
+		power = VNT_RF_MAX_POWER;
+
 	if (priv->byCurPwr == power)
 		return true;
 
diff --git a/drivers/staging/vt6656/rf.h b/drivers/staging/vt6656/rf.h
index de5c613..e9a01fe 100644
--- a/drivers/staging/vt6656/rf.h
+++ b/drivers/staging/vt6656/rf.h
@@ -53,6 +53,8 @@
 #define RF_EMU              0x80
 #define RF_MASK             0x7F
 
+#define VNT_RF_MAX_POWER    0x3f
+
 extern const u8 RFaby11aChannelIndex[200];
 
 int IFRFbWriteEmbedded(struct vnt_private *, u32 dwData);
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2014-05-17  8:53 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-17  8:50 [PATCH 01/22] staging: vt6656: rf.c additional power Malcolm Priestley
2014-05-17  8:50 ` [PATCH 02/22] staging: vt6656: usbpipe: get rid of in/out debug messages Malcolm Priestley
2014-05-17  8:50 ` [PATCH 03/22] staging: vt6656: usbpipe: replace debug messsages Malcolm Priestley
2014-05-17  8:50 ` [PATCH 04/22] staging: vt6656: PIPEnsControlOut remove camel case Malcolm Priestley
2014-05-17  8:50 ` [PATCH 05/22] staging: vt6656: PIPEnsControlIn " Malcolm Priestley
2014-05-17  8:50 ` [PATCH 06/22] staging: vt6656: device_cfg.h remove dead code Malcolm Priestley
2014-05-17  8:50 ` [PATCH 07/22] staging: vt6656: device_cfg.h Move macros to device.h Malcolm Priestley
2014-05-17  8:50 ` [PATCH 08/22] staging: vt6656: device.h remove dead macros Malcolm Priestley
2014-05-17  8:50 ` [PATCH 09/22] staging: vt6656: desc.h Remove unused macros Malcolm Priestley
2014-05-17  8:50 ` [PATCH 10/22] staging: vt6656: srom.h : Remove dead code Malcolm Priestley
2014-05-17  8:50 ` [PATCH 11/22] staging: vt6656: srom.h move all macros to device.h Malcolm Priestley
2014-05-17  8:50 ` [PATCH 12/22] staging: vt6656: rndis.h remove dead code Malcolm Priestley
2014-05-17  8:50 ` [PATCH 13/22] staging: vt6656: rndis.h move all to device.h Malcolm Priestley
2014-05-17  8:50 ` [PATCH 14/22] staging: vt6656: Remove unused variable byRevId Malcolm Priestley
2014-05-17  8:50 ` [PATCH 15/22] staging: vt6656: Remove unused variable ulTxPower Malcolm Priestley
2014-05-17  8:50 ` [PATCH 16/22] staging: vt6656: Remove dead variable bCCK Malcolm Priestley
2014-05-17  8:50 ` [PATCH 17/22] staging: vt6656: Remove unused variable uScanTime Malcolm Priestley
2014-05-17  8:50 ` [PATCH 18/22] staging: vt6656: Remove unused variable byACKRate Malcolm Priestley
2014-05-17  8:50 ` [PATCH 19/22] staging: vt6656: vnt_private remove dead variables Malcolm Priestley
2014-05-17  8:50 ` [PATCH 20/22] " Malcolm Priestley
2014-05-17  8:50 ` [PATCH 21/22] " Malcolm Priestley
2014-05-17  8:50 ` [PATCH 22/22] staging: vt6656: Remove always true bUpdateBBVGA Malcolm Priestley

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).