Lines Matching +full:static +full:- +full:beta
2 * Copyright (c) 2010-2011 Atheros Communications Inc.
23 struct ath9k_channel *chan = ah->curchan; in ar9003_paprd_enable()
28 * is used for sub-band disabling of PAPRD. in ar9003_paprd_enable()
29 * 5G band is divided into 3 sub-bands -- upper, in ar9003_paprd_enable()
32 * -- disable PAPRD for upper band 5GHz in ar9003_paprd_enable()
34 * -- disable PAPRD for middle band 5GHz in ar9003_paprd_enable()
36 * -- disable PAPRD for lower band 5GHz in ar9003_paprd_enable()
40 if (chan->channel >= UPPER_5G_SUB_BAND_START) { in ar9003_paprd_enable()
44 } else if (chan->channel >= MID_5G_SUB_BAND_START) { in ar9003_paprd_enable()
56 ah->paprd_table_write_done = true; in ar9003_paprd_enable()
62 if (ah->caps.tx_chainmask & BIT(1)) in ar9003_paprd_enable()
65 if (ah->caps.tx_chainmask & BIT(2)) in ar9003_paprd_enable()
71 static int ar9003_get_training_power_2g(struct ath_hw *ah) in ar9003_get_training_power_2g()
73 struct ath9k_channel *chan = ah->curchan; in ar9003_get_training_power_2g()
80 power = ah->paprd_target_power + 2; in ar9003_get_training_power_2g()
87 delta = abs((int) ah->paprd_target_power - (int) power); in ar9003_get_training_power_2g()
89 return -1; in ar9003_get_training_power_2g()
92 power -= 4 - delta; in ar9003_get_training_power_2g()
98 static int ar9003_get_training_power_5g(struct ath_hw *ah) in ar9003_get_training_power_5g()
101 struct ath9k_channel *chan = ah->curchan; in ar9003_get_training_power_5g()
114 delta = abs((int) ah->paprd_target_power - (int) power); in ar9003_get_training_power_5g()
116 return -1; in ar9003_get_training_power_5g()
118 switch (get_streams(ah->txchainmask)) { in ar9003_get_training_power_5g()
130 ath_dbg(common, CALIBRATE, "Invalid tx-chainmask: %u\n", in ar9003_get_training_power_5g()
131 ah->txchainmask); in ar9003_get_training_power_5g()
138 static int ar9003_paprd_setup_single_table(struct ath_hw *ah) in ar9003_paprd_setup_single_table()
141 static const u32 ctrl0[3] = { in ar9003_paprd_setup_single_table()
146 static const u32 ctrl1[3] = { in ar9003_paprd_setup_single_table()
153 u32 am2pm_mask = ah->paprd_ratemask; in ar9003_paprd_setup_single_table()
155 if (IS_CHAN_2GHZ(ah->curchan)) in ar9003_paprd_setup_single_table()
161 training_power, ah->paprd_target_power); in ar9003_paprd_setup_single_table()
166 return -ERANGE; in ar9003_paprd_setup_single_table()
168 ah->paprd_training_power = training_power; in ar9003_paprd_setup_single_table()
174 ah->paprd_ratemask); in ar9003_paprd_setup_single_table()
178 ah->paprd_ratemask_ht40); in ar9003_paprd_setup_single_table()
181 ah->paprd_ratemask, ah->paprd_ratemask_ht40); in ar9003_paprd_setup_single_table()
183 for (i = 0; i < ah->caps.max_txchains; i++) { in ar9003_paprd_setup_single_table()
222 if (IS_CHAN_2GHZ(ah->curchan)) { in ar9003_paprd_setup_single_table()
250 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, -3); in ar9003_paprd_setup_single_table()
253 AR_PHY_PAPRD_TRAINER_CNTL3_CF_PAPRD_QUICK_DROP, -6); in ar9003_paprd_setup_single_table()
255 val = -10; in ar9003_paprd_setup_single_table()
257 if (IS_CHAN_2GHZ(ah->curchan) && !AR_SREV_9462(ah) && !AR_SREV_9565(ah)) in ar9003_paprd_setup_single_table()
258 val = -15; in ar9003_paprd_setup_single_table()
291 static void ar9003_paprd_get_gain_table(struct ath_hw *ah) in ar9003_paprd_get_gain_table()
293 u32 *entry = ah->paprd_gain_table_entries; in ar9003_paprd_get_gain_table()
294 u8 *index = ah->paprd_gain_table_index; in ar9003_paprd_get_gain_table()
305 static unsigned int ar9003_get_desired_gain(struct ath_hw *ah, int chain, in ar9003_get_desired_gain()
358 olpc_gain_delta = olpc_gain_delta - 256; in ar9003_get_desired_gain()
360 thermal_gain_corr = (alpha_therm * (therm_value - therm_cal_value) + in ar9003_get_desired_gain()
362 voltage_gain_corr = (alpha_volt * (volt_value - volt_cal_value) + in ar9003_get_desired_gain()
364 desired_gain = target_power - olpc_gain_delta - thermal_gain_corr - in ar9003_get_desired_gain()
370 static void ar9003_tx_force_gain(struct ath_hw *ah, unsigned int gain_index) in ar9003_tx_force_gain()
374 u32 *gain_table_entries = ah->paprd_gain_table_entries; in ar9003_tx_force_gain()
407 static inline int find_expn(int num) in find_expn()
409 return fls(num) - 1; in find_expn()
412 static inline int find_proper_scale(int expn, int N) in find_proper_scale()
414 return (expn > N) ? expn - 10 : 0; in find_proper_scale()
419 static bool create_pa_curve(u32 *data_L, u32 *data_U, u32 *pa_table, u16 *gain) in create_pa_curve()
432 int Q_scale_B, Q_beta, Q_alpha, alpha, beta, order_1, order_2; in create_pa_curve() local
483 accum_ang -= 1 << 27; in create_pa_curve()
504 theta[i] -= theta_low_bin; in create_pa_curve()
515 (((Y[6] - Y[3]) * 1 << scale_factor) + in create_pa_curve()
516 (x_est[6] - x_est[3])) / (x_est[6] - x_est[3]); in create_pa_curve()
523 (G_fxp * (x_est[0] - x_est[3]) + in create_pa_curve()
527 y_est[i] = Y[i] - Y_intercept; in create_pa_curve()
538 x_est[max_index] - ((1 << scale_factor) * y_est[max_index] + in create_pa_curve()
552 L = max_index - I; in create_pa_curve()
568 x_est[i + I] - ((1 << scale_factor) * y_est[i + I] + in create_pa_curve()
598 B1_tmp[i] -= sum_y_sqr; in create_pa_curve()
599 B2_tmp[i] = sum_y_quad - sum_y_sqr * B2_tmp[i]; in create_pa_curve()
625 ((sum_y_quad / scale_factor) * (L + 1) - in create_pa_curve()
637 beta = (beta_raw << 10) / scale_B; in create_pa_curve()
638 order_1 = 3 * M - Q_x - Q_B1 - Q_beta + 10 + Q_scale_B; in create_pa_curve()
639 order_2 = 3 * M - Q_x - Q_B2 - Q_alpha + 10 + Q_scale_B; in create_pa_curve()
642 order1_5x_rem = order_1 - 5 * order1_5x; in create_pa_curve()
643 order2_3x_rem = order_2 - 3 * order2_3x; in create_pa_curve()
647 y5 = ((beta * tmp) >> 6) >> order1_5x; in create_pa_curve()
660 tmp = PA_in[i] - PA_in[i - 1]; in create_pa_curve()
663 PA_in[i - 1] + (PA_in[i - 1] - in create_pa_curve()
664 PA_in[i - 2]); in create_pa_curve()
690 beta = (beta_raw << 10) / scale_B; in create_pa_curve()
691 order_1 = 3 * M - Q_x - Q_B1 - Q_beta + 10 + Q_scale_B + 5; in create_pa_curve()
692 order_2 = 3 * M - Q_x - Q_B2 - Q_alpha + 10 + Q_scale_B + 5; in create_pa_curve()
695 order1_5x_rem = order_1 - 5 * order1_5x; in create_pa_curve()
696 order2_3x_rem = order_2 - 3 * order2_3x; in create_pa_curve()
706 if (beta > 0) in create_pa_curve()
707 y5 = (((beta * tmp - 64) >> 6) - in create_pa_curve()
710 y5 = ((((beta * tmp - 64) >> 6) + in create_pa_curve()
719 if (beta > 0) in create_pa_curve()
720 y3 = (alpha * tmp - in create_pa_curve()
733 if (PA_angle < -150) in create_pa_curve()
734 PA_angle = -150; in create_pa_curve()
742 pa_table[i - 1] = ((PA_in[i - 1] & 0x7ff) << 11) + in create_pa_curve()
755 u32 *paprd_table_val = caldata->pa_table[chain]; in ar9003_paprd_populate_single_table()
756 u32 small_signal_gain = caldata->small_signal_gain[chain]; in ar9003_paprd_populate_single_table()
757 u32 training_power = ah->paprd_training_power; in ar9003_paprd_populate_single_table()
786 if (ah->caps.tx_chainmask & BIT(1)) in ar9003_paprd_populate_single_table()
791 if (ah->caps.tx_chainmask & BIT(2)) in ar9003_paprd_populate_single_table()
802 unsigned int train_power = ah->paprd_training_power; in ar9003_paprd_setup_gain_table()
808 if (ah->paprd_gain_table_index[i] >= desired_gain) in ar9003_paprd_setup_gain_table()
820 static bool ar9003_paprd_retrain_pa_in(struct ath_hw *ah, in ar9003_paprd_retrain_pa_in()
824 u32 *pa_in = caldata->pa_table[chain]; in ar9003_paprd_retrain_pa_in()
840 quick_drop -= 0x40; in ar9003_paprd_retrain_pa_in()
849 capdiv_offset = (int)((1000 - pa_in[23] + 75) / 150); in ar9003_paprd_retrain_pa_in()
869 capdiv2g -= quick_drop_offset; in ar9003_paprd_retrain_pa_in()
878 capdiv_offset = (1000 - pa_in[23]) / 100; in ar9003_paprd_retrain_pa_in()
882 quick_drop--; in ar9003_paprd_retrain_pa_in()
888 if (quick_drop < -4) in ar9003_paprd_retrain_pa_in()
889 quick_drop = -4; in ar9003_paprd_retrain_pa_in()
893 capdiv2g -= count / 4; in ar9003_paprd_retrain_pa_in()
894 if (quick_drop > -2) in ar9003_paprd_retrain_pa_in()
895 quick_drop = -2; in ar9003_paprd_retrain_pa_in()
897 capdiv2g--; in ar9003_paprd_retrain_pa_in()
919 u16 *small_signal_gain = &caldata->small_signal_gain[chain]; in ar9003_paprd_create_curve()
920 u32 *pa_table = caldata->pa_table[chain]; in ar9003_paprd_create_curve()
926 memset(caldata->pa_table[chain], 0, sizeof(caldata->pa_table[chain])); in ar9003_paprd_create_curve()
930 return -ENOMEM; in ar9003_paprd_create_curve()
949 status = -2; in ar9003_paprd_create_curve()
952 status = -EINPROGRESS; in ar9003_paprd_create_curve()
1008 if ((ah->caps.hw_caps & ATH9K_HW_CAP_PAPRD) && ah->config.enable_paprd) in ar9003_is_paprd_enabled()