All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
@ 2021-05-18 23:07 Linus Walleij
  2021-05-18 23:07 ` [PATCH 2/5 v3] iio: accel: st_sensors: Support generic mounting matrix Linus Walleij
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Linus Walleij @ 2021-05-18 23:07 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Hans de Goede, Denis Ciocca, Daniel Drake,
	Andy Shevchenko, Stephan Gerhold

Extend ST_SENSORS_LSM_CHANNELS() to a version that will accept extended
attributes named ST_SENSORS_LSM_CHANNELS_EXT() and wrap the former as a
specialized version of the former.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Cc: Daniel Drake <drake@endlessm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Rebase and resend.
ChangeLog v1->v2:
- New helper patch from Stephan.
---
 include/linux/iio/common/st_sensors.h | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 0b9aeb479f48..8e0d76b42db9 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -48,8 +48,8 @@
 #define ST_SENSORS_MAX_NAME			17
 #define ST_SENSORS_MAX_4WAI			8
 
-#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
-					ch2, s, endian, rbits, sbits, addr) \
+#define ST_SENSORS_LSM_CHANNELS_EXT(device_type, mask, index, mod, \
+				    ch2, s, endian, rbits, sbits, addr, ext) \
 { \
 	.type = device_type, \
 	.modified = mod, \
@@ -65,8 +65,14 @@
 		.storagebits = sbits, \
 		.endianness = endian, \
 	}, \
+	.ext_info = ext, \
 }
 
+#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
+				ch2, s, endian, rbits, sbits, addr)	\
+	ST_SENSORS_LSM_CHANNELS_EXT(device_type, mask, index, mod,	\
+				    ch2, s, endian, rbits, sbits, addr, NULL)
+
 #define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \
 		IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \
 			st_sensors_sysfs_sampling_frequency_avail)
-- 
2.31.1


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

* [PATCH 2/5 v3] iio: accel: st_sensors: Support generic mounting matrix
  2021-05-18 23:07 [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Linus Walleij
@ 2021-05-18 23:07 ` Linus Walleij
  2021-05-18 23:07 ` [PATCH 3/5 v3] iio: accel: st_sensors: Stop copying channels Linus Walleij
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2021-05-18 23:07 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Hans de Goede, Denis Ciocca, Daniel Drake,
	Andy Shevchenko, Stephan Gerhold

The ST accelerators support a special type of quirky mounting matrix found
in ACPI systems, but not a generic mounting matrix such as from the device
tree.

Augment the ACPI hack to be a bit more generic and accept a mounting
matrix from device properties.

This makes it possible to fix orientation on the Ux500 HREF device.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Cc: Daniel Drake <drake@endlessm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Rebase on Andy's patches and mount-matrix generalization
- Drop surplus comma after sentinel
- Reword ACPI quirk call site
ChangeLog v1->v2:
- Make the .mount_matrix member of st_sensor_data a full member
  instead of a pointer so we get rid of a bunch of unneeded
  allocations that could fail.
- Make a drive-by fix to the kerneldoc.
- Use the new ST_SENSORS_LSM_CHANNELS_EXT() to define the channels
  with the extended attribute for mounting matrix.
- Demote the error message at the end of apply_acpi_orientation()
  to dev_dbg() and only print it of ret != 0.
---
 drivers/iio/accel/st_accel_core.c     | 112 ++++++++++++++------------
 include/linux/iio/common/st_sensors.h |   4 +-
 2 files changed, 62 insertions(+), 54 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index dc32ebefe3fc..9abcebf767b1 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -41,51 +41,74 @@
 #define ST_ACCEL_FS_AVL_200G			200
 #define ST_ACCEL_FS_AVL_400G			400
 
+static const struct iio_mount_matrix *
+st_accel_get_mount_matrix(const struct iio_dev *indio_dev,
+			  const struct iio_chan_spec *chan)
+{
+	struct st_sensor_data *adata = iio_priv(indio_dev);
+
+	return &adata->mount_matrix;
+}
+
+static const struct iio_chan_spec_ext_info st_accel_mount_matrix_ext_info[] = {
+	IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, st_accel_get_mount_matrix),
+	{ }
+};
+
 static const struct iio_chan_spec st_accel_8bit_channels[] = {
-	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ACCEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 8, 8,
-			ST_ACCEL_DEFAULT_OUT_X_L_ADDR+1),
-	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+			ST_ACCEL_DEFAULT_OUT_X_L_ADDR+1,
+			st_accel_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ACCEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 8, 8,
-			ST_ACCEL_DEFAULT_OUT_Y_L_ADDR+1),
-	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+			ST_ACCEL_DEFAULT_OUT_Y_L_ADDR+1,
+			st_accel_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ACCEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 8, 8,
-			ST_ACCEL_DEFAULT_OUT_Z_L_ADDR+1),
+			ST_ACCEL_DEFAULT_OUT_Z_L_ADDR+1,
+			st_accel_mount_matrix_ext_info),
 	IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
 static const struct iio_chan_spec st_accel_12bit_channels[] = {
-	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ACCEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 12, 16,
-			ST_ACCEL_DEFAULT_OUT_X_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+			ST_ACCEL_DEFAULT_OUT_X_L_ADDR,
+			st_accel_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ACCEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 12, 16,
-			ST_ACCEL_DEFAULT_OUT_Y_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+			ST_ACCEL_DEFAULT_OUT_Y_L_ADDR,
+			st_accel_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ACCEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 12, 16,
-			ST_ACCEL_DEFAULT_OUT_Z_L_ADDR),
+			ST_ACCEL_DEFAULT_OUT_Z_L_ADDR,
+			st_accel_mount_matrix_ext_info),
 	IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
 static const struct iio_chan_spec st_accel_16bit_channels[] = {
-	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ACCEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16,
-			ST_ACCEL_DEFAULT_OUT_X_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+			ST_ACCEL_DEFAULT_OUT_X_L_ADDR,
+			st_accel_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ACCEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16,
-			ST_ACCEL_DEFAULT_OUT_Y_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_ACCEL,
+			ST_ACCEL_DEFAULT_OUT_Y_L_ADDR,
+			st_accel_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ACCEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16,
-			ST_ACCEL_DEFAULT_OUT_Z_L_ADDR),
+			ST_ACCEL_DEFAULT_OUT_Z_L_ADDR,
+			st_accel_mount_matrix_ext_info),
 	IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
@@ -1162,25 +1185,10 @@ static const struct iio_trigger_ops st_accel_trigger_ops = {
 #endif
 
 #ifdef CONFIG_ACPI
-static const struct iio_mount_matrix *
-get_mount_matrix(const struct iio_dev *indio_dev,
-		 const struct iio_chan_spec *chan)
-{
-	struct st_sensor_data *adata = iio_priv(indio_dev);
-
-	return adata->mount_matrix;
-}
-
-static const struct iio_chan_spec_ext_info mount_matrix_ext_info[] = {
-	IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, get_mount_matrix),
-	{ },
-};
-
 /* Read ST-specific _ONT orientation data from ACPI and generate an
  * appropriate mount matrix.
  */
-static int apply_acpi_orientation(struct iio_dev *indio_dev,
-				  struct iio_chan_spec *channels)
+static int apply_acpi_orientation(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *adata = iio_priv(indio_dev);
 	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
@@ -1269,14 +1277,6 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev,
 	}
 
 	/* Convert our integer matrix to a string-based iio_mount_matrix */
-	adata->mount_matrix = devm_kmalloc(&indio_dev->dev,
-					   sizeof(*adata->mount_matrix),
-					   GFP_KERNEL);
-	if (!adata->mount_matrix) {
-		ret = -ENOMEM;
-		goto out;
-	}
-
 	for (i = 0; i < 3; i++) {
 		for (j = 0; j < 3; j++) {
 			int matrix_val = final_ont[i][j];
@@ -1295,26 +1295,25 @@ static int apply_acpi_orientation(struct iio_dev *indio_dev,
 			default:
 				goto out;
 			}
-			adata->mount_matrix->rotation[i * 3 + j] = str_value;
+			adata->mount_matrix.rotation[i * 3 + j] = str_value;
 		}
 	}
 
-	/* Expose the mount matrix via ext_info */
-	for (i = 0; i < indio_dev->num_channels; i++)
-		channels[i].ext_info = mount_matrix_ext_info;
-
 	ret = 0;
 	dev_info(&indio_dev->dev, "computed mount matrix from ACPI\n");
 
 out:
 	kfree(buffer.pointer);
+	if (ret)
+		dev_dbg(&indio_dev->dev,
+			"failed to apply ACPI orientation data: %d\n", ret);
+
 	return ret;
 }
 #else /* !CONFIG_ACPI */
-static int apply_acpi_orientation(struct iio_dev *indio_dev,
-				  struct iio_chan_spec *channels)
+static int apply_acpi_orientation(struct iio_dev *indio_dev)
 {
-	return 0;
+	return -EINVAL;
 }
 #endif
 
@@ -1361,9 +1360,16 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
 	if (!channels)
 		return -ENOMEM;
 
-	if (apply_acpi_orientation(indio_dev, channels))
-		dev_warn(&indio_dev->dev,
-			 "failed to apply ACPI orientation data: %d\n", err);
+	/*
+	 * First try specific ACPI methods to retrieve orientation then try the
+	 * generic function.
+	 */
+	err = apply_acpi_orientation(indio_dev);
+	if (err) {
+		err = iio_read_mount_matrix(adata->dev, &adata->mount_matrix);
+		if (err)
+			return err;
+	}
 
 	indio_dev->channels = channels;
 	adata->current_fullscale = &adata->sensor_settings->fs.fs_avl[0];
diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
index 8e0d76b42db9..8bdbaf3f3796 100644
--- a/include/linux/iio/common/st_sensors.h
+++ b/include/linux/iio/common/st_sensors.h
@@ -13,6 +13,7 @@
 #include <linux/i2c.h>
 #include <linux/spi/spi.h>
 #include <linux/irqreturn.h>
+#include <linux/iio/iio.h>
 #include <linux/iio/trigger.h>
 #include <linux/bitops.h>
 #include <linux/regulator/consumer.h>
@@ -221,6 +222,7 @@ struct st_sensor_settings {
  * struct st_sensor_data - ST sensor device status
  * @dev: Pointer to instance of struct device (I2C or SPI).
  * @trig: The trigger in use by the core driver.
+ * @mount_matrix: The mounting matrix of the sensor.
  * @sensor_settings: Pointer to the specific sensor settings in use.
  * @current_fullscale: Maximum range of measure by the sensor.
  * @vdd: Pointer to sensor's Vdd power supply
@@ -240,7 +242,7 @@ struct st_sensor_settings {
 struct st_sensor_data {
 	struct device *dev;
 	struct iio_trigger *trig;
-	struct iio_mount_matrix *mount_matrix;
+	struct iio_mount_matrix mount_matrix;
 	struct st_sensor_settings *sensor_settings;
 	struct st_sensor_fullscale_avl *current_fullscale;
 	struct regulator *vdd;
-- 
2.31.1


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

* [PATCH 3/5 v3] iio: accel: st_sensors: Stop copying channels
  2021-05-18 23:07 [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Linus Walleij
  2021-05-18 23:07 ` [PATCH 2/5 v3] iio: accel: st_sensors: Support generic mounting matrix Linus Walleij
@ 2021-05-18 23:07 ` Linus Walleij
  2021-05-18 23:07 ` [PATCH 4/5 v3] iio: magnetometer: st_magn: Support mount matrix Linus Walleij
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2021-05-18 23:07 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Hans de Goede, Denis Ciocca, Daniel Drake,
	Andy Shevchenko, Stephan Gerhold

The channels were copied only so that the .ext_info member should become
assignable. We now have compile-time static assignment so drop this code.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Cc: Daniel Drake <drake@endlessm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Rebase on the other changes.
ChangeLog v1->v2:
- Improvement found by Stephan.
---
 drivers/iio/accel/st_accel_core.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/iio/accel/st_accel_core.c b/drivers/iio/accel/st_accel_core.c
index 9abcebf767b1..28fceac9f2f6 100644
--- a/drivers/iio/accel/st_accel_core.c
+++ b/drivers/iio/accel/st_accel_core.c
@@ -1339,8 +1339,6 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
 {
 	struct st_sensor_data *adata = iio_priv(indio_dev);
 	struct st_sensors_platform_data *pdata = dev_get_platdata(adata->dev);
-	struct iio_chan_spec *channels;
-	size_t channels_size;
 	int err;
 
 	indio_dev->modes = INDIO_DIRECT_MODE;
@@ -1351,15 +1349,9 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
 		return err;
 
 	adata->num_data_channels = ST_ACCEL_NUMBER_DATA_CHANNELS;
+	indio_dev->channels = adata->sensor_settings->ch;
 	indio_dev->num_channels = ST_SENSORS_NUMBER_ALL_CHANNELS;
 
-	channels_size = indio_dev->num_channels * sizeof(struct iio_chan_spec);
-	channels = devm_kmemdup(&indio_dev->dev,
-				adata->sensor_settings->ch,
-				channels_size, GFP_KERNEL);
-	if (!channels)
-		return -ENOMEM;
-
 	/*
 	 * First try specific ACPI methods to retrieve orientation then try the
 	 * generic function.
@@ -1371,7 +1363,6 @@ int st_accel_common_probe(struct iio_dev *indio_dev)
 			return err;
 	}
 
-	indio_dev->channels = channels;
 	adata->current_fullscale = &adata->sensor_settings->fs.fs_avl[0];
 	adata->odr = adata->sensor_settings->odr.odr_avl[0].hz;
 
-- 
2.31.1


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

* [PATCH 4/5 v3] iio: magnetometer: st_magn: Support mount matrix
  2021-05-18 23:07 [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Linus Walleij
  2021-05-18 23:07 ` [PATCH 2/5 v3] iio: accel: st_sensors: Support generic mounting matrix Linus Walleij
  2021-05-18 23:07 ` [PATCH 3/5 v3] iio: accel: st_sensors: Stop copying channels Linus Walleij
@ 2021-05-18 23:07 ` Linus Walleij
  2021-05-18 23:07 ` [PATCH 5/5 v3] iio: gyro: st_gyro: " Linus Walleij
  2021-05-19 13:17 ` [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Hans de Goede
  4 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2021-05-18 23:07 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Hans de Goede, Denis Ciocca, Daniel Drake,
	Stephan Gerhold, Andy Shevchenko

Add support to read and present the mounting matrix on ST magnetometers.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Cc: Daniel Drake <drake@endlessm.com>
Cc: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Rebase on Andy's patches and mount-matrix generalization
- Drop surplus comma.
ChangeLog v1->v2:
- New patch because why not.
---
 drivers/iio/magnetometer/st_magn_core.c | 63 ++++++++++++++++++-------
 1 file changed, 45 insertions(+), 18 deletions(-)

diff --git a/drivers/iio/magnetometer/st_magn_core.c b/drivers/iio/magnetometer/st_magn_core.c
index 1596faa74da9..0048c3cd36ee 100644
--- a/drivers/iio/magnetometer/st_magn_core.c
+++ b/drivers/iio/magnetometer/st_magn_core.c
@@ -59,51 +59,74 @@
 #define ST_MAGN_4_OUT_Y_L_ADDR			0x0a
 #define ST_MAGN_4_OUT_Z_L_ADDR			0x0c
 
+static const struct iio_mount_matrix *
+st_magn_get_mount_matrix(const struct iio_dev *indio_dev,
+			 const struct iio_chan_spec *chan)
+{
+	struct st_sensor_data *mdata = iio_priv(indio_dev);
+
+	return &mdata->mount_matrix;
+}
+
+static const struct iio_chan_spec_ext_info st_magn_mount_matrix_ext_info[] = {
+	IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, st_magn_get_mount_matrix),
+	{ }
+};
+
 static const struct iio_chan_spec st_magn_16bit_channels[] = {
-	ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_MAGN,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_BE, 16, 16,
-			ST_MAGN_DEFAULT_OUT_X_H_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+			ST_MAGN_DEFAULT_OUT_X_H_ADDR,
+			st_magn_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_MAGN,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_BE, 16, 16,
-			ST_MAGN_DEFAULT_OUT_Y_H_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+			ST_MAGN_DEFAULT_OUT_Y_H_ADDR,
+			st_magn_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_MAGN,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_BE, 16, 16,
-			ST_MAGN_DEFAULT_OUT_Z_H_ADDR),
+			ST_MAGN_DEFAULT_OUT_Z_H_ADDR,
+			st_magn_mount_matrix_ext_info),
 	IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
 static const struct iio_chan_spec st_magn_2_16bit_channels[] = {
-	ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_MAGN,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16,
-			ST_MAGN_2_OUT_X_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+			ST_MAGN_2_OUT_X_L_ADDR,
+			st_magn_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_MAGN,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16,
-			ST_MAGN_2_OUT_Y_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+			ST_MAGN_2_OUT_Y_L_ADDR,
+			st_magn_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_MAGN,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16,
-			ST_MAGN_2_OUT_Z_L_ADDR),
+			ST_MAGN_2_OUT_Z_L_ADDR,
+			st_magn_mount_matrix_ext_info),
 	IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
 static const struct iio_chan_spec st_magn_3_16bit_channels[] = {
-	ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_MAGN,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16,
-			ST_MAGN_3_OUT_X_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+			ST_MAGN_3_OUT_X_L_ADDR,
+			st_magn_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_MAGN,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16,
-			ST_MAGN_3_OUT_Y_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_MAGN,
+			ST_MAGN_3_OUT_Y_L_ADDR,
+			st_magn_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_MAGN,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16,
-			ST_MAGN_3_OUT_Z_L_ADDR),
+			ST_MAGN_3_OUT_Z_L_ADDR,
+			st_magn_mount_matrix_ext_info),
 	IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
@@ -607,6 +630,10 @@ int st_magn_common_probe(struct iio_dev *indio_dev)
 	indio_dev->channels = mdata->sensor_settings->ch;
 	indio_dev->num_channels = ST_SENSORS_NUMBER_ALL_CHANNELS;
 
+	err = iio_read_mount_matrix(mdata->dev, &mdata->mount_matrix);
+	if (err)
+		return err;
+
 	mdata->current_fullscale = &mdata->sensor_settings->fs.fs_avl[0];
 	mdata->odr = mdata->sensor_settings->odr.odr_avl[0].hz;
 
-- 
2.31.1


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

* [PATCH 5/5 v3] iio: gyro: st_gyro: Support mount matrix
  2021-05-18 23:07 [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Linus Walleij
                   ` (2 preceding siblings ...)
  2021-05-18 23:07 ` [PATCH 4/5 v3] iio: magnetometer: st_magn: Support mount matrix Linus Walleij
@ 2021-05-18 23:07 ` Linus Walleij
  2021-05-19 13:17 ` [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Hans de Goede
  4 siblings, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2021-05-18 23:07 UTC (permalink / raw)
  To: Jonathan Cameron, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Linus Walleij, Hans de Goede, Denis Ciocca, Daniel Drake,
	Stephan Gerhold, Andy Shevchenko

Add support to read and present the mounting matrix on ST gyroscopes.

Cc: Hans de Goede <hdegoede@redhat.com>
Cc: Denis Ciocca <denis.ciocca@st.com>
Cc: Daniel Drake <drake@endlessm.com>
Cc: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
ChangeLog v2->v3:
- Rebase on Andy's patches and mount-matrix generalization
- Drop surplus comma.
ChangeLog v1->v2:
- New patch because why not.
---
 drivers/iio/gyro/st_gyro_core.c | 33 +++++++++++++++++++++++++++------
 1 file changed, 27 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/gyro/st_gyro_core.c b/drivers/iio/gyro/st_gyro_core.c
index ee3f0ea96ac5..b86ee4d940d9 100644
--- a/drivers/iio/gyro/st_gyro_core.c
+++ b/drivers/iio/gyro/st_gyro_core.c
@@ -37,19 +37,36 @@
 #define ST_GYRO_FS_AVL_500DPS			500
 #define ST_GYRO_FS_AVL_2000DPS			2000
 
+static const struct iio_mount_matrix *
+st_gyro_get_mount_matrix(const struct iio_dev *indio_dev,
+			 const struct iio_chan_spec *chan)
+{
+	struct st_sensor_data *gdata = iio_priv(indio_dev);
+
+	return &gdata->mount_matrix;
+}
+
+static const struct iio_chan_spec_ext_info st_gyro_mount_matrix_ext_info[] = {
+	IIO_MOUNT_MATRIX(IIO_SHARED_BY_ALL, st_gyro_get_mount_matrix),
+	{ }
+};
+
 static const struct iio_chan_spec st_gyro_16bit_channels[] = {
-	ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ANGL_VEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_X, 1, IIO_MOD_X, 's', IIO_LE, 16, 16,
-			ST_GYRO_DEFAULT_OUT_X_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
+			ST_GYRO_DEFAULT_OUT_X_L_ADDR,
+			st_gyro_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ANGL_VEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Y, 1, IIO_MOD_Y, 's', IIO_LE, 16, 16,
-			ST_GYRO_DEFAULT_OUT_Y_L_ADDR),
-	ST_SENSORS_LSM_CHANNELS(IIO_ANGL_VEL,
+			ST_GYRO_DEFAULT_OUT_Y_L_ADDR,
+			st_gyro_mount_matrix_ext_info),
+	ST_SENSORS_LSM_CHANNELS_EXT(IIO_ANGL_VEL,
 			BIT(IIO_CHAN_INFO_RAW) | BIT(IIO_CHAN_INFO_SCALE),
 			ST_SENSORS_SCAN_Z, 1, IIO_MOD_Z, 's', IIO_LE, 16, 16,
-			ST_GYRO_DEFAULT_OUT_Z_L_ADDR),
+			ST_GYRO_DEFAULT_OUT_Z_L_ADDR,
+			st_gyro_mount_matrix_ext_info),
 	IIO_CHAN_SOFT_TIMESTAMP(3)
 };
 
@@ -479,6 +496,10 @@ int st_gyro_common_probe(struct iio_dev *indio_dev)
 	indio_dev->channels = gdata->sensor_settings->ch;
 	indio_dev->num_channels = ST_SENSORS_NUMBER_ALL_CHANNELS;
 
+	err = iio_read_mount_matrix(gdata->dev, &gdata->mount_matrix);
+	if (err)
+		return err;
+
 	gdata->current_fullscale = &gdata->sensor_settings->fs.fs_avl[0];
 	gdata->odr = gdata->sensor_settings->odr.odr_avl[0].hz;
 
-- 
2.31.1


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

* Re: [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
  2021-05-18 23:07 [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Linus Walleij
                   ` (3 preceding siblings ...)
  2021-05-18 23:07 ` [PATCH 5/5 v3] iio: gyro: st_gyro: " Linus Walleij
@ 2021-05-19 13:17 ` Hans de Goede
  2021-05-22 18:15   ` Jonathan Cameron
  4 siblings, 1 reply; 12+ messages in thread
From: Hans de Goede @ 2021-05-19 13:17 UTC (permalink / raw)
  To: Linus Walleij, Jonathan Cameron, linux-iio
  Cc: Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Denis Ciocca, Daniel Drake, Andy Shevchenko, Stephan Gerhold

Hi,

On 5/19/21 1:07 AM, Linus Walleij wrote:
> Extend ST_SENSORS_LSM_CHANNELS() to a version that will accept extended
> attributes named ST_SENSORS_LSM_CHANNELS_EXT() and wrap the former as a
> specialized version of the former.
> 
> Cc: Hans de Goede <hdegoede@redhat.com>
> Cc: Denis Ciocca <denis.ciocca@st.com>
> Cc: Daniel Drake <drake@endlessm.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Thanks.

The entire series looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

for the series.

Regards,

Hans


> ---
> ChangeLog v2->v3:
> - Rebase and resend.
> ChangeLog v1->v2:
> - New helper patch from Stephan.
> ---
>  include/linux/iio/common/st_sensors.h | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> index 0b9aeb479f48..8e0d76b42db9 100644
> --- a/include/linux/iio/common/st_sensors.h
> +++ b/include/linux/iio/common/st_sensors.h
> @@ -48,8 +48,8 @@
>  #define ST_SENSORS_MAX_NAME			17
>  #define ST_SENSORS_MAX_4WAI			8
>  
> -#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
> -					ch2, s, endian, rbits, sbits, addr) \
> +#define ST_SENSORS_LSM_CHANNELS_EXT(device_type, mask, index, mod, \
> +				    ch2, s, endian, rbits, sbits, addr, ext) \
>  { \
>  	.type = device_type, \
>  	.modified = mod, \
> @@ -65,8 +65,14 @@
>  		.storagebits = sbits, \
>  		.endianness = endian, \
>  	}, \
> +	.ext_info = ext, \
>  }
>  
> +#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
> +				ch2, s, endian, rbits, sbits, addr)	\
> +	ST_SENSORS_LSM_CHANNELS_EXT(device_type, mask, index, mod,	\
> +				    ch2, s, endian, rbits, sbits, addr, NULL)
> +
>  #define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \
>  		IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \
>  			st_sensors_sysfs_sampling_frequency_avail)
> 


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

* Re: [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
  2021-05-19 13:17 ` [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Hans de Goede
@ 2021-05-22 18:15   ` Jonathan Cameron
  2021-05-24  9:43     ` Linus Walleij
  0 siblings, 1 reply; 12+ messages in thread
From: Jonathan Cameron @ 2021-05-22 18:15 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Linus Walleij, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Daniel Drake,
	Andy Shevchenko, Stephan Gerhold

On Wed, 19 May 2021 15:17:36 +0200
Hans de Goede <hdegoede@redhat.com> wrote:

> Hi,
> 
> On 5/19/21 1:07 AM, Linus Walleij wrote:
> > Extend ST_SENSORS_LSM_CHANNELS() to a version that will accept extended
> > attributes named ST_SENSORS_LSM_CHANNELS_EXT() and wrap the former as a
> > specialized version of the former.
> > 
> > Cc: Hans de Goede <hdegoede@redhat.com>
> > Cc: Denis Ciocca <denis.ciocca@st.com>
> > Cc: Daniel Drake <drake@endlessm.com>
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>  
> 
> Thanks.
> 
> The entire series looks good to me:
> 
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>

@Linus, for IIO stuff, please put a cover letter on series as it makes it
easier for people to reply with things like this and still let me use b4
without manual tweaking.

Anyhow, manually tweaked series applied to the togreg branch of iio.git and
pushed out as testing for the autobuilders to poke at it and see what they
find.

Thanks,

Jonathan


> 
> for the series.
> 
> Regards,
> 
> Hans
> 
> 
> > ---
> > ChangeLog v2->v3:
> > - Rebase and resend.
> > ChangeLog v1->v2:
> > - New helper patch from Stephan.
> > ---
> >  include/linux/iio/common/st_sensors.h | 10 ++++++++--
> >  1 file changed, 8 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/linux/iio/common/st_sensors.h b/include/linux/iio/common/st_sensors.h
> > index 0b9aeb479f48..8e0d76b42db9 100644
> > --- a/include/linux/iio/common/st_sensors.h
> > +++ b/include/linux/iio/common/st_sensors.h
> > @@ -48,8 +48,8 @@
> >  #define ST_SENSORS_MAX_NAME			17
> >  #define ST_SENSORS_MAX_4WAI			8
> >  
> > -#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
> > -					ch2, s, endian, rbits, sbits, addr) \
> > +#define ST_SENSORS_LSM_CHANNELS_EXT(device_type, mask, index, mod, \
> > +				    ch2, s, endian, rbits, sbits, addr, ext) \
> >  { \
> >  	.type = device_type, \
> >  	.modified = mod, \
> > @@ -65,8 +65,14 @@
> >  		.storagebits = sbits, \
> >  		.endianness = endian, \
> >  	}, \
> > +	.ext_info = ext, \
> >  }
> >  
> > +#define ST_SENSORS_LSM_CHANNELS(device_type, mask, index, mod, \
> > +				ch2, s, endian, rbits, sbits, addr)	\
> > +	ST_SENSORS_LSM_CHANNELS_EXT(device_type, mask, index, mod,	\
> > +				    ch2, s, endian, rbits, sbits, addr, NULL)
> > +
> >  #define ST_SENSORS_DEV_ATTR_SAMP_FREQ_AVAIL() \
> >  		IIO_DEV_ATTR_SAMP_FREQ_AVAIL( \
> >  			st_sensors_sysfs_sampling_frequency_avail)
> >   
> 


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

* Re: [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
  2021-05-22 18:15   ` Jonathan Cameron
@ 2021-05-24  9:43     ` Linus Walleij
  2021-05-24  9:50       ` Jonathan Cameron
  0 siblings, 1 reply; 12+ messages in thread
From: Linus Walleij @ 2021-05-24  9:43 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Hans de Goede, linux-iio, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Denis Ciocca, Daniel Drake,
	Andy Shevchenko, Stephan Gerhold

On Sat, May 22, 2021 at 8:14 PM Jonathan Cameron <jic23@kernel.org> wrote:

> @Linus, for IIO stuff, please put a cover letter on series as it makes it
> easier for people to reply with things like this

OK sorry about that, I'll try to keep it in mind.

> and still let me use b4
> without manual tweaking.

b4 only need the patches to be sent in a thread which I
actually did, at least this works fine for me from here:

tmp]$ b4 am -t 20210518230722.522446-1-linus.walleij@linaro.org
Looking up https://lore.kernel.org/r/20210518230722.522446-1-linus.walleij%40linaro.org
Grabbing thread from lore.kernel.org/linux-iio
Analyzing 7 messages in the thread
---
Writing ./v3_20210519_linus_walleij_iio_st_sensors_create_extended_attr_macro.mbx
  ✓ [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
    + Reviewed-by: Hans de Goede <hdegoede@redhat.com> (✓ DKIM/redhat.com)
  ✓ [PATCH 2/5 v3] iio: accel: st_sensors: Support generic mounting matrix
  ✓ [PATCH 3/5 v3] iio: accel: st_sensors: Stop copying channels
  ✓ [PATCH 4/5 v3] iio: magnetometer: st_magn: Support mount matrix
  ✓ [PATCH 5/5 v3] iio: gyro: st_gyro: Support mount matrix
  ---
  ✓ Attestation-by: DKIM/linaro.org (From: linus.walleij@linaro.org)
---
Total patches: 5
---
 Link: https://lore.kernel.org/r/20210518230722.522446-1-linus.walleij@linaro.org
 Base: not found
       git am ./v3_20210519_linus_walleij_iio_st_sensors_create_extended_attr_macro.mbx

But I guess that without a 00/nn it is maybe not as clear if a series was
sent as a thread.

Yours,
Linus Walleij

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

* Re: [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
  2021-05-24  9:43     ` Linus Walleij
@ 2021-05-24  9:50       ` Jonathan Cameron
  2021-05-24 10:37         ` Andy Shevchenko
  2021-05-24 12:07         ` Linus Walleij
  0 siblings, 2 replies; 12+ messages in thread
From: Jonathan Cameron @ 2021-05-24  9:50 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Jonathan Cameron, Hans de Goede, linux-iio, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Denis Ciocca,
	Daniel Drake, Andy Shevchenko, Stephan Gerhold

On Mon, 24 May 2021 11:43:11 +0200
Linus Walleij <linus.walleij@linaro.org> wrote:

> On Sat, May 22, 2021 at 8:14 PM Jonathan Cameron <jic23@kernel.org> wrote:
> 
> > @Linus, for IIO stuff, please put a cover letter on series as it makes it
> > easier for people to reply with things like this  
> 
> OK sorry about that, I'll try to keep it in mind.
> 
> > and still let me use b4
> > without manual tweaking.  
> 
> b4 only need the patches to be sent in a thread which I
> actually did, at least this works fine for me from here:
> 
> tmp]$ b4 am -t 20210518230722.522446-1-linus.walleij@linaro.org
> Looking up https://lore.kernel.org/r/20210518230722.522446-1-linus.walleij%40linaro.org
> Grabbing thread from lore.kernel.org/linux-iio
> Analyzing 7 messages in the thread
> ---
> Writing ./v3_20210519_linus_walleij_iio_st_sensors_create_extended_attr_macro.mbx
>   ✓ [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
>     + Reviewed-by: Hans de Goede <hdegoede@redhat.com> (✓ DKIM/redhat.com)
>   ✓ [PATCH 2/5 v3] iio: accel: st_sensors: Support generic mounting matrix
>   ✓ [PATCH 3/5 v3] iio: accel: st_sensors: Stop copying channels
>   ✓ [PATCH 4/5 v3] iio: magnetometer: st_magn: Support mount matrix
>   ✓ [PATCH 5/5 v3] iio: gyro: st_gyro: Support mount matrix

That only adds the Reviewed-by for patch 1 which was not Hans'
intention.  If the reply was to a cover letter it would apply to all of the patches.

Thanks,

Jonathan


>   ---
>   ✓ Attestation-by: DKIM/linaro.org (From: linus.walleij@linaro.org)
> ---
> Total patches: 5
> ---
>  Link: https://lore.kernel.org/r/20210518230722.522446-1-linus.walleij@linaro.org
>  Base: not found
>        git am ./v3_20210519_linus_walleij_iio_st_sensors_create_extended_attr_macro.mbx
> 
> But I guess that without a 00/nn it is maybe not as clear if a series was
> sent as a thread.
> 
> Yours,
> Linus Walleij


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

* Re: [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
  2021-05-24  9:50       ` Jonathan Cameron
@ 2021-05-24 10:37         ` Andy Shevchenko
  2021-05-24 10:39           ` Andy Shevchenko
  2021-05-24 12:07         ` Linus Walleij
  1 sibling, 1 reply; 12+ messages in thread
From: Andy Shevchenko @ 2021-05-24 10:37 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Linus Walleij, Jonathan Cameron, Hans de Goede, linux-iio,
	Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Denis Ciocca, Daniel Drake, Stephan Gerhold

On Mon, May 24, 2021 at 10:50:42AM +0100, Jonathan Cameron wrote:
> On Mon, 24 May 2021 11:43:11 +0200
> Linus Walleij <linus.walleij@linaro.org> wrote:
> 
> > On Sat, May 22, 2021 at 8:14 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > 
> > > @Linus, for IIO stuff, please put a cover letter on series as it makes it
> > > easier for people to reply with things like this  
> > 
> > OK sorry about that, I'll try to keep it in mind.
> > 
> > > and still let me use b4
> > > without manual tweaking.  
> > 
> > b4 only need the patches to be sent in a thread which I
> > actually did, at least this works fine for me from here:
> > 
> > tmp]$ b4 am -t 20210518230722.522446-1-linus.walleij@linaro.org
> > Looking up https://lore.kernel.org/r/20210518230722.522446-1-linus.walleij%40linaro.org
> > Grabbing thread from lore.kernel.org/linux-iio
> > Analyzing 7 messages in the thread
> > ---
> > Writing ./v3_20210519_linus_walleij_iio_st_sensors_create_extended_attr_macro.mbx
> >   ✓ [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
> >     + Reviewed-by: Hans de Goede <hdegoede@redhat.com> (✓ DKIM/redhat.com)
> >   ✓ [PATCH 2/5 v3] iio: accel: st_sensors: Support generic mounting matrix
> >   ✓ [PATCH 3/5 v3] iio: accel: st_sensors: Stop copying channels
> >   ✓ [PATCH 4/5 v3] iio: magnetometer: st_magn: Support mount matrix
> >   ✓ [PATCH 5/5 v3] iio: gyro: st_gyro: Support mount matrix
> 
> That only adds the Reviewed-by for patch 1 which was not Hans'
> intention.  If the reply was to a cover letter it would apply to all of the patches.

It's easy to fix with `git filter-branch --msg-filter ...`.

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
  2021-05-24 10:37         ` Andy Shevchenko
@ 2021-05-24 10:39           ` Andy Shevchenko
  0 siblings, 0 replies; 12+ messages in thread
From: Andy Shevchenko @ 2021-05-24 10:39 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Linus Walleij, Jonathan Cameron, Hans de Goede, linux-iio,
	Hartmut Knaack, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Denis Ciocca, Daniel Drake, Stephan Gerhold

On Mon, May 24, 2021 at 01:37:52PM +0300, Andy Shevchenko wrote:
> On Mon, May 24, 2021 at 10:50:42AM +0100, Jonathan Cameron wrote:
> > On Mon, 24 May 2021 11:43:11 +0200
> > Linus Walleij <linus.walleij@linaro.org> wrote:
> > 
> > > On Sat, May 22, 2021 at 8:14 PM Jonathan Cameron <jic23@kernel.org> wrote:
> > > 
> > > > @Linus, for IIO stuff, please put a cover letter on series as it makes it
> > > > easier for people to reply with things like this  
> > > 
> > > OK sorry about that, I'll try to keep it in mind.
> > > 
> > > > and still let me use b4
> > > > without manual tweaking.  
> > > 
> > > b4 only need the patches to be sent in a thread which I
> > > actually did, at least this works fine for me from here:
> > > 
> > > tmp]$ b4 am -t 20210518230722.522446-1-linus.walleij@linaro.org
> > > Looking up https://lore.kernel.org/r/20210518230722.522446-1-linus.walleij%40linaro.org
> > > Grabbing thread from lore.kernel.org/linux-iio
> > > Analyzing 7 messages in the thread
> > > ---
> > > Writing ./v3_20210519_linus_walleij_iio_st_sensors_create_extended_attr_macro.mbx
> > >   ✓ [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
> > >     + Reviewed-by: Hans de Goede <hdegoede@redhat.com> (✓ DKIM/redhat.com)
> > >   ✓ [PATCH 2/5 v3] iio: accel: st_sensors: Support generic mounting matrix
> > >   ✓ [PATCH 3/5 v3] iio: accel: st_sensors: Stop copying channels
> > >   ✓ [PATCH 4/5 v3] iio: magnetometer: st_magn: Support mount matrix
> > >   ✓ [PATCH 5/5 v3] iio: gyro: st_gyro: Support mount matrix
> > 
> > That only adds the Reviewed-by for patch 1 which was not Hans'
> > intention.  If the reply was to a cover letter it would apply to all of the patches.
> 
> It's easy to fix with `git filter-branch --msg-filter ...`.

But OTOH, tools may not recognize a human intention well from the natural
language, it's also recommended to the reviewers to be explicit that bots can
handle it (here: add a tag per each patch that is considered to be tagged).

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro
  2021-05-24  9:50       ` Jonathan Cameron
  2021-05-24 10:37         ` Andy Shevchenko
@ 2021-05-24 12:07         ` Linus Walleij
  1 sibling, 0 replies; 12+ messages in thread
From: Linus Walleij @ 2021-05-24 12:07 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: Jonathan Cameron, Hans de Goede, linux-iio, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Denis Ciocca,
	Daniel Drake, Andy Shevchenko, Stephan Gerhold

On Mon, May 24, 2021 at 11:52 AM Jonathan Cameron
<Jonathan.Cameron@huawei.com> wrote:

> That only adds the Reviewed-by for patch 1 which was not Hans'
> intention.  If the reply was to a cover letter it would apply to all of the patches.

Aha I see, yeah that makes a lot of sense.
I'll try to put cover letters on my series!

Yours,
Linus Walleij

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

end of thread, other threads:[~2021-05-24 12:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 23:07 [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Linus Walleij
2021-05-18 23:07 ` [PATCH 2/5 v3] iio: accel: st_sensors: Support generic mounting matrix Linus Walleij
2021-05-18 23:07 ` [PATCH 3/5 v3] iio: accel: st_sensors: Stop copying channels Linus Walleij
2021-05-18 23:07 ` [PATCH 4/5 v3] iio: magnetometer: st_magn: Support mount matrix Linus Walleij
2021-05-18 23:07 ` [PATCH 5/5 v3] iio: gyro: st_gyro: " Linus Walleij
2021-05-19 13:17 ` [PATCH 1/5 v3] iio: st_sensors: Create extended attr macro Hans de Goede
2021-05-22 18:15   ` Jonathan Cameron
2021-05-24  9:43     ` Linus Walleij
2021-05-24  9:50       ` Jonathan Cameron
2021-05-24 10:37         ` Andy Shevchenko
2021-05-24 10:39           ` Andy Shevchenko
2021-05-24 12:07         ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.