Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: sensor: Update document for custom sensor

Added custom sensor documentation

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>

authored by

Srinivas Pandruvada and committed by
Jiri Kosina
b2eafd72 4a7de051

+84
+84
Documentation/hid/hid-sensor.txt
··· 138 138 the usage id of X axis. HID sensors can provide events, so this is not necessary 139 139 to poll for any field. If there is some new sample, the core driver will call 140 140 registered callback function to process the sample. 141 + 142 + 143 + ---------- 144 + 145 + HID Custom and generic Sensors 146 + 147 + HID Sensor specification defines two special sensor usage types. Since they 148 + don't represent a standard sensor, it is not possible to define using Linux IIO 149 + type interfaces. 150 + The purpose of these sensors is to extend the functionality or provide a 151 + way to obfuscate the data being communicated by a sensor. Without knowing the 152 + mapping between the data and its encapsulated form, it is difficult for 153 + an application/driver to determine what data is being communicated by the sensor. 154 + This allows some differentiating use cases, where vendor can provide applications. 155 + Some common use cases are debug other sensors or to provide some events like 156 + keyboard attached/detached or lid open/close. 157 + 158 + To allow application to utilize these sensors, here they are exported uses sysfs 159 + attribute groups, attributes and misc device interface. 160 + 161 + An example of this representation on sysfs: 162 + /sys/devices/pci0000:00/INT33C2:00/i2c-0/i2c-INT33D1:00/0018:8086:09FA.0001/HID-SENSOR-2000e1.6.auto$ tree -R 163 + . 164 + ????????? enable_sensor 165 + ????????? feature-0-200316 166 + ??????? ????????? feature-0-200316-maximum 167 + ??????? ????????? feature-0-200316-minimum 168 + ??????? ????????? feature-0-200316-name 169 + ??????? ????????? feature-0-200316-size 170 + ??????? ????????? feature-0-200316-unit-expo 171 + ??????? ????????? feature-0-200316-units 172 + ??????? ????????? feature-0-200316-value 173 + ????????? feature-1-200201 174 + ??????? ????????? feature-1-200201-maximum 175 + ??????? ????????? feature-1-200201-minimum 176 + ??????? ????????? feature-1-200201-name 177 + ??????? ????????? feature-1-200201-size 178 + ??????? ????????? feature-1-200201-unit-expo 179 + ??????? ????????? feature-1-200201-units 180 + ??????? ????????? feature-1-200201-value 181 + ????????? input-0-200201 182 + ??????? ????????? input-0-200201-maximum 183 + ??????? ????????? input-0-200201-minimum 184 + ??????? ????????? input-0-200201-name 185 + ??????? ????????? input-0-200201-size 186 + ??????? ????????? input-0-200201-unit-expo 187 + ??????? ????????? input-0-200201-units 188 + ??????? ????????? input-0-200201-value 189 + ????????? input-1-200202 190 + ??????? ????????? input-1-200202-maximum 191 + ??????? ????????? input-1-200202-minimum 192 + ??????? ????????? input-1-200202-name 193 + ??????? ????????? input-1-200202-size 194 + ??????? ????????? input-1-200202-unit-expo 195 + ??????? ????????? input-1-200202-units 196 + ??????? ????????? input-1-200202-value 197 + 198 + Here there is a custom sensors with four fields, two feature and two inputs. 199 + Each field is represented by a set of attributes. All fields except the "value" 200 + are read only. The value field is a RW field. 201 + Example 202 + /sys/bus/platform/devices/HID-SENSOR-2000e1.6.auto/feature-0-200316$ grep -r . * 203 + feature-0-200316-maximum:6 204 + feature-0-200316-minimum:0 205 + feature-0-200316-name:property-reporting-state 206 + feature-0-200316-size:1 207 + feature-0-200316-unit-expo:0 208 + feature-0-200316-units:25 209 + feature-0-200316-value:1 210 + 211 + How to enable such sensor? 212 + By default sensor can be power gated. To enable sysfs attribute "enable" can be 213 + used. 214 + $ echo 1 > enable_sensor 215 + 216 + Once enabled and powered on, sensor can report value using HID reports. 217 + These reports are pushed using misc device interface in a FIFO order. 218 + /dev$ tree | grep HID-SENSOR-2000e1.6.auto 219 + ??????? ????????? 10:53 -> ../HID-SENSOR-2000e1.6.auto 220 + ????????? HID-SENSOR-2000e1.6.auto 221 + 222 + Each reports can be of variable length preceded by a header. This header 223 + consist of a 32 bit usage id, 64 bit time stamp and 32 bit length field of raw 224 + data.