lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN6PR04MB0660A14860692EAB2A658AEFA3AE0@BN6PR04MB0660.namprd04.prod.outlook.com>
Date:   Sat, 25 Apr 2020 19:26:50 -0700
From:   Jonathan Bakker <xc-racer2@...e.ca>
To:     kyungmin.park@...sung.com, s.nawrocki@...sung.com,
        mchehab@...nel.org, kgene@...nel.org, krzk@...nel.org,
        linux-media@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-samsung-soc@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Jonathan Bakker <xc-racer2@...e.ca>
Subject: [PATCH 11/11] media: exynos4-is: Correct parallel port probing

According to the binding doc[1], port A should be reg = 0
and port B reg = 1.  Unfortunately, the driver was treating 0
as invalid and 1 as camera port A.  Match the binding doc and
make 0=A and 1=B.

[1] Documentation/devicetree/bindings/media/samsung-fimc.txt

Signed-off-by: Jonathan Bakker <xc-racer2@...e.ca>
---
 drivers/media/platform/exynos4-is/media-dev.c | 18 +++++++++++++-----
 drivers/media/platform/exynos4-is/media-dev.h |  1 +
 include/media/drv-intf/exynos-fimc.h          |  2 +-
 3 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/exynos4-is/media-dev.c b/drivers/media/platform/exynos4-is/media-dev.c
index a87ebd7913be..9c4fdf726b92 100644
--- a/drivers/media/platform/exynos4-is/media-dev.c
+++ b/drivers/media/platform/exynos4-is/media-dev.c
@@ -418,13 +418,21 @@ static int fimc_md_parse_port_node(struct fimc_md *fmd,
 		return ret;
 	}
 
-	if (WARN_ON(endpoint.base.port == 0) || *index >= FIMC_MAX_SENSORS) {
-		of_node_put(ep);
-		return -EINVAL;
+	if (fimc_input_is_parallel(endpoint.base.port)) {
+		if (WARN_ON(*index >= FIMC_MAX_PARALLEL)) {
+			of_node_put(ep);
+			return -EINVAL;
+		}
+		pd->mux_id = endpoint.base.port;
+	} else {
+		if (WARN_ON(endpoint.base.port == 0 ||
+				*index >= FIMC_MAX_SENSORS)) {
+			of_node_put(ep);
+			return -EINVAL;
+		}
+		pd->mux_id = (endpoint.base.port - 1) & 0x1;
 	}
 
-	pd->mux_id = (endpoint.base.port - 1) & 0x1;
-
 	rem = of_graph_get_remote_port_parent(ep);
 	of_node_put(ep);
 	if (rem == NULL) {
diff --git a/drivers/media/platform/exynos4-is/media-dev.h b/drivers/media/platform/exynos4-is/media-dev.h
index 4b8f9ac52ebc..7bd93fd11b33 100644
--- a/drivers/media/platform/exynos4-is/media-dev.h
+++ b/drivers/media/platform/exynos4-is/media-dev.h
@@ -29,6 +29,7 @@
 
 #define PINCTRL_STATE_IDLE	"idle"
 
+#define FIMC_MAX_PARALLEL	2
 #define FIMC_MAX_SENSORS	4
 #define FIMC_MAX_CAMCLKS	2
 #define DEFAULT_SENSOR_CLK_FREQ	24000000U
diff --git a/include/media/drv-intf/exynos-fimc.h b/include/media/drv-intf/exynos-fimc.h
index 6b9ef631d6bb..5a07576c378b 100644
--- a/include/media/drv-intf/exynos-fimc.h
+++ b/include/media/drv-intf/exynos-fimc.h
@@ -44,7 +44,7 @@ enum fimc_bus_type {
 	FIMC_BUS_TYPE_ISP_WRITEBACK = FIMC_BUS_TYPE_LCD_WRITEBACK_B,
 };
 
-#define fimc_input_is_parallel(x) ((x) == 1 || (x) == 2)
+#define fimc_input_is_parallel(x) ((x) == 0 || (x) == 1)
 #define fimc_input_is_mipi_csi(x) ((x) == 3 || (x) == 4)
 
 /*
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ