1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 /* 3 * AMD MP2 Sensors transport driver 4 * 5 * Authors: Nehal Bakulchandra Shah <Nehal-bakulchandra.shah@amd.com> 6 * Sandeep Singh <sandeep.singh@amd.com> 7 */ 8 9 #ifndef AMDSFH_HID_H 10 #define AMDSFH_HID_H 11 12 #define MAX_HID_DEVICES 4 13 #define BUS_AMD_AMDTP 0x20 14 #define AMD_SFH_HID_VENDOR 0x1022 15 #define AMD_SFH_HID_PRODUCT 0x0001 16 17 struct amdtp_cl_data { 18 u8 init_done; 19 u32 cur_hid_dev; 20 u32 hid_dev_count; 21 u32 num_hid_devices; 22 struct device_info *hid_devices; 23 u8 *report_descr[MAX_HID_DEVICES]; 24 int report_descr_sz[MAX_HID_DEVICES]; 25 struct hid_device *hid_sensor_hubs[MAX_HID_DEVICES]; 26 u8 *hid_descr[MAX_HID_DEVICES]; 27 int hid_descr_size[MAX_HID_DEVICES]; 28 phys_addr_t phys_addr_base; 29 u32 *sensor_virt_addr[MAX_HID_DEVICES]; 30 dma_addr_t sensor_dma_addr[MAX_HID_DEVICES]; 31 u32 sensor_sts[MAX_HID_DEVICES]; 32 u32 sensor_requested_cnt[MAX_HID_DEVICES]; 33 u8 report_type[MAX_HID_DEVICES]; 34 u8 report_id[MAX_HID_DEVICES]; 35 u8 sensor_idx[MAX_HID_DEVICES]; 36 u8 *feature_report[MAX_HID_DEVICES]; 37 u8 *input_report[MAX_HID_DEVICES]; 38 u8 request_done[MAX_HID_DEVICES]; 39 struct delayed_work work; 40 struct delayed_work work_buffer; 41 }; 42 43 /** 44 * struct amdtp_hid_data - Per instance HID data 45 * @index: Device index in the order of enumeration 46 * @request_done: Get Feature/Input report complete flag 47 * used during get/set request from hid core 48 * @cli_data: Link to the client instance 49 * @hid_wait: Completion waitq 50 * 51 * Used to tie hid->driver data to driver client instance 52 */ 53 struct amdtp_hid_data { 54 int index; 55 struct amdtp_cl_data *cli_data; 56 wait_queue_head_t hid_wait; 57 }; 58 59 /* Interface functions between HID LL driver and AMD SFH client */ 60 void hid_amdtp_set_feature(struct hid_device *hid, char *buf, u32 len, int report_id); 61 void hid_amdtp_get_report(struct hid_device *hid, int report_id, int report_type); 62 int amdtp_hid_probe(u32 cur_hid_dev, struct amdtp_cl_data *cli_data); 63 void amdtp_hid_remove(struct amdtp_cl_data *cli_data); 64 int amd_sfh_get_report(struct hid_device *hid, int report_id, int report_type); 65 void amd_sfh_set_report(struct hid_device *hid, int report_id, int report_type); 66 void amdtp_hid_wakeup(struct hid_device *hid); 67 #endif 68