Path: blob/main/sys/contrib/dev/mediatek/mt76/mt76x2/eeprom.h
48525 views
/* SPDX-License-Identifier: ISC */1/*2* Copyright (C) 2016 Felix Fietkau <[email protected]>3*/45#ifndef __MT76x2_EEPROM_H6#define __MT76x2_EEPROM_H78#include "../mt76x02_eeprom.h"910enum mt76x2_cal_channel_group {11MT_CH_5G_JAPAN,12MT_CH_5G_UNII_1,13MT_CH_5G_UNII_2,14MT_CH_5G_UNII_2E_1,15MT_CH_5G_UNII_2E_2,16MT_CH_5G_UNII_3,17__MT_CH_MAX18};1920struct mt76x2_tx_power_info {21u8 target_power;2223s8 delta_bw40;24s8 delta_bw80;2526struct {27s8 tssi_slope;28s8 tssi_offset;29s8 target_power;30s8 delta;31} chain[MT_MAX_CHAINS];32};3334struct mt76x2_temp_comp {35u8 temp_25_ref;36int lower_bound; /* J */37int upper_bound; /* J */38unsigned int high_slope; /* J / dB */39unsigned int low_slope; /* J / dB */40};4142void mt76x2_get_rate_power(struct mt76x02_dev *dev, struct mt76x02_rate_power *t,43struct ieee80211_channel *chan);44void mt76x2_get_power_info(struct mt76x02_dev *dev,45struct mt76x2_tx_power_info *t,46struct ieee80211_channel *chan);47int mt76x2_get_temp_comp(struct mt76x02_dev *dev, struct mt76x2_temp_comp *t);48void mt76x2_read_rx_gain(struct mt76x02_dev *dev);4950static inline bool51mt76x2_has_ext_lna(struct mt76x02_dev *dev)52{53u32 val = mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1);5455if (dev->mphy.chandef.chan->band == NL80211_BAND_2GHZ)56return val & MT_EE_NIC_CONF_1_LNA_EXT_2G;57else58return val & MT_EE_NIC_CONF_1_LNA_EXT_5G;59}6061static inline bool62mt76x2_temp_tx_alc_enabled(struct mt76x02_dev *dev)63{64u16 val;6566val = mt76x02_eeprom_get(dev, MT_EE_TX_POWER_EXT_PA_5G);67if (!(val & BIT(15)))68return false;6970return mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1) &71MT_EE_NIC_CONF_1_TEMP_TX_ALC;72}7374static inline bool75mt76x2_tssi_enabled(struct mt76x02_dev *dev)76{77return !mt76x2_temp_tx_alc_enabled(dev) &&78(mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1) &79MT_EE_NIC_CONF_1_TX_ALC_EN);80}8182#endif838485