summaryrefslogtreecommitdiff
path: root/drivers/iio/accel/mma9553.c
AgeCommit message (Collapse)AuthorFilesLines
2015-07-23iio: fix drivers that consider 0 as a valid IRQ in client->irqOctavian Purdila1-1/+1
Since patch "i2c / ACPI: Use 0 to indicate that device does not have interrupt assigned" [1], 0 is not a valid i2c client irq anymore, so change all driver's checks accordingly. The same issue occurs when the device is instantiated via device tree with no IRQ, or from the i2c sysfs interface, even before the patch above. [1] http://lkml.kernel.org/g/<1430908148-201129-3-git-send-email-mika.westerberg@linux.intel.com> Signed-off-by: Octavian Purdila <octavian.purdila@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-14iio: accel: mma9553: document use of mutexIrina Tirdea1-0/+4
Fix checkpatch.pl --strict check: CHECK: struct mutex definition without comment + struct mutex mutex; Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-14iio: accel: mma9553: fix alignment issuesIrina Tirdea1-40/+36
Fix code alignment and wrap parameters. Fix issues reported by checkpatch.pl --strict. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Suggested-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-14iio: accel: mma9551_core: use size in words for word buffersIrina Tirdea1-3/+6
Change the prototype for the mma9551_read/write_*_words functions to receive the length of the buffer in words (instead of bytes) since we are using a word buffer. This will prevent users from sending an odd number of bytes for a word array. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-18Merge 4.1-rc4 into staging-nextGreg Kroah-Hartman1-8/+10
We want the fixes in here for testing and merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-04-26iio: accel: mma9553: fix gpio bitnum init valueIrina Tirdea1-1/+2
Initial value of gpio bitnum is set to -1, but the variable is declared as unsigned. Use a positive invalid value for initial gpio bitnum. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Suggested-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio: accel: mma9553: refactor mma9553_read_rawIrina Tirdea1-68/+33
Refactor code for simplicity and clarity. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Suggested-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio: accel: mma9553: prefix naming fixesIrina Tirdea1-7/+7
Add mma9553_ prefix to all local functions/declarations. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Suggested-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio: accel: mma9553: use GENMASKIrina Tirdea1-2/+2
Use GENMASK instead of BIT or direct value to define a mask. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Suggested-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio: accel: mma9553: comment and error message fixesIrina Tirdea1-9/+10
Use "GPIO" instead of "gpio" and "ACPI" instead of "acpi". Includes a couple of small style fixes in comments (missing full stop, whitespace, paranthesis). Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Suggested-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio: accel: mma9553: return 0 as indication of successIrina Tirdea1-1/+1
Use return 0 instead of return ret to mark clearly the success return path. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Suggested-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio: accel: mma9553: check for error in reading initial activity and stepcntIrina Tirdea1-3/+6
When configuring gpio, we need to read initial values for activity and step count. This function may fail due to i2c read errors. Check the error code returned by mma9553_read_activity_stepcnt and return the appropriate error in gpio config function. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reported-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio: accel: mma9553: check input value for activity periodIrina Tirdea1-0/+4
When setting the activity period, the value introduced by the user in sysfs is not checked for validity. Add a boundary check so that only allowed values are reported as successfully written to device. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reported-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio: accel: mma9553: add enable channel for activityIrina Tirdea1-1/+2
Add an enable channel for activity, so it can also be polled independently of events or other channels. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reported-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-26iio: accel: mma9553: fix endianness issue when reading statusIrina Tirdea1-7/+4
Refactor code for simplicity and clarity. This also fixes an endianness issue with the original code. When reading multiple registers, the received buffer of 16-bytes words is little endian (status, step count). On big endian machines, casting them to u32 would result in reversed order in the buffer (step count, status) leading to incorrect values for step count and activity. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reported-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-02-22iio: improve usage of gpiod APIUwe Kleine-König1-5/+1
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-30iio: add driver for Freescale MMA9553Irina Tirdea1-0/+1334
Add support for Freescale MMA9553L Intelligent Pedometer Platform. The following functionalities are supported: - step counter (counts the number of steps using a HW register) - step detector (generates an iio event at every step the user takes) - activity recognition (rest, walking, jogging, running) - speed - calories - distance To get accurate pedometer results, the user's height, weight and gender need to be configured. The specifications can be downloaded from: http://www.freescale.com/files/sensors/doc/ref_manual/MMA955xLSWRM.pdf http://www.freescale.com/files/sensors/doc/ref_manual/MMA9553LSWRM.pdf Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>