driver: sensor: Remove set_resolution when NOOP

set_resolution is only used for few sensors and is not exposed to the AP.
Remove definition when sensors have a fixed resolution.

BUG=none
BRANCH=master
TEST=compile, kevin has enough space for perform_calib.

Change-Id: I8482387e135356467edaee44da3a0e47cf1db524
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/961222
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
Gwendal Grignou
2018-03-13 10:37:56 -07:00
committed by chrome-bot
parent c63bb63b5a
commit e0a2a98b69
10 changed files with 2 additions and 79 deletions

View File

@@ -1560,7 +1560,8 @@ static int command_accelresolution(int argc, char **argv)
* Write new resolution, if it returns invalid arg, then
* return a parameter error.
*/
if (sensor->drv->set_resolution(sensor, data, round)
if (sensor->drv->set_resolution &&
sensor->drv->set_resolution(sensor, data, round)
== EC_ERROR_INVAL)
return EC_ERROR_PARAM2;
} else {

View File

@@ -93,12 +93,6 @@ static int get_range(const struct motion_sensor_t *s)
return data->sensor_range;
}
static int set_resolution(const struct motion_sensor_t *s, int res, int rnd)
{
/* Only one resolution, BMA2x2_RESOLUTION, so nothing to do. */
return EC_SUCCESS;
}
static int get_resolution(const struct motion_sensor_t *s)
{
return BMA2x2_RESOLUTION;
@@ -252,11 +246,6 @@ static int init(const struct motion_sensor_t *s)
} while (1);
mutex_unlock(s->mutex);
/* Initialize with the desired parameters. */
ret = set_resolution(s, 12, 1);
if (ret != EC_SUCCESS)
return ret;
return sensor_init_done(s);
}
@@ -265,7 +254,6 @@ const struct accelgyro_drv bma2x2_accel_drv = {
.read = read,
.set_range = set_range,
.get_range = get_range,
.set_resolution = set_resolution,
.get_resolution = get_resolution,
.set_data_rate = set_data_rate,
.get_data_rate = get_data_rate,

View File

@@ -397,7 +397,6 @@ const struct accelgyro_drv lis2dh_drv = {
.read = read,
.set_range = set_range,
.get_range = get_range,
.set_resolution = st_set_resolution,
.get_resolution = st_get_resolution,
.set_data_rate = set_data_rate,
.get_data_rate = st_get_data_rate,

View File

@@ -348,14 +348,6 @@ static int get_range(const struct motion_sensor_t *s)
return data->range;
}
static int set_resolution(const struct motion_sensor_t *s,
int res,
int rnd)
{
/* Only one resolution, BMI160_RESOLUTION, so nothing to do. */
return EC_SUCCESS;
}
static int get_resolution(const struct motion_sensor_t *s)
{
return BMI160_RESOLUTION;
@@ -1308,7 +1300,6 @@ const struct accelgyro_drv bmi160_drv = {
.read = read,
.set_range = set_range,
.get_range = get_range,
.set_resolution = set_resolution,
.get_resolution = get_resolution,
.set_data_rate = set_data_rate,
.get_data_rate = get_data_rate,

View File

@@ -209,14 +209,6 @@ static int get_range(const struct motion_sensor_t *s)
return data->base.range;
}
static int set_resolution(const struct motion_sensor_t *s,
int res,
int rnd)
{
/* Only one resolution, LSM6DS0_RESOLUTION, so nothing to do. */
return EC_SUCCESS;
}
static int get_resolution(const struct motion_sensor_t *s)
{
return LSM6DS0_RESOLUTION;
@@ -427,7 +419,6 @@ const struct accelgyro_drv lsm6ds0_drv = {
.read = read,
.set_range = set_range,
.get_range = get_range,
.set_resolution = set_resolution,
.get_resolution = get_resolution,
.set_data_rate = set_data_rate,
.get_data_rate = get_data_rate,

View File

@@ -124,12 +124,6 @@ static int get_range(const struct motion_sensor_t *s)
return LSM6DSM_GYRO_GAIN_FS(data->base.range);
}
static int set_resolution(const struct motion_sensor_t *s, int res, int rnd)
{
/* Only one resolution, LSM6DSM_RESOLUTION, so nothing to do. */
return EC_SUCCESS;
}
static int get_resolution(const struct motion_sensor_t *s)
{
/* Only one resolution, LSM6DSM_RESOLUTION, so nothing to do. */
@@ -338,11 +332,9 @@ const struct accelgyro_drv lsm6dsm_drv = {
.read = read,
.set_range = set_range,
.get_range = get_range,
.set_resolution = set_resolution,
.get_resolution = get_resolution,
.set_data_rate = set_data_rate,
.get_data_rate = get_data_rate,
.set_offset = set_offset,
.get_offset = get_offset,
.perform_calib = NULL,
};

View File

@@ -177,14 +177,6 @@ static int get_range(const struct motion_sensor_t *s)
return data->base.range;
}
static int set_resolution(const struct motion_sensor_t *s,
int res,
int rnd)
{
/* Only one resolution, L3GD20_RESOLUTION, so nothing to do. */
return EC_SUCCESS;
}
static int get_resolution(const struct motion_sensor_t *s)
{
return L3GD20_RESOLUTION;
@@ -409,11 +401,9 @@ const struct accelgyro_drv l3gd20h_drv = {
.read = read,
.set_range = set_range,
.get_range = get_range,
.set_resolution = set_resolution,
.get_resolution = get_resolution,
.set_data_rate = set_data_rate,
.get_data_rate = get_data_rate,
.set_offset = set_offset,
.get_offset = get_offset,
.perform_calib = NULL,
};

View File

@@ -72,19 +72,6 @@ int st_write_data_with_mask(const struct motion_sensor_t *s, int reg,
return raw_write8(s->port, s->addr, reg, new_data);
}
/**
* set_resolution - Set bit resolution
* @s: Motion sensor pointer
* @res: Bit resolution
* @rnd: Round bit
*
* TODO: must support multiple resolution
*/
int st_set_resolution(const struct motion_sensor_t *s, int res, int rnd)
{
return EC_SUCCESS;
}
/**
* get_resolution - Get bit resolution
* @s: Motion sensor pointer

View File

@@ -60,14 +60,6 @@ int st_raw_read_n(const int port, const int addr, const uint8_t reg,
int st_write_data_with_mask(const struct motion_sensor_t *s, int reg,
uint8_t mask, uint8_t data);
/**
* set_resolution - Set bit resolution
* @s: Motion sensor pointer
* @res: Bit resolution
* @rnd: Round bit
*/
int st_set_resolution(const struct motion_sensor_t *s, int res, int rnd);
/**
* get_resolution - Get bit resolution
* @s: Motion sensor pointer

View File

@@ -59,13 +59,6 @@ static int accel_get_range(const struct motion_sensor_t *s)
return 0;
}
static int accel_set_resolution(const struct motion_sensor_t *s,
const int res,
const int rnd)
{
return EC_SUCCESS;
}
static int accel_get_resolution(const struct motion_sensor_t *s)
{
return 0;
@@ -91,7 +84,6 @@ const struct accelgyro_drv test_motion_sense = {
.read = accel_read,
.set_range = accel_set_range,
.get_range = accel_get_range,
.set_resolution = accel_set_resolution,
.get_resolution = accel_get_resolution,
.set_data_rate = accel_set_data_rate,
.get_data_rate = accel_get_data_rate,