From: Jonathan Cameron <jic23@kernel.org>
To: Victor Chernyakin <chernyakin.victor.j@outlook.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] iio: add IIO_VAL_DECIMAL64_{ATTO,ZEPTO,YOCTO} formats
Date: Fri, 23 Oct 2026 04:06:07 +0100 [thread overview]
Message-ID: <20261023040607.400f8420@jic23-hlaptop> (raw)
In-Reply-To: <SN1PR12MB25287F63D68E82759D3A0FF5A5652@SN1PR12MB2528.namprd12.prod.outlook.com>
On Thu, 22 Oct 2026 18:40:30 -0500
Victor Chernyakin <chernyakin.victor.j@outlook.com> wrote:
> The highest-precision format IIO has right now is IIO_VAL_DECIMAL64_FEMTO,
> which gives 15 decimal digits of precision after the decimal point. This
> is not enough for the upcoming TI FDC1004 driver, which needs 22 digits
> of precision to exactly express its scale value. This patch adds higher-
> precision formats, up to IIO_VAL_DECIMAL64_YOCTO (24 digits of precision).
>
> Signed-off-by: Victor Chernyakin <chernyakin.victor.j@outlook.com>
Some discussion of whether these are perhaps overkill in the driver
patch given device precision doesn't seem to be nearly that good.
> ---
> drivers/iio/industrialio-core.c | 6 ++++++
> include/linux/iio/types.h | 3 +++
> 2 files changed, 9 insertions(+)
>
> diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
> index 767a7794624a..008387efe96b 100644
> --- a/drivers/iio/industrialio-core.c
> +++ b/drivers/iio/industrialio-core.c
> @@ -716,6 +716,9 @@ static ssize_t __iio_format_value(char *buf, size_t offset, unsigned int type,
> case IIO_VAL_DECIMAL64_NANO:
> case IIO_VAL_DECIMAL64_PICO:
> case IIO_VAL_DECIMAL64_FEMTO:
Seems we failed to update the test in drivers/iio/tests/iio-test-format.c for
FEMTO. Please add that and a similar test for your new units.
> + case IIO_VAL_DECIMAL64_ATTO:
> + case IIO_VAL_DECIMAL64_ZEPTO:
> + case IIO_VAL_DECIMAL64_YOCTO:
> {
> int scale = type - IIO_VAL_DECIMAL64_BASE;
> s64 frac;
> @@ -1034,6 +1037,9 @@ static ssize_t iio_write_channel_info(struct device *dev,
> case IIO_VAL_DECIMAL64_NANO:
> case IIO_VAL_DECIMAL64_PICO:
> case IIO_VAL_DECIMAL64_FEMTO:
> + case IIO_VAL_DECIMAL64_ATTO:
> + case IIO_VAL_DECIMAL64_ZEPTO:
> + case IIO_VAL_DECIMAL64_YOCTO:
> dec_scale = type - IIO_VAL_DECIMAL64_BASE;
> fallthrough;
> case IIO_VAL_INT_64:
> diff --git a/include/linux/iio/types.h b/include/linux/iio/types.h
> index d8944c9e5e90..2ef9b2a8b119 100644
> --- a/include/linux/iio/types.h
> +++ b/include/linux/iio/types.h
> @@ -43,6 +43,9 @@ enum iio_event_info {
> #define IIO_VAL_DECIMAL64_NANO (IIO_VAL_DECIMAL64_BASE + 9)
> #define IIO_VAL_DECIMAL64_PICO (IIO_VAL_DECIMAL64_BASE + 12)
> #define IIO_VAL_DECIMAL64_FEMTO (IIO_VAL_DECIMAL64_BASE + 15)
> +#define IIO_VAL_DECIMAL64_ATTO (IIO_VAL_DECIMAL64_BASE + 18)
> +#define IIO_VAL_DECIMAL64_ZEPTO (IIO_VAL_DECIMAL64_BASE + 21)
> +#define IIO_VAL_DECIMAL64_YOCTO (IIO_VAL_DECIMAL64_BASE + 24)
>
> static inline s64 iio_val_s64_compose(s32 val0, s32 val1)
> {
next prev parent reply other threads:[~2026-10-23 3:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-22 23:40 [PATCH 0/3] iio: cdc: add Texas Instruments FDC1004 driver Victor Chernyakin
2026-10-22 23:40 ` [PATCH 1/3] iio: add IIO_VAL_DECIMAL64_{ATTO,ZEPTO,YOCTO} formats Victor Chernyakin
2026-10-23 3:06 ` Jonathan Cameron [this message]
2026-10-22 23:40 ` [PATCH 2/3] dt-bindings: iio: cdc: add Texas Instruments FDC1004 Victor Chernyakin
2026-10-23 3:09 ` Jonathan Cameron
2026-10-22 23:40 ` [PATCH 3/3] iio: cdc: add Texas Instruments FDC1004 driver Victor Chernyakin
2026-10-23 3:01 ` Jonathan Cameron
2026-10-23 7:29 ` Andy Shevchenko
2026-10-23 7:09 ` [PATCH 0/3] " Andy Shevchenko
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=20261023040607.400f8420@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=chernyakin.victor.j@outlook.com \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.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
all inboxes | Powered by JetHome®