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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>