1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * AMD MP2 common macros and structures
5 * Copyright (c) 2022, Advanced Micro Devices, Inc.
8 * Author: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
10 #ifndef AMD_SFH_COMMON_H
11 #define AMD_SFH_COMMON_H
13 #include <linux/pci.h>
14 #include "amd_sfh_hid.h"
16 #define PCI_DEVICE_ID_AMD_MP2 0x15E4
17 #define PCI_DEVICE_ID_AMD_MP2_1_1 0x164A
19 #define AMD_C2P_MSG(regno) (0x10500 + ((regno) * 4))
20 #define AMD_P2C_MSG(regno) (0x10680 + ((regno) * 4))
22 #define SENSOR_ENABLED 4
23 #define SENSOR_DISABLED 5
25 #define AMD_SFH_IDLE_LOOP 200
34 struct amd_mp2_sensor_info {
37 dma_addr_t dma_address;
42 struct amdtp_cl_data *cl_data;
45 const struct amd_sfh1_1_ops *sfh1_1_ops;
46 struct amd_mp2_ops *mp2_ops;
47 struct amd_input_data in_data;
48 /* mp2 active control status */
53 void (*start)(struct amd_mp2_dev *privdata, struct amd_mp2_sensor_info info);
54 void (*stop)(struct amd_mp2_dev *privdata, u16 sensor_idx);
55 void (*stop_all)(struct amd_mp2_dev *privdata);
56 int (*response)(struct amd_mp2_dev *mp2, u8 sid, u32 sensor_sts);
57 void (*clear_intr)(struct amd_mp2_dev *privdata);
58 int (*init_intr)(struct amd_mp2_dev *privdata);
59 int (*discovery_status)(struct amd_mp2_dev *privdata);
60 void (*suspend)(struct amd_mp2_dev *mp2);
61 void (*resume)(struct amd_mp2_dev *mp2);
62 void (*remove)(void *privdata);
63 int (*get_rep_desc)(int sensor_idx, u8 rep_desc[]);
64 u32 (*get_desc_sz)(int sensor_idx, int descriptor_name);
65 u8 (*get_feat_rep)(int sensor_idx, int report_id, u8 *feature_report);
66 u8 (*get_in_rep)(u8 current_index, int sensor_idx, int report_id,
67 struct amd_input_data *in_data);
70 void amd_sfh_work(struct work_struct *work);
71 void amd_sfh_work_buffer(struct work_struct *work);
72 void amd_sfh_clear_intr_v2(struct amd_mp2_dev *privdata);
73 int amd_sfh_irq_init_v2(struct amd_mp2_dev *privdata);
74 void amd_sfh_clear_intr(struct amd_mp2_dev *privdata);
75 int amd_sfh_irq_init(struct amd_mp2_dev *privdata);