From: Ariana Lazar <ariana.lazar@microchip.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
"Guenter Roeck" <linux@roeck-us.net>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>
Cc: <linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-hwmon@vger.kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Marius Cristea <marius.cristea@microchip.com>,
Ariana Lazar <ariana.lazar@microchip.com>
Subject: [PATCH v5 3/5] iio: core: add iio_fill_val_int_64() helper
Date: Tue, 3 Nov 2026 16:37:13 +0200 [thread overview]
Message-ID: <20261103-pac1711-v5-3-71c20101a52e@microchip.com> (raw)
In-Reply-To: <20261103-pac1711-v5-0-71c20101a52e@microchip.com>
Add iio_fill_val_int_64() to populate the val and val2 output parameters
with the lower and upper 32 bits of a 64-bit value, as used for
IIO_VAL_INT_64. The helper wraps lower_32_bits() and upper_32_bits() in
order to split the value with a single call.
The pac1711 driver will be the first user of this function.
Signed-off-by: Ariana Lazar <ariana.lazar@microchip.com>
---
include/linux/iio/iio.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/include/linux/iio/iio.h b/include/linux/iio/iio.h
index 711c00f67371356c913ef0dbf2325e3f4d35266d..d8fd300a125d676bf60e0b59f84a69f99ff23c89 100644
--- a/include/linux/iio/iio.h
+++ b/include/linux/iio/iio.h
@@ -1099,6 +1099,21 @@ ssize_t iio_format_value(char *buf, unsigned int type, int size, int *vals);
int iio_str_to_fixpoint(const char *str, int fract_mult, int *integer,
int *fract);
+/**
+ * iio_fill_val_int_64() - Fill the value fields used to represent a 64-bit integer
+ * @value: The 64-bit value to be represented
+ * @val: the lower 32 bits of @value
+ * @val2: the upper 32 bits of @value
+ *
+ * Populate @val and @val2 with the lower and upper halves of @value, as
+ * expected by IIO_VAL_INT_64.
+ */
+static inline void iio_fill_val_int_64(s64 value, int *val, int *val2)
+{
+ *val = lower_32_bits(value);
+ *val2 = upper_32_bits(value);
+}
+
/**
* IIO_DEGREE_TO_RAD() - Convert degree to rad
* @deg: A value in degree
--
2.43.0
next prev parent reply other threads:[~2026-11-03 14:38 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 14:37 [PATCH v5 0/5] Add support for Microchip PAC1711 Power Monitor Ariana Lazar
2026-11-03 14:37 ` [PATCH v5 1/5] unaligned: introduce be56 unaligned accessors Ariana Lazar
2026-11-03 14:37 ` [PATCH v5 2/5] iio: core: add IIO_CHARGE channel type Ariana Lazar
2026-11-03 16:13 ` Andy Shevchenko
2026-11-03 14:37 ` Ariana Lazar [this message]
2026-11-03 16:14 ` [PATCH v5 3/5] iio: core: add iio_fill_val_int_64() helper Andy Shevchenko
2026-11-03 14:37 ` [PATCH v5 4/5] dt-bindings: iio: adc: add support for PAC1711 Ariana Lazar
2026-11-03 14:37 ` [PATCH v5 5/5] " Ariana Lazar
2026-11-03 16:40 ` 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=20261103-pac1711-v5-3-71c20101a52e@microchip.com \
--to=ariana.lazar@microchip.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=marius.cristea@microchip.com \
--cc=neil.armstrong@linaro.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/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®