Skip to content

Commit 968925c

Browse files
committed
drivers: video: mcux_mipi_csi2rx: Get data lanes number from devicetree
Get number of data lanes from device tree instead of hard-coding it. Signed-off-by: Phi Bang Nguyen <phibang.nguyen@nxp.com>
1 parent 25a8065 commit 968925c

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/video/video_mcux_mipi_csi2rx.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414

1515
LOG_MODULE_REGISTER(video_mipi_csi2rx, CONFIG_VIDEO_LOG_LEVEL);
1616

17-
/*
18-
* Two data lanes are set by default as 2-lanes camera sensors are
19-
* more common and more performant but single lane is also supported.
20-
*/
21-
#define DEFAULT_MIPI_CSI_NUM_LANES 2
2217
#define DEFAULT_CAMERA_FRAME_RATE 30
2318

2419
struct mipi_csi2rx_config {
@@ -102,8 +97,6 @@ static int mipi_csi2rx_set_fmt(const struct device *dev, enum video_endpoint_id
10297
},
10398
};
10499

105-
csi2rxConfig.laneNum = DEFAULT_MIPI_CSI_NUM_LANES;
106-
107100
for (i = 0; i < ARRAY_SIZE(csi2rxHsSettle); i++) {
108101
if ((fmt->width == csi2rxHsSettle[i][0]) && (fmt->height == csi2rxHsSettle[i][1]) &&
109102
(DEFAULT_CAMERA_FRAME_RATE == csi2rxHsSettle[i][2])) {
@@ -203,7 +196,11 @@ static int mipi_csi2rx_init(const struct device *dev)
203196
}
204197

205198
#define MIPI_CSI2RX_INIT(n) \
206-
static struct mipi_csi2rx_data mipi_csi2rx_data_##n; \
199+
static struct mipi_csi2rx_data mipi_csi2rx_data_##n = { \
200+
.csi2rxConfig.laneNum = \
201+
DT_PROP_LEN(DT_CHILD(DT_CHILD(DT_INST_CHILD(n, ports), port_1), endpoint), \
202+
data_lanes), \
203+
}; \
207204
\
208205
static const struct mipi_csi2rx_config mipi_csi2rx_config_##n = { \
209206
.base = (MIPI_CSI2RX_Type *)DT_INST_REG_ADDR(n), \

0 commit comments

Comments
 (0)