From: Andi Shyti <andi.shyti@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Andi Shyti <andi.shyti@kernel.org>,
Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Zhigang Shi <Zhigang.Shi@liteon.com>,
Shreeya Patel <shreeya.patel@collabora.com>,
Paul Gazzillo <paul@pgazz.com>,
Dmitry Osipenko <dmitry.osipenko@collabora.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 4/5] iio: light: ROHM BU27008 color sensor
Date: Wed, 26 Apr 2023 14:20:15 +0200 [thread overview]
Message-ID: <20230426122015.cilet7diaxapgbim@intel.intel> (raw)
In-Reply-To: <d1121acc-6300-011f-caa2-0ddc01c46e91@gmail.com>
Hi Matti,
> > > > > +static int bu27008_chip_init(struct bu27008_data *data)
> > > > > +{
> > > > > + int ret;
> > > > > +
> > > > > + ret = regmap_update_bits(data->regmap, BU27008_REG_SYSTEM_CONTROL,
> > > > > + BU27008_MASK_SW_RESET, BU27008_MASK_SW_RESET);
> > > > > + if (ret)
> > > > > + return dev_err_probe(data->dev, ret, "Sensor reset failed\n");
> > > > > +
> > > > > + /*
> > > > > + * The data-sheet does not tell how long performing the IC reset takes.
> > > > > + * However, the data-sheet says the minimum time it takes the IC to be
> > > > > + * able to take inputs after power is applied, is 100 uS. I'd assume
> > > > > + * > 1 mS is enough.
> > > > > + */
> > > > > + msleep(1);
> > > >
> > > > please use usleep_range().
> > >
> > > I prefer to not require setting up hrtimers as we have no real requirements
> > > for the duration of this sleep. I know the msleep() is likely to exceed the
> > > 1 mS, potentially a lot if there is things to do - but we don't really care
> > > at this point. The main thing is to give the HW time to reset while allowing
> > > other things to be scheduled.
> >
> > For the reason above, msleep(1) is quite a meaningless
> > instruction. If you need to wait around 1ms, then usleep_range is
> > the function to be used.
> >
> > Refer, also, to the Documentation/timers/timers-howto.rst
>
> I know the msleep() may sleep much longer. It still is not meaningless. Here
> we use the msleep() in a purpose:
>
> "Sleep at least 1 mS, but actually I don't care if that is 20 mS or more -
> as long as you allow scheduling other things with as little overhead as
> possible".
>
> For that purpose msleep() works just perfectly :)
>
> I actually had a comment clarifying this in previous IIO driver I wrote
> (just to avoid confusing reviewers) but Jonathan asked me to remove the
> comment ;)
OK... ok... you convinced me :)
Thanks, will check soon your v3.
Andi
next prev parent reply other threads:[~2023-04-26 12:20 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-24 13:07 [PATCH v2 0/5] Support ROHM BU27008 RGB sensor Matti Vaittinen
2023-04-24 13:07 ` [PATCH v2 1/5] dt-bindings: iio: light: ROHM BU27008 Matti Vaittinen
2023-04-24 14:00 ` Krzysztof Kozlowski
2023-04-24 13:08 ` [PATCH v2 2/5] iio:trigger: Add simple trigger_validation helper Matti Vaittinen
2023-04-24 15:08 ` Andy Shevchenko
2023-04-25 5:17 ` Matti Vaittinen
2023-04-24 13:08 ` [PATCH v2 3/5] iio: kx022a: Use new iio_validate_own_trigger() Matti Vaittinen
2023-04-24 13:10 ` [PATCH v2 4/5] iio: light: ROHM BU27008 color sensor Matti Vaittinen
2023-04-24 15:22 ` Andy Shevchenko
2023-04-25 5:24 ` Matti Vaittinen
2023-04-25 13:45 ` Andy Shevchenko
2023-04-25 16:45 ` Andi Shyti
2023-04-26 5:32 ` Matti Vaittinen
2023-04-26 10:12 ` Andi Shyti
2023-04-26 10:19 ` Matti Vaittinen
2023-04-26 12:20 ` Andi Shyti [this message]
2023-04-24 13:10 ` [PATCH v2 5/5] MAINTAINERS: Add ROHM BU27008 Matti Vaittinen
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=20230426122015.cilet7diaxapgbim@intel.intel \
--to=andi.shyti@kernel.org \
--cc=Zhigang.Shi@liteon.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.osipenko@collabora.com \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matti.vaittinen@fi.rohmeurope.com \
--cc=mazziesaccount@gmail.com \
--cc=paul@pgazz.com \
--cc=robh+dt@kernel.org \
--cc=shreeya.patel@collabora.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