iio: max31856: add option for setting mains filter rejection frequency
authorAndrea Merello <andrea.merello@gmail.com>
Wed, 20 Nov 2019 14:47:48 +0000 (15:47 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 23 Nov 2019 12:29:24 +0000 (12:29 +0000)
commit76aa41c17befa67b8727942d134eb65af501908b
treed6c2036e472b4bb3d21a3fe0e06738d8f3cc1d52
parent160b37f49ec3b3adc6916f411ee3ceebea8dd13d
iio: max31856: add option for setting mains filter rejection frequency

This sensor has an embedded notch filter for reducing interferences caused
by the power mains. This filter can be tuned to reject either 50Hz or 60Hz
(and harmonics).

Currently the said setting is left alone (the sensor defaults to 60Hz).
This patch introduces a IIO attribute that allows the user to set the said
filter to the desired frequency.

NOTE: this has been intentionally not tied to any DT property to allow
the configuration of this setting from userspace, e.g. with a GUI or by
reading a configuration file, or maybe reading a GPIO tied to a physical
switch or accessing some device that can autodetect the line frequency.

Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Colin Ian King <colin.king@canonical.com>
Cc: Patrick Havelange <patrick.havelange@essensium.com>
Cc: Matt Weber <matthew.weber@rockwellcollins.com>
Cc: Matt Ranostay <matt.ranostay@konsulko.com>
Cc: Chuhong Yuan <hslester96@gmail.com>
Cc: Daniel Gomez <dagmcr@gmail.com>
Cc: linux-iio@vger.kernel.org
Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/temperature/max31856.c