From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Massimo Toscanelli <massimo.toscanelli@leica-geosystems.com>
Cc: <linux-kernel@vger.kernel.org>, <jic23@kernel.org>,
<lars@metafoo.de>, <linus.walleij@linaro.org>,
<caihuoqing@baidu.com>, <aardelean@deviqon.com>,
<andy.shevchenko@gmail.com>, <hdegoede@redhat.com>,
<Qing-wu.Li@leica-geosystems.com.cn>, <stephan@gerhold.net>,
<linux-iio@vger.kernel.org>,
<bsp-development.geo@leica-geosystems.com>
Subject: Re: [PATCH RESEND 0/2] Solve data access delay of ST sensors
Date: Mon, 7 Feb 2022 13:58:58 +0000 [thread overview]
Message-ID: <20220207135858.00000745@Huawei.com> (raw)
In-Reply-To: <20220207090443.3710425-1-massimo.toscanelli@leica-geosystems.com>
On Mon, 7 Feb 2022 09:04:41 +0000
Massimo Toscanelli <massimo.toscanelli@leica-geosystems.com> wrote:
> Reading raw data from ST sensors implies enabling the device and
> waiting for its activation.
> This leads to significant delays every time the data is fetched,
> especially if the operation has to be repeated.
>
> The introduction of the 'always_on' flag as sysfs attribute can
> solve this issue, by allowing the user to keep the device enabled
> during the entire read session and therefore, to perform a much
> faster data access.
>
> This implementation has been already tested on a ST magnetometer.
>
> I forgot to add maintainers as recepients, so I resend the patches.
>
> Massimo Toscanelli (2):
> iio: st_sensors: add always_on flag
> iio: st_magn_core.c: activate always_on attribute
>
> .../iio/common/st_sensors/st_sensors_core.c | 85 +++++++++++++++++--
> drivers/iio/magnetometer/st_magn_core.c | 2 +
> include/linux/iio/common/st_sensors.h | 14 +++
> 3 files changed, 96 insertions(+), 5 deletions(-)
>
>
> base-commit: dcb85f85fa6f142aae1fe86f399d4503d49f2b60
Hi Massimo,
The standard approach to avoiding rapid power up and power down cycles
is to use runtime_pm with autosuspend and a period set at a period
of perhaps 1 second. Would that work for you? You'll pay the costs
of power up only on the first read after a period of not reading.
Exposing the control to userspace for this sort of thing is normally
a bad idea because userspace generally has no idea if it should use it
as there is no clean way of telling userspace the costs of not using
it (as those will be device specific).
If you have a usecase that requires regular reading you should also
think about whether using the buffered interface is more appropriate.
IIRC that will keep these devices powered up continuously whilst
the buffer is enabled and will provide a lower overhead way of
reading data than sysfs reads.
Jonathan
next prev parent reply other threads:[~2022-02-07 14:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20220204192552.428433-1-massimo.toscanelli@leica-geosystems.com>
2022-02-07 9:04 ` [PATCH RESEND 0/2] Solve data access delay of ST sensors Massimo Toscanelli
2022-02-07 9:04 ` [PATCH 1/2] iio: st_sensors: add always_on flag Massimo Toscanelli
2022-02-11 1:10 ` Linus Walleij
2022-02-07 9:04 ` [PATCH 2/2] iio: st_magn_core.c: activate always_on attribute Massimo Toscanelli
2022-02-07 13:58 ` Jonathan Cameron [this message]
2022-02-11 1:12 ` [PATCH RESEND 0/2] Solve data access delay of ST sensors Linus Walleij
2022-02-11 15:14 ` TOSCANELLI Massimo
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=20220207135858.00000745@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=Qing-wu.Li@leica-geosystems.com.cn \
--cc=aardelean@deviqon.com \
--cc=andy.shevchenko@gmail.com \
--cc=bsp-development.geo@leica-geosystems.com \
--cc=caihuoqing@baidu.com \
--cc=hdegoede@redhat.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linus.walleij@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=massimo.toscanelli@leica-geosystems.com \
--cc=stephan@gerhold.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