OSDN Git Service

Add support for using a hrtimer trigger.
[android-x86/hardware-intel-libsensors.git] / common.h
index 809400b..a6360ac 100644 (file)
--- a/common.h
+++ b/common.h
@@ -28,6 +28,9 @@
 #define DEVICE_AVAIL_FREQ_PATH BASE_PATH "sampling_frequency_available"
 #define ILLUMINATION_CALIBPATH BASE_PATH "in_illuminance_calibscale"
 #define SENSOR_CALIB_BIAS_PATH BASE_PATH "in_%s_calibbias"
+#define MOUNTING_MATRIX_PATH   BASE_PATH "mounting_matrix"
+
+#define CONFIGFS_TRIGGER_PATH  "/config/iio/triggers/"
 
 #define PROP_BASE              "ro.iio.%s.%s" /* Note: PROPERTY_KEY_MAX is small */
 
@@ -51,6 +54,7 @@
 #define MODE_TRIGGER   2
 #define MODE_EVENT     3
 
+
 typedef struct
 {
        const char *type; /* event type; e.g: transition */
@@ -86,6 +90,7 @@ channel_descriptor_t;
 typedef struct
 {
        const char *tag;        /* Prefix such as "accel", "gyro", "temp"... */
+       const char *shorthand;
        const int type;         /* Sensor type ; ex: SENSOR_TYPE_ACCELEROMETER */
        const int num_channels; /* Expected iio channels for this sensor */
        const int is_virtual;   /* Is the sensor virtual or not */
@@ -150,6 +155,7 @@ typedef struct
        char vendor_name[MAX_NAME_SIZE];        /* ex: Intel                 */
        char init_trigger_name[MAX_NAME_SIZE];  /* ex: accel-name-dev1       */
        char motion_trigger_name[MAX_NAME_SIZE];/* ex: accel-any-motion-dev1 */
+       char hrtimer_trigger_name[MAX_NAME_SIZE]; /*ex: accel-hr-dev1 */
        float max_range;
        float resolution;
        float power;
@@ -254,6 +260,7 @@ typedef struct
         * more than one at a later time.
         */
        sensors_event_t sample;
+       uint64_t event_id;
 
        /*
         * If the QUIRK_FIELD_ORDERING bit is set in quirks, the contents of this array are used in the finalization stage to swap sample fields
@@ -263,6 +270,12 @@ typedef struct
        unsigned char order[MAX_CHANNELS];
 
        /*
+        * If the QUIRK_MOUNTING_MATRIX bit is set in quirks, the contents of this matrix is used to correct the sample values so that it takes
+        * into account the way the sensor has been mounted on the PCB.
+        */
+       float mounting_matrix[9];
+
+       /*
         * Event counter - will be used to check if we have a significant sample for noisy sensors. We want to make sure we do not send any wrong
         * events before filtering kicks in. We can also use it for statistics.
         */
@@ -274,7 +287,7 @@ typedef struct
         */
        int needs_enable;
 
-       int semi_arbitrated_rate;       /* Arbitrated sampling rate before we considered other sensors co-located on the same iio device */
+       float semi_arbitrated_rate;     /* Arbitrated sampling rate before we considered other sensors co-located on the same iio device */
 }
 sensor_info_t;