aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/accel/mma9551.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-06-11iio: accel: mma9551: use NULL for GPIO connection IDAndy Shevchenko1-3/+1
While using GPIO library API we might get into troubles in the future, because we can't rely on label name in the driver since vendor firmware might provide any GPIO pin there, e.g. "reset", and even mark it in _DSD (in which case the request will fail). To avoid inconsistency and potential issues we have two options: a) generate GPIO ACPI mapping table and supply it via acpi_dev_add_driver_gpios(), or b) just pass NULL as connection ID. The b) approach is much simpler and would work since the driver relies on GPIO indices only. Moreover, the _CRS fallback mechanism, when requesting GPIO, is going to be stricter, and supplying non-NULL connection ID when neither _DSD, nor GPIO ACPI mapping is present, will make request fail. See https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/commit/?h=for-next&id=ed7fcf1ed5ea4ea01243995ae085757a77cf0f3e for more background. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30iio:core: timestamping clock selection supportGregor Boirie1-1/+1
Adds a new per-device sysfs attribute "current_timestamp_clock" to allow userspace to select a particular POSIX clock for buffered samples and events timestamping. Following clocks, as listed in clock_gettime(2), are supported: CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and CLOCK_TAI. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-08iio: Reconcile operation order between iio_register/unregister and pm functionsAdriana Reus1-10/+9
At probe, runtime pm should be setup before registering the sysfs interface so that all the power attributes are accurate and functional when registering. Also, when removing the device we should unregister first to make sure that the interfaces that may result in wakeups are no longer available. Fix this behaviour for the following drivers: bmc150, bmg160, kmx61, kxcj-1013, mma9551, mma9553, rpr0521. Signed-off-by: Adriana Reus <adriana.reus@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-09iio: accel: mma9551: Check gpiod_to_irq return valueRoberta Dobrescu1-1/+5
The return value of gpiod_to_irq should be checked before giving it to devm_request_threaded_irq in order to not pass an error code in case it fails. Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-02-22iio: improve usage of gpiod APIUwe Kleine-König1-5/+2
Since 39b2bbe3d715 (gpio: add flags argument to gpiod_get*() functions) which appeared in v3.17-rc1, the gpiod_get* functions take an additional parameter that allows to specify direction and initial value for outputs. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-27iio: accel: mma9551: split driver to expose mma955x apiIrina Tirdea1-439/+4
Freescale has the MMA955xL family of devices that use the same communication protocol (based on i2c messages): http://www.freescale.com/files/sensors/doc/data_sheet/MMA955xL.pdf. To support more devices from this family, we need to split the mma9551 driver so we can export the common functions that will be used by other mma955x drivers. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-27iio: accel: mma9551: Add runtime pm supportIrina Tirdea1-23/+139
Add support for runtime pm to reduce the power consumed by the device when not used. If CONFIG_PM is not enabled, the device will be powered on at init and only powered off on system suspend. If CONFIG_PM is enabled, runtime pm autosuspend is used: - for raw reads will keep the device on for a specified time - for events it will keep the device on as long as we have at least one event active Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-26iio: mma9551: fix sparse warningVlad Dogaru1-2/+4
sparse warnings: (new ones prefixed by >>) >> drivers/iio/accel/mma9551.c:554:57: sparse: mixing different enum types drivers/iio/accel/mma9551.c:554:57: int enum mma9551_tilt_axis versus drivers/iio/accel/mma9551.c:554:57: int enum mma9551_gpio_pin >> drivers/iio/accel/mma9551.c:576:57: sparse: mixing different enum types drivers/iio/accel/mma9551.c:576:57: int enum mma9551_tilt_axis versus drivers/iio/accel/mma9551.c:576:57: int enum mma9551_gpio_pin Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com> Reported-by: kbuild test robot <fengguang.wu@intel.com> Reviewed-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-12-12iio: add driver for Freescale MMA9551LVlad Dogaru1-0/+954
Add support for Freescale MMA9551L Intelligent Motion-Sensing Platform. The driver supports raw reads for acceleration and inclination, as well as configuring inclination rate-of-change events. The events can be used similarly to an Android sensor Tilt event. The specifications can be downloaded from: http://www.freescale.com/files/sensors/doc/ref_manual/MMA955xLSWRM.pdf Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Vlad Dogaru <vlad.dogaru@intel.com> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>