All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Daniel Baluta <daniel.baluta@intel.com>
Cc: srinivas.pandruvada@linux.intel.com, linux-iio@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: accel: kxcjk-1013: Fix kxcjk10013_set_range
Date: Sat, 15 Nov 2014 16:13:26 +0000	[thread overview]
Message-ID: <54677BA6.1030205@kernel.org> (raw)
In-Reply-To: <1415607616-17215-1-git-send-email-daniel.baluta@intel.com>

On 10/11/14 08:20, Daniel Baluta wrote:
> Currently, we get the new GSEL bits by OR-ing the old values
> with the new ones. This only works first time when the old
> values are 0.
> 
> Startup:
> 	* GSEL0 = 0, GSEL1 = 0
> 
> Set range to 4G: (GSEL0 = 1, GSEL1 = 0)
> 	* GSEL0 = 0 | 1 = 1
> 	* GSEL1 = 0 | 0 = 0
> 	* correct
> 
> Change range to 2G: (GSEL0 = 0, GSEL1 = 0)
> 	* GSEL0 = 1 | 0 = 1
> 	* GSEL1 = 0 | 0 = 0
> 	* wrong, GSEL0 should be 0
> 
> This has the nice effect that we can use the full scale range,
> exported in in_accel_scale_available.
> 
> Fixes: a735e3d7f03 (iio: accel: kxcjk-1013: Set adjustable range)
> Signed-off-by: Daniel Baluta <daniel.baluta@intel.com>
> Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Applied to the fixes-togreg branch of iio.git and marked for stable.
Thanks,

> ---
>  drivers/iio/accel/kxcjk-1013.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
> index 98909a9..21f1279 100644
> --- a/drivers/iio/accel/kxcjk-1013.c
> +++ b/drivers/iio/accel/kxcjk-1013.c
> @@ -269,6 +269,8 @@ static int kxcjk1013_set_range(struct kxcjk1013_data *data, int range_index)
>  		return ret;
>  	}
>  
> +	ret &= ~(KXCJK1013_REG_CTRL1_BIT_GSEL0 |
> +		 KXCJK1013_REG_CTRL1_BIT_GSEL1);
>  	ret |= (KXCJK1013_scale_table[range_index].gsel_0 << 3);
>  	ret |= (KXCJK1013_scale_table[range_index].gsel_1 << 4);
>  
> 


      reply	other threads:[~2014-11-15 16:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-10  8:20 [PATCH] iio: accel: kxcjk-1013: Fix kxcjk10013_set_range Daniel Baluta
2014-11-15 16:13 ` Jonathan Cameron [this message]

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=54677BA6.1030205@kernel.org \
    --to=jic23@kernel.org \
    --cc=daniel.baluta@intel.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.