linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Mike Looijmans <mike.looijmans@topic.nl>
Cc: linux-iio@vger.kernel.org, himanshujha199640@gmail.com,
	linux-kernel@vger.kernel.org, knaack.h@gmx.de, lars@metafoo.de,
	pmeerw@pmeerw.net, dpfrey@gmail.com, colin.king@canonical.com
Subject: Re: [PATCH v3 1/2] iio/chemical/bme680: Report temperature in millidegrees
Date: Sat, 9 Mar 2019 17:05:55 +0000	[thread overview]
Message-ID: <20190309170555.4982543d@archlinux> (raw)
In-Reply-To: <1551857508-4254-1-git-send-email-mike.looijmans@topic.nl>

On Wed,  6 Mar 2019 08:31:47 +0100
Mike Looijmans <mike.looijmans@topic.nl> wrote:

> The standard unit for temperature is millidegrees Celcius. Adapt the
> driver to report in millidegrees instead of degrees.
> 
> Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
I tweaked the patch title to make it obvious this was a fix
(added the word fix ;)

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

> ---
> v2: Remove unused 'addr7' variable                                                       
> v3: Split patch into temperature and SPI
> 
>  drivers/iio/chemical/bme680_core.c | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/iio/chemical/bme680_core.c b/drivers/iio/chemical/bme680_core.c
> index 70c1fe4..fefe32b 100644
> --- a/drivers/iio/chemical/bme680_core.c
> +++ b/drivers/iio/chemical/bme680_core.c
> @@ -583,8 +583,7 @@ static int bme680_gas_config(struct bme680_data *data)
>  	return ret;
>  }
>  
> -static int bme680_read_temp(struct bme680_data *data,
> -			    int *val, int *val2)
> +static int bme680_read_temp(struct bme680_data *data, int *val)
>  {
>  	struct device *dev = regmap_get_device(data->regmap);
>  	int ret;
> @@ -617,10 +616,9 @@ static int bme680_read_temp(struct bme680_data *data,
>  	 * compensate_press/compensate_humid to get compensated
>  	 * pressure/humidity readings.
>  	 */
> -	if (val && val2) {
> -		*val = comp_temp;
> -		*val2 = 100;
> -		return IIO_VAL_FRACTIONAL;
> +	if (val) {
> +		*val = comp_temp * 10; /* Centidegrees to millidegrees */
> +		return IIO_VAL_INT;
>  	}
>  
>  	return ret;
> @@ -635,7 +633,7 @@ static int bme680_read_press(struct bme680_data *data,
>  	s32 adc_press;
>  
>  	/* Read and compensate temperature to get a reading of t_fine */
> -	ret = bme680_read_temp(data, NULL, NULL);
> +	ret = bme680_read_temp(data, NULL);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -668,7 +666,7 @@ static int bme680_read_humid(struct bme680_data *data,
>  	u32 comp_humidity;
>  
>  	/* Read and compensate temperature to get a reading of t_fine */
> -	ret = bme680_read_temp(data, NULL, NULL);
> +	ret = bme680_read_temp(data, NULL);
>  	if (ret < 0)
>  		return ret;
>  
> @@ -761,7 +759,7 @@ static int bme680_read_raw(struct iio_dev *indio_dev,
>  	case IIO_CHAN_INFO_PROCESSED:
>  		switch (chan->type) {
>  		case IIO_TEMP:
> -			return bme680_read_temp(data, val, val2);
> +			return bme680_read_temp(data, val);
>  		case IIO_PRESSURE:
>  			return bme680_read_press(data, val, val2);
>  		case IIO_HUMIDITYRELATIVE:


  reply	other threads:[~2019-03-09 17:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 13:47 [PATCH] iio/chemical/bme680: Fix SPI read interface Mike Looijmans
2019-02-16 11:27 ` Himanshu Jha
2019-02-18  7:03   ` Mike Looijmans
2019-02-20 11:33     ` Jonathan Cameron
2019-02-20 11:22   ` Jonathan Cameron
2019-02-21  9:20 ` [PATCH v2] " Mike Looijmans
2019-03-03 16:57   ` Jonathan Cameron
2019-03-06  7:27     ` Mike Looijmans
2019-03-06  7:31 ` [PATCH v3 1/2] iio/chemical/bme680: Report temperature in millidegrees Mike Looijmans
2019-03-09 17:05   ` Jonathan Cameron [this message]
2019-03-06  7:31 ` [PATCH v3 2/2] iio/chemical/bme680: Fix SPI read interface Mike Looijmans
2019-03-09 17:28   ` Jonathan Cameron
2019-03-16 10:24   ` Himanshu Jha
2019-03-16 13:00     ` Mike Looijmans
2019-03-17  9:48       ` Himanshu Jha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190309170555.4982543d@archlinux \
    --to=jic23@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=dpfrey@gmail.com \
    --cc=himanshujha199640@gmail.com \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=pmeerw@pmeerw.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).