eeprom.h 1.2 KB
Newer Older
S
Stanislaw Gruszka 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/*
 * Copyright (C) 2014 Felix Fietkau <nbd@openwrt.org>
 * Copyright (C) 2015 Jakub Kicinski <kubakici@wp.pl>
 * Copyright (C) 2018 Stanislaw Gruszka <stf_xl@wp.pl>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

#ifndef __MT76X0U_EEPROM_H
#define __MT76X0U_EEPROM_H

19
#include "../mt76x02_eeprom.h"
S
Stanislaw Gruszka 已提交
20

21
struct mt76x0_dev;
S
Stanislaw Gruszka 已提交
22

23 24
#define MT76X0U_EE_MAX_VER		0x0c
#define MT76X0_EEPROM_SIZE		512
S
Stanislaw Gruszka 已提交
25

L
Lorenzo Bianconi 已提交
26
struct mt76x0_caldata {
27
	s8 rssi_offset[2];
L
Lorenzo Bianconi 已提交
28
	s8 lna_gain;
29 30

	s16 temp_offset;
31
	u8 freq_offset;
L
Lorenzo Bianconi 已提交
32 33
};

S
Stanislaw Gruszka 已提交
34
int mt76x0_eeprom_init(struct mt76x0_dev *dev);
L
Lorenzo Bianconi 已提交
35
void mt76x0_read_rx_gain(struct mt76x0_dev *dev);
36
void mt76x0_get_tx_power_per_rate(struct mt76x0_dev *dev);
37
void mt76x0_get_power_info(struct mt76x0_dev *dev, u8 *info);
S
Stanislaw Gruszka 已提交
38

39
static inline s8 s6_to_s8(u32 val)
S
Stanislaw Gruszka 已提交
40
{
41
	s8 ret = val & GENMASK(5, 0);
S
Stanislaw Gruszka 已提交
42

43 44 45
	if (ret & BIT(5))
		ret -= BIT(6);
	return ret;
S
Stanislaw Gruszka 已提交
46 47 48
}

#endif