Commit 6c76aab5 authored by Axel Rasmussen's avatar Axel Rasmussen Committed by Greg Kroah-Hartman

drivers: staging: rtl8187se: refactor/clean signal smoothing

Signed-off-by: default avatarAxel Rasmussen <axel.rasmussen1@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent d11ca55d
...@@ -586,7 +586,7 @@ typedef struct r8180_priv { ...@@ -586,7 +586,7 @@ typedef struct r8180_priv {
/* High Power Mechanism. Added by amy, 080312. */ /* High Power Mechanism. Added by amy, 080312. */
bool bToUpdateTxPwr; bool bToUpdateTxPwr;
long UndecoratedSmoothedSS; long UndecoratedSmoothedSS;
long UndercorateSmoothedRxPower; long UndecoratedSmoothedRxPower;
u8 RSSI; u8 RSSI;
char RxPower; char RxPower;
u8 InitialGain; u8 InitialGain;
......
...@@ -1143,23 +1143,30 @@ static long TranslateToDbm8185(u8 SignalStrengthIndex) ...@@ -1143,23 +1143,30 @@ static long TranslateToDbm8185(u8 SignalStrengthIndex)
/* /*
* Perform signal smoothing for dynamic mechanism. * Perform signal smoothing for dynamic mechanism.
* This is different with PerformSignalSmoothing8185 in smoothing formula. * This is different with PerformSignalSmoothing8185 in smoothing formula.
* No dramatic adjustion is apply because dynamic mechanism need some degree * No dramatic adjustment is applied because dynamic mechanism need some
* of correctness. Ported from 8187B. * degree of correctness. Ported from 8187B.
*/ */
static void PerformUndecoratedSignalSmoothing8185(struct r8180_priv *priv, static void PerformUndecoratedSignalSmoothing8185(struct r8180_priv *priv,
bool bCckRate) bool bCckRate)
{ {
/* Determin the current packet is CCK rate. */ long smoothedSS;
long smoothedRx;
/* Determine the current packet is CCK rate. */
priv->bCurCCKPkt = bCckRate; priv->bCurCCKPkt = bCckRate;
smoothedSS = priv->SignalStrength * 10;
if (priv->UndecoratedSmoothedSS >= 0) if (priv->UndecoratedSmoothedSS >= 0)
priv->UndecoratedSmoothedSS = ((priv->UndecoratedSmoothedSS * 5) + smoothedSS = ((priv->UndecoratedSmoothedSS * 5) +
(priv->SignalStrength * 10)) / 6; smoothedSS) / 6;
else
priv->UndecoratedSmoothedSS = priv->SignalStrength * 10; priv->UndecoratedSmoothedSS = smoothedSS;
smoothedRx = ((priv->UndecoratedSmoothedRxPower * 50) +
(priv->RxPower * 11)) / 60;
priv->UndercorateSmoothedRxPower = ((priv->UndercorateSmoothedRxPower * 50) + priv->UndecoratedSmoothedRxPower = smoothedRx;
(priv->RxPower * 11)) / 60;
if (bCckRate) if (bCckRate)
priv->CurCCKRSSI = priv->RSSI; priv->CurCCKRSSI = priv->RSSI;
...@@ -1399,8 +1406,8 @@ static void rtl8180_rx(struct net_device *dev) ...@@ -1399,8 +1406,8 @@ static void rtl8180_rx(struct net_device *dev)
/* For good-looking singal strength. */ /* For good-looking singal strength. */
SignalStrengthIndex = NetgearSignalStrengthTranslate( SignalStrengthIndex = NetgearSignalStrengthTranslate(
priv->LastSignalStrengthInPercent, priv->LastSignalStrengthInPercent,
priv->SignalStrength); priv->SignalStrength);
priv->LastSignalStrengthInPercent = SignalStrengthIndex; priv->LastSignalStrengthInPercent = SignalStrengthIndex;
priv->Stats_SignalStrength = TranslateToDbm8185((u8)SignalStrengthIndex); priv->Stats_SignalStrength = TranslateToDbm8185((u8)SignalStrengthIndex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment