aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/common/cros_ec_sensors (follow)
AgeCommit message (Collapse)AuthorFilesLines
2019-05-21treewide: Add SPDX license identifier - Makefile/KconfigThomas Gleixner2-0/+2
Add SPDX license identifiers to all Make/Kconfig files which: - Have no license information of any form These files fall under the project license, GPL v2 only. The resulting SPDX license identifier is: GPL-2.0-only Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-21Merge 5.1-rc6 into staging-nextGreg Kroah-Hartman1-3/+4
We want the fixes in here as well as this resolves an iio driver merge issue. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-04iio: cros_ec: Switch to SPDX identifier.Enric Balletbo i Serra2-18/+2
Adopt the SPDX license identifier headers to ease license compliance management. Also fix MODULE_LICENSE for cros_ec_accel_legacy to match the SPDX and boiler plate license. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: cros_ec: Add kernel-doc for cros_ec_sensors_read_lpcGwendal Grignou1-0/+11
Document cros_ec_sensors_read_lpc, adding an additional note to explain that this is the safe function for reading the EC data. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04iio: cros_ec: Drop unnecessary include filesGuenter Roeck2-3/+0
The cros_ec sensors drivers do not call any sysfs functions or use any sysfs defines, and thus do not need to include linux/sysfs.h. Also, some cros_ec drivers include linux/delay.h and is not used. Signed-off-by: Guenter Roeck <groeck@chromium.org> [remove linux/delay.h] Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-03-16iio: cros_ec: Fix the maths for gyro scale calculationGwendal Grignou1-3/+4
Calculation did not use IIO_DEGREE_TO_RAD and implemented a variant to avoid precision loss as we aim a nano value. The offset added to avoid rounding error, though, doesn't give us a close result to the expected value. E.g. For 1000dps, the result should be: (1000 * pi ) / 180 >> 15 ~= 0.000532632218 But with current calculation we get $ cat scale 0.000547890 Fix the calculation by just doing the maths involved for a nano value val * pi * 10e12 / (180 * 2^15) so we get a closer result. $ cat scale 0.000532632 Fixes: c14dca07a31d ("iio: cros_ec_sensors: add ChromeOS EC Contiguous Sensors driver") Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-04-28iio: common: cros_ec_sensors: simplify getting .drvdataWolfram Sang1-4/+2
We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-17iio: cros_ec: Move cros_ec_sensors_core.h in /includeGwendal Grignou3-181/+2
Similar to other common iio frameworks, move cros_ec_sensors_core.h from drivers/iio/common/cros_ec_sensors/ to include/linux/iio/common. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03iio: cros_ec: Relax sampling frequency before suspendingGwendal Grignou3-0/+52
If an application set a tight sampling frequency, given the interrupt use is a wakeup source, suspend will not happen: the kernel will receive a wake up interrupt and will cancel the suspend process. Given cros_ec sensors type is non wake up, this patch adds prepare and complete callbacks to set 1s sampling period just before suspend. This ensures the sensor hub will not be a source of interrupt during the suspend process. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-12-02iio: cros_ec: Remove unused variablesPaolo Cretaro1-2/+0
Fix gcc warnings about variable 'ec_device' being set but not used in these files: common/cros_ec_sensors/cros_ec_sensors.c:194:25 light/cros_ec_light_prox.c:184:25 Signed-off-by: Paolo Cretaro <paolocretaro@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-22iio:common: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron1-1/+0
The equivalent of both of these are now done via macro magic when the relevant register calls are made. The actual structure elements will shortly go away. Clearly this set jumps across multiple areas, but inherently it can't be grouped like the other sets in this series so I've done all the stuff in the common directory together. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-04-10Merge 4.11-rc6 into staging-nextGreg Kroah-Hartman1-2/+2
We want the staging and iio fixes in here to handle merging easier. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-03-25iio: cros_ec_sensors: Use devm to setup the triggered buffer.Enric Balletbo i Serra1-23/+3
Use resourced managed function devm_iio_triggered_buffer_setup to make error path simpler and be able to get rid of the remove function. Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25iio: cros_ec_sensors: Fix return value to get raw and calibbias data.Enric Balletbo i Serra1-2/+2
The cros_ec_sensors_read function must return the type of value on all cases. This was always true except for RAW and CALIBBIAS data which returned an error or 0. This patch just fixes the mistake I introduced when submitting the series. Fixes: commit c14dca07a31d (iio: cros_ec_sensors: add ChromeOS EC Contiguous Sensors driver) Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-12iio: cros_ec_sensors_core: fix unsigned compared less than zero on statusColin Ian King1-4/+4
status is a u8 hence the check if status is less than zero has no effect. Fix this by replacing status with int ret so the less than zero compare will correctly detect errors. Issue found with static analysis with CoverityScan, CID 1375919 Signed-off-by: Colin Ian King <colin.king@canonical.com> Fixes: 974e6f02e27e ("iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub") Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-11-01iio:cros_ec_sensors: Swap from a select to a depends in KconfigJonathan Cameron1-2/+1
Would have merged this into the original patch as a fixup but I've already pushed that out as an immutable branch for others to use so it'll have to be a separate patch. The original select had a typo as well. Trying to do this via a select was opening a can of worms due to a tree of other elements that would also have needed selecting. A simple depends seems much mroe straight forward and appropriate in this case. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Lee Jones <lee.jones@linaro.org> Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
2016-10-25platform/chrome: cros_ec_dev - Register cros-ec sensorsEnric Balletbo i Serra1-2/+2
Check whether the ChromeOS Embedded Controller is a sensor hub and in such case issue a command to get the number of sensors and register them all. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <groeck@chromium.org> Acked-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-25iio: cros_ec_sensors: add ChromeOS EC Contiguous Sensors driverEnric Balletbo i Serra3-0/+332
Handle 3d contiguous sensors like Accelerometers, Gyroscope and Magnetometer that are presented by the ChromeOS EC Sensor hub. Signed-off-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-25iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub.Enric Balletbo i Serra4-0/+644
Add the core functions to be able to support the sensors attached behind the ChromeOS Embedded Controller and used by other IIO cros-ec sensor drivers. The cros_ec_sensor_core driver matches with current driver in ChromeOS 4.4 tree, so it includes all the fixes at the moment. The support for this driver was made by Gwendal Grignou. The original patch and all the fixes has been squashed and rebased on top of mainline. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Guenter Roeck <groeck@chromium.org> [eballetbo: split, squash and rebase on top of mainline the patches found in ChromeOS tree] Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>