From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: LI Qingwu <Qing-wu.Li@leica-geosystems.com.cn>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh+dt@kernel.org>,
Tomas Melin <tomas.melin@vaisala.com>,
devicetree <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-iio@vger.kernel.org
Subject: Re: [PATCH V1 5/6] iio: accel: sca3300: Add inclination channels.
Date: Sun, 30 Jan 2022 11:46:38 +0000 [thread overview]
Message-ID: <20220130114638.20097dd8@jic23-huawei> (raw)
In-Reply-To: <CAHp75VeNFj3Hz1+quqpuWGuVYhPFngC20Gk=AfG+ZVEsrU9Qeg@mail.gmail.com>
On Mon, 24 Jan 2022 15:19:09 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> On Mon, Jan 24, 2022 at 11:39 AM LI Qingwu
> <Qing-wu.Li@leica-geosystems.com.cn> wrote:
> >
> > Different with SCA3300, SCL3300 can output inclination angles.
> > Angles are formed from acceleration with following equations:
> > ANG_X = atan2(accx / √(accy^2 + accz^2)),
> > ANG_Y = atan2(accy / √(accx^2 + accz^2)),
> > ANG_Z = atan2(accz / √(accx^2 + accy^2)),
> >
> > The commit add output of the raw value,scale
> > and scale_available of angles.
> > add interface for enable/disable of the angle output.
> >
> > new interfaces:
>
> New
>
> > in_incli_en
Why? There are only a few reasons to have an enable for a
channel and they don't include something that we might only
sometimes read (tend to be temporal channels such as step
counters where we want to be able to pause their counting,
or output channels).
> > in_incli_scale
> > in_incli_scale_available
> > in_incli_x_raw
> > in_incli_y_raw
> > in_incli_z_raw
>
> Indent them by 2 spaces.
>
> Wondering if these need to be described in ABI documentation.
It's standard ABI, though we don't give much description of what
exactly these ease. It might be possible to add more information
to the generic docs, but that would require looking very carefully
at the current supporting devices.
"Inclination raw reading about axis x, y or z (may be
Arbitrarily assigned). Data converted by application of offset
and scale to degrees."
>
> ...
>
> > SCA3300_ACCEL_CHANNEL(SCA3300_ACC_Y, 0x2, Y),
> > SCA3300_ACCEL_CHANNEL(SCA3300_ACC_Z, 0x3, Z),
> > SCA3300_TEMP_CHANNEL(SCA3300_TEMP, 0x05),
> > - IIO_CHAN_SOFT_TIMESTAMP(4)
>
> > + IIO_CHAN_SOFT_TIMESTAMP(SCA3300_TIMESTAMP)
>
> + Comma (while at it)?
>
> ...
>
> > - IIO_CHAN_SOFT_TIMESTAMP(4),
> > + SCA3300_INCLI_CHANNEL(SCA3300_INCLI_X, 0x09, X),
> > + SCA3300_INCLI_CHANNEL(SCA3300_INCLI_Y, 0x0A, Y),
> > + SCA3300_INCLI_CHANNEL(SCA3300_INCLI_Z, 0x0B, Z),
> > + IIO_CHAN_SOFT_TIMESTAMP(SCA3300_TIMESTAMP)
>
> Ditto.
>
> > +static const int sca3300_incli_scale[CHIP_CNT][OP_MOD_CNT][2] = {
> > + [CHIP_SCA3300] = {{0, 0}, {0, 0}, {0, 0}, {0, 0}},
>
> > + [CHIP_SCL3300] = {{0, 5495}, {0, 5495}, {0, 5495}, {0, 5495}}
>
> + Comma.
>
> > +};
>
> ...
>
> > struct {
> > - s16 channels[4];
> > + s16 channels[SCA3300_TIMESTAMP-1];
>
> Missed spaces around the arithmetic operator.
>
> > s64 ts __aligned(sizeof(s64));
> > } scan;
> > const struct sca3300_chip_info *chip_info;
> > u8 txbuf[4] ____cacheline_aligned;
> > u8 rxbuf[4];
>
> > -
>
> Stray change.
>
> > };
>
> ...
>
> > + /*Inclination scale info tied to accel scale.*/
> > + /*not allowed to set separately. */
>
> Please, follow the proper style for multi-line comments, including
> necessary spaces, periods, starting and ending lines.
>
> ...
>
> > + case IIO_CHAN_INFO_ENABLE:
> > + if (data->chip_info->chip_type == CHIP_SCL3300) {
>
> > + if (chan->type == IIO_INCLI) {
>
> See below.
>
> > + if (val != 0)
>
> if (val)
>
> > + reg_val = 0x1F;
> > + else
> > + reg_val = 0x00;
> > + return sca3300_write_reg(data, SCA3300_REG_ANG_CTRL, reg_val);
> > + }
> > + }
>
> ...
>
> > - if (chan->type == IIO_ACCEL) {
> > +
> > + if (chan->type == IIO_INCLI) {
>
> > + } else if (chan->type == IIO_ACCEL) {
>
> I would recommend using switch-case for channel type as well.
>
> ...
>
> > + case IIO_CHAN_INFO_ENABLE:
> > + if (chan->type == IIO_INCLI) {
>
> > + ret = sca3300_read_reg(data, SCA3300_REG_ANG_CTRL, ®_val);
>
> How is ret supposed to be used?
>
> > + *val = reg_val;
> > + return IIO_VAL_INT;
> > + }
> > + return -EINVAL;
>
next prev parent reply other threads:[~2022-01-30 11:40 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-24 9:39 [PATCH V1 0/6] i iio: accel: sca3300: add compitible for scl3300 LI Qingwu
2022-01-24 9:39 ` [PATCH V1 1/6] iio: accel: sca3300: add define for temp channel for reuse LI Qingwu
2022-01-24 9:39 ` [PATCH V1 2/6] iio: accel: sca3300: Add interface for operation modes LI Qingwu
2022-01-24 13:03 ` Andy Shevchenko
2022-01-24 13:49 ` kernel test robot
2022-01-24 13:59 ` kernel test robot
2022-01-30 11:40 ` Jonathan Cameron
2022-02-10 10:08 ` LI Qingwu
2022-02-10 15:40 ` Jonathan Cameron
2022-01-24 9:39 ` [PATCH V1 3/6] iio: accel: sca3300: modified to support multi chips LI Qingwu
2022-01-24 13:08 ` Andy Shevchenko
2022-01-24 15:01 ` kernel test robot
2022-01-24 15:32 ` kernel test robot
2022-01-24 9:39 ` [PATCH V1 4/6] iio: accel: sca3300: Add support for SCL3300 LI Qingwu
2022-01-24 13:12 ` Andy Shevchenko
2022-01-24 9:39 ` [PATCH V1 5/6] iio: accel: sca3300: Add inclination channels LI Qingwu
2022-01-24 13:19 ` Andy Shevchenko
2022-01-30 11:46 ` Jonathan Cameron [this message]
2022-01-24 9:39 ` [PATCH V1 6/6] dt-bindings: iio: accel: sca3300: Document murata,scl3300 LI Qingwu
2022-02-09 3:08 ` Rob Herring
2022-01-30 11:35 ` [PATCH V1 0/6] i iio: accel: sca3300: add compitible for scl3300 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=20220130114638.20097dd8@jic23-huawei \
--to=jic23@kernel.org \
--cc=Qing-wu.Li@leica-geosystems.com.cn \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=tomas.melin@vaisala.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 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).