xref: /linux/drivers/hid/amd-sfh-hid/hid_descriptor/amd_sfh_hid_desc.h (revision 0ea5c948cb64bab5bc7a5516774eb8536f05aa0d)
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  * HID report descriptors, structures and routines
4  * Copyright 2020-2021 Advanced Micro Devices, Inc.
5  * Authors: Nehal Bakulchandra Shah <Nehal-bakulchandra.shah@amd.com>
6  *	    Sandeep Singh <Sandeep.singh@amd.com>
7  *	    Basavaraj Natikar <Basavaraj.Natikar@amd.com>
8  */
9 
10 #ifndef AMD_SFH_HID_DESCRIPTOR_H
11 #define AMD_SFH_HID_DESCRIPTOR_H
12 
13 enum desc_type {
14 	/* Report descriptor name */
15 	descr_size = 1,
16 	input_size,
17 	feature_size,
18 };
19 
20 struct common_feature_property {
21 	/* common properties */
22 	u8 report_id;
23 	u8 connection_type;
24 	u8 report_state;
25 	u8 power_state;
26 	u8 sensor_state;
27 	u32 report_interval;
28 } __packed;
29 
30 struct common_input_property {
31 	/* common properties */
32 	u8 report_id;
33 	u8 sensor_state;
34 	u8 event_type;
35 } __packed;
36 
37 struct accel3_feature_report {
38 	struct common_feature_property common_property;
39 	/* properties specific to this sensor */
40 	u16 accel_change_sesnitivity;
41 	s16 accel_sensitivity_max;
42 	s16 accel_sensitivity_min;
43 } __packed;
44 
45 struct accel3_input_report {
46 	struct	common_input_property common_property;
47 	/* values specific to this sensor */
48 	int in_accel_x_value;
49 	int in_accel_y_value;
50 	int in_accel_z_value;
51 	/* include if required to support the "shake" event */
52 	u8 in_accel_shake_detection;
53 } __packed;
54 
55 struct gyro_feature_report {
56 	struct common_feature_property common_property;
57 	/* properties specific to this sensor */
58 	u16 gyro_change_sesnitivity;
59 	s16 gyro_sensitivity_max;
60 	s16 gyro_sensitivity_min;
61 } __packed;
62 
63 struct gyro_input_report {
64 	struct	common_input_property common_property;
65 	/* values specific to this sensor */
66 	int in_angel_x_value;
67 	int in_angel_y_value;
68 	int in_angel_z_value;
69 } __packed;
70 
71 struct magno_feature_report {
72 	struct common_feature_property common_property;
73 	/*properties specific to this sensor */
74 	u16 magno_headingchange_sensitivity;
75 	s16 heading_min;
76 	s16 heading_max;
77 	u16 flux_change_sensitivity;
78 	s16 flux_min;
79 	s16 flux_max;
80 } __packed;
81 
82 struct magno_input_report {
83 	struct	common_input_property common_property;
84 	int in_magno_x;
85 	int in_magno_y;
86 	int in_magno_z;
87 	int in_magno_accuracy;
88 } __packed;
89 
90 struct als_feature_report {
91 	struct common_feature_property common_property;
92 	/* properties specific to this sensor */
93 	u16 als_change_sesnitivity;
94 	s16 als_sensitivity_max;
95 	s16 als_sensitivity_min;
96 } __packed;
97 
98 struct als_input_report {
99 	struct common_input_property common_property;
100 	/* values specific to this sensor */
101 	int illuminance_value;
102 	int light_color_temp;
103 	int chromaticity_x_value;
104 	int chromaticity_y_value;
105 } __packed;
106 
107 struct hpd_feature_report {
108 	struct common_feature_property common_property;
109 } __packed;
110 
111 struct hpd_input_report {
112 	struct common_input_property common_property;
113 	 /* values specific to human presence sensor */
114 	u8 human_presence;
115 } __packed;
116 
117 #endif
118