Message ID | BN6PR04MB0660A14860692EAB2A658AEFA3AE0@BN6PR04MB0660.namprd04.prod.outlook.com |
---|---|
State | New |
Headers | show |
Series | [01/11] media: exynos4-is: Remove static driver data for S5PV210 FIMC variants | expand |
Hi Sylwester, On 2020-07-08 9:15 a.m., Sylwester Nawrocki wrote: > Hi, > > On 26.04.2020 04:26, Jonathan Bakker wrote: >> 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 > > Thank you for correcting this. I would prefer to correct the binding > documentation instead, so it says reg=1 for A and reg=2 for B. > Then it would also match what we have in dts for Goni and > enum fimc_input in include/media/drv-intf/exynos-fimc.h No problem, that works for me. I'll drop this patch and replace it with one changing the documentation. > > Thanks, Jonathan
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) /*
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@live.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(-)