[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHp75VeiuJjiPFFh0pEGGH4+UEn0g5902UhAJL93Ho2WvH0_gg@mail.gmail.com>
Date: Mon, 4 Jul 2022 23:51:32 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: ChiYuan Huang <u0084500@...il.com>
Cc: Jonathan Cameron <jic23@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Lars-Peter Clausen <lars@...afoo.de>,
cy_huang <cy_huang@...htek.com>,
linux-iio <linux-iio@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
devicetree <devicetree@...r.kernel.org>
Subject: Re: [PATCH v2 2/2] iio: adc: Add rtq6056 support
On Mon, Jul 4, 2022 at 9:27 AM ChiYuan Huang <u0084500@...il.com> wrote:
> ChiYuan Huang <u0084500@...il.com> 於 2022年7月4日 週一 上午11:16寫道:
> > Andy Shevchenko <andy.shevchenko@...il.com> 於 2022年7月1日 週五 下午6:05寫道:
> > > On Wed, Jun 29, 2022 at 4:23 AM cy_huang <u0084500@...il.com> wrote:
...
> > > > + *val = DIV_ROUND_UP(1000000, sample_time);
> > >
> > > USEC_PER_SEC ?
> > >
> > No, sample time is (vshunt convesion time + vbus conversion time) *
> > average sample.
> > And the sample freq returns the unit by HZ (sample frequency per second)
> >
> The 'sample time' is unit by micro-second like as you mentioned.
Ah, then it should be MICRO, so we will get Hz.
> > > > + return IIO_VAL_INT;
> > > > +}
...
> > > > + struct {
> > > > + u16 vals[RTQ6056_MAX_CHANNEL];
> > > > + int64_t timestamp;
> > > > + } data __aligned(8);
> > >
> > > Hmm... alignment of this struct will be at least 4 bytes, but
> > > shouldn't we rather be sure that the timestamp member is aligned
> > > properly? Otherwise this seems fragile and dependent on
> > > RTQ6056_MAX_CHANNEL % 4 == 0.
> > >
> > Yap, from the 'max channel', it already guarantee this struct will be
> > aligned at lease 4.
> > Actually, It can be removed.
I think for the safest side it should be given to the timestamp member. No?
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists