1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * AMD Platform Management Framework Interface 4 * 5 * Copyright (c) 2023, Advanced Micro Devices, Inc. 6 * All Rights Reserved. 7 * 8 * Authors: Shyam Sundar S K <Shyam-sundar.S-k@amd.com> 9 * Basavaraj Natikar <Basavaraj.Natikar@amd.com> 10 */ 11 12 #ifndef AMD_PMF_IO_H 13 #define AMD_PMF_IO_H 14 15 #include <linux/types.h> 16 17 /** 18 * enum sfh_message_type - Query the SFH message type 19 * @MT_HPD: Message ID to know the Human presence info from MP2 FW 20 * @MT_ALS: Message ID to know the Ambient light info from MP2 FW 21 * @MT_SRA: Message ID to know the SRA data from MP2 FW 22 */ 23 enum sfh_message_type { 24 MT_HPD, 25 MT_ALS, 26 MT_SRA, 27 }; 28 29 /** 30 * enum sfh_hpd_info - Query the Human presence information 31 * @SFH_NOT_DETECTED: Check the HPD connection information from MP2 FW 32 * @SFH_USER_PRESENT: Check if the user is present from HPD sensor 33 * @SFH_USER_AWAY: Check if the user is away from HPD sensor 34 */ 35 enum sfh_hpd_info { 36 SFH_NOT_DETECTED, 37 SFH_USER_PRESENT, 38 SFH_USER_AWAY, 39 }; 40 41 /** 42 * struct amd_sfh_info - get HPD sensor info from MP2 FW 43 * @ambient_light: Populates the ambient light information 44 * @user_present: Populates the user presence information 45 * @platform_type: Operating modes (clamshell, flat, tent, etc.) 46 * @laptop_placement: Device states (ontable, onlap, outbag) 47 */ 48 struct amd_sfh_info { 49 u32 ambient_light; 50 u8 user_present; 51 u32 platform_type; 52 u32 laptop_placement; 53 }; 54 55 enum laptop_placement { 56 LP_UNKNOWN = 0, 57 ON_TABLE, 58 ON_LAP_MOTION, 59 IN_BAG, 60 OUT_OF_BAG, 61 LP_UNDEFINED, 62 }; 63 64 /** 65 * struct amd_pmf_npu_metrics: Get NPU metrics data from PMF driver 66 * @npuclk_freq: NPU clock frequency [MHz] 67 * @npu_busy: NPU busy % [0-100] 68 * @npu_power: NPU power [mW] 69 * @mpnpuclk_freq: MPNPU [MHz] 70 * @npu_reads: NPU read bandwidth [MB/sec] 71 * @npu_writes: NPU write bandwidth [MB/sec] 72 */ 73 struct amd_pmf_npu_metrics { 74 u16 npuclk_freq; 75 u16 npu_busy[8]; 76 u16 npu_power; 77 u16 mpnpuclk_freq; 78 u16 npu_reads; 79 u16 npu_writes; 80 }; 81 82 int amd_get_sfh_info(struct amd_sfh_info *sfh_info, enum sfh_message_type op); 83 84 /* AMD PMF and NPU interface */ 85 int amd_pmf_get_npu_data(struct amd_pmf_npu_metrics *info); 86 #endif 87