aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/temperature/mlx90614.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-07-13i2c: remove i2c_lock_adapter and use i2c_lock_bus directlyPeter Rosin1-2/+2
The i2c_lock_adapter name is ambiguous since it is unclear if it refers to the root adapter or the adapter you name in the argument. The natural interpretation is the adapter you name in the argument, but there are historical reasons for that not being the case; it in fact locks the root adapter. Just remove the function and force users to spell out the I2C_LOCK_ROOT_ADAPTER name to indicate what is really going on. Also remove i2c_unlock_adapter, of course. This patch was generated with git grep -l 'i2c_\(un\)\?lock_adapter' \ | xargs sed -i 's/i2c_\(un\)\?lock_adapter(\([^)]*\))/'\ 'i2c_\1lock_bus(\2, I2C_LOCK_ROOT_ADAPTER)/g' followed by white-space touch-up. Signed-off-by: Peter Rosin <peda@axentia.se> Acked-by: Jonathan Cameron <jonathan.cameron@huawei.com> Tested-by: Sekhar Nori <nsekhar@ti.com> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2017-08-22iio:temperature: drop assignment of iio_info.driver_moduleJonathan Cameron1-1/+0
The equivalent of this is now done via macro magic when the relevant register call is 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-19iio: mlx96014: Add OF device ID tableJavier Martinez Canillas1-0/+7
The driver doesn't have a struct of_device_id table but supported devices are registered via Device Trees. This is working on the assumption that a I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>. But this could change in the future so the correct approach is to have an OF device ID table if the devices are registered via OF. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Tested-by: Crt Mori <cmo@melexis.com> Acked-by: Crt Mori <cmo@melexis.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-02-27iio: convert to common i2c_check_functionality() return valueMatt Ranostay1-1/+1
Previously most drivers that used a i2c_check_functionality() check condition required various error codes on failure. This patchset converts to a standard of -EOPNOTSUPP Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-10-03iio: mlx96014: Error checking from positive to negativeCrt Mori1-6/+8
Dan Carpenter reported a static checker report and after his mail I noticed that we actually return from function if positive value is obtained from i2c read. This was remainder from when code was not in separate function (which I changed during the review process). Static checker reported drivers/iio/temperature/mlx90614.c:167 mlx90614_iir_search() warn: this cast is a no-op which meant that cast before negating is useless. Dan also proposed a solution on nicer bit operation form. Also changed magic number to macro in process as that was confusing. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Crt Mori <cmo@melexis.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-27iio: mlx90614: Implement filter configurationCrt Mori1-3/+87
Implemented Low pass 3db frequency filter which configures FIR and IIR values within the configuration register of EEPROM. For more standardized interface we have fixed the FIR value to 1024, while changes in IIR value are directly connected to filter responses. The new datasheet version will provide a simplified table (also in reStructured text format below) with this change, to provide quick overview of possible settings. Below sensor timings (bandwidth) are calculated for 3db frequency low pass filter. +--------------------+-----------------+ | Filter setting (%) | Band width (Hz) | | (rounded to 1.0) | | +====================+=================+ | 13 | 0.15 | +--------------------+-----------------+ | 17 | 0.20 | +--------------------+-----------------+ | 25 | 0.31 | +--------------------+-----------------+ | 50 | 0.77 | +--------------------+-----------------+ | 57 | 0.86 | +--------------------+-----------------+ | 67 | 1.10 | +--------------------+-----------------+ | 80 | 1.53 | +--------------------+-----------------+ | 100 | 7.23 | +--------------------+-----------------+ The diff is made towards togreg branch. Added myself to MAINTAINERS and authors as per discussion with Jonathan. Signed-off-by: Crt Mori <cmo@melexis.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-08-02iio: mlx90614: Define magic numbersCrt Mori1-6/+14
Translates the magic constant numbers to named macros and add some additional comments about their meaning. The diff is made towards togreg branch as that branch seems to have the most recent updates of mlx90614 driver (many are yet to be merged). Signed-off-by: Crt Mori <cmo@melexis.com> Acked-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-07-11iio: Drop owner assignment from i2c_driverKrzysztof Kozlowski1-1/+0
i2c_driver does not need to set an owner because i2c_register_driver() will set it. Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-05-13iio:temp:mlx90614 trivial drop of unnecessary ret return from write_raw.Jonathan Cameron1-3/+1
This is mostly part of an effort to clean out our current warnings and make the autobuilder build reports more useful. Still a worthwhile if trivial cleanup! Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Peter Meerwald <pmeerw@pmeerw.net>
2015-04-18iio: mlx90614: Fix duplicate const warningVianney le Clément de Saint-Marcq1-1/+1
Fix a typo triggering a duplicate const warning on some compilers. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-09iio: mlx90614: Check for errors in read valuesVianney le Clément de Saint-Marcq1-0/+5
The device uses the MSB of the returned temperature value as an error flag. Return a read error when this bit is set. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-09iio: mlx90614: Add power managementVianney le Clément de Saint-Marcq1-2/+244
Add support for system sleep and runtime power management. To wake up the device, the SDA line should be held low for at least 33ms while SCL is high. As this is not possible using the i2c API (and not supported by all i2c adapters), a GPIO connected to the SDA line is needed. The GPIO is named "wakeup" and can be specified in a device tree with the "wakeup-gpios" binding. If the wake-up GPIO is not given, disable power management for the device. Entering sleep requires an SMBus byte access, hence power management is also disabled if byte access is not supported by the adapter. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-09iio: mlx90614: Add emissivity settingVianney le Clément de Saint-Marcq1-3/+103
The mapping from the 16-bit EEPROM value to the decimal 0-1 range is approximate. A special case ensures 0xFFFF shows as 1.0 instead of 0.999998565. Writing to EEPROM requires an explicit erase by writing zero. In addition, it takes 20ms for the erase/write to complete. During this time no EEPROM register should be accessed. Therefore, two msleep()s are added to the write function and a mutex protects against concurrent access. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-29iio: mlx90614: Support devices with dual IR sensorVianney le Clément de Saint-Marcq1-10/+57
The model is detected by reading the EEPROM configuration during probing. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-29iio: mlx90614: Add symbols for accessible registersVianney le Clément de Saint-Marcq1-1/+25
Add symbols for all accessible RAM and EEPROM registers, as well as the sleep command and timings defined in the datasheet. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-03-09iio: mlx90614: Refactor register symbolsVianney le Clément de Saint-Marcq1-4/+4
The defined registers only make sense when used for accessing RAM. Make MLX90614_OP_RAM part of the symbol definition to avoid accidental access to the wrong register. Signed-off-by: Vianney le Clément de Saint-Marcq <vianney.leclement@essensium.com> Cc: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2014-05-03iio: Add Melexis mlx90614 contact-less infrared temperature sensor driverPeter Meerwald1-0/+150
I2C-controlled sensor measures ambient and object temperatuer see http://www.melexis.com/Infrared-Thermometer-Sensors/Infrared-Thermometer-Sensors/MLX90614-615.aspx Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>