18c2ecf20Sopenharmony_ci/*
28c2ecf20Sopenharmony_ci * Copyright (c) 2015 Qualcomm Atheros Inc.
38c2ecf20Sopenharmony_ci *
48c2ecf20Sopenharmony_ci * Permission to use, copy, modify, and/or distribute this software for any
58c2ecf20Sopenharmony_ci * purpose with or without fee is hereby granted, provided that the above
68c2ecf20Sopenharmony_ci * copyright notice and this permission notice appear in all copies.
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
98c2ecf20Sopenharmony_ci * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
108c2ecf20Sopenharmony_ci * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
118c2ecf20Sopenharmony_ci * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
128c2ecf20Sopenharmony_ci * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
138c2ecf20Sopenharmony_ci * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
148c2ecf20Sopenharmony_ci * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
158c2ecf20Sopenharmony_ci */
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#ifndef AR9003_AIC_H
188c2ecf20Sopenharmony_ci#define AR9003_AIC_H
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define ATH_AIC_MAX_COM_ATT_DB_TABLE    6
218c2ecf20Sopenharmony_ci#define ATH_AIC_MAX_AIC_LIN_TABLE       69
228c2ecf20Sopenharmony_ci#define ATH_AIC_MIN_ROT_DIR_ATT_DB      0
238c2ecf20Sopenharmony_ci#define ATH_AIC_MIN_ROT_QUAD_ATT_DB     0
248c2ecf20Sopenharmony_ci#define ATH_AIC_MAX_ROT_DIR_ATT_DB      37
258c2ecf20Sopenharmony_ci#define ATH_AIC_MAX_ROT_QUAD_ATT_DB     37
268c2ecf20Sopenharmony_ci#define ATH_AIC_SRAM_AUTO_INCREMENT     0x80000000
278c2ecf20Sopenharmony_ci#define ATH_AIC_SRAM_GAIN_TABLE_OFFSET  0x280
288c2ecf20Sopenharmony_ci#define ATH_AIC_SRAM_CAL_OFFSET         0x140
298c2ecf20Sopenharmony_ci#define ATH_AIC_SRAM_OFFSET             0x00
308c2ecf20Sopenharmony_ci#define ATH_AIC_MEAS_MAG_THRESH         20
318c2ecf20Sopenharmony_ci#define ATH_AIC_BT_JUPITER_CTRL         0x66820
328c2ecf20Sopenharmony_ci#define ATH_AIC_BT_AIC_ENABLE           0x02
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cienum aic_cal_state {
358c2ecf20Sopenharmony_ci	AIC_CAL_STATE_IDLE = 0,
368c2ecf20Sopenharmony_ci	AIC_CAL_STATE_STARTED,
378c2ecf20Sopenharmony_ci	AIC_CAL_STATE_DONE,
388c2ecf20Sopenharmony_ci	AIC_CAL_STATE_ERROR
398c2ecf20Sopenharmony_ci};
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cistruct ath_aic_sram_info {
428c2ecf20Sopenharmony_ci	bool valid:1;
438c2ecf20Sopenharmony_ci	bool vga_quad_sign:1;
448c2ecf20Sopenharmony_ci	bool vga_dir_sign:1;
458c2ecf20Sopenharmony_ci	u8 rot_quad_att_db;
468c2ecf20Sopenharmony_ci	u8 rot_dir_att_db;
478c2ecf20Sopenharmony_ci	u8 com_att_6db;
488c2ecf20Sopenharmony_ci};
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_cistruct ath_aic_out_info {
518c2ecf20Sopenharmony_ci	int16_t dir_path_gain_lin;
528c2ecf20Sopenharmony_ci	int16_t quad_path_gain_lin;
538c2ecf20Sopenharmony_ci};
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ciu8 ar9003_aic_calibration(struct ath_hw *ah);
568c2ecf20Sopenharmony_ciu8 ar9003_aic_start_normal(struct ath_hw *ah);
578c2ecf20Sopenharmony_ciu8 ar9003_aic_cal_reset(struct ath_hw *ah);
588c2ecf20Sopenharmony_ciu8 ar9003_aic_calibration_single(struct ath_hw *ah);
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#endif /* AR9003_AIC_H */
61