staging: iio: adc: ad7192: fix external frequency setting
authorAlexandru Ardelean <alexandru.ardelean@analog.com>
Mon, 22 Jan 2018 09:53:12 +0000 (11:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 25 Feb 2018 10:07:52 +0000 (11:07 +0100)
commit5ccf5138bd107624a9ef371166399a6c970babd7
tree2f96a6f9c0bc2f0b4b43a9f2b8a424ee2697e035
parent6648ab4f03c01bd84815d1d0e4ab55485c0994c7
staging: iio: adc: ad7192: fix external frequency setting

commit e31b617d0a63c6558485aaa730fd162faa95a766 upstream.

The external clock frequency was set only when selecting
the internal clock, which is fixed at 4.9152 Mhz.

This is incorrect, since it should be set when any of
the external clock or crystal settings is selected.

Added range validation for the external (crystal/clock)
frequency setting.
Valid values are between 2.4576 and 5.12 Mhz.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/iio/adc/ad7192.c