summaryrefslogtreecommitdiffstats
path: root/drivers/iio/magnetometer/ak8975.c
Commit message (Collapse)AuthorAgeFilesLines
* iio: magnetometer: ak8975: Add another ACPI IDAndy Shevchenko2017-12-021-0/+1
| | | | | | | Add new ACPI ID for ak9911 as had been found on prototype board. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio:magnetometer: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron2017-08-221-1/+0Star
| | | | | | | | | 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. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
* iio: magnetometer: Only declare ACPI table when ACPI is enableMatthias Kaehlcke2017-07-021-0/+2
| | | | | | | | | | | | | Don't inflate the kernel size with data that isn't used. The conditional declaration also fixes the following warning when building with clang: drivers/iio/magnetometer/ak8975.c:704:36: error: variable 'ak_acpi_match' is not needed and will not be emitted [-Werror,-Wunneeded-internal-declaration] Signed-off-by: Matthias Kaehlcke <mka@chromium.org> Acked-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* drivers: iio: magnetometer: Fix sparse endianness warnings cast to ↵Sandhya Bankar2016-09-271-7/+9
| | | | | | | | | | | | | | restricted __be16 Fix the following sparse endianness warnings: drivers/iio/magnetometer/ak8975.c:716:16: warning: cast to restricted __le16 drivers/iio/magnetometer/ak8975.c:837:19: warning: cast to restricted __le16 drivers/iio/magnetometer/ak8975.c:838:19: warning: cast to restricted __le16 drivers/iio/magnetometer/ak8975.c:839:19: warning: cast to restricted __le16 Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: magn: ak8975: deploy runtime and system PMLinus Walleij2016-06-301-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds runtime PM support to the AK8975 driver. It solves two problems: - After reading the first value the chip was left in MODE_ONCE, meaning (presumably) it may be consuming more power. Now the runtime PM hooks kick in and set it to POWER_DOWN. - Regulators were simply enabled and left on, making it impossible to turn the power consuming regulators off because of the increased refcount. We now disable the regulators at autosuspend. - We also handle system suspend: by using pm_runtime_force_suspend() and pm_runtime_force_resume() from the system PM sleep hooks, the runtime PM code is managing the power also for this case. It is currently not completely optimal: when the system resumes the AK8975 goes into active mode even if noone is going to use it: currently the force calls need to be paired, but the runtime PM people are working on making it possible to leave devices runtime suspended when coming back from sleep. Inspired by my work on the BH1780 light sensor driver. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: magn: ak8975: make sure to power down at remove()Linus Walleij2016-06-301-0/+1
| | | | | | | | | | The code was not powering the magnetometer down properly at remove(): just cutting the regulators without first setting the device in power off mode. Fix this. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: magn: ak8975: allow a delay after enabling regulatorsLinus Walleij2016-06-301-0/+6
| | | | | | | | The datasheet actually specifies that we need to wait atleast 500us after powering on the device before trying to set mode. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: magn: ak8975: refactor regulator handlersLinus Walleij2016-06-301-25/+18Star
| | | | | | | | | Move the regulator_get() calls directly into the probe() function, keep only the power_on()/power_off() functions to flick the regulators on/off. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: magn: ak8975: add Vid regulatorLinus Walleij2016-06-301-0/+15
| | | | | | | | | | | | | | | The AK8975 has two power sources: Vdd (analog voltage supply) and Vid (digital voltage supply). Optionally also obtain the Vid supply regulator and enable it. If an error occurs when enabling one of the regulators: bail out. Cc: Gregor Boirie <gregor.boirie@parrot.com> Cc: Richard Leitner <dev@g0hl1n.net> Cc: Krzysztof Kozlowski <k.kozlowski@samsung.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: magn: ak8975: fix regulator usageLinus Walleij2016-06-301-9/+7Star
| | | | | | | | | | | | | | | | | | | | | | IS_ERR_OR_NULL() should never be used with regulators because a NULL pointer may be a perfectly valid dummy regulator We should always succeed to fetch and enable a regulator, but it may be a dummy. That is fine, so bail out for any real errors or probe deferrals Include the error code in the warning print so we know what kind of problem we're dealing with (for example it is nice to see if it is a probe deferral). As we will bail out of probe if the regulator is erroneous, just issue regulator_disable() on the poweroff path: it will succeed. Cc: Mark Brown <broonie@kernel.org> Cc: Lars-Peter Clausen Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:core: timestamping clock selection supportGregor Boirie2016-06-301-1/+2
| | | | | | | | | | | | | | | 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>
* Merge tag 'iio-for-4.8a' of ↵Greg Kroah-Hartman2016-06-091-8/+12
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First round of IIO new device support, features and cleanups for the 4.8 cycle. New device support * ads1015 - add ads1115 support * bma220 accelerometer - new driver - triggered buffer support. * bmc150 - add bmm150 support. * bmp280 - bme280 support with addition of humidity channel. * max5487 potentiometer - new driver * MMA7660FC accelerometer. - New driver * st-pressure - support for the lps22hb * loop trigger. - This one is *nasty* but we have real applications (parrot drones) where it is useful. The trigger basically spins as hard as it can firing off a new trigger each time all triggered devices come back to say they are done. It doesn't hang a machine even when doing it on a dummy driver. A lot nicer than having this implemented within lots of device drivers anyway. Core stuff * Add support to create IIO devices via configfs (similar to we did for triggers a while back) + docs. * New channel types - IIO_ELECTRICAL_CONDUCTIVITY * Couple of MAINTAINERS patches to list the device tree bindings. * Make trigger ops structure non optional (comment fix). It hasn't been for an awful long time, but that's not what the description said. New features * ak8975 - support adapters that are limited to byte data only by allowing the emulated block read i2c function that was recently introduced. * atlas-ph - support atlas-ec (electrical conductivity sensor) * bmi160 - add available frequency and scale attributes to make the driver more user friendly (and avoid having to read the datasheet to know what will work). * dummy - move creation to configfs interface. It's not real hardware so we are not that worried about the ABI breakage ;) * mma8452 - oversampling ration support * nau7802 - expose available gains to make life easier for userspace. * st-sensors - allow use of emulation for SMBus block reads as all the st parts support it. * ti-ads1015 - list datasheet names to allow their use by inkernel consumers. * Various module alias additions to help auto probing. Drop one redundant one as well. Cleanups * ad7266, ad7476, ad7887, ad7923, ad799x - use direct mode claim function rather than open coding it during sensor read (prevents switching on buffers mid read). * ad7793, ad7791 - use direct mode claim to prevent frequency changes when buffers running. * afe440x - These are ABI breaking but the driver requires custom userspace code to do anything useful anyway and that is still being written and under control of TI. Ultimately we may have other libraries to do pulse oximetry with these devices but we aren't aware of any yet. - kernel-doc format fixes - drop ifdef fun around of_match_ptr - it's not worth the mess to save a tiny amount of space. - drop some unnecessary register initializations. - drop the weird locked gain modes as they gain us nothing (can just set all gains separately). - remove handling of offset attributes seeing as no channels actually have them (oops) - Drop the LED3 input channel as it's an alias for ALED2. - *big one* remove channel names - an experiment that turned out to not make sense - see patch for details. - use regmap fields to clean up code. - tie the tia gain stages to appropriate channels in the ABI as that is what they really effect. Same with the LED currents. - cleanout some unused defines and fix a missnamed one. * atlas-ph - reorganise to allow support of other similar parts. * bmc150 - document supported chips in kconfig help. * jsa1212 - drop an unneeded i2c functionality check for functionality the driver doesn't use. * mxs-lradc - simply touch screen registration code. - remove the touch screen unregister as all devm based now. - disable only those channels that are masked in hardware stop (others are already dealt with elsewhere) * st-sensors - unexport st_sensors_get_buffer_element as nothing outside the st-sensors core driver uses it. - fix handling of failure to start up regulators. * tpl0102 - drop an i2c functionality test for features that aren't needed. * ti-am335x - use variable name rather than type in sizeof for clarity. - use SIMPLE_DEV_PM_OPS helper macro to tidy up a bit. Tools * Add install / uninstall to makefile. Someone cares, so presumably some people will find it useful! * generic_buffer - rename to iio_generic_buffer to line up with other tools. - handle cleanup when receiving signals - Add a --device-num option and a --trigger-num option rather than relying on naming which doesn't work if you have two of the same part.
| * iio: ak8975: Support adapters limited to BYTE_DATACrestez Dan Leonard2016-05-011-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | The device has simple 8-bit registers but the driver incorrectly uses block or word reads without checking functionality bits. Fix by using i2c_smbus_read_i2c_block_data_or_emulated instead of i2c_smbus_read_i2c_block_data or i2c_smbus_read_word_data. This will check functionality bits and use the fastest available transfer method. Signed-off-by: Crestez Dan Leonard <leonard.crestez@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | Merge 4.6-rc7 into staging-nextGreg Kroah-Hartman2016-05-091-3/+3
|\ \ | |/ |/| | | | | | | | | This fixes some merge issues with some iio drivers that were found in linux-next. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * iio: ak8975: fix maybe-uninitialized warningRichard Leitner2016-04-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If i2c_device_id *id is NULL and acpi_match_device returns NULL too, then chipset may be unitialized when accessing &ak_def_array[chipset] in ak8975_probe. Therefore initialize chipset to AK_MAX_TYPE, which will return an error when not changed. This patch fixes the following maybe-uninitialized warning: drivers/iio/magnetometer/ak8975.c: In function ‘ak8975_probe’: drivers/iio/magnetometer/ak8975.c:788:14: warning: ‘chipset’ may be used uninitialized in this function [-Wmaybe-uninitialized] data->def = &ak_def_array[chipset]; Signed-off-by: Richard Leitner <dev@g0hl1n.net> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: ak8975: Fix NULL pointer exception on early interruptKrzysztof Kozlowski2016-04-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In certain probe conditions the interrupt came right after registering the handler causing a NULL pointer exception because of uninitialized waitqueue: $ udevadm trigger i2c-gpio i2c-gpio-1: using pins 143 (SDA) and 144 (SCL) i2c-gpio i2c-gpio-3: using pins 53 (SDA) and 52 (SCL) Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = e8b38000 [00000000] *pgd=00000000 Internal error: Oops: 5 [#1] SMP ARM Modules linked in: snd_soc_i2s(+) i2c_gpio(+) snd_soc_idma snd_soc_s3c_dma snd_soc_core snd_pcm_dmaengine snd_pcm snd_timer snd soundcore ac97_bus spi_s3c64xx pwm_samsung dwc2 exynos_adc phy_exynos_usb2 exynosdrm exynos_rng rng_core rtc_s3c CPU: 0 PID: 717 Comm: data-provider-m Not tainted 4.6.0-rc1-next-20160401-00011-g1b8d87473b9e-dirty #101 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) (...) (__wake_up_common) from [<c0379624>] (__wake_up+0x38/0x4c) (__wake_up) from [<c0a41d30>] (ak8975_irq_handler+0x28/0x30) (ak8975_irq_handler) from [<c0386720>] (handle_irq_event_percpu+0x88/0x140) (handle_irq_event_percpu) from [<c038681c>] (handle_irq_event+0x44/0x68) (handle_irq_event) from [<c0389c40>] (handle_edge_irq+0xf0/0x19c) (handle_edge_irq) from [<c0385e04>] (generic_handle_irq+0x24/0x34) (generic_handle_irq) from [<c05ee360>] (exynos_eint_gpio_irq+0x50/0x68) (exynos_eint_gpio_irq) from [<c0386720>] (handle_irq_event_percpu+0x88/0x140) (handle_irq_event_percpu) from [<c038681c>] (handle_irq_event+0x44/0x68) (handle_irq_event) from [<c0389a70>] (handle_fasteoi_irq+0xb4/0x194) (handle_fasteoi_irq) from [<c0385e04>] (generic_handle_irq+0x24/0x34) (generic_handle_irq) from [<c03860b4>] (__handle_domain_irq+0x5c/0xb4) (__handle_domain_irq) from [<c0301774>] (gic_handle_irq+0x54/0x94) (gic_handle_irq) from [<c030c910>] (__irq_usr+0x50/0x80) The bug was reproduced on exynos4412-trats2 (with a max77693 device also using i2c-gpio) after building max77693 as a module. Cc: <stable@vger.kernel.org> Fixes: 94a6d5cf7caa ("iio:ak8975 Implement data ready interrupt handling") Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Tested-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:ak8975: add mounting matrix supportGregor Boirie2016-04-231-4/+30
| | | | | | | | | | | | | | | | | | | | | | Expose a rotation matrix to indicate userspace the chip orientation with respect to the overall hardware system. Matrix is retrieved from "in_mount_matrix". It is declared into ak8975 DTS entry as a "mount-matrix" property. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: magnetometer: ak8975: put else and brace at the same lineSlawomir Stepien2016-04-161-2/+1Star
| | | | | | | | | | | | | | | | | | This fixes the error reported by checkpatch.pl: ERROR: else should follow close brace '}' Signed-off-by: Slawomir Stepien <sst@poczta.fm> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:magnetometer:ak8975: triggered buffer supportGregor Boirie2016-04-101-25/+110
| | | | | | | | | | | | | | | | This will be used together with an external trigger (e.g hrtimer based software trigger). Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:magnetometer:ak8975: fix missing regulator_disableGregor Boirie2016-03-201-18/+60
| | | | | | | | | | | | | | | | Ensure optional regulator is properly disabled when present. Fixes: 63d5d525cbbc ("iio:magnetometer:ak8975: power regulator support") Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:magnetometer:ak8975: power regulator supportGregor Boirie2016-03-051-0/+16
| | | | | | | | | | | | | | | | | | Add support for an optional regulator which, if found into device-tree, will power on device at probing time. The regulator is declared into ak8975 DTS entry as a "vdd-supply" property. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:magnetometer:ak8975: remove unused fieldGregor Boirie2016-03-051-1/+0Star
| | | | | | | | | | | | | | Remove unused struct ak8975_data attrs field. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio:magnetometer:ak8975: fix uninitialized chipsetGregor Boirie2016-03-051-1/+4
|/ | | | | | | | | ak_def_array bounds are not properly checked in case of ACPI matching failure. GCC warns with the following message at line 799: ‘chipset’ may be used uninitialized in this function. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: ak8975: constify ak_def structuresJulia Lawall2016-01-101-2/+2
| | | | | | | | | The ak_def structures are never modified, so declare them as const. Done with the help of Coccinelle. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: magnetometer: ak8975: Add AK8963Srinivas Pandruvada2015-01-271-0/+1
| | | | | | | | Added AK8963 in the id table. Unfortunately some commercial devices using caps version ak8963. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: ak8975: add ak09911 and ak09912 supportGwendal Grignou2014-12-121-16/+180
| | | | | | | | | | | Add 2 new definition entries to support ak0991x compass. Add a more advanced function to check we are dealing with the expected device. Remove standalone driver for ak09911. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Tested-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: ak8975: add definition structure per compass typeGwendal Grignou2014-12-121-95/+186
| | | | | | | | | | | | For each type of compass supported (AK8975 and AK8963), add a definition structure for register masks, important registers, raw data interpretation. This change will make integrating new type of devices easier. Remove i2c register cache. It is only used for one single register. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: ak8975: minor fixesGwendal Grignou2014-11-221-21/+14Star
| | | | | | | | | Fixes code duplication, return of function. Check client->irq properly when setting up optional irq handler. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: magn: ak8975: fix unnecessary casting between char* and const char*Irina Tirdea2014-09-141-5/+5
| | | | | | | Use const char* instead of casting const char* to char*. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Merge tag 'iio-for-3.17b' of ↵Greg Kroah-Hartman2014-06-291-44/+14Star
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Second round of new drivers and cleanups for IIO in the 3.17 cycle. New drivers * mcp4902, mcp4912 and mcp4922 SPI DAC driver. * max1027, max1029 and max1031 SPI ADC driver. Cleanups * cm32181 - use devm APIs to simplify error paths. * ak8975 - use devm APIs to simplify error paths. * ad9850 - drop some unused defines and an unnecessary goto. * hmc5843 - add missing devices to the device id table and the documentation. * ad9832 - small formatting cleanups. * sca3000 - hide direct use of the stufftoread element by adding a data_available function. This is a precursor for the addition of buffer watermarks to the subsystem but stands as a good cleanup on its own.
| * iio: magnetometer: ak8975: Use devm_* APIsBeomho Seo2014-06-291-44/+14Star
| | | | | | | | | | | | | | This patch use devm_* APIs make driver simpler. Signed-off-by: Beomho Seo <beomho.seo@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | Merge tag 'iio-fixes-for-3.16a' of ↵Greg Kroah-Hartman2014-06-181-8/+1Star
|\ \ | |/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus Jonathan writes: First set of IIO fixes for the 3.16 cycle. A mixed bag of fixes, many of which feel just to late for 3.15. * hid sensors - some devices need a feature report request in order to change power state. This isn't part of the spec, but has been observed on several devices and does no harm to others. * mpl3115 has had two errors in the buffer description fixed. The presure is signed, not unsigned and the temperature has 12 bits rather than 16. These could lead to incorrect interpretation of the data in userspace. * tsl2x7x - the high byte of the proximity thresholds should be written along with the low byte (which was). This could lead to interesting results with large thresholds. * twl4030 - a flag to specify processed values were required was not set when initializing a reading. As such values returned were in an unknown state. Fixed by simply initializing it appropriately. * IIO_SIMPLE_DUMMY_BUFFER did not select IIO_BUFFER leading to randconfig build errors. * ak8975 was applying an unwanted le16_to_cpu conversion as the i2c framework already performs one. As such for big endian systems, the bytes would be in the wrong order in the magnetic field measurements reported. * mxs-lradc - the controllable voltage dividers were not enabled / disabled for later channels than the first one during conversion. * at91_adc error handling returned -ENOMEM in a u8. Return value of at91_adc_get_trigger_value_by_name changed to int thus allowing -ENOMEM and also original values to be returned. * mcb - mcb_request_mem returns and ERR_PTR but the caller was checking for NULL to detect an error.
| * iio: Fix endianness issue in ak8975_read_axis()Peter Meerwald2014-06-071-8/+1Star
| | | | | | | | | | | | | | | | | | i2c_smbus_read_word_data() does host endian conversion already, no need for le16_to_cpu() Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Stable@vger.kernel.org
* | iio: ak8975: Fix issue with the nameSrinivas Pandruvada2014-05-031-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixing issue caused by clash of two patches, one adding a name with the acpi enumeration patch. 54ab3e24 Beomho Seo 2014-04-02 @572 indio_dev->name = id->name; d913971e Srinivas Pandruvada 2014-03-19 574 indio_dev->name = name; The name added by commit 54ab3e24 is not required as this is already added by taking care of case where id is NULL. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reported-by: kbuild test robot <fengguang.wu@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: ak8975: Added ACPI enumerationSrinivas Pandruvada2014-03-291-3/+37
| | | | | | | | | | | | | | Added capability so that this device can be enumerated via ACPI. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: ak8975 : Add AK8963 compatibility mode supportSrinivas Pandruvada2014-03-221-5/+29
|/ | | | | | | | | | AK8963 and AK8975 use same register definitions, except the range of X,Y,Z values. Added support of 8963 based on i2c_device_id. Unfortunately there is no way to detect the type via registers, both device registers return 0x48 as id of chipset. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Merge tag 'iio-for-3.15a' of ↵Greg Kroah-Hartman2014-02-111-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: First set of new drivers and cleanups for IIO in the 3.15 cycle. New drivers: * si7005 relative humidity and temperature sensor * Lite-on ltr501 ambient light and proximity sensor Cleanups * Clean up some dead comments in max1363 * Drop some obsolete variables in adjd_s311 and tcs3472 left over from the introduction of iio_push_to_buffers_with_timestamp. * Drop some unneeded linux/init.h includes * Squish a sparse warning in mpl3115 by correctly specifying a be32 variable. * A number of cleanups and fixes for sca3000 * Drop an unneed checks in mxs-lradc, ad7303 and adis16400. * Drop a platform_set_drvdata in viperboard after the only use of it was removed during a devm conversion. * Add a missing device name for ak8975 to comply with the ABI. * Put mpu6050 into the IMU menu as it slipped out into the main menu. * Fix a typo and some comment formatting in mpu6050. * Document at91 ADC clock properties.
| * iio: ak8975: Add device nameBeomho Seo2014-02-081-0/+1
| | | | | | | | | | | | | | This patch add device name. Signed-off-by: Beomho Seo <beomho.seo@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: ak8975: Fix calculation formula for convert micro tesla to gauss unitBeomho Seo2014-02-081-7/+9
|/ | | | | | | | | | | | | | This effects the reported scale of the raw values, and thus userspace applications that use this value. One micro tesla equal 0.01 gauss. So I have fixed calculation formula And add RAW_TO_GAUSS macro. ASA is in the range of 0 to 255. If multiply 0.003, calculation result(in_magn_[*]_scale) is always 0. So multiply 3000 and return and IIO_VAL_INT_PLUS_MICRO. As a result, read_raw call back function return accurate scale value. Signed-off-by: Beomho Seo <beomho.seo@samsung.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: Correct description how to convert microtesla to gaussPeter Meerwald2013-10-201-1/+1
| | | | | | | | | | this just fixes the comment; however, I'm not sure if the driver reports measurements correctly; the raw values are 0.3 uT / LSB; IIO is supposed to report magnetic fields in Gauss, so the scale should be around 1/300 (ignoring ASA) -- but value and scale are returned as VAL_INT Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:ak8975 Implement data ready interrupt handlingJacek Anaszewski2013-05-221-2/+89
| | | | | | | | | | Implement "data ready" interrupt handling in addition to the two existing read modes - DRDY GPIO polling and ST1 register DRDY bit polling. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:ak8975 Add support for gpios DT propertyJacek Anaszewski2013-05-221-3/+9
| | | | | | | | | | Add support for parsing 'gpios' property when initializing from oftree. This patch adds also the binding documentation file. Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:magnetometer:ak8975 move driver out of stagingJonathan Cameron2013-04-021-0/+485
Issues raised in last series to propose this have now been resolved so there should be no reason this driver cannot graduate from staging. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Laxman Dewangan <ldewangan@nvidia.com>