Patch "iio: health: max30102: Add power enable parameter to get_temp function" has been added to the 4.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
iio: health: max30102: Add power enable parameter to get_temp function
to the 4.14-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-health-max30102-add-power-enable-parameter-to-get_temp-function.patch
and it can be found in the queue-4.14 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 foo@baz Fri Mar 16 15:43:17 CET 2018
From: Peter Meerwald-Stadler <[email protected]>
Date: Fri, 27 Oct 2017 21:45:38 +0200
Subject: iio: health: max30102: Add power enable parameter to get_temp function
From: Peter Meerwald-Stadler <[email protected]>
[ Upstream commit a9c47abbdd71dceeaf1b923e5ce10e700e036905 ]
Chip must not be in shutdown for reading temperature, so briefly leave shutdown if buffer is not already running
--- drivers/iio/health/max30102.c | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-)
drivers/iio/health/max30102.c +23 -13
@@ -329,20 +329,31 @@ static int max30102_read_temp(struct maxreturn 0 ; } -static int max30102_get_temp (struct max30102_data *data,int *val) +static int max30102_get_temp (struct max30102_data *data,int *val,bool en) {int ret; +if (en) { + ret =max30102_set_powermode (data, true); +if (ret) +return ret; + } +/* start acquisition */ ret =regmap_update_bits (data->regmap,MAX30102_REG_TEMP_CONFIG ,MAX30102_REG_TEMP_CONFIG_TEMP_EN ,MAX30102_REG_TEMP_CONFIG_TEMP_EN );if (ret) -return ret; + goto out;msleep (35 ); + ret =max30102_read_temp (data, val); + +out: +if (en) +max30102_set_powermode (data, false); -return max30102_read_temp (data, val); +return ret; } static int max30102_read_raw(struct iio_dev *indio_dev,
@@ -355,20 +366,19 @@ static int max30102_read_raw(struct iio_switch (mask) {case IIO_CHAN_INFO_RAW :/* -* Temperature reading can only be acquired while engine -* is running +* Temperature reading can only be acquired when not in +* shutdown; leave shutdown briefly when buffer not running */ mutex_lock (&indio_dev->mlock); -if (!iio_buffer_enabled (indio_dev)) - ret = -EBUSY ; -else { - ret =max30102_get_temp (data, val); -if (!ret) - ret =IIO_VAL_INT ; - } - + ret =max30102_get_temp (data, val, true); +else + ret =max30102_get_temp (data, val, false);mutex_unlock (&indio_dev->mlock); +if (ret) +return ret; + + ret =IIO_VAL_INT ;break ;case IIO_CHAN_INFO_SCALE : *val =1000 ;/* 62.5 */
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/iio-health-max30102-add-power-enable-parameter-to-get_temp-function.patch