aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath5k/rfgain.h
diff options
context:
space:
mode:
authorNick Kossifidis <mick@madwifi-project.org>2009-02-08 23:03:41 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-02-13 13:44:43 -0500
commit6f3b414aca060a847e243f676b8601731938eb48 (patch)
tree51345c9930dbb9281d2f3dd0ebf0268870caa357 /drivers/net/wireless/ath5k/rfgain.h
parent33a31826b4fe9f26d6b383bad19b7ae522fda006 (diff)
ath5k: Update gain_F calibration code and add documentation
* Update and cleanup rf gain optimization code * Add comments and refferences to docs and use sane function names * Use only step index on ath5k_gain, no need to have a pointer to the current step since we can determine te step from it's index, this also allows us to put all other structs on rfgain.h and cleanup ath5k.h a little * No need for ah_rfgain variable, we use ah_gain.g_state for everything * Tested on RF2112B chip but gain_F calibration is not yet done (we will finish this on the next patch where we'll rewrite rf-buffer handling) * Use initial rf gain settings for 2316 and 2317 SoCs introduced on a previous patch It seems big but it's mostly cleanup, very few functional changes have been made on phy.c Signed-off-by: Nick Kossifidis <mickflemm@gmail.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath5k/rfgain.h')
-rw-r--r--drivers/net/wireless/ath5k/rfgain.h40
1 files changed, 38 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath5k/rfgain.h b/drivers/net/wireless/ath5k/rfgain.h
index 6dd2ea13ff41..1354d8c392c8 100644
--- a/drivers/net/wireless/ath5k/rfgain.h
+++ b/drivers/net/wireless/ath5k/rfgain.h
@@ -441,12 +441,38 @@ static const struct ath5k_ini_rfgain rfgain_2425[] = {
441 { AR5K_RF_GAIN(63), { 0x00000000, 0x000000f9 } }, 441 { AR5K_RF_GAIN(63), { 0x00000000, 0x000000f9 } },
442}; 442};
443 443
444#define AR5K_GAIN_CRN_FIX_BITS_5111 4
445#define AR5K_GAIN_CRN_FIX_BITS_5112 7
446#define AR5K_GAIN_CRN_MAX_FIX_BITS AR5K_GAIN_CRN_FIX_BITS_5112
447#define AR5K_GAIN_DYN_ADJUST_HI_MARGIN 15
448#define AR5K_GAIN_DYN_ADJUST_LO_MARGIN 20
449#define AR5K_GAIN_CCK_PROBE_CORR 5
450#define AR5K_GAIN_CCK_OFDM_GAIN_DELTA 15
451#define AR5K_GAIN_STEP_COUNT 10
452
453/* Check if our current measurement is inside our
454 * current variable attenuation window */
455#define AR5K_GAIN_CHECK_ADJUST(_g) \
456 ((_g)->g_current <= (_g)->g_low || (_g)->g_current >= (_g)->g_high)
457
458struct ath5k_gain_opt_step {
459 s8 gos_param[AR5K_GAIN_CRN_MAX_FIX_BITS];
460 s8 gos_gain;
461};
462
444struct ath5k_gain_opt { 463struct ath5k_gain_opt {
445 u32 go_default; 464 u8 go_default;
446 u32 go_steps_count; 465 u8 go_steps_count;
447 const struct ath5k_gain_opt_step go_step[AR5K_GAIN_STEP_COUNT]; 466 const struct ath5k_gain_opt_step go_step[AR5K_GAIN_STEP_COUNT];
448}; 467};
449 468
469/*
470 * Parameters on gos_param:
471 * 1) Tx clip PHY register
472 * 2) PWD 90 RF register
473 * 3) PWD 84 RF register
474 * 4) RFGainSel RF register
475 */
450static const struct ath5k_gain_opt rfgain_opt_5111 = { 476static const struct ath5k_gain_opt rfgain_opt_5111 = {
451 4, 477 4,
452 9, 478 9,
@@ -463,6 +489,16 @@ static const struct ath5k_gain_opt rfgain_opt_5111 = {
463 } 489 }
464}; 490};
465 491
492/*
493 * Parameters on gos_param:
494 * 1) Mixgain ovr RF register
495 * 2) PWD 138 RF register
496 * 3) PWD 137 RF register
497 * 4) PWD 136 RF register
498 * 5) PWD 132 RF register
499 * 6) PWD 131 RF register
500 * 7) PWD 130 RF register
501 */
466static const struct ath5k_gain_opt rfgain_opt_5112 = { 502static const struct ath5k_gain_opt rfgain_opt_5112 = {
467 1, 503 1,
468 8, 504 8,