iio: ad7793: Fix the serial interface reset
The serial interface can be reset by writing 32 consecutive 1s to the device.
'ret' was initialized correctly but its value was overwritten when
ad7793_check_platform_data() was called. Since a dedicated reset function
is present now, it should be used instead.
Fixes: 2edb769d24
("iio:ad7793: Add support for the ad7798 and ad7799")
Signed-off-by: Dragos Bogdan <dragos.bogdan@analog.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Родитель
7fc10de8d4
Коммит
7ee3b7ebcb
|
@ -257,7 +257,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
|
|||
unsigned int vref_mv)
|
||||
{
|
||||
struct ad7793_state *st = iio_priv(indio_dev);
|
||||
int i, ret = -1;
|
||||
int i, ret;
|
||||
unsigned long long scale_uv;
|
||||
u32 id;
|
||||
|
||||
|
@ -266,7 +266,7 @@ static int ad7793_setup(struct iio_dev *indio_dev,
|
|||
return ret;
|
||||
|
||||
/* reset the serial interface */
|
||||
ret = spi_write(st->sd.spi, (u8 *)&ret, sizeof(ret));
|
||||
ret = ad_sd_reset(&st->sd, 32);
|
||||
if (ret < 0)
|
||||
goto out;
|
||||
usleep_range(500, 2000); /* Wait for at least 500us */
|
||||
|
|
Загрузка…
Ссылка в новой задаче