ar9285.h revision 220593
1/*
2 * Copyright (c) 2008-2009 Sam Leffler, Errno Consulting
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 *
16 * $FreeBSD: head/sys/dev/ath/ath_hal/ar9002/ar9285.h 220593 2011-04-13 11:32:15Z adrian $
17 */
18#ifndef _ATH_AR9285_H_
19#define _ATH_AR9285_H_
20
21#include "ar5416/ar5416.h"
22
23enum ar9285_ant_div_comb_lna_conf {
24	ATH_ANT_DIV_COMB_LNA1_MINUS_LNA2,
25	ATH_ANT_DIV_COMB_LNA2,
26	ATH_ANT_DIV_COMB_LNA1,
27	ATH_ANT_DIV_COMB_LNA1_PLUS_LNA2,
28};
29
30struct ar9285_ant_comb {
31	uint16_t count;
32	uint16_t total_pkt_count;
33	HAL_BOOL scan;
34	HAL_BOOL scan_not_start;
35	int main_total_rssi;
36	int alt_total_rssi;
37	int alt_recv_cnt;
38	int main_recv_cnt;
39	int rssi_lna1;
40	int rssi_lna2;
41	int rssi_add;
42	int rssi_sub;
43	int rssi_first;
44	int rssi_second;
45	int rssi_third;
46	HAL_BOOL alt_good;
47	int quick_scan_cnt;
48	int main_conf;
49	enum ar9285_ant_div_comb_lna_conf first_quick_scan_conf;
50	enum ar9285_ant_div_comb_lna_conf second_quick_scan_conf;
51	int first_bias;
52	int second_bias;
53	HAL_BOOL first_ratio;
54	HAL_BOOL second_ratio;
55	unsigned long scan_start_time;
56};
57
58struct ath_hal_9285 {
59	struct ath_hal_5416 ah_5416;
60
61	HAL_INI_ARRAY	ah_ini_txgain;
62	HAL_INI_ARRAY	ah_ini_rxgain;
63
64	struct ar9285_ant_comb ant_comb;	/* Kite Antenna comb/diversity */
65
66	struct {
67		int32_t prev_offset;	/* Previous value of PA offset value */
68		int8_t max_skipcount;	/* Max No. of times PACAL can be skipped */
69		int8_t skipcount;	/* No. of times the PACAL to be skipped */
70	} pacal_info;
71};
72#define	AH9285(_ah)	((struct ath_hal_9285 *)(_ah))
73
74#define	AR9285_DEFAULT_RXCHAINMASK	1
75#define	AR9285_DEFAULT_TXCHAINMASK	1
76
77#define	AR_PHY_CCA_NOM_VAL_9285_2GHZ		-118
78#define	AR_PHY_CCA_MIN_GOOD_VAL_9285_2GHZ	-127
79#define	AR_PHY_CCA_MAX_GOOD_VAL_9285_2GHZ	-108
80
81HAL_BOOL ar9285SetAntennaSwitch(struct ath_hal *, HAL_ANT_SETTING);
82HAL_BOOL ar9285RfAttach(struct ath_hal *, HAL_STATUS *);
83
84extern	HAL_BOOL ar9285SetTransmitPower(struct ath_hal *,
85		const struct ieee80211_channel *, uint16_t *);
86extern HAL_BOOL ar9285SetBoardValues(struct ath_hal *,
87		const struct ieee80211_channel *);
88
89#endif	/* _ATH_AR9285_H_ */
90