Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 224573
b: refs/heads/master
c: bc20680
h: refs/heads/master
i:
  224571: 383cd45
v: v3
  • Loading branch information
Vasanthakumar Thiagarajan authored and John W. Linville committed Nov 16, 2010
1 parent 4794a47 commit dc95aaa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 15cbbc44cc4abaaebc37caf0ec9410a3f83d1deb
refs/heads/master: bc2068020bfa976efd425f3be590f58a012fd747
48 changes: 28 additions & 20 deletions trunk/drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
Original file line number Diff line number Diff line change
Expand Up @@ -2982,6 +2982,16 @@ static int ath9k_hw_ar9300_check_eeprom(struct ath_hw *ah)
return 0;
}

static int interpolate(int x, int xa, int xb, int ya, int yb)
{
int bf, factor, plus;

bf = 2 * (yb - ya) * (x - xa) / (xb - xa);
factor = bf / 2;
plus = bf % 2;
return ya + factor + plus;
}

static u32 ath9k_hw_ar9300_get_eeprom(struct ath_hw *ah,
enum eeprom_param param)
{
Expand Down Expand Up @@ -3614,7 +3624,7 @@ static int ar9003_hw_power_interpolate(int32_t x,
if (hx == lx)
y = ly;
else /* interpolate */
y = ly + (((x - lx) * (hy - ly)) / (hx - lx));
y = interpolate(x, lx, hx, ly, hy);
} else /* only low is good, use it */
y = ly;
} else if (hhave) /* only high is good, use it */
Expand Down Expand Up @@ -4204,25 +4214,23 @@ static int ar9003_hw_calibration_apply(struct ath_hw *ah, int frequency)
/* so is the high frequency, interpolate */
if (hfrequency[ichain] - frequency < 1000) {

correction[ichain] = lcorrection[ichain] +
(((frequency - lfrequency[ichain]) *
(hcorrection[ichain] -
lcorrection[ichain])) /
(hfrequency[ichain] - lfrequency[ichain]));

temperature[ichain] = ltemperature[ichain] +
(((frequency - lfrequency[ichain]) *
(htemperature[ichain] -
ltemperature[ichain])) /
(hfrequency[ichain] - lfrequency[ichain]));

voltage[ichain] =
lvoltage[ichain] +
(((frequency -
lfrequency[ichain]) * (hvoltage[ichain] -
lvoltage[ichain]))
/ (hfrequency[ichain] -
lfrequency[ichain]));
correction[ichain] = interpolate(frequency,
lfrequency[ichain],
hfrequency[ichain],
lcorrection[ichain],
hcorrection[ichain]);

temperature[ichain] = interpolate(frequency,
lfrequency[ichain],
hfrequency[ichain],
ltemperature[ichain],
htemperature[ichain]);

voltage[ichain] = interpolate(frequency,
lfrequency[ichain],
hfrequency[ichain],
lvoltage[ichain],
hvoltage[ichain]);
}
/* only low is good, use it */
else {
Expand Down

0 comments on commit dc95aaa

Please sign in to comment.