eeprom.h (3eb66e91a25497065c5322b1268cbc3953642227) eeprom.h (05672636b339c557feb6a98b2f2034be790aa4fb)
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

--- 12 unchanged lines hidden (view full) ---

21struct mt76x02_dev;
22
23#define MT76X0U_EE_MAX_VER 0x0c
24#define MT76X0_EEPROM_SIZE 512
25
26int mt76x0_eeprom_init(struct mt76x02_dev *dev);
27void mt76x0_read_rx_gain(struct mt76x02_dev *dev);
28void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev);
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

--- 12 unchanged lines hidden (view full) ---

21struct mt76x02_dev;
22
23#define MT76X0U_EE_MAX_VER 0x0c
24#define MT76X0_EEPROM_SIZE 512
25
26int mt76x0_eeprom_init(struct mt76x02_dev *dev);
27void mt76x0_read_rx_gain(struct mt76x02_dev *dev);
28void mt76x0_get_tx_power_per_rate(struct mt76x02_dev *dev);
29void mt76x0_get_power_info(struct mt76x02_dev *dev, u8 *info);
29void mt76x0_get_power_info(struct mt76x02_dev *dev, s8 *tp);
30
31static inline s8 s6_to_s8(u32 val)
32{
33 s8 ret = val & GENMASK(5, 0);
34
35 if (ret & BIT(5))
36 ret -= BIT(6);
37 return ret;
38}
39
40static inline bool mt76x0_tssi_enabled(struct mt76x02_dev *dev)
41{
42 return (mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1) &
43 MT_EE_NIC_CONF_1_TX_ALC_EN);
44}
45
46#endif
30
31static inline s8 s6_to_s8(u32 val)
32{
33 s8 ret = val & GENMASK(5, 0);
34
35 if (ret & BIT(5))
36 ret -= BIT(6);
37 return ret;
38}
39
40static inline bool mt76x0_tssi_enabled(struct mt76x02_dev *dev)
41{
42 return (mt76x02_eeprom_get(dev, MT_EE_NIC_CONF_1) &
43 MT_EE_NIC_CONF_1_TX_ALC_EN);
44}
45
46#endif