Skip to content

Commit 7cea2a4

Browse files
committed
drivers: video: csi: Rename sensor to source
The CSI can connect to either a camera sensor (as on i.MX RT10xx) or a MIPI CSI-2 receiver (as on i.MX RT11xx). To be generic, change the naming from sensor to source. Signed-off-by: Phi Bang Nguyen <[email protected]>
1 parent f2e3d3f commit 7cea2a4

File tree

4 files changed

+24
-23
lines changed

4 files changed

+24
-23
lines changed

boards/madmachine/mm_swiftio/mm_swiftio.dts

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@
192192

193193
&csi {
194194
status = "okay";
195-
sensor = <&ov7725>;
195+
source = <&ov7725>;
196196
pinctrl-0 = <&pinmux_csi>;
197197
pinctrl-names = "default";
198198

boards/nxp/mimxrt1064_evk/mimxrt1064_evk.dts

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ zephyr_udc0: &usb1 {
272272

273273
&csi {
274274
status = "okay";
275-
sensor = <&mt9m114>;
275+
source = <&mt9m114>;
276276
pinctrl-0 = <&pinmux_csi>;
277277
pinctrl-names = "default";
278278

drivers/video/video_mcux_csi.c

+19-19
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
struct video_mcux_csi_config {
2222
CSI_Type *base;
23-
const struct device *sensor_dev;
23+
const struct device *source_dev;
2424
const struct pinctrl_dev_config *pincfg;
2525
};
2626

@@ -144,7 +144,7 @@ static int video_mcux_csi_set_fmt(const struct device *dev, enum video_endpoint_
144144
return -EIO;
145145
}
146146

147-
if (config->sensor_dev && video_set_format(config->sensor_dev, ep, fmt)) {
147+
if (config->source_dev && video_set_format(config->source_dev, ep, fmt)) {
148148
return -EIO;
149149
}
150150

@@ -160,8 +160,8 @@ static int video_mcux_csi_get_fmt(const struct device *dev, enum video_endpoint_
160160
return -EINVAL;
161161
}
162162

163-
if (config->sensor_dev && !video_get_format(config->sensor_dev, ep, fmt)) {
164-
/* align CSI with sensor fmt */
163+
if (config->source_dev && !video_get_format(config->source_dev, ep, fmt)) {
164+
/* align CSI with source fmt */
165165
return video_mcux_csi_set_fmt(dev, ep, fmt);
166166
}
167167

@@ -179,7 +179,7 @@ static int video_mcux_csi_stream_start(const struct device *dev)
179179
return -EIO;
180180
}
181181

182-
if (config->sensor_dev && video_stream_start(config->sensor_dev)) {
182+
if (config->source_dev && video_stream_start(config->source_dev)) {
183183
return -EIO;
184184
}
185185

@@ -192,7 +192,7 @@ static int video_mcux_csi_stream_stop(const struct device *dev)
192192
struct video_mcux_csi_data *data = dev->data;
193193
status_t ret;
194194

195-
if (config->sensor_dev && video_stream_stop(config->sensor_dev)) {
195+
if (config->source_dev && video_stream_stop(config->source_dev)) {
196196
return -EIO;
197197
}
198198

@@ -283,9 +283,9 @@ static inline int video_mcux_csi_set_ctrl(const struct device *dev, unsigned int
283283
const struct video_mcux_csi_config *config = dev->config;
284284
int ret = -ENOTSUP;
285285

286-
/* Forward to sensor dev if any */
287-
if (config->sensor_dev) {
288-
ret = video_set_ctrl(config->sensor_dev, cid, value);
286+
/* Forward to source dev if any */
287+
if (config->source_dev) {
288+
ret = video_set_ctrl(config->source_dev, cid, value);
289289
}
290290

291291
return ret;
@@ -296,9 +296,9 @@ static inline int video_mcux_csi_get_ctrl(const struct device *dev, unsigned int
296296
const struct video_mcux_csi_config *config = dev->config;
297297
int ret = -ENOTSUP;
298298

299-
/* Forward to sensor dev if any */
300-
if (config->sensor_dev) {
301-
ret = video_get_ctrl(config->sensor_dev, cid, value);
299+
/* Forward to source dev if any */
300+
if (config->source_dev) {
301+
ret = video_get_ctrl(config->source_dev, cid, value);
302302
}
303303

304304
return ret;
@@ -314,15 +314,15 @@ static int video_mcux_csi_get_caps(const struct device *dev, enum video_endpoint
314314
return -EINVAL;
315315
}
316316

317-
/* Just forward to sensor dev for now */
318-
if (config->sensor_dev) {
319-
err = video_get_caps(config->sensor_dev, ep, caps);
317+
/* Just forward to source dev for now */
318+
if (config->source_dev) {
319+
err = video_get_caps(config->source_dev, ep, caps);
320320
}
321321

322322
/* NXP MCUX CSI request at least 2 buffer before starting */
323323
caps->min_vbuf_count = 2;
324324

325-
/* no sensor dev */
325+
/* no source dev */
326326
return err;
327327
}
328328

@@ -344,10 +344,10 @@ static int video_mcux_csi_init(const struct device *dev)
344344

345345
CSI_GetDefaultConfig(&data->csi_config);
346346

347-
/* check if there is any sensor device (video ctrl device)
347+
/* check if there is any source device (video ctrl device)
348348
* the device is not yet initialized so we only check if it exists
349349
*/
350-
if (config->sensor_dev == NULL) {
350+
if (config->source_dev == NULL) {
351351
return -ENODEV;
352352
}
353353

@@ -396,7 +396,7 @@ PINCTRL_DT_INST_DEFINE(0);
396396

397397
static const struct video_mcux_csi_config video_mcux_csi_config_0 = {
398398
.base = (CSI_Type *)DT_INST_REG_ADDR(0),
399-
.sensor_dev = DEVICE_DT_GET(DT_INST_PHANDLE(0, sensor)),
399+
.source_dev = DEVICE_DT_GET(DT_INST_PHANDLE(0, source)),
400400
.pincfg = PINCTRL_DT_INST_DEV_CONFIG_GET(0),
401401
};
402402

dts/bindings/video/nxp,imx-csi.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ properties:
1414
interrupts:
1515
required: true
1616

17-
sensor:
17+
source:
1818
required: true
1919
type: phandle
20-
description: phandle of connected sensor device
20+
description: the connected source device,
21+
e.g., a mipi csi or a camera sensor

0 commit comments

Comments
 (0)