[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-iio
Subject:    Re: [PATCH 2/2 v2] iio: magnetometer: Add driver for Yamaha YAS5xx
From:       Linus Walleij <linus.walleij () linaro ! org>
Date:       2020-11-29 20:42:15
Message-ID: CACRpkdYFGRsk28hLGxNB4jOE2vVMMmSLEGSxucsBQGnuzxPCeg () mail ! gmail ! com
[Download RAW message or body]

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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic