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