1 /* SPDX-License-Identifier: ISC */
3 * Copyright (C) 2016 Felix Fietkau <nbd@nbd.name>
6 #ifndef __MT76x2_EEPROM_H
7 #define __MT76x2_EEPROM_H
9 #include "../mt76x02_eeprom.h"
11 enum mt76x2_cal_channel_group
{
21 struct mt76x2_tx_power_info
{
32 } chain
[MT_MAX_CHAINS
];
35 struct mt76x2_temp_comp
{
37 int lower_bound
; /* J */
38 int upper_bound
; /* J */
39 unsigned int high_slope
; /* J / dB */
40 unsigned int low_slope
; /* J / dB */
43 void mt76x2_get_rate_power(struct mt76x02_dev
*dev
, struct mt76_rate_power
*t
,
44 struct ieee80211_channel
*chan
);
45 void mt76x2_get_power_info(struct mt76x02_dev
*dev
,
46 struct mt76x2_tx_power_info
*t
,
47 struct ieee80211_channel
*chan
);
48 int mt76x2_get_temp_comp(struct mt76x02_dev
*dev
, struct mt76x2_temp_comp
*t
);
49 void mt76x2_read_rx_gain(struct mt76x02_dev
*dev
);
52 mt76x2_has_ext_lna(struct mt76x02_dev
*dev
)
54 u32 val
= mt76x02_eeprom_get(dev
, MT_EE_NIC_CONF_1
);
56 if (dev
->mt76
.chandef
.chan
->band
== NL80211_BAND_2GHZ
)
57 return val
& MT_EE_NIC_CONF_1_LNA_EXT_2G
;
59 return val
& MT_EE_NIC_CONF_1_LNA_EXT_5G
;
63 mt76x2_temp_tx_alc_enabled(struct mt76x02_dev
*dev
)
67 val
= mt76x02_eeprom_get(dev
, MT_EE_TX_POWER_EXT_PA_5G
);
71 return mt76x02_eeprom_get(dev
, MT_EE_NIC_CONF_1
) &
72 MT_EE_NIC_CONF_1_TEMP_TX_ALC
;
76 mt76x2_tssi_enabled(struct mt76x02_dev
*dev
)
78 return !mt76x2_temp_tx_alc_enabled(dev
) &&
79 (mt76x02_eeprom_get(dev
, MT_EE_NIC_CONF_1
) &
80 MT_EE_NIC_CONF_1_TX_ALC_EN
);