WIP FPC-III support
[linux/fpc-iii.git] / drivers / net / wireless / mediatek / mt76 / mt76x0 / eeprom.h
blob15540ce8db871eb3071794f84276b29856403313
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
4 * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
5 * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl>
6 */
8 #ifndef __MT76X0U_EEPROM_H
9 #define __MT76X0U_EEPROM_H
11 #include "../mt76x02_eeprom.h"
13 struct mt76x02_dev;
15 #define MT76X0U_EE_MAX_VER 0x0c
16 #define MT76X0_EEPROM_SIZE 512
18 int mt76x0_eeprom_init(struct mt76x02_dev *dev);
19 void mt76x0_read_rx_gain(struct mt76x02_dev *dev);
20 void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev,
21 struct ieee80211_channel *chan,
22 struct mt76_rate_power *t);
23 void mt76x0_get_power_info(struct mt76x02_dev *dev,
24 struct ieee80211_channel *chan, s8 *tp);
26 static inline s8 s6_to_s8(u32 val)
28 s8 ret = val & GENMASK(5, 0);
30 if (ret & BIT(5))
31 ret -= BIT(6);
32 return ret;
35 static inline bool mt76x0_tssi_enabled(struct mt76x02_dev *dev)
37 return (mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1) &
38 MT_EE_NIC_CONF_1_TX_ALC_EN);
41 #endif