summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio/adc
Commit message (Collapse)AuthorAgeFilesLines
* staging: iio: adc: fix error return code in ad7606_par_probe()Gustavo A. R. Silva2017-08-121-2/+2
| | | | | | | | | | | | | platform_get_irq() returns an error code, but the ad7606_par driver ignores it and always returns -ENODEV. This is not correct and, prevents -EPROBE_DEFER from being propagated properly. Print and propagate the return value of platform_get_irq on failure. This issue was detected with the help of Coccinelle. Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* Staging: iio: adc: ad7280a.c: Fixed Macro argument reuseJaya Durga2017-07-221-8/+13
| | | | | | | | | | | | CHECK: Macro argument reuse 'addr' - possible side-effects? convert AD7280A_DEVADDR to ad7280a_devaddr static function to fix checkpath check v3: small style changes Signed-off-by: Jaya Durga <rjdurga@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* staging: iio: adc: ad7280a: fix permission coding style issueOlivier Leveque2017-03-251-6/+6
| | | | | | | | Symbolic permissions 'S_IWUSR | S_IRUGO' are not preferred. Consider using octal permissions '0644'. Found running checkpatch. Signed-off-by: Olivier Leveque <o_leveque@orange.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: ad7606: Replace mlock with driver private lockArushi Singhal2017-03-232-4/+8
| | | | | | | | | | | | The IIO subsystem is redefining iio_dev->mlock to be used by the IIO core only for protecting device operating mode changes. ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes. In this driver, mlock was being used to protect hardware state changes. Replace it with a lock in the devices global data. Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7280: Replace mlock with driver private lockGargi Sharma2017-03-191-10/+12
| | | | | | | | | | | | The IIO subsystem is redefining iio_dev->mlock to be used by the IIO core only for protecting device operating mode changes. ie. Changes between INDIO_DIRECT_MODE, INDIO_BUFFER_* modes. In this driver, mlock was being used to protect hardware state changes. Replace it with a lock in the devices global data. Signed-off-by: Gargi Sharma <gs051095@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7780: Remove exceptional & on function namesimran singhal2017-03-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | Remove & from function pointers to conform to the style found elsewhere in the file. Done using the following semantic patch // <smpl> @r@ identifier f; @@ f(...) { ... } @@ identifier r.f; @@ - &f + f // </smpl> Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7192: Remove exceptional & on function namesimran singhal2017-03-131-6/+6
| | | | | | | | | | | | | | | | | | | | | | Remove & from function pointers to conform to the style found elsewhere in the file. Done using the following semantic patch // <smpl> @r@ identifier f; @@ f(...) { ... } @@ identifier r.f; @@ - &f + f // </smpl> Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:adc:lpc32xx Move out of staging.Jonathan Cameron2017-02-113-232/+0
| | | | | | | | | | | | | There are a few more little cleanups that could be done on this driver, but I don't think any are sufficient to justify not moving it out of staging. It's a very simple driver (presumably for a simple part) so not much that can go wrong. I think it was only ever in staging because that's where IIO was as a whole at the time and then we forgot about it! Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Roland Stigge <stigge@antcom.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:adc:lpc32xx rename local state structure to _stateJonathan Cameron2017-02-111-23/+23
| | | | | | | | | | Previously it was called _info with instances as info. This caused some confusion against the info structure that are used in the core of IIO. Since this driver was written it's become a fairly strong convention to use _state and st for instances so change to that. Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:adc:lpc32xx Apply consistent prefix to local definesJonathan Cameron2017-02-111-25/+29
| | | | | | | There was a bit of a random mixture going on here so change all prefixes to LPC32XXAD_ Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:adc:spear Move out of staging.Jonathan Cameron2017-02-113-406/+0
| | | | | | | | | | | | There are some unanswered questions due to disagreements between the code and various datasheets (including between different datasheets for the same part). I don't think that is necessarily a reason to keep it in staging however. I'm partly posting this patch inorder to reignite debate and with a bit of luck find someone who has one of these to test! Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: adc: ad7192: fixed symbolic permission references 'S_IRUGO | S_IWUSR'Artur Lorincz2017-02-051-4/+4
| | | | | | | | Replaced the symbolic permission references S_IRUGO and S_IWUSR with their octal counterparts. Signed-off-by: Artur Lorincz <larturus@yahoo.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Staging: iio: adc: ad7816: fix symbolic permissions coding style issueJulián de Gortari2017-01-281-5/+5
| | | | | | | | Octal permissions should be used instead of symbolic ones for easier reading. Signed-off-by: Julián de Gortari <kiototeko@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7606: replace range/range_available with corresponding scaleEva Rachel Retuya2017-01-071-40/+39
| | | | | | | | | | | Eliminate the non-standard attributes in_voltage_range and in_voltage_range_available. Implement in_voltage_scale_available in place of these attributes and update the SCALE accordingly. The array scale_avail is introduced to hold the available scale values. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7192: rename regulator 'reg' to 'avdd'Eva Rachel Retuya2016-11-051-11/+11
| | | | | | | | Rename regulator 'reg' to 'avdd' so as to be clear what regulator it stands for specifically. Also, update the goto label accordingly. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7192: add DVdd regulatorEva Rachel Retuya2016-11-051-1/+18
| | | | | | | | | | | | The AD7190/AD7192/AD7193/AD7195 is supplied with two power sources: AVdd as analog supply voltage and DVdd as digital supply voltage. Attempt to fetch and enable the regulator 'dvdd'. Bail out if any error occurs. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: rework regulator handlingEva Rachel Retuya2016-11-052-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the affected drivers ignore all errors from regulator_get(). The way it is now, it also breaks probe deferral (EPROBE_DEFER). The correct behavior is to propagate the error to the upper layers so they can handle it accordingly. Rework the regulator handling so that it matches the standard behavior. If the specific design uses a static always-on regulator and does not explicitly specify it, regulator_get() will return the dummy regulator. The following semantic patch was used to apply the change: @r1@ expression reg, dev, en, volt; @@ reg = \(devm_regulator_get\|regulator_get\)(dev, ...); if ( - ! IS_ERR(reg)) + return PTR_ERR(reg); ( - { en = regulator_enable(reg); - if (en) return en; } + + en = regulator_enable(reg); + if (en) { + dev_err(dev, "Failed to enable specified supply\n"); + return en; } | + - { en = regulator_enable(reg); - if (en) return en; - volt = regulator_get_voltage(reg); } + en = regulator_enable(reg); + if (en) { + dev_err(dev, "Failed to enable specified supply\n"); + return en; + } + volt = regulator_get_voltage(reg); ) @r2@ expression arg; @@ - if (!IS_ERR(arg)) regulator_disable(arg); + regulator_disable(arg); Hand-edit the debugging prints with the supply name to become more specific. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: set proper supply name to devm_regulator_get()Eva Rachel Retuya2016-11-052-2/+2
| | | | | | | | | | | | | | | The name passed to devm_regulator_get() should match the name of the supply as specified in the device datasheet. This makes it clear what power supply is being referred to in case of presence of other regulators. Currently, the supply name specified on the affected devices is 'vcc'. Use lowercase version of the datasheet name to specify the supply voltage. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: fix ptr_ret.cocci warningskbuild test robot2016-10-231-4/+1
| | | | | | | | | | | | drivers/staging/iio/adc/ad7606.c:357:1-3: WARNING: PTR_ERR_OR_ZERO can be used Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR Generated by: scripts/coccinelle/api/ptr_ret.cocci CC: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7606: rework regulator handlingEva Rachel Retuya2016-10-231-8/+9
| | | | | | | | | | | | | | | | Currently, this driver ignores all errors from regulator_get(). The way it is now, it also breaks probe deferral (EPROBE_DEFER). The correct behavior is to propagate the error to the upper layers so they can handle it accordingly. Rework the regulator handling so that it matches the standard behavior. If the specific design uses a static always-on regulator and does not explicitly specify it, regulator_get() will return the dummy regulator. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7606: set proper supply name to devm_regulator_get()Eva Rachel Retuya2016-10-231-1/+1
| | | | | | | | | | | | | | The name passed to devm_regulator_get() should match the name of the supply as specified in the device datasheet. The supply on this device is called 'AVcc' while currently, the driver uses just 'vcc'. Use 'avcc' to specify the supply voltage since it is custom to use the lower-caps version of the datasheet name. Suggested-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Move buffer code to main source fileLars-Peter Clausen2016-10-234-80/+44
| | | | | | | | | | | | | | Currently the ad7606 buffer handling code resides in its own source file. But this file contains only 4 small functions of which half are just wrappers around other functions. Buffer support is also always enabled for this driver, so move them over to the main source file. This reduces the amount of boilerplate code. Also rename the main function from ad7606_core.c to ad7606.c since there is only a single file now. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Use GPIO descriptor APILars-Peter Clausen2016-10-233-175/+64
| | | | | | | | | | | Convert the ad7606 driver away from the deprecated legacy GPIO API and use the new GPIO descriptor API. This also means that the platform data struct is now empty and can be removed. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Run trigger handler only once per trigger eventLars-Peter Clausen2016-10-231-8/+3
| | | | | | | | | | | | | | | | | | | Currently the ad7606 driver installs the same function for the hard-irq and threaded trigger handlers. This was introduced in commit 1caf7cb46135 ("staging:iio:adc:ad7606 Convert to new channel registration method Update Add missing call to iio_trigger_notify_done() Set pollfunc top and bottom half handler"). Unfortunately the commit message does not mention why this was done and Michael does not remember either. Since the trigger handler function is idempotent (set a GPIO to 1) running it twice does not do any harm, but is simply not necessary either. So set the threaded trigger handler for the driver to NULL. While we are at it also remove the function description comment that does no say anything that can't be derived from the function name itself. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Let common remove function take a struct device *Lars-Peter Clausen2016-10-234-10/+5
| | | | | | | | | | | | | Currently the common remove function takes a struct iio_dev *. This parameter is retrieved by the individual driver remove functions by calling get_drvdata() on their device. To simplify the code let the common remove function directly take a struct dev * and do the IIO device in retrieval the common remove function. This also aligns the interface with the common probe function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Let the common probe function return intLars-Peter Clausen2016-10-234-31/+17
| | | | | | | | | | | | The common probe function for the ad7606 currently returns a struct iio_dev pointer. The returned value is not used by the individual driver probe functions other than for error checking. Let the common probe function return a int instead to report the error value directly (or 0 on success). This allows to simplify the code. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Move set_drvdata() into common codeLars-Peter Clausen2016-10-233-4/+2
| | | | | | | | | Both the platform_device and SPI driver call set_drvdata() at the end of their probe function. Move this into the common probe() function to reduce duplicated code. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Factor out common code between periodic and one-shot captureLars-Peter Clausen2016-10-233-48/+41
| | | | | | | | | | | | Both the periodic buffer based and one-shot sysfs based capture methods share a large portion of their code. Factor this out into a common helper function. Also provide a comment that better explains in more detail what is going on in the capture function. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Avoid allocating buffer for each data captureLars-Peter Clausen2016-10-232-12/+6
| | | | | | | | | | | | | Currently the ad7606 driver dynamically allocates and frees a transfer buffer each time a sample capture is performed in buffered mode, which introduces unnecessary overhead. The driver state struct already contains a buffer that is used for transfers in one-shot mode. This buffer is large enough to hold all samples, but not the timestamp that might be present in buffered mode. Extend the buffer size to be able to contain the timestamp and update the buffered capture function to use this buffer. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Use oversampling ratio of 1 for no oversamplingLars-Peter Clausen2016-10-231-3/+3
| | | | | | | | | | | Currently the ad7606 driver uses a value of 0 for the oversampling ratio to express that no oversampling is done. Strictly speaking this means though that no data capture is done at all. Instead change the driver to use a value of 1, this is in accordance with what other drivers do and what the IIO spec suggests. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Remove out-of-band error reportingLars-Peter Clausen2016-10-231-7/+3
| | | | | | | | | | | | | | | Currently the ad7606 driver prints a error message to the kernel log when an application writes an invalid value to a sysfs attribute. While for initial driver development and testing this might be useful it is quite disadvantageous in a production environment. The write() call to the sysfs attribute will already return an error if the value was invalid so the application is aware that the operation failed. And generally speaking it is impossible for an application to reliably match a log message in the kernel log to a specific operation it performed, so the message becomes just noise and might distract from more critical messages. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Remove default device configuration from platform dataLars-Peter Clausen2016-10-232-14/+2
| | | | | | | | | | | | | | | While for some very selected setups it might be useful to be able to provide default configuration data via the platform data, generally this becomes very impractical as the number of configuration options increases. So the general policy is to use the power-on default values of the device and let the application using the device configure it according to its needs. Implement this scheme for the ad7606 driver by removing support for specifying a default configuration via the platform data. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Remove redundant name field from ad7606_chip_infoLars-Peter Clausen2016-10-234-11/+10
| | | | | | | | | | | The name field in the ad7606_chip_info struct is set to the same value as the as the name field in the corresponding {platform,spi}_device_id table entry. Remove it from the ad7606_chip_info struct and pass the name from the ID to the probe function. This slightly reduces the size of the chip_info table and adding new entries requires less boilerplate. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging:iio:ad7606: Remove unused int_vref_mv fieldLars-Peter Clausen2016-10-232-5/+0
| | | | | | | | | | Remove the int_vref_mv field from the ad7606_chip_info struct since the field is never used by the driver. The value is also the same for all derivatives of this chip, so if it will ever be used in the driver a constant value will work just fine. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7192: implement IIO_CHAN_INFO_SAMP_FREQEva Rachel Retuya2016-10-111-55/+29
| | | | | | | | | | | | | | | | | This driver predates the availability of IIO_CHAN_INFO_SAMP_FREQ attribute wherein usage has some advantages like it can be accessed by in-kernel consumers as well as reduces the code size. Therefore, use IIO_CHAN_INFO_SAMP_FREQ to implement the sampling_frequency attribute instead of using IIO_DEV_ATTR_SAMP_FREQ() macro. Move code from the functions associated with IIO_DEV_ATTR_SAMP_FREQ() into respective read and write hooks with the mask set to IIO_CHAN_INFO_SAMP_FREQ. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7606: implement IIO_CHAN_INFO_OVERSAMPLING_RATIOEva Rachel Retuya2016-10-081-36/+31
| | | | | | | | | | | | | | | | | This driver predates the availability of IIO_CHAN_INFO_OVERSAMPLING_RATIO attribute wherein usage has some advantages like it can be accessed by in-kernel consumers as well as reduces the code size. Therefore, use IIO_CHAN_INFO_OVERSAMPLING_RATIO to implement the oversampling_ratio attribute instead of using IIO_DEVICE_ATTR() macro. Move code from the functions associated with IIO_DEVICE_ATTR() into the read_raw hook as well as add the write_raw hook with both masks set to IIO_CHAN_INFO_OVERSAMPLING_RATIO. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7606: fix improper setting of oversampling pinsEva Rachel Retuya2016-10-081-1/+1
| | | | | | | | | | | | | | | The oversampling ratio is controlled using the oversampling pins, OS [2:0] with OS2 being the MSB control bit, and OS0 the LSB control bit. The gpio connected to the OS2 pin is not being set correctly, only OS0 and OS1 pins are being set. Fix the typo to allow proper control of the oversampling pins. Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Fixes: b9618c0 ("staging: IIO: ADC: New driver for AD7606/AD7606-6/AD7606-4") Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Staging: iio: ad7816: constify attribute_group structuresBhumika Goyal2016-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 3295 768 0 4063 fdf drivers/staging/iio/adc/ad7816.o File size after: text data bss dec hex filename 3359 736 0 4095 fff drivers/staging/iio/adc/ad7816.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Staging: iio: ad7280a: constify attribute_group structuresBhumika Goyal2016-10-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 6271 672 776 7719 1e27 drivers/staging/iio/adc/ad7280a.o File size after: text data bss dec hex filename 6335 608 776 7719 1e27 drivers/staging/iio/adc/ad7280a.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Staging:iio:adc:ad7280a: constify attribute_group structuresBhumika Goyal2016-09-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for attribute_group structures that are only stored in the attrs filed of iio_info structure. As the 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.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: drivers/staging/iio/adc/ad7280a.o text data bss dec hex filename 6487 584 776 7847 1ea7 drivers/staging/iio/adc/ad7280a.o File size after: drivers/staging/iio/adc/ad7280a.o text data bss dec hex filename 6551 544 776 7871 1ebf drivers/staging/iio/adc/ad7280a.o Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Merge tag 'iio-for-4.8c' of ↵Greg Kroah-Hartman2016-07-143-6/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: Third set of IIO new device support, features and cleanups for the 4.8 cycle. New core features - Selection of the clock source for IIO timestamps. This is done per device as it makes little sense to have events in one timebase and data timestamped on another. Biggest reason for this is that we currently use a clock source which is non monotonic which can result in 'interesting' data sets. (Includes export for get_monotonic_corse64 which Thomas Gleixner didn't mind in an earlier version.) - MAINTAINERS add the git tree to the list for IIO. New device support + a kind of indirect staging graduation. * Broadcom iproc-static-adc - new driver * mcp4531 - support for MCP454x, MCP456x, MCP464x and MCP466x potentiometers * mpu6050 - support the IC20608 6 axis motion tracking device * st-sensors - support the lis3l02dq + drop the lis3l02dq driver from staging. The general purpose driver is missing event support, but good to get rid of this driver which was rather long in the tooth. New driver features * ak8975 - Add vid regulator support and refactor handling in general. - Allow a delay after enabling regulators. - Runtime and system PM. * bmg160 - filter frequency control support. * bmp280 - SPI device support. - EOC interrupt support for the BMP085 - power management support. - supply regulator support. - reset gpio support - dt bindings for reset gpio and regulators. - of table to support device tree registration * max1363 - Device tree bindings. * mcp4531 - Device tree bindings. * st-pressure - temperature channels as part of triggered buffer (previously not due probably to alignment issues - see below). - lps22hb open drain interrupt support. - lps22hb temperature channel support Cleanups and reworkings. * numerous ADC drivers - ensure the iio_dev->dev.of_node is set to the parent dev.of_node so as to allow client bindings to find the device. * ak8975 - Fix incorrect handling of missing regulator - make sure power is down and remove. * bmp280 - read the calibration data only once as it doesn't change. * isl29125 - Use a few macros to make code a touch more readable. * mma8452 - fix a memory leak on error. - drop an unecessary bit of return value handling. * potentiometer kconfig - typo fix. * st-pressure - drop some uninformative default assignments of elements of the channel array structure (aids readability). * st-sensors - Harden interrupt handling considerably. These are actually all using level interrupts, but at least two known boards have them wired to edge only interrupt chips. Hence a slightly interesting bit of handling is needed in which we first allow for the easy option (level triggered) and secondly check the status registers before reenabling edge interrupts and fall back to a tight loop in the thread until we successfully clear the interrupt. No harm is done if we never succeed in doing so. It's an odd patch that has been through a lot of revisions to reach a consensus on how to handle what is basically broken hardware (which the previous defaults allowed to kind of work). - Fix alignment to defined storagebytes boundaries. - Ensure alignment of power of 2 byte boundaries. This has always in theory been part of the ABI of IIO, but we missed a few that snuck in that need fixing. The effect was minor as they were only followed by timestamp channels which were correctly aligned, - Add some docs to explain the gain calculations.
| * iio:core: timestamping clock selection supportGregor Boirie2016-06-303-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | staging: iio: fix ad7606_spi regressionArnd Bergmann2016-06-111-1/+1
|/ | | | | | | | | | | | | | | | | | | | | | As pointed out by Geert Uytterhoeven, the patch was incorrect and breaks the driver, which was fortunately pointed out by this gcc warning: drivers/staging/iio/adc/ad7606_spi.c: In function ‘ad7606_spi_read_block’: drivers/staging/iio/adc/ad7606_spi.c:34: warning: ‘data’ is used uninitialized in this function The effect of the patch is that the data is copied into a random memory location (from the uninitialized pointer) instead of being byteswapped in place. This adds the initialization for the 'data' variable back to restore the original behavior. Cc: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Fixes: 87787e5ef727 ("Staging: iio: Fix sparse endian warning") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* staging: iio: ad7606: use iio_device_{claim|release}_direct_mode()Alison Schofield2016-04-101-6/+6
| | | | | | | | | Replace the code that guarantees the device stays in direct mode with iio_device_{claim|release}_direct_mode() which does same. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Acked-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Merge tag 'iio-for-4.7a' of ↵Greg Kroah-Hartman2016-04-046-60/+54
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.7 cycle. New core support * UV light modifier (for intensity) * UV light index channel type. New device support * hp206c barometer and altimeter - new driver. * mcp4131 potentiometer - new driver supporting lots of parts from Microchip. * mma8452 - FXLS8471Q support - NXP LPC18XX SOC ADC - new driver. - NXP LPC18XX SOC DAC - new driver. - rockchip_saradc - support rk3399 * st accel - h3lis331dl support Staging driver removals * adis16204 - obsolete part making it hard to get parts to test the driver in order to clean it up. * adis16220 - obsolete part making it hard to get the parts test the driver in order to clean it up. Features * core - convenience functions to claim / release direct access to the device. Makes more consistent handling of this corner easier. Used in ad7192 driver. * ak8975 - power regulator support. * at91-sama5d2 - differential channel support. * mma8452 - runtime pm support - drop device specific autosleep and use the runtime pm one instead. * ms5611 - DT bindings - oversampling ratio support Cleanups and minor fixes * MAINTAINERS - Peter got married - hence name change! * Documentation - Fix a typo in in_proximity_raw description. - Add some missing docs for iio_buffer_access_funcs. * Tools - update iio_event_monitor names to match new stuff. - make generic_buffer look for triggers ending in -trigger as we let these in for a number of drivers a long time back and now it is a fairly common option. Drivers * staging wide - convert bare unsigned usage to unsigned int to comply with coding style. * non staging wide: - since boiler plate gpio handling of interrupts has been moved into the ACPI core we don't need to include gpio/consumer.h in a load of drivers so drop it. * ad7606 - fix an endian casting sparse warning. * ak8975 - fix a possible unitialized warning from gcc. - drop and unused field left over from earlier cleanups - fix a missing regulator_disable on exit. * at91-sama5d2 - typo and indentation - missing IOMEM dependency. - cleanup mode register usage by avoidling erasing whole thing when changing the sampling frequency. * bmc150 - use the core demux and available_scan_masks to simplify buffer handling - optimize the transfers in the trigger handler now we have a magic function to emulate bulk reads (under circumstances met here). This matters with some rather dumb i2c adapters in particular. - use a single regmap_conf for all bus types as they were all the same. * bmg160 - use the core demux and available_scan_masks to simplify the buffer handling - optimize the transfers in the trigger handler now we have a magic funciton to emulate bulk rads (under circumstances met here). - drop gpio interrupt probing from the driver (ACPI) as now handled by the ACPI core. * ina2xx-adc - update the CALIB register when RShunt changes. - fix scale for VShunt - in reality this error canceled out when used. * isl29028 - use regmap to retrieve the struct device instead of carrying a second copy of it around. * kxcjk-1013 - use core demux - optimize i2c transfers in the trigger handler. * mcp4531 - refactor to use a pointer to access model parameters instead of indexing into the array each time. * mma8452 - style fixes - avoid swtiching to active whenever the config changes - add missin i2c_device_id for mma8451 * mpu6050 - fix possible NULL dereference. - fix the name / chip_id used when ACPI used (otherwise reports as NULL). * ms5611 - fix a missing regulator_disable that left the regulator on during removal. * mxc4005 - drop gpio interrupt handling for ACPI case from driver as the core now handles this case. * st-sensors - note that there are only ever a maximum of 3 axis on current st-sensors so just allocate a fixed sized buffer big enough for that. * tpl0102 - change the i2c_check_functionality condition to bring it inline with other IIO users as EOPNOTSUPP. * tsl2563 - replace deprecated flush_scheduled_work
| * Staging: iio: ad7606: Fix sparse endian warningKsenija Stanojevic2016-04-031-2/+3
| | | | | | | | | | | | | | | | Fix following sparse warning: warning: cast to restricted __be16 Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * staging: iio: convert bare unsigned usage to unsigned intAlison Schofield2016-03-285-42/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | Use kernel preferred unsigned int declaration style. Patch created using: git ls-files drivers/staging/iio | \ xargs ./scripts/checkpatch.pl -f --fix-inplace --types=unspecified_int Hand edits restored columns in structure definitions. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * staging: iio: ad7192: use iio_device_{claim|release}_direct_mode()Alison Schofield2016-03-121-18/+12
| | | | | | | | | | | | | | | | Replace the code that guarantees the device stays in direct mode with iio_device_{claim|release}_direct_mode() which does same. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | Staging: iio: Fix sparse endian warningKsenija Stanojevic2016-03-281-2/+3
| | | | | | | | | | | | | | | | Fix following sparse warning: warning: cast to restricted __be16 Signed-off-by: Ksenija Stanojevic <ksenija.stanojevic@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* | staging: iio: use kernel preferred block commenting styleAlison Schofield2016-03-281-10/+10
| | | | | | | | | | | | | | | | Use * on subsequent lines and trailing */ on a separate line in block comments. Signed-off-by: Alison Schofield <amsfield22@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OpenPOWER on IntegriCloud