linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: Jonathan Cameron <jic23@kernel.org>, Olof Johansson <olof@lixom.net>
Cc: knaack.h@gmx.de, lars@metafoo.de, pmeerw@pmeerw.net,
	mpa@pengutronix.de, irina.tirdea@intel.com,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: accel: bmc150: reset chip at init time
Date: Tue, 30 Aug 2016 12:45:43 -0700	[thread overview]
Message-ID: <1472586343.5025.1.camel@linux.intel.com> (raw)
In-Reply-To: <16ba4f3e-50fa-cadf-da57-39522b6ce386@kernel.org>

On Mon, 2016-08-29 at 18:23 +0100, Jonathan Cameron wrote:
> On 25/08/16 17:45, Olof Johansson wrote:
> > 
> > In at least one known setup, the chip comes up in a state where
> > reading
> > the chip ID returns garbage unless it's been reset, due to noise on
> > the
> > wires during system boot.
> > 
> > All supported chips have the same reset method, and based on the
> > datasheets they all need 1.3 or 1.8ms to recover after reset. So,
> > do
> > the conservative thing here and always reset the chip.
> > 
> > Signed-off-by: Olof Johansson <olof@lixom.net>
Reviewed-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> Looks good to me.
> 
> Srinivas, it's your driver. Can you take a quick look at this?
> 
> Thanks,
> 
> Jonathan
> > 
> > ---
> >  drivers/iio/accel/bmc150-accel-core.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/iio/accel/bmc150-accel-core.c
> > b/drivers/iio/accel/bmc150-accel-core.c
> > index bf17aae..59b380d 100644
> > --- a/drivers/iio/accel/bmc150-accel-core.c
> > +++ b/drivers/iio/accel/bmc150-accel-core.c
> > @@ -67,6 +67,9 @@
> >  #define BMC150_ACCEL_REG_PMU_BW		0x10
> >  #define BMC150_ACCEL_DEF_BW			125
> >  
> > +#define BMC150_ACCEL_REG_RESET			0x14
> > +#define BMC150_ACCEL_RESET_VAL			0xB6
> > +
> >  #define BMC150_ACCEL_REG_INT_MAP_0		0x19
> >  #define BMC150_ACCEL_INT_MAP_0_BIT_SLOPE	BIT(2)
> >  
> > @@ -1497,6 +1500,14 @@ static int bmc150_accel_chip_init(struct
> > bmc150_accel_data *data)
> >  	int ret, i;
> >  	unsigned int val;
> >  
> > +	/*
> > +	 * Reset chip to get it in a known good state. A delay of
> > 1.8ms after
> > +	 * reset is required according to the data sheets of
> > supported chips.
> > +	 */
> > +	regmap_write(data->regmap, BMC150_ACCEL_REG_RESET,
> > +		     BMC150_ACCEL_RESET_VAL);
> > +	usleep_range(1800, 2500);
> > +
> >  	ret = regmap_read(data->regmap, BMC150_ACCEL_REG_CHIP_ID,
> > &val);
> >  	if (ret < 0) {
> >  		dev_err(dev, "Error: Reading chip id\n");
> > 

  reply	other threads:[~2016-08-30 19:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-25 16:45 [PATCH] iio: accel: bmc150: reset chip at init time Olof Johansson
2016-08-29 17:23 ` Jonathan Cameron
2016-08-30 19:45   ` Srinivas Pandruvada [this message]
2016-09-03 16:27     ` Jonathan Cameron

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=1472586343.5025.1.camel@linux.intel.com \
    --to=srinivas.pandruvada@linux.intel.com \
    --cc=irina.tirdea@intel.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=mpa@pengutronix.de \
    --cc=olof@lixom.net \
    --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).