diff options
Diffstat (limited to 'driver/als_cm32183.c')
-rw-r--r-- | driver/als_cm32183.c | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/driver/als_cm32183.c b/driver/als_cm32183.c index 13ea942dd1..d97c179fe8 100644 --- a/driver/als_cm32183.c +++ b/driver/als_cm32183.c @@ -1,4 +1,4 @@ -/* Copyright 2022 The Chromium OS Authors. All rights reserved. +/* Copyright 2022 The ChromiumOS Authors * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. * @@ -20,7 +20,7 @@ struct cm32183_drv_data { int16_t offset; }; -#define CM32183_GET_DATA(_s) ((struct cm32183_drv_data *)(_s)->drv_data) +#define CM32183_GET_DATA(_s) ((struct cm32183_drv_data *)(_s)->drv_data) /* * Read CM32183 light sensor data. @@ -31,7 +31,7 @@ static int cm32183_read_lux(int *lux) int data; ret = i2c_read16(I2C_PORT_SENSOR, CM32183_I2C_ADDR, - CM32183_REG_ALS_RESULT, &data); + CM32183_REG_ALS_RESULT, &data); if (ret) return ret; @@ -39,7 +39,7 @@ static int cm32183_read_lux(int *lux) /* * lux = data * 0.016 */ - *lux = (data * 16)/1000; + *lux = (data * 16) / 1000; return EC_SUCCESS; } @@ -60,7 +60,7 @@ static int cm32183_read(const struct motion_sensor_t *s, intv3_t v) lux_data += drv_data->offset; lux_data = lux_data * drv_data->scale + - lux_data * drv_data->uscale / 10000; + lux_data * drv_data->uscale / 10000; v[0] = lux_data; v[1] = 0; @@ -77,14 +77,13 @@ static int cm32183_read(const struct motion_sensor_t *s, intv3_t v) return EC_SUCCESS; } -static int cm32183_set_range(struct motion_sensor_t *s, int range, - int rnd) +static int cm32183_set_range(struct motion_sensor_t *s, int range, int rnd) { return EC_SUCCESS; } -static int cm32183_set_data_rate(const struct motion_sensor_t *s, - int rate, int roundup) +static int cm32183_set_data_rate(const struct motion_sensor_t *s, int rate, + int roundup) { CM32183_GET_DATA(s)->rate = rate; return EC_SUCCESS; @@ -96,14 +95,14 @@ static int cm32183_get_data_rate(const struct motion_sensor_t *s) } static int cm32183_set_offset(const struct motion_sensor_t *s, - const int16_t *offset, int16_t temp) + const int16_t *offset, int16_t temp) { /* TODO: check calibration method */ return EC_SUCCESS; } -static int cm32183_get_offset(const struct motion_sensor_t *s, - int16_t *offset, int16_t *temp) +static int cm32183_get_offset(const struct motion_sensor_t *s, int16_t *offset, + int16_t *temp) { *offset = CM32183_GET_DATA(s)->offset; return EC_SUCCESS; @@ -117,14 +116,14 @@ static int cm32183_init(struct motion_sensor_t *s) int ret; int data; - ret = i2c_write16(s->port, s->i2c_spi_addr_flags, - CM32183_REG_CONFIGURE, CM32183_REG_CONFIGURE_CH_EN); + ret = i2c_write16(s->port, s->i2c_spi_addr_flags, CM32183_REG_CONFIGURE, + CM32183_REG_CONFIGURE_CH_EN); if (ret) return ret; - ret = i2c_read16(s->port, s->i2c_spi_addr_flags, - CM32183_REG_ALS_RESULT, &data); + ret = i2c_read16(s->port, s->i2c_spi_addr_flags, CM32183_REG_ALS_RESULT, + &data); if (ret) return ret; |