1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * AMD MP2 PCIe communication driver
4 * Copyright 2020 Advanced Micro Devices, Inc.
5 * Authors: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>
6 * Sandeep Singh <Sandeep.singh@amd.com>
10 #define PCIE_MP2_AMD_H
12 #include <linux/pci.h>
13 #include "amd_sfh_hid.h"
15 #define PCI_DEVICE_ID_AMD_MP2 0x15E4
17 #define ENABLE_SENSOR 1
18 #define DISABLE_SENSOR 2
19 #define STOP_ALL_SENSORS 8
21 /* MP2 C2P Message Registers */
22 #define AMD_C2P_MSG0 0x10500
23 #define AMD_C2P_MSG1 0x10504
24 #define AMD_C2P_MSG2 0x10508
26 #define AMD_C2P_MSG(regno) (0x10500 + ((regno) * 4))
28 /* MP2 P2C Message Registers */
29 #define AMD_P2C_MSG3 0x1068C /* Supported Sensors info */
35 /* SFH Command register */
64 union sfh_cmd_base cmd_base;
65 union sfh_cmd_param cmd_param;
66 phys_addr_t phys_addr;
78 struct amdtp_cl_data *cl_data;
80 const struct amd_mp2_ops *mp2_ops;
81 struct amd_input_data in_data;
82 /* mp2 active control status */
86 struct amd_mp2_sensor_info {
89 dma_addr_t dma_address;
100 u32 human_presence_report : 4;
101 u32 human_presence_actual : 4;
103 u32 object_distance : 16;
109 void amd_start_sensor(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info info);
110 void amd_stop_sensor(struct amd_mp2_dev *privdata, u16 sensor_idx);
111 void amd_stop_all_sensors(struct amd_mp2_dev *privdata);
112 int amd_mp2_get_sensor_num(struct amd_mp2_dev *privdata, u8 *sensor_id);
113 int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata);
114 int amd_sfh_hid_client_deinit(struct amd_mp2_dev *privdata);
117 void (*start)(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info info);
118 void (*stop)(struct amd_mp2_dev *privdata, u16 sensor_idx);
119 void (*stop_all)(struct amd_mp2_dev *privdata);