| 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 | int amd_get_sfh_info(struct amd_sfh_info *sfh_info, enum sfh_message_type op); |
| 65 | #endif |
| 66 | |