| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Copyright (C) 2014 Felix Fietkau <[email protected]> |
| 4 |
* Copyright (C) 2015 Jakub Kicinski <[email protected]> |
| 5 |
* Copyright (C) 2018 Stanislaw Gruszka <[email protected]> |
| 6 |
*/ |
| 7 |
|
| 8 |
#ifndef __MT76X0U_EEPROM_H |
| 9 |
#define __MT76X0U_EEPROM_H |
| 10 |
|
| 11 |
#include "../mt76x02_eeprom.h" |
| 12 |
|
| 13 |
struct mt76x02_dev; |
| 14 |
|
| 15 |
#define MT76X0U_EE_MAX_VER 0x0c |
| 16 |
#define MT76X0_EEPROM_SIZE 512 |
| 17 |
|
| 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 mt76x02_rate_power *t); |
| 23 |
void mt76x0_get_power_info(struct mt76x02_dev *dev, |
| 24 |
struct ieee80211_channel *chan, s8 *tp); |
| 25 |
|
| 26 |
static inline s8 s6_to_s8(u32 val) |
| 27 |
{ |
| 28 |
s8 ret = val & GENMASK(5, 0); |
| 29 |
|
| 30 |
if (ret & BIT(5)) |
| 31 |
ret -= BIT(6); |
| 32 |
return ret; |
| 33 |
} |
| 34 |
|
| 35 |
static inline bool mt76x0_tssi_enabled(struct mt76x02_dev *dev) |
| 36 |
{ |
| 37 |
return (mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1) & |
| 38 |
MT_EE_NIC_CONF_1_TX_ALC_EN); |
| 39 |
} |
| 40 |
|
| 41 |
#endif |