blob: 78a1b09f2bf83f48e6c4a784a16a2f2e3d87aa8d [file] [log] [blame]
Angel Pons32859fc2020-04-02 23:48:27 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Robbie Zhanged840022016-12-23 11:43:07 -08002#ifndef _SAR_H_
3#define _SAR_H_
4
5#include <stdint.h>
6
7#define NUM_SAR_LIMITS 4
8#define BYTES_PER_SAR_LIMIT 10
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -07009enum {
10 SAR_FCC,
11 SAR_EUROPE_JAPAN,
12 SAR_REST_OF_WORLD,
13 SAR_NUM_WGDS_GROUPS
14};
15
16struct wifi_sar_delta_table {
17 uint8_t version;
18 struct {
19 uint8_t power_max_2400mhz;
20 uint8_t power_chain_a_2400mhz;
21 uint8_t power_chain_b_2400mhz;
22 uint8_t power_max_5200mhz;
23 uint8_t power_chain_a_5200mhz;
24 uint8_t power_chain_b_5200mhz;
25 } __packed group[SAR_NUM_WGDS_GROUPS];
26} __packed;
Robbie Zhanged840022016-12-23 11:43:07 -080027
28/* Wifi SAR limit table structure */
29struct wifi_sar_limits {
30 /* Total 4 SAR limit sets, each has 10 bytes */
31 uint8_t sar_limit[NUM_SAR_LIMITS][BYTES_PER_SAR_LIMIT];
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -070032 struct wifi_sar_delta_table wgds;
33} __packed;
Robbie Zhanged840022016-12-23 11:43:07 -080034
35/*
36 * Retrieve the SAR limits data from VPD and decode it.
37 * sar_limits: Pointer to wifi_sar_limits where the resulted data is stored
38 *
Pratik Prajapati7fd1e4b2017-08-11 14:06:57 -070039 * Returns: 0 on success, -1 on errors (The VPD entry doesn't exist, or the
Robbie Zhanged840022016-12-23 11:43:07 -080040 * VPD entry contains non-heximal value.)
41 */
42int get_wifi_sar_limits(struct wifi_sar_limits *sar_limits);
43
Furquan Shaikh7fe5d3d2021-03-13 22:54:16 -080044#define WIFI_SAR_CBFS_DEFAULT_FILENAME "wifi_sar_defaults.hex"
45
Justin TerAvestc650d6c2018-12-14 11:05:03 -070046const char *get_wifi_sar_cbfs_filename(void);
47
Robbie Zhanged840022016-12-23 11:43:07 -080048#endif /* _SAR_H_ */