1 /* SPDX-License-Identifier: GPL-2.0-only */ 2 /* 3 * Copyright (c) 2021, Intel Corporation. 4 */ 5 #ifndef INTEL_SAR_H 6 #define INTEL_SAR_H 7 8 #define COMMAND_ID_DEV_MODE 1 9 #define COMMAND_ID_CONFIG_TABLE 2 10 #define DRVNAME "intc_sar" 11 #define MAX_DEV_MODES 50 12 #define MAX_REGULATORY 3 13 #define SAR_DSM_UUID "82737E72-3A33-4C45-A9C7-57C0411A5F13" 14 #define SAR_EVENT 0x80 15 #define SYSFS_DATANAME "intc_data" 16 #define TOTAL_DATA 4 17 18 /** 19 * Structure wwan_device_mode_info - device mode information 20 * Holds the data that needs to be passed to userspace. 21 * The data is updated from the BIOS sensor information. 22 * @device_mode: Specific mode of the device 23 * @bandtable_index: Index of RF band 24 * @antennatable_index: Index of antenna 25 * @sartable_index: Index of SAR 26 */ 27 struct wwan_device_mode_info { 28 int device_mode; 29 int bandtable_index; 30 int antennatable_index; 31 int sartable_index; 32 }; 33 34 /** 35 * Structure wwan_device_mode_configuration - device configuration 36 * Holds the data that is configured and obtained on probe event. 37 * The data is updated from the BIOS sensor information. 38 * @version: Mode configuration version 39 * @total_dev_mode: Total number of device modes 40 * @device_mode_info: pointer to structure wwan_device_mode_info 41 */ 42 struct wwan_device_mode_configuration { 43 int version; 44 int total_dev_mode; 45 struct wwan_device_mode_info *device_mode_info; 46 }; 47 48 /** 49 * Structure wwan_supported_info - userspace datastore 50 * Holds the data that is obtained from userspace 51 * The data is updated from the userspace and send value back in the 52 * structure format that is mentioned here. 53 * @reg_mode_needed: regulatory mode set by user for tests 54 * @bios_table_revision: Version of SAR table 55 * @num_supported_modes: Total supported modes based on reg_mode 56 */ 57 struct wwan_supported_info { 58 int reg_mode_needed; 59 int bios_table_revision; 60 int num_supported_modes; 61 }; 62 63 /** 64 * Structure wwan_sar_context - context of SAR 65 * Holds the complete context as long as the driver is in existence 66 * The context holds instance of the data used for different cases. 67 * @guid: Group id 68 * @handle: store acpi handle 69 * @reg_value: regulatory value 70 * Regulatory 0: FCC, 1: CE, 2: ISED 71 * @sar_device: platform_device type 72 * @sar_kobject: kobject for sysfs 73 * @supported_data: wwan_supported_info struct 74 * @sar_data: wwan_device_mode_info struct 75 * @config_data: wwan_device_mode_configuration array struct 76 */ 77 struct wwan_sar_context { 78 guid_t guid; 79 acpi_handle handle; 80 int reg_value; 81 struct platform_device *sar_device; 82 struct wwan_supported_info supported_data; 83 struct wwan_device_mode_info sar_data; 84 struct wwan_device_mode_configuration config_data[MAX_REGULATORY]; 85 }; 86 #endif /* INTEL_SAR_H */ 87