~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/hid-sensor-hub.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/linux/hid-sensor-hub.h (Version linux-6.12-rc7) and /include/linux/hid-sensor-hub.h (Version linux-2.4.37.11)


  1 /* SPDX-License-Identifier: GPL-2.0-only */         1 
  2 /*                                                
  3  * HID Sensors Driver                             
  4  * Copyright (c) 2012, Intel Corporation.         
  5  */                                               
  6 #ifndef _HID_SENSORS_HUB_H                        
  7 #define _HID_SENSORS_HUB_H                        
  8                                                   
  9 #include <linux/hid.h>                            
 10 #include <linux/hid-sensor-ids.h>                 
 11 #include <linux/iio/iio.h>                        
 12 #include <linux/iio/trigger.h>                    
 13                                                   
 14 /**                                               
 15  * struct hid_sensor_hub_attribute_info - Attr    
 16  * @usage_id:           Parent usage id of a p    
 17  * @attrib_id:          Attribute id for this     
 18  * @report_id:          Report id in which thi    
 19  * @index:              Field index in the rep    
 20  * @units:              Measurment unit for th    
 21  * @unit_expo:          Exponent used in the d    
 22  * @size:               Size in bytes for data    
 23  * @logical_minimum:    Logical minimum value     
 24  * @logical_maximum:    Logical maximum value     
 25  */                                               
 26 struct hid_sensor_hub_attribute_info {            
 27         u32 usage_id;                             
 28         u32 attrib_id;                            
 29         s32 report_id;                            
 30         s32 index;                                
 31         s32 units;                                
 32         s32 unit_expo;                            
 33         s32 size;                                 
 34         s32 logical_minimum;                      
 35         s32 logical_maximum;                      
 36 };                                                
 37                                                   
 38 /**                                               
 39  * struct sensor_hub_pending - Synchronous rea    
 40  * @status:             Pending status true/fa    
 41  * @ready:              Completion synchroniza    
 42  * @usage_id:           Usage id for physical     
 43  * @attr_usage_id:      Usage Id of a field, E    
 44  * @raw_size:           Response size for a re    
 45  * @raw_data:           Place holder for recei    
 46  */                                               
 47 struct sensor_hub_pending {                       
 48         bool status;                              
 49         struct completion ready;                  
 50         u32 usage_id;                             
 51         u32 attr_usage_id;                        
 52         int raw_size;                             
 53         u8  *raw_data;                            
 54 };                                                
 55                                                   
 56 /**                                               
 57  * struct hid_sensor_hub_device - Stores the h    
 58  * @hdev:               Stores the hid instanc    
 59  * @vendor_id:          Vendor id of hub devic    
 60  * @product_id:         Product id of hub devi    
 61  * @usage:              Usage id for this hub     
 62  * @start_collection_index: Starting index for    
 63  * @end_collection_index: Last index for a phy    
 64  * @mutex_ptr:          synchronizing mutex po    
 65  * @pending:            Holds information of p    
 66  */                                               
 67 struct hid_sensor_hub_device {                    
 68         struct hid_device *hdev;                  
 69         u32 vendor_id;                            
 70         u32 product_id;                           
 71         u32 usage;                                
 72         int start_collection_index;               
 73         int end_collection_index;                 
 74         struct mutex *mutex_ptr;                  
 75         struct sensor_hub_pending pending;        
 76 };                                                
 77                                                   
 78 /**                                               
 79  * struct hid_sensor_hub_callbacks - Client ca    
 80  * @pdev:               Platform device instan    
 81  * @suspend:            Suspend callback.         
 82  * @resume:             Resume callback.          
 83  * @capture_sample:     Callback to get a samp    
 84  * @send_event:         Send notification to i    
 85  *                      captured, process and     
 86  */                                               
 87 struct hid_sensor_hub_callbacks {                 
 88         struct platform_device *pdev;             
 89         int (*suspend)(struct hid_sensor_hub_d    
 90         int (*resume)(struct hid_sensor_hub_de    
 91         int (*capture_sample)(struct hid_senso    
 92                         u32 usage_id, size_t r    
 93                         void *priv);              
 94         int (*send_event)(struct hid_sensor_hu    
 95                          void *priv);             
 96 };                                                
 97                                                   
 98 /**                                               
 99 * sensor_hub_device_open() - Open hub device      
100 * @hsdev:       Hub device instance.              
101 *                                                 
102 * Used to open hid device for sensor hub.         
103 */                                                
104 int sensor_hub_device_open(struct hid_sensor_h    
105                                                   
106 /**                                               
107 * sensor_hub_device_clode() - Close hub device    
108 * @hsdev:       Hub device instance.              
109 *                                                 
110 * Used to clode hid device for sensor hub.        
111 */                                                
112 void sensor_hub_device_close(struct hid_sensor    
113                                                   
114 /* Registration functions */                      
115                                                   
116 /**                                               
117 * sensor_hub_register_callback() - Register cl    
118 * @hsdev:       Hub device instance.              
119 * @usage_id:    Usage id of the client (E.g. 0    
120 * @usage_callback: Callback function storage      
121 *                                                 
122 * Used to register callbacks by client process    
123 * hub core driver will call these callbacks to    
124 * of data streams and notifications.              
125 */                                                
126 int sensor_hub_register_callback(struct hid_se    
127                         u32 usage_id,             
128                         struct hid_sensor_hub_    
129                                                   
130 /**                                               
131 * sensor_hub_remove_callback() - Remove client    
132 * @hsdev:       Hub device instance.              
133 * @usage_id:    Usage id of the client (E.g. 0    
134 *                                                 
135 * If there is a callback registred, this call     
136 * callbacks, so that it will stop data and eve    
137 */                                                
138 int sensor_hub_remove_callback(struct hid_sens    
139                         u32 usage_id);            
140                                                   
141                                                   
142 /* Hid sensor hub core interfaces */              
143                                                   
144 /**                                               
145 * sensor_hub_input_get_attribute_info() - Get     
146 * @hsdev:       Hub device instance.              
147 * @type:        Type of this attribute, input/    
148 * @usage_id:    Attribute usage id of parent p    
149 * @attr_usage_id:       Attribute usage id as     
150 * @info:        return information about attri    
151 *                                                 
152 * Parses report and returns the attribute info    
153 * field index, units and exponent etc.            
154 */                                                
155 int sensor_hub_input_get_attribute_info(struct    
156                         u8 type,                  
157                         u32 usage_id, u32 attr    
158                         struct hid_sensor_hub_    
159                                                   
160 /**                                               
161 * sensor_hub_input_attr_get_raw_value() - Sync    
162 * @hsdev:       Hub device instance.              
163 * @usage_id:    Attribute usage id of parent p    
164 * @attr_usage_id:       Attribute usage id as     
165 * @report_id:   Report id to look for             
166 * @flag:      Synchronous or asynchronous read    
167 * @is_signed:   If true then fields < 32 bits     
168 *                                                 
169 * Issues a synchronous or asynchronous read re    
170 * Return: data up to 32 bits.                     
171 */                                                
172                                                   
173 enum sensor_hub_read_flags {                      
174         SENSOR_HUB_SYNC,                          
175         SENSOR_HUB_ASYNC,                         
176 };                                                
177                                                   
178 int sensor_hub_input_attr_get_raw_value(struct    
179                                         u32 us    
180                                         u32 at    
181                                         enum s    
182                                         bool i    
183 );                                                
184                                                   
185 /**                                               
186 * sensor_hub_set_feature() - Feature set reque    
187 * @hsdev:       Hub device instance.              
188 * @report_id:   Report id to look for             
189 * @field_index: Field index inside a report       
190 * @buffer_size: size of the buffer                
191 * @buffer:      buffer to use in the feature s    
192 *                                                 
193 * Used to set a field in feature report. For e    
194 * interval, sensitivity, activate/deactivate s    
195 */                                                
196 int sensor_hub_set_feature(struct hid_sensor_h    
197                            u32 field_index, in    
198                                                   
199 /**                                               
200 * sensor_hub_get_feature() - Feature get reque    
201 * @hsdev:       Hub device instance.              
202 * @report_id:   Report id to look for             
203 * @field_index: Field index inside a report       
204 * @buffer_size: size of the buffer                
205 * @buffer:      buffer to copy output             
206 *                                                 
207 * Used to get a field in feature report. For e    
208 * interval, sensitivity, activate/deactivate s    
209 * Return: On success, it returns the number of    
210 * On failure, it returns value < 0.               
211 */                                                
212 int sensor_hub_get_feature(struct hid_sensor_h    
213                            u32 field_index, in    
214                                                   
215 /* hid-sensor-attributes */                       
216                                                   
217 /* Common hid sensor iio structure */             
218 struct hid_sensor_common {                        
219         struct hid_sensor_hub_device *hsdev;      
220         struct platform_device *pdev;             
221         unsigned usage_id;                        
222         atomic_t data_ready;                      
223         atomic_t user_requested_state;            
224         atomic_t runtime_pm_enable;               
225         int poll_interval;                        
226         int raw_hystersis;                        
227         int latency_ms;                           
228         struct iio_trigger *trigger;              
229         int timestamp_ns_scale;                   
230         struct hid_sensor_hub_attribute_info p    
231         struct hid_sensor_hub_attribute_info r    
232         struct hid_sensor_hub_attribute_info p    
233         struct hid_sensor_hub_attribute_info s    
234         struct hid_sensor_hub_attribute_info s    
235         struct hid_sensor_hub_attribute_info r    
236         struct work_struct work;                  
237 };                                                
238                                                   
239 /* Convert from hid unit expo to regular expon    
240 static inline int hid_sensor_convert_exponent(    
241 {                                                 
242         if (unit_expo < 0x08)                     
243                 return unit_expo;                 
244         else if (unit_expo <= 0x0f)               
245                 return -(0x0f-unit_expo+1);       
246         else                                      
247                 return 0;                         
248 }                                                 
249                                                   
250 int hid_sensor_parse_common_attributes(struct     
251                                         u32 us    
252                                         struct    
253                                         const     
254                                         u32 se    
255 int hid_sensor_write_raw_hyst_value(struct hid    
256                                         int va    
257 int hid_sensor_write_raw_hyst_rel_value(struct    
258                                         int va    
259 int hid_sensor_read_raw_hyst_value(struct hid_    
260                                         int *v    
261 int hid_sensor_read_raw_hyst_rel_value(struct     
262                                        int *va    
263 int hid_sensor_write_samp_freq_value(struct hi    
264                                         int va    
265 int hid_sensor_read_samp_freq_value(struct hid    
266                                         int *v    
267                                                   
268 int hid_sensor_get_usage_index(struct hid_sens    
269                                 u32 report_id,    
270                                                   
271 int hid_sensor_format_scale(u32 usage_id,         
272                             struct hid_sensor_    
273                             int *val0, int *va    
274                                                   
275 s32 hid_sensor_read_poll_value(struct hid_sens    
276                                                   
277 int64_t hid_sensor_convert_timestamp(struct hi    
278                                      int64_t r    
279 bool hid_sensor_batch_mode_supported(struct hi    
280 int hid_sensor_set_report_latency(struct hid_s    
281 int hid_sensor_get_report_latency(struct hid_s    
282                                                   
283 #endif                                            
284                                                   

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php