All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Sergey Larin <cerg2010cerg2010@mail.ru>
Cc: linus.walleij@linaro.org, knaack.h@gmx.de, lars@metafoo.de,
	pmeerw@pmeerw.net, linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: gyro: mpu3050: fix chip ID reading
Date: Sun, 3 Mar 2019 11:58:49 +0000	[thread overview]
Message-ID: <20190303115849.0475aa05@archlinux> (raw)
In-Reply-To: <20190302184829.GA7375@hp>

On Sat, 2 Mar 2019 21:48:30 +0300
Sergey Larin <cerg2010cerg2010@mail.ru> wrote:

> On Sat, Mar 02, 2019 at 06:08:24PM +0000, Jonathan Cameron wrote:
> > On Sat,  2 Mar 2019 19:54:55 +0300
> > Sergey Larin <cerg2010cerg2010@mail.ru> wrote:
> >   
> > > According to the datasheet, the last bit of CHIP_ID register controls
> > > I2C bus, and the first one is unused. Handle this correctly.
> > > 
> > > Signed-off-by: Sergey Larin <cerg2010cerg2010@mail.ru>  
> > Fix certainly seems to be correct, but seeing as we only support i2c for
> > this chip and that I assume the bottom bit is actually set (though
> > reserved), currently this is a tidy up rather than a fix.
> > 
> > Hence I'll take this the slow way rather than quickly as I would
> > a fix with actual effect.
> > 
> > Let me know if I've missed something!
> > 
> > Jonathan  
> 
> That's actually a fix for me. On my device, the bottom bit is set so driver
> reports an error. With this patch, driver probes OK, prints chip info to
> dmesg (die ID, revision, etc) and reports the data to sysfs, which looks
> correct.
Ah fair enough. Moved to the fixes-togreg branch with a note added
to the description that there are real parts out there where this matters.

Also added Linus' tag.

This will upstream sometime after rc1 in a few weeks time.

Thanks,

Jonathan
> 
> >   
> > > ---
> > >  drivers/iio/gyro/mpu3050-core.c | 8 +++++---
> > >  1 file changed, 5 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c
> > > index 77fac81a3adc..5ddebede31a6 100644
> > > --- a/drivers/iio/gyro/mpu3050-core.c
> > > +++ b/drivers/iio/gyro/mpu3050-core.c
> > > @@ -29,7 +29,8 @@
> > >  
> > >  #include "mpu3050.h"
> > >  
> > > -#define MPU3050_CHIP_ID		0x69
> > > +#define MPU3050_CHIP_ID		0x68
> > > +#define MPU3050_CHIP_ID_MASK	0x7E
> > >  
> > >  /*
> > >   * Register map: anything suffixed *_H is a big-endian high byte and always
> > > @@ -1176,8 +1177,9 @@ int mpu3050_common_probe(struct device *dev,
> > >  		goto err_power_down;
> > >  	}
> > >  
> > > -	if (val != MPU3050_CHIP_ID) {
> > > -		dev_err(dev, "unsupported chip id %02x\n", (u8)val);
> > > +	if ((val & MPU3050_CHIP_ID_MASK) != MPU3050_CHIP_ID) {
> > > +		dev_err(dev, "unsupported chip id %02x\n",
> > > +				(u8)(val & MPU3050_CHIP_ID_MASK));
> > >  		ret = -ENODEV;
> > >  		goto err_power_down;
> > >  	}  
> >   


  reply	other threads:[~2019-03-03 11:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-02 16:54 [PATCH] iio: gyro: mpu3050: fix chip ID reading Sergey Larin
2019-03-02 18:08 ` Jonathan Cameron
2019-03-02 18:48   ` Sergey Larin
2019-03-03 11:58     ` Jonathan Cameron [this message]
2019-03-03  9:12 ` Linus Walleij

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=20190303115849.0475aa05@archlinux \
    --to=jic23@kernel.org \
    --cc=cerg2010cerg2010@mail.ru \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-iio@vger.kernel.org \
    --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 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.