linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio <linux-iio@vger.kernel.org>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	phone-devel@vger.kernel.org
Subject: Re: [PATCH 2/2 v2] iio: magnetometer: Add driver for Yamaha YAS5xx
Date: Sun, 29 Nov 2020 21:42:15 +0100	[thread overview]
Message-ID: <CACRpkdYFGRsk28hLGxNB4jOE2vVMMmSLEGSxucsBQGnuzxPCeg@mail.gmail.com> (raw)
In-Reply-To: <20201129112603.1644e5a5@archlinux>

On Sun, Nov 29, 2020 at 12:26 PM Jonathan Cameron <jic23@kernel.org> wrote:
> On Sat, 28 Nov 2020 22:04:56 +0100  Linus Walleij <linus.walleij@linaro.org> wrote:

> > > > + * YAS530 MS-3E (2011 Samsung Galaxy S Advance)
> > > > + * YAS532 MS-3R (2011 Samsung Galaxy S4)
> > > > + * YAS533 MS-3F (Vivo 1633, 1707, V3, Y21L)
> > > > + * (YAS534 is a magnetic switch, not handled)
> > >
> > > And there is your reason not to use wild cards in the dt file name etc!
> >
> > It's pretty safe as we definately account for all magnetometers
> > of the naming scheme YAS53x. The YAS534 would be in another
> > subsystem (proximity, I guess) so the path to the file gives the
> > right info: this covers all magnetometers named yas53x, goes
> > for both the bindings and the driver I think?
>
> I'd just name it after a specific part.

OK no problem I just name it yas530 everywhere as it is the
oldest supported part number.

> > > > +     c->a2 = yas5xx_extract_bits(&data[3], 10, 15) - 32;
> > > > +     c->a3 = yas5xx_extract_bits(&data[3], 6, 9) - 8;
> > > > +     c->a4 = yas5xx_extract_bits(&data[4], 8, 13) - 32;
> > > > +     c->a5 = yas5xx_extract_bits(&data[5], 10, 15) + 38;
> > > > +     c->a6 = yas5xx_extract_bits(&data[5], 4, 9) - 32;
> > > > +     c->a7 = yas5xx_extract_bits(&data[6], 5, 11) - 64;
> > > > +     c->a8 = yas5xx_extract_bits(&data[7], 7, 12) - 32;
> > > > +     c->a9 = yas5xx_extract_bits(&data[8], 7, 14);
> > > > +     c->k = yas5xx_extract_bits(&data[9], 10, 14) + 10;
> >
> > Since this segment easily fits in a u64 I thought about
> > extracing a u64 and then use FIELD_GET on that.
>
> Could do, but to a degree what makes sense here is dependent on what
> aligns well with the datasheet as that's what people will check against.
> Is there a public datasheet with this in?

There are public data sheets, but no public register descriptions.
The only documentation is code looking worse than what I
wrote (IMO).

Yours,
Linus Walleij

  reply	other threads:[~2020-11-29 20:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-28  0:40 [PATCH 1/2 v2] iio: accel: yamaha-yas53x: Add DT bindings Linus Walleij
2020-11-28  0:40 ` [PATCH 2/2 v2] iio: magnetometer: Add driver for Yamaha YAS5xx Linus Walleij
2020-11-28  4:09   ` Bjorn Andersson
2020-11-28 11:27     ` Jonathan Cameron
2020-11-28 11:33       ` Linus Walleij
2020-11-28 12:21   ` Jonathan Cameron
2020-11-28 21:04     ` Linus Walleij
2020-11-29 11:26       ` Jonathan Cameron
2020-11-29 20:42         ` Linus Walleij [this message]
2020-11-28 11:37 ` [PATCH 1/2 v2] iio: accel: yamaha-yas53x: Add DT bindings 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=CACRpkdYFGRsk28hLGxNB4jOE2vVMMmSLEGSxucsBQGnuzxPCeg@mail.gmail.com \
    --to=linus.walleij@linaro.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=phone-devel@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 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).