Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
0004  * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
0005  * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl>
0006  */
0007 
0008 #ifndef __MT76X0U_EEPROM_H
0009 #define __MT76X0U_EEPROM_H
0010 
0011 #include "../mt76x02_eeprom.h"
0012 
0013 struct mt76x02_dev;
0014 
0015 #define MT76X0U_EE_MAX_VER      0x0c
0016 #define MT76X0_EEPROM_SIZE      512
0017 
0018 int mt76x0_eeprom_init(struct mt76x02_dev *dev);
0019 void mt76x0_read_rx_gain(struct mt76x02_dev *dev);
0020 void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev,
0021                   struct ieee80211_channel *chan,
0022                   struct mt76_rate_power *t);
0023 void mt76x0_get_power_info(struct mt76x02_dev *dev,
0024                struct ieee80211_channel *chan, s8 *tp);
0025 
0026 static inline s8 s6_to_s8(u32 val)
0027 {
0028     s8 ret = val & GENMASK(5, 0);
0029 
0030     if (ret & BIT(5))
0031         ret -= BIT(6);
0032     return ret;
0033 }
0034 
0035 static inline bool mt76x0_tssi_enabled(struct mt76x02_dev *dev)
0036 {
0037     return (mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1) &
0038         MT_EE_NIC_CONF_1_TX_ALC_EN);
0039 }
0040 
0041 #endif