diff options
Diffstat (limited to 'drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c')
-rw-r--r-- | drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c index 89cb0066a6e0..17af4e0fd5f8 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c @@ -1,22 +1,13 @@ +// SPDX-License-Identifier: GPL-2.0 /* * cros_ec_sensors - Driver for Chrome OS Embedded Controller sensors. * * Copyright (C) 2016 Google, Inc * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * * This driver uses the cros-ec interface to communicate with the Chrome OS * EC about sensors data. Data access is presented through iio sysfs. */ -#include <linux/delay.h> #include <linux/device.h> #include <linux/iio/buffer.h> #include <linux/iio/common/cros_ec_sensors_core.h> @@ -30,7 +21,6 @@ #include <linux/module.h> #include <linux/platform_device.h> #include <linux/slab.h> -#include <linux/sysfs.h> #define CROS_EC_SENSORS_MAX_CHANNELS 4 @@ -103,9 +93,10 @@ static int cros_ec_sensors_read(struct iio_dev *indio_dev, * Do not use IIO_DEGREE_TO_RAD to avoid precision * loss. Round to the nearest integer. */ - *val = div_s64(val64 * 314159 + 9000000ULL, 1000); - *val2 = 18000 << (CROS_EC_SENSOR_BITS - 1); - ret = IIO_VAL_FRACTIONAL; + *val = 0; + *val2 = div_s64(val64 * 3141592653ULL, + 180 << (CROS_EC_SENSOR_BITS - 1)); + ret = IIO_VAL_INT_PLUS_NANO; break; case MOTIONSENSE_TYPE_MAG: /* |