1 /* 2 * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org> 3 * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl> 4 * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl> 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License version 2 8 * as published by the Free Software Foundation 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 */ 15 16 #ifndef __MT76X0U_EEPROM_H 17 #define __MT76X0U_EEPROM_H 18 19 #include "../mt76x02_eeprom.h" 20 21 struct mt76x0_dev; 22 23 #define MT76X0U_EE_MAX_VER 0x0c 24 #define MT76X0_EEPROM_SIZE 512 25 26 struct reg_channel_bounds { 27 u8 start; 28 u8 num; 29 }; 30 31 struct mt76x0_caldata { 32 s8 rssi_offset[2]; 33 s8 lna_gain; 34 35 s16 temp_offset; 36 u8 freq_offset; 37 }; 38 39 struct mt76x0_eeprom_params { 40 41 u8 tx_pwr_per_chan[58]; 42 }; 43 44 int mt76x0_eeprom_init(struct mt76x0_dev *dev); 45 void mt76x0_read_rx_gain(struct mt76x0_dev *dev); 46 void mt76x0_get_tx_power_per_rate(struct mt76x0_dev *dev); 47 48 static inline s8 s6_to_s8(u32 val) 49 { 50 s8 ret = val & GENMASK(5, 0); 51 52 if (ret & BIT(5)) 53 ret -= BIT(6); 54 return ret; 55 } 56 57 #endif 58