aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/max1363.c
AgeCommit message (Collapse)Author
2019-06-19treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500Thomas Gleixner
Based on 2 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation this program is free software you can redistribute it and or modify it under the terms of the gnu general public license version 2 as published by the free software foundation # extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 4122 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Reviewed-by: Allison Randal <allison@lohutok.net> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-07-08iio: adc: max1363: merge calls to of_match_device and of_device_get_match_dataJulia Lawall
Drop call to of_match_device, which is subsumed by the subsequent call to of_device_get_match_data. The code becomes simpler, and a temporary variable can be dropped. The semantic match that makes this change is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ local idexpression match; identifier i; expression x, dev, e, e1; @@ - match@i = of_match_device(x, dev); - if (match) e = of_device_get_match_data(dev); - else e = e1; + e = of_device_get_match_data(dev); + if (!e) e = e1; @@ identifier r.i; @@ - const struct of_device_id *i; ... when != i // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-06-12treewide: devm_kzalloc() -> devm_kcalloc()Kees Cook
The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc(). This patch replaces cases of: devm_kzalloc(handle, a * b, gfp) with: devm_kcalloc(handle, a * b, gfp) as well as handling cases of: devm_kzalloc(handle, a * b * c, gfp) with: devm_kzalloc(handle, array3_size(a, b, c), gfp) as it's slightly less ugly than: devm_kcalloc(handle, array_size(a, b), c, gfp) This does, however, attempt to ignore constant size factors like: devm_kzalloc(handle, 4 * 1024, gfp) though any constants defined via macros get caught up in the conversion. Any factors with a sizeof() of "unsigned char", "char", and "u8" were dropped, since they're redundant. Some manual whitespace fixes were needed in this patch, as Coccinelle really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...". The Coccinelle script used for this was: // Fix redundant parens around sizeof(). @@ expression HANDLE; type TYPE; expression THING, E; @@ ( devm_kzalloc(HANDLE, - (sizeof(TYPE)) * E + sizeof(TYPE) * E , ...) | devm_kzalloc(HANDLE, - (sizeof(THING)) * E + sizeof(THING) * E , ...) ) // Drop single-byte sizes and redundant parens. @@ expression HANDLE; expression COUNT; typedef u8; typedef __u8; @@ ( devm_kzalloc(HANDLE, - sizeof(u8) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(__u8) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(char) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(unsigned char) * (COUNT) + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(u8) * COUNT + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(__u8) * COUNT + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(char) * COUNT + COUNT , ...) | devm_kzalloc(HANDLE, - sizeof(unsigned char) * COUNT + COUNT , ...) ) // 2-factor product with sizeof(type/expression) and identifier or constant. @@ expression HANDLE; type TYPE; expression THING; identifier COUNT_ID; constant COUNT_CONST; @@ ( - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * (COUNT_ID) + COUNT_ID, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * COUNT_ID + COUNT_ID, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * (COUNT_CONST) + COUNT_CONST, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * COUNT_CONST + COUNT_CONST, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * (COUNT_ID) + COUNT_ID, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * COUNT_ID + COUNT_ID, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * (COUNT_CONST) + COUNT_CONST, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * COUNT_CONST + COUNT_CONST, sizeof(THING) , ...) ) // 2-factor product, only identifiers. @@ expression HANDLE; identifier SIZE, COUNT; @@ - devm_kzalloc + devm_kcalloc (HANDLE, - SIZE * COUNT + COUNT, SIZE , ...) // 3-factor product with 1 sizeof(type) or sizeof(expression), with // redundant parens removed. @@ expression HANDLE; expression THING; identifier STRIDE, COUNT; type TYPE; @@ ( devm_kzalloc(HANDLE, - sizeof(TYPE) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(TYPE)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * (COUNT) * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * (COUNT) * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * COUNT * (STRIDE) + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING) * COUNT * STRIDE + array3_size(COUNT, STRIDE, sizeof(THING)) , ...) ) // 3-factor product with 2 sizeof(variable), with redundant parens removed. @@ expression HANDLE; expression THING1, THING2; identifier COUNT; type TYPE1, TYPE2; @@ ( devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(TYPE2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | devm_kzalloc(HANDLE, - sizeof(THING1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(THING1), sizeof(THING2)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(THING2) * COUNT + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) | devm_kzalloc(HANDLE, - sizeof(TYPE1) * sizeof(THING2) * (COUNT) + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2)) , ...) ) // 3-factor product, only identifiers, with redundant parens removed. @@ expression HANDLE; identifier STRIDE, SIZE, COUNT; @@ ( devm_kzalloc(HANDLE, - (COUNT) * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - (COUNT) * (STRIDE) * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - (COUNT) * STRIDE * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - (COUNT) * (STRIDE) * (SIZE) + array3_size(COUNT, STRIDE, SIZE) , ...) | devm_kzalloc(HANDLE, - COUNT * STRIDE * SIZE + array3_size(COUNT, STRIDE, SIZE) , ...) ) // Any remaining multi-factor products, first at least 3-factor products, // when they're not all constants... @@ expression HANDLE; expression E1, E2, E3; constant C1, C2, C3; @@ ( devm_kzalloc(HANDLE, C1 * C2 * C3, ...) | devm_kzalloc(HANDLE, - (E1) * E2 * E3 + array3_size(E1, E2, E3) , ...) | devm_kzalloc(HANDLE, - (E1) * (E2) * E3 + array3_size(E1, E2, E3) , ...) | devm_kzalloc(HANDLE, - (E1) * (E2) * (E3) + array3_size(E1, E2, E3) , ...) | devm_kzalloc(HANDLE, - E1 * E2 * E3 + array3_size(E1, E2, E3) , ...) ) // And then all remaining 2 factors products when they're not all constants, // keeping sizeof() as the second factor argument. @@ expression HANDLE; expression THING, E1, E2; type TYPE; constant C1, C2, C3; @@ ( devm_kzalloc(HANDLE, sizeof(THING) * C2, ...) | devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...) | devm_kzalloc(HANDLE, C1 * C2 * C3, ...) | devm_kzalloc(HANDLE, C1 * C2, ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * (E2) + E2, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(TYPE) * E2 + E2, sizeof(TYPE) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * (E2) + E2, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - sizeof(THING) * E2 + E2, sizeof(THING) , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - (E1) * E2 + E1, E2 , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - (E1) * (E2) + E1, E2 , ...) | - devm_kzalloc + devm_kcalloc (HANDLE, - E1 * E2 + E1, E2 , ...) ) Signed-off-by: Kees Cook <keescook@chromium.org>
2017-08-22iio:adc: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron
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>
2017-03-29iio: adc: max1363: constify attribute_group structuressimran singhal
Check for attribute_group structures that are only stored in the event_attrs filed of iio_info structure. As the event_attrs field of iio_info structures is constant, so these attribute_group structures can also be declared constant. Done using coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct attribute_group i@p = {...}; @ok1@ identifier r1.i; position p; struct iio_info x; @@ x.event_attrs=&i@p; @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct attribute_group i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct attribute_group i; File size before: text data bss dec hex filename 36951 448 0 37399 9217 drivers/iio/adc/max1363.o File size after: text data bss dec hex filename 37015 384 0 37399 9217 drivers/iio/adc/max1363.o Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-22iio: adc: max1363: Export OF device ID table as module aliasesJavier Martinez Canillas
The I2C core always reports a MODALIAS of the form i2c:<foo> even if the device was registered via OF, this means that exporting the OF device ID table device aliases in the module is not needed. But in order to change how the core reports modaliases to user-space, it's better to export it. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-03iio: adc: add missing of_node references to iio_devMatt Ranostay
Adding missing indio_dev->dev.of_node references to allow iio consumers to access the device channels. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-07-03iio: adc: max1363: Add device tree bindingFlorian Vaussard
This patch adds the necessary device tree binding to allow DT probing of currently supported parts. Signed-off-by: Florian Vaussard <florian.vaussard@heig-vd.ch> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-06-30iio:core: timestamping clock selection supportGregor Boirie
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>
2016-03-20iio: adc: max1363: correct reference voltageStefan Eichenberger
Swap max11644/max11645 and max 11646/max11647 reference voltages according to datasheet. Signed-off-by: Stefan Eichenberger <stefan.eichenberger@netmodule.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-03-20iio: adc: max1363: add missing adc to max1363_idStefan Eichenberger
max11644-max11647 had an enum value but were not added to the max1363_id, so they where not selectable in the devictree. Signed-off-by: Stefan Eichenberger <stefan.eichenberger@netmodule.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-09-30iio: adc: max1363: leave sysfs naming to the coreMartin Kepplinger
This shouldn't actually change anything since the core calls the events sysfs folder "events" anyways. Signed-off-by: Martin Kepplinger <martink@posteo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-25iio:adc:max1363 incorrect resolutions for max11604, max11605, max11610 and ↵Jonathan Cameron
max11611. Cc: Stable@vger.kernel.org> Reported-by: Erik Habbinga <Erik.Habbinga@schneider-electric.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Acked-by: Hartmut Knaack <knaack.h@gmx.de>
2014-02-18iio:max1363 fix typos of int_vref_mvHartmut Knaack
This patch fixes some typos in max1363_chip_info_tbl[]. Signed-off-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-02-11Merge tag 'iio-for-3.15a' of ↵Greg Kroah-Hartman
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.
2014-02-08iio: max1363: Use devm_regulator_get_optional for optional regulatorGuenter Roeck
In kernel version 3.13, devm_regulator_get() may return no error if a regulator is undeclared. regulator_get_voltage() will return -EINVAL if this happens. This causes the driver to fail loading if the vref regulator is not declared. Since vref is optional, call devm_regulator_get_optional instead. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Cc: Stable@vger.kernel.org Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-01-11iio:adc:max1363 clear list of missing featuresVivien Didelot
Remove "Control of internal reference" from the list of unimplemented features, since as of commit a405b00, external reference is supported if the device has a regulator and falls back to internal if it doesn't. While we are modifying the header, let's make it more concise and remove a redundant filename. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-12-08iio: Remove support for the legacy event config interfaceLars-Peter Clausen
Now that all drivers have been converted to the new event config interface we can remove for the legacy event config interface. Also drop the '_new' suffix for the event config interface callbacks, since those are the only callbacks now. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-20iio:adc:max1363 support SMBus for 8-bit devicesVivien Didelot
The driver currently supports only I2C access. But supported devices with an accuracy of 8-bit are compatible with the SMBus byte access routines. This patch wraps the send and receive routines depending on the chip accuracy and fonctionnalities of its adapter. For instance, this allows us to use a MAX11603 on a ICH7 controller. This patch also simplifies the max1363_write_basic_config() routine to use the struct max1363_state fields directly. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-12iio:max1363: Switch to new event config interfaceLars-Peter Clausen
Switch the max1363 driver to the new IIO event config interface as the old one is going to be removed. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-10-01iio:max1363: Report scale as fractional valueLars-Peter Clausen
Move the complexity of calculating the fixed point scale to the core. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-21iio:max1363: Use iio_push_to_buffers_with_timestamp()Lars-Peter Clausen
Makes the code a bit shorter and less ugly. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-09-16iio:max1361: Use default triggered buffer setup opsLars-Peter Clausen
The max1361 driver uses the same callbacks as the triggered buffer default buffer setup ops, so just remove the max1361 specific ops and let it use the default ops. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-08-03iio: max1363: Use devm_iio_device_allocSachin Kamat
Using devm_iio_device_alloc makes code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-06-04iio: replace strict_strtoul() with kstrtoul()Jingoo Han
The usage of strict_strtoul() is not preferred, because strict_strtoul() is obsolete. Thus, kstrtoul() should be used. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-03-17iio:adc:max1363 move to info_mask_(shared_by_type/separate)Jonathan Cameron
The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-06iio/adc: (max1363) Add support for external reference voltageGuenter Roeck
Implement external reference voltage as regulator named "vref". Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-06iio: max1363: Use devm_ functions whereever possible to allocate resourcesGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-05Merge tag 'iio-for-3.9c' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: "Third set of IIO new drivers, cleanups and fixes for the 3.9 cycle New drivers 1) A driver for ST microelectronics sensors. This driver already covers a large set of new parts (20 gyros, accelerometer and magnetometers) not currently covered by the existing drivers. The intent moving forward is to merge this with the other drivers for similar parts already in tree. The lis3l02dq driver currently in staging/iio will be trivial, the lis3 driver in misc more complex as it has a number of additional interfaces. Any merging in of the lis3 driver will rely on the not currently merged iio_input bridge driver and handling of freefall notifications etc. 2) A driver for the itg3200 gyroscope. Graduations from staging 1) Cleanup and move out of staging of the adxrs450 gyroscope driver. The cleanup required was all minor but there were a couple of fixes hidden in there. Core and driver additions 1) Initial work from Guenter Roeck on device tree support for IIO's provider/ consumer code. Focuses on the iio_hwmon driver and the max1363 adc driver. The full device tree syntax is currently under discussion but should follow shortly. Cleanups and fixes 1) Remove a noop function __iio_update_buffer 2) Couple of small fixes and cleanups for the max1363 "
2013-02-02iio:max1363 remove some functions left after mergeJonathan Cameron
merge commit 17cb3be61b45d716f6b21a9380925493413ce0ed seems to have resulted in two functions that were removed in 4389fbec5b8fd0577c1e854ff5d7139329558c20 reappearing. Spotted due to a build kicking out drivers/iio/adc/max1363.c:1486:12: warning: 'max1363_register_buffered_funcs_and_init' defined but not used drivers/iio/adc/max1363.c:1521:13: warning: 'max1363_buffer_cleanup' defined but not used This patch just removes them again. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-02iio: Simplify iio_map_array_unregister APIGuenter Roeck
Instead of requiring the map to unregister, simply unregister all map entries associated with the given iio device. This simplifies map removal and also works for maps generated through devicetree. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-02iio/adc: (max1363) Fix data conversion problemsGuenter Roeck
For chips with more than 8 bit ADC resolution, received data was always masked against 0xfff, ie with a 12 bit mask. This can result in bad data for chips with 10 bit resolution if those chips have higher bits set (seen with MAX1139). The receive buffer was defined as char array. This could result in unintentional sign extensions if the upper bit in a received byte was set. Since the chip is configured for unipolar mode, we never have to handle negative values, and sign extensions are never needed. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-02iio/adc: (max1363) Remove duplicate codeGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-02iio/adc: (max1363) Provide OF node information to iio deviceGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-25Merge 3.8-rc5 into staging-nextGreg Kroah-Hartman
This resolves a merge issue with a iio driver, and the zram code. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-14Merge tag 'staging-3.8-rc3' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging Pull staging fixes from Greg Kroah-Hartman: "Here are a number of small fixes to staging drivers for your 3.8-rc3 tree. Well, the omapdrm fixes aren't really "small" but they were waiting on a number of other drm patches to go in through the drm tree, and got delayed by my vacation over the holidays. They are totally self-contained, everyone involved have acked them, and they fix issues that people have been having with the driver. Other than that one, it's a bunch of tiny bugfixes for a number of reported issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>" * tag 'staging-3.8-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (36 commits) staging: zram: fix invalid memory references during disk write staging: tidspbridge: use prepare/unprepare on dsp clocks staging: tidspbridge: Fix build breakage due to splitting CM functions. staging: comedi: comedi_test: fix race when cancelling command staging: comedi: Kconfig: COMEDI_NI_AT_A2150 should select COMEDI_FC staging: comedi: prevent auto-unconfig of manually configured devices staging: comedi: fix minimum AO period for NI 625x and NI 628x staging: vme_pio2: fix oops on module unloading staging: speakup: avoid out-of-range access in synth_add() staging: speakup: avoid out-of-range access in synth_init() staging: rtl8192e: Fix failure to check pci_map_single() staging: rtl8187se: Fix failure to check pci_map_single() staging: drm/imx: fix double free bug in error path staging: drm/imx: several bug fixes staging: drm/imx: check return value of ipu_reset() staging: drm/omap: fix flags in dma buf exporting staging: drm/omap: use omapdss low level API staging/fwserial: Update TODO file per reviewer comments staging/fwserial: Limit tx/rx to 1394-2008 spec maximum staging/fwserial: Refine Kconfig help text ...
2013-01-07Merge branch 'staging-linus' into staging-nextGreg Kroah-Hartman
This is to get the comedi fixes, and resolve the issue in comdi_test.c and comedi_fops.c that were caused by changes in both branches. It also allows the fwserial driver changes to be applied, as they required the fixes that are in staging-linus. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-03Drivers: iio: remove __dev* attributes.Greg Kroah-Hartman
CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <wfp5p@virginia.edu> Cc: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-01iio: max1363 comment and whitespace fixesPeter Meerwald
Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-01iio: cleanup buffer setup code in max1363 driverPeter Meerwald
use iio_triggered_buffer_setup(), iio_triggered_buffer_cleanup() Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-12-27iio: (max1363) Fix probe error pathGuenter Roeck
Instantiating the driver with no available regulator results in: [39711.686393] i2c i2c-7: new_device: Instantiated device max1139 at 0x35 [39711.688687] BUG: unable to handle kernel paging request at fffffffffffffe13 [39711.688734] IP: [<ffffffff813e835b>] regulator_disable+0x1b/0x80 [39711.688788] PGD 1c0e067 PUD 1c0f067 PMD 0 [39711.688835] Oops: 0000 [#1] SMP Caused by bad probe error path. Fix it. Driver should also not attempt to free the interrupt in its error path if none was allocated. Fix that problem as well. Finally, testing if the regulator was allocated is not necessary in the remove function, since the probe function bails out if this is the case. Remove that check. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2012-11-10iio:adc:max1363 move from staging.Jonathan Cameron
Now this driver is using kfifo we can move it out of staging. Signed-off-by: Jonathan Cameron <jic23@kernel.org>