summaryrefslogtreecommitdiffstats
path: root/drivers/staging/iio
AgeCommit message (Collapse)Author
2019-04-04staging: iio: ad7780: move regulator to after GPIO initRenato Lui Geh
To maintain consistency between ad7780_probe and ad7780_remove orders, regulator initialization has been moved to after GPIO initializations. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging:iio:ad7780: add chip ID values and maskRenato Lui Geh
The ad7780 supports both the ad778x and ad717x families. Each chip has a corresponding ID. This patch provides a mask for extracting ID values from the status bits and also macros for the correct values for the ad7170, ad7171, ad7780 and ad7781. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: set pattern values and masks directlyRenato Lui Geh
The AD7780 driver contains status pattern bits designed for checking whether serial transfers have been correctly performed. Pattern macros were previously generated through bit fields. This patch sets good pattern values directly and masks through GENMASK. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add filter reading to ad778xRenato Lui Geh
This patch adds the new feature of reading the filter odr value for ad778x chips. This value is stored in the chip's state struct whenever a read or write call is performed on the chip's driver. This feature requires sharing SAMP_FREQ. Since the ad717x does not have a filter option, the driver only shares the relevant info mask for the ad778x family. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add gain reading to ad778xRenato Lui Geh
This patch adds a new functionality of reading gain values from the ad778x chips. This value is stored in the chip's state struct and is updated whenever a read or write call is performed on the driver. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add missing switch default caseRenato Lui Geh
This patch simply adds a missing switch default case in read_raw. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: ad7780: add gain & filter gpio supportRenato Lui Geh
Previously, the AD7780 driver only supported gpio for the 'powerdown' pin. This commit adds suppport for the 'gain' and 'filter' pin. Signed-off-by: Renato Lui Geh <renatogeh@gmail.com> Signed-off-by: Giuliano Belinassi <giuliano.belinassi@usp.br> Co-developed-by: Giuliano Belinassi <giuliano.belinassi@usp.br> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7192: Convert platform data to DT propertiesMircea Caprioru
This patch will remove platform data members and replace them with device tree properties. These properties will be subject to further modifications and probably replaced with other functionalities at some point in time. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7192: Report error directly in ad7192_setupMircea Caprioru
This patch removes the goto out statement and uninformative print message. This improves readability. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7192: Use DT clock bindingMircea Caprioru
This patch replaces the platform data clock select member with DT clock binding. Through the DT the external clock binding is specified. If this is not provided then the device will use the internal clock source. With the external clock binding there is the option to use a clock or a crystal as the clock source. When an external crystal is used it is connected to MCLK1 and MCLK2 pins. If the external clock is used only MCLK2 pin will be connected. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-04staging: iio: adc: ad7192: Fix identationMircea Caprioru
This patch fixes the odd indentation inside function ad7192_calibrate_all. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-04-03staging: iio: add proper SPDX identifiers to remaining driver filesGreg Kroah-Hartman
There are a number of IIO staging drivers that do not have a proper SPDX identifier on it. So fix that up and at the same time, remove the "free form" license text, as that's pretty much impossible for any tool to parse. Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Michael Hennerich <Michael.Hennerich@analog.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03staging: add missing SPDX lines to Makefile filesGreg Kroah-Hartman
There are a few remaining drivers/staging/*/Makefile files that do not have SPDX identifiers in them. Add the correct GPL-2.0 identifier to them to make scanning tools happy. Reviewed-by: Mukesh Ojha <mojha@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-03staging: add missing SPDX lines to Kconfig filesGreg Kroah-Hartman
There are a few remaining drivers/staging/*/Kconfig files that do not have SPDX identifiers in them. Add the correct GPL-2.0 identifier to them to make scanning tools happy. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-02staging: iio: adc: ad7816.c: Replace bit shifting with BIT macroPayal Kshirsagar
Challenge suggested by coccinelle. Prefer using BIT and replace bit shifting with the BIT(x) macro. Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-02staging: iio: impedance-analyzer: ad5933.c: Replace bit shifting with BIT macroPayal Kshirsagar
Challenge suggested by coccinelle. Prefer using BIT and replace bit shifting with the BIT(x) macro. Signed-off-by: Payal Kshirsagar <payal.s.kshirsagar.98@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-18staging: iio: Line over 80 charactersDaniela Mormocea
Fix line over 80 characters, warning by checkpatch Signed-off-by: Daniela Mormocea <daniela.mormocea@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-03-09staging: iio: ad7192: Fix ad7193 channel addressMircea Caprioru
This patch fixes the differential channels addresses for the ad7193. Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-03-09Staging: iio: meter: fixed typoLeonard Pollak
This patch fixes an obvious typo, which will cause erroneously returning the Peak Voltage instead of the Peak Current. Signed-off-by: Leonard Pollak <leonardp@tr-host.de> Cc: <Stable@vger.kernel.org> Acked-by: Michael Hennerich <michael.hennerich@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-02staging: iio: frequency: ad9833: Load clock using clock frameworkBeniamin Bia
The clock frequency is loaded from device-tree using clock framework instead of statically value. The change allow configuration of the device via device-trees and better initialization sequence. This is part of broader effort to add device-tree support to this driver and take it out from staging. Signed-off-by: Beniamin Bia <beniamin.bia@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-02staging: iio: frequency: ad9833: Get frequency value staticallyBeniamin Bia
The values from platform data were replaced by statically values. This was just a intermediate step of taking this driver out of staging and load data from device tree. Signed-off-by: Beniamin Bia <beniamin.bia@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-02-02staging: iio: cdc: ad7152: remove driver completelyAlexandru Ardelean
The AD7153 part has been obsoleted for some time. The AD7152 part will be obsolete in the coming future. Moving it out of staging doesn't make sense anymore. Which makes the driver enter a limbo state. This patch removes the driver completely, so that no effort is placed on it, allowing people to focus on other parts that will still be around. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05staging: iio: adt7316: fix the dac write calculationJeremy Fertic
The lsb calculation is not masking the correct bits from the user input. Subtract 1 from (1 << offset) to correctly set up the mask to be applied to user input. The lsb register stores its value starting at the bit 7 position. adt7316_store_DAC() currently assumes the value is at the other end of the register. Shift the lsb value before storing it in a new variable lsb_reg, and write this variable to the lsb register. Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05staging: iio: adt7316: fix the dac read calculationJeremy Fertic
The calculation of the current dac value is using the wrong bits of the dac lsb register. Create two macros to shift the lsb register value into lsb position, depending on whether the dac is 10 or 12 bit. Initialize data to 0 so, with an 8 bit dac, the msb register value can be bitwise ORed with data. Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05staging: iio: adt7316: fix handling of dac high resolution optionJeremy Fertic
The adt7316/7 and adt7516/7 have the option to output voltage proportional to temperature on dac a and/or dac b. The default dac resolution in this mode is 8 bits with the dac high resolution option enabling 10 bits. None of these settings affect dacs c and d. Remove the "1 (12 bits)" output from the show function since that is not an option for this mode. Return "1 (10 bits)" if the device is one of the above mentioned chips and the dac high resolution mode is enabled. In the store function, the driver currently allows the user to write to the ADT7316_DA_HIGH_RESOLUTION bit regardless of the device in use. Add a check to return an error in the case of an adt7318 or adt7519. Remove the else statement that clears the ADT7316_DA_HIGH_RESOLUTION bit. Instead, clear it before conditionally enabling it, depending on user input. This matches the typical pattern in the driver when an attribute is a boolean. Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05staging: iio: adt7316: fix dac_bits assignmentJeremy Fertic
The value of dac_bits is used in adt7316_show_DAC() and adt7316_store_DAC(), and it should be either 8, 10, or 12 bits depending on the device in use. The driver currently only assigns a value to dac_bits in adt7316_store_da_high_resolution(). The purpose of the dac high resolution option is not to change dac resolution for normal operation. Instead, it is specific to an optional feature where one or two of the four dacs can be set to output voltage proportional to temperature. If the user chooses to set dac a and/or dac b to output voltage proportional to temperature, the da_high_resolution attribute can optionally be enabled to use 10 bit resolution rather than the default 8 bits. This is only available on the 10 and 12 bit dac devices. If the user attempts to read or write dacs a or b under these settings, the driver's current behaviour is to return an error. Dacs c and d continue to operate normally under these conditions. With the above in mind, remove the dac_bits assignments from this function since the value of dac_bits as used in the driver is not dependent on this dac high resolution option. Since the dac_bits assignments discussed above are currently the only ones in this driver, the default value of dac_bits is 0. This results in incorrect calculations when the dacs are read or written in adt7316_show_DAC() and adt7316_store_DAC(). To correct this, assign a value to dac_bits in adt7316_probe() to ensure correct operation as soon as the device is registered and available to userspace. Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05staging: iio: adc: ad7606: Move out of stagingStefan Popa
Move ad7606 ADC driver out of staging and into the mainline. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05staging: iio: adc: ad7606: Misc style fixes (no functional change)Stefan Popa
* Placed includes in alphabetical order * Added brackets around num and mask through out for AD760X_CHANNEL * Used single line comments where needed * Removed extra lines and spaces Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05staging: iio: adc: ad7606: Add support for threaded irqStefan Popa
This patch replaces the use of a polling ring buffer with a threaded interrupt. Enabling the buffer sets the CONVST signal to high. When the rising edge of the CONVST is applied, BUSY signal goes logic high and transitions low at the end of the entire conversion process. The falling edge of the BUSY signal triggers the interrupt. ad7606_trigger_handler() is used as bottom half of the poll function. It reads data from the device and stores it in the internal buffer. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05staging: iio: adc: ad7606: Use SPDX identifierStefan Popa
This patch replaces the license text at the top of ad7606 driver files and instead adds SPDX GPL-2.0 license identifier. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-01-05staging: iio: adc: ad7606: Simplify the Kconfing menuStefan Popa
There is no point in having three menu entries that can be selected individually. Instead, the SPI and parallel interfaces should select AD7606. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22staging: iio: adc: ad7606: Add OF device ID tableStefan Popa
The driver does not have a struct of_device_id table, but supported devices are registered via Device Trees. This patch adds and OF device ID table. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22staging: iio: adc: ad7606: Use vendor prefix for DT propertiesStefan Popa
The 'adi' vendor prefix needs to be added to conversion-start, range, first-data and oversampling-ratio properties. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22staging: iio: adc: ad7606: Use find_closest() macroStefan Popa
When looking for the available scale or oversampling ratio, it is better to use the find_closest() macro. This simplifies the code and also does not require an exact value to be entered from the user space. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22staging: iio: adc: ad7606: Use devm functions in probeStefan Popa
Switch to devm version of request_irq, iio_triggered_buffer_setup, iio_device_register. To avoid potential ordering issues in probe, devm_add_action_or_reset() is used for the regulator_disable(). This simplifies the code and decreases the chance of bugs. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-22staging: iio: adc: ad7606: Use wait-for-completion handlerStefan Popa
This patch replaces the use of wait_event_interruptible() with wait_for_completion_timeout() when reading the result of a single conversion. In this way, if the interrupt never occurs, the program will not remain blocked. Signed-off-by: Stefan Popa <stefan.popa@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: ad7816: drop unnecessary initialization of variablesHardik Singh Rathore
Initialization is unnecessary when the variable is written before it is read. There were some occasions in which the driver would initialize `ret' during declaration without need. Signed-off-by: Hardik Singh Rathore <hardiksingh.k@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adc: ad7280a: split ad7280_attr_init() to more functionsSlawomir Stepien
The ad7280_attr_init function has been split into more specific functions to increase the code readability. Signed-off-by: Slawomir Stepien <sst@poczta.fm> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adc: ad7280a: split ad7280_channel_init() to more functionsSlawomir Stepien
The ad7280_channel_init function has been split into more specific functions to increase the code readability. The setting of channel's scan_type.shift to 0, has been removed, since it is the default value. Signed-off-by: Slawomir Stepien <sst@poczta.fm> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: ad5933: use clock framework for clock referenceMarcelo Schmitt
Add the option to specify the external clock (MCLK) using the clock framework. Also remove the old platform data structure. Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Gabriel Capella <gabriel@capella.pro> Co-developed-by: Gabriel Capella <gabriel@capella.pro> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: ad5933: change regulator binging for vrefMarcelo Schmitt
Set a single voltage regulator for all voltage references. Remove voltage reference value from default platafrom data struct. Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com> Signed-off-by: Gabriel Capella <gabriel@capella.pro> Co-developed-by: Gabriel Capella <gabriel@capella.pro> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16Staging: iio: adt7316: Add all irq related code in adt7316_irq_setup()Shreeya Patel
ADT7316 driver no more uses platform data and hence use device tree data instead of platform data for assigning irq_type field and implement this in adt7316_irq_setup function. Switch case figures out the type of irq and if it's the default case then assign the default value to the irq_type i.e. irq_type = IRQF_TRIGGER_LOW Move devm_request_threaded_irq() and assignment of chip->config1 into the adt7316_setup_irq() to unclutter the code in probe function. Signed-off-by: Shreeya Patel <shreeya.patel23498@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adt7316: drop unnecessary initialization of variablesHardik Singh Rathore
Initialization is unnecessary when the variable is written before it is read. There were some occasions in which the driver would initialize `ret' during declaration without need. Purely a cosmetic change with no functional impact. Signed-off-by: Hardik Singh Rathore <hardiksingh.k@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adt7316: correct spelling of ADT7316_DA_EN_VIA_DAC_LDCAJeremy Fertic
Change LDCA to LDAC. Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adt7316: change interpretation of write to dac update modeJeremy Fertic
Based on the output of adt7316_show_all_DAC_update_modes() and adt7316_show_DAC_update_mode(), adt7316_store_DAC_update_mode() should expect the user to enter an integer input from 0 to 3. The user input is currently expected to account for the actual bit positions in the register. For example, choosing option 3 would require a write of 0x30 (actually 48 since it expects base 10). To address this inconsistency, create a shift macro to be used in the valid input check as well as the calculation for the register write. Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adt7316: remove dac vref buffer bypass from adt751xJeremy Fertic
The option to allow the external vref to bypass the reference buffer is only available for adt7316/7/8. Remove the attributes for adt751x as well as the chip->id checks from the show and store functions. Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adt7316: allow adt751x to use internal vref for all dacsJeremy Fertic
With adt7516/7/9, internal vref is available for dacs a and b, dacs c and d, or all dacs. The driver doesn't currently support internal vref for all dacs. Change the else if to an if so both bits are checked rather than just one or the other. Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adt7316: use correct variable in DAC_internal_Vref readJeremy Fertic
The dac internal vref settings are part of the ldac config register rather than the dac config register. Change the variable being used so the read returns the correct result. Whilst a fix, it is for a driver in heavy churn so do not backport to stable without taking considerable care and testing. Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adt7316: invert the logic of the check for an ldac pinJeremy Fertic
ADT7316_DA_EN_VIA_DAC_LDCA is set when the dac and ldac registers are being used to update the dacs instead of the ldac pin. ADT7516_SEL_AIN3 is an adc input that shares the ldac pin. Only set these bits if an ldac pin is not being used. This could be backported to stable, but note there are various other bugs that probably make that a waste of time. Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-12-16staging: iio: adt7316: fix register and bit definitionsJeremy Fertic
Change two register addresses and one bit definition to match the datasheet. Note that there are many issues in this driver so I would not suggest backporting these fixes to stable trees. Signed-off-by: Jeremy Fertic <jeremyfertic@gmail.com> Fixes: 35f6b6b86ede ("staging: iio: new ADT7316/7/8 and ADT7516/7/9 driver") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>