public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] iio: st_sensors: make scale channels also shared by type
@ 2020-04-23 12:17 Gaëtan André
  2020-04-25 17:13 ` Jonathan Cameron
  0 siblings, 1 reply; 8+ messages in thread
From: Gaëtan André @ 2020-04-23 12:17 UTC (permalink / raw)
  To: jic23; +Cc: linux-iio, ~postmarketos/upstreaming, Gaëtan André

Scale channels are available by axis. For example for accelerometers,
in_accel_x_scale, in_accel_y_scale and in_accel_z_scale are available.

However, they should be shared by type as documented in
Documentation/ABI/testing/sysfs-bus-iio.

For each sensor (acceleros, gyros and magnetos) only one value is specified
for all the axes.

Existing, by axis, entries are preserved in order to to leave the old ABI
untouched.

Signed-off-by: Gaëtan André <rvlander@gaetanandre.eu>
---
v1->v2: add comment explaining why we are doing both.

 include/linux/iio/common/st_sensors.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 33e939977444..42663fbab085 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -46,12 +46,19 @@
 #define ST_SENSORS_MAX_NAME			17
 #define ST_SENSORS_MAX_4WAI			8
 
+/*
+ * Scale channels are configured both by type and by axis.
+ * - By axis to keep the previous ABI and flexibility.
+ * - By type because it is how some userland
+ * applications are expecting them (ex: iio-sensor-proxy).
+ */
 #define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
 					ch2, s, endian, rbits, sbits, addr) \
 { \
 	.type = device_type, \
 	.modified = mod, \
 	.info_mask_separate = mask, \
+	.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE), \
 	.info_mask_shared_by_all = BIT(IIO_CHAN_INFO_SAMP_FREQ), \
 	.scan_index = index, \
 	.channel2 = ch2, \

base-commit: 2de8c02349f02d014e51b43f306d28fc7a23ea6e
-- 
2.26.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-05-12 14:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-23 12:17 [PATCH v2] iio: st_sensors: make scale channels also shared by type Gaëtan André
2020-04-25 17:13 ` Jonathan Cameron
2020-04-26 11:19   ` Bastien Nocera
2020-05-02 18:07     ` Jonathan Cameron
2020-05-04 10:02       ` Bastien Nocera
2020-05-04 10:22         ` Jonathan Cameron
2020-05-04 11:05           ` Bastien Nocera
2020-05-12 14:11           ` Bastien Nocera

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox