From 6d49b06149a67450b8ff7ddc819426d13364a6ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Tue, 8 Sep 2020 13:41:20 +0200
Subject: [PATCH 080/389] iio: core: Add option to force identity mount matrix

This is just to make it simpler to create multi-boot image for pinephone.

Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
 drivers/iio/industrialio-core.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index 151ff3993354..dc02124a1bd0 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -33,6 +33,16 @@
 #include <linux/iio/buffer.h>
 #include <linux/iio/buffer_impl.h>
 
+static int ignore_mount_matrix = 0;
+
+static int __init ignore_matrix(char *str)
+{
+	ignore_mount_matrix = 1;
+	return 1;
+}
+
+__setup("ignore_mount_matrix", ignore_matrix);
+
 /* IDA to assign each registered device a unique id */
 static DEFINE_IDA(iio_ida);
 
@@ -629,6 +639,7 @@ int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix)
 	size_t len = ARRAY_SIZE(iio_mount_idmatrix.rotation);
 	int err;
 
+	if (!ignore_mount_matrix) {
 	err = device_property_read_string_array(dev, "mount-matrix", matrix->rotation, len);
 	if (err == len)
 		return 0;
@@ -640,6 +651,7 @@ int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix)
 	if (err != -EINVAL)
 		/* Invalid matrix declaration format. */
 		return err;
+	}
 
 	/* Matrix was not declared at all: fallback to identity. */
 	return iio_setup_mount_idmatrix(dev, matrix);
-- 
2.35.3

