summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--driver/accel_kionix.c15
-rw-r--r--driver/accel_kionix.h7
2 files changed, 11 insertions, 11 deletions
diff --git a/driver/accel_kionix.c b/driver/accel_kionix.c
index 062a3896fd..06dc8564b8 100644
--- a/driver/accel_kionix.c
+++ b/driver/accel_kionix.c
@@ -320,14 +320,15 @@ static int set_range(const struct motion_sensor_t *s, int range, int rnd)
ret = set_value(s, reg, range_val, range_field);
if (ret == EC_SUCCESS)
- data->sensor_range = index;
+ data->base.range = ranges[T(s)][index].val;
return ret;
}
static int get_range(const struct motion_sensor_t *s)
{
struct kionix_accel_data *data = s->drv_data;
- return ranges[T(s)][data->sensor_range].val;
+
+ return data->base.range;
}
static int set_resolution(const struct motion_sensor_t *s, int res, int rnd)
@@ -344,14 +345,15 @@ static int set_resolution(const struct motion_sensor_t *s, int res, int rnd)
ret = set_value(s, reg, res_val, res_field);
if (ret == EC_SUCCESS)
- data->sensor_resolution = index;
+ data->sensor_resolution = resolutions[T(s)][index].val;
return ret;
}
static int get_resolution(const struct motion_sensor_t *s)
{
struct kionix_accel_data *data = s->drv_data;
- return resolutions[T(s)][data->sensor_resolution].val;
+
+ return data->sensor_resolution;
}
static int set_data_rate(const struct motion_sensor_t *s, int rate, int rnd)
@@ -368,14 +370,15 @@ static int set_data_rate(const struct motion_sensor_t *s, int rate, int rnd)
ret = set_value(s, reg, odr_val, odr_field);
if (ret == EC_SUCCESS)
- data->sensor_datarate = index;
+ data->base.odr = datarates[T(s)][index].val;
return ret;
}
static int get_data_rate(const struct motion_sensor_t *s)
{
struct kionix_accel_data *data = s->drv_data;
- return datarates[T(s)][data->sensor_datarate].val;
+
+ return data->base.odr;
}
static int set_offset(const struct motion_sensor_t *s, const int16_t *offset,
diff --git a/driver/accel_kionix.h b/driver/accel_kionix.h
index 79d6374917..b6dfa08b48 100644
--- a/driver/accel_kionix.h
+++ b/driver/accel_kionix.h
@@ -9,6 +9,7 @@
#define __CROS_EC_ACCEL_KIONIX_H
#include "common.h"
+#include "accelgyro.h"
#include "driver/accel_kx022.h"
#include "driver/accel_kxcj9.h"
@@ -22,11 +23,7 @@ struct accel_param_pair {
};
struct kionix_accel_data {
- /* Note, the following are indicies into their respective tables. */
- /* Current range of accelerometer. */
- int sensor_range;
- /* Current output data rate of accelerometer. */
- int sensor_datarate;
+ struct accelgyro_saved_data_t base;
/* Current resolution of accelerometer. */
int sensor_resolution;
int16_t offset[3];