Patch "iio: ad_sigma_delta: Implement a dedicated reset function" has been added to the 3.18-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
iio: ad_sigma_delta: Implement a dedicated reset function
to the 3.18-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
iio-ad_sigma_delta-implement-a-dedicated-reset-function.patch
and it can be found in the queue-3.18 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
7fc10de8d49a748c476532c9d8e8fe19e548dd67Mon Sep 17 00:00:00 2001
From: Dragos Bogdan <[email protected]>
Date: Tue, 5 Sep 2017 15:14:45 +0300
Subject: iio: ad_sigma_delta: Implement a dedicated reset function
From: Dragos Bogdan <[email protected]>
commit 7fc10de8d49a748c476532c9d8e8fe19e548dd67 upstream.
Since most of the SD ADCs have the option of reseting the serial interface by sending a number of SCLKs with CS = 0 and DIN = 1, a dedicated function that can do this is usefull.
Needed for the patch: iio: ad7793: Fix the serial interface reset
--- drivers/iio/adc/ad_sigma_delta.c | 28 ++++++++++++++++++++++++++++ include/linux/iio/adc/ad_sigma_delta.h | 3 +++ 2 files changed, 31 insertions(+)
drivers/iio/adc/ad_sigma_delta.c +28 -0
@@ -177,6 +177,34 @@ out: }EXPORT_SYMBOL_GPL (ad_sd_read_reg); +/** +* ad_sd_reset() - Reset the serial interface +* +* @sigma_delta: The sigma delta device +* @reset_length: Number of SCLKs with DIN = 1 +* +* Returns 0 on success, an error code otherwise. +**/ +int ad_sd_reset (struct ad_sigma_delta *sigma_delta, +unsigned int reset_length) +{ +uint8_t *buf; +unsigned int size; +int ret; + + size =DIV_ROUND_UP (reset_length,8 ); + buf =kcalloc (size,sizeof (*buf),GFP_KERNEL ); +if (!buf) +return -ENOMEM ; + +memset (buf,0xff , size); + ret =spi_write (sigma_delta->spi, buf, size); +kfree (buf); + +return ret; +} +EXPORT_SYMBOL_GPL (ad_sd_reset); +static int ad_sd_calibrate (struct ad_sigma_delta *sigma_delta,unsigned int mode,unsigned int channel) {
include/linux/iio/adc/ad_sigma_delta.h +3 -0
@@ -111,6 +111,9 @@ int ad_sd_write_reg(struct ad_sigma_deltint ad_sd_read_reg (struct ad_sigma_delta *sigma_delta,unsigned int reg,unsigned int size,unsigned int *val); +int ad_sd_reset (struct ad_sigma_delta *sigma_delta, +unsigned int reset_length); +int ad_sigma_delta_single_conversion (struct iio_dev *indio_dev,const struct iio_chan_spec *chan,int *val); int ad_sd_calibrate_all(struct ad_sigma_delta *sigma_delta,
Patches currently in stable-queue which might be from [email protected] are
queue-3.18/iio-ad7793-fix-the-serial-interface-reset.patch queue-3.18/iio-ad_sigma_delta-implement-a-dedicated-reset-function.patch