Skip to content

Commit 46eb7e2

Browse files
ngphibangnashif
authored andcommitted
drivers: video: csi: Fix get_fmt
The CSI should always propagate the get_fmt request down to the sensor. It should not return a format by it own unless it contains a test pattern generator inside it. The problem with the legacy code is that this code snippet is never reached if the sensor could return a format. In case the sensor failed to return a format, these codes are reached but the returned format makes no sense and its value was not initialized. Signed-off-by: Phi Bang Nguyen <[email protected]>
1 parent 1a40d1f commit 46eb7e2

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

drivers/video/video_mcux_csi.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ static int video_mcux_csi_set_fmt(const struct device *dev, enum video_endpoint_
156156
static int video_mcux_csi_get_fmt(const struct device *dev, enum video_endpoint_id ep,
157157
struct video_format *fmt)
158158
{
159-
struct video_mcux_csi_data *data = dev->data;
160159
const struct video_mcux_csi_config *config = dev->config;
161160

162161
if (fmt == NULL || ep != VIDEO_EP_OUT) {
@@ -168,12 +167,7 @@ static int video_mcux_csi_get_fmt(const struct device *dev, enum video_endpoint_
168167
return video_mcux_csi_set_fmt(dev, ep, fmt);
169168
}
170169

171-
fmt->pixelformat = data->pixelformat;
172-
fmt->height = data->csi_config.height;
173-
fmt->width = data->csi_config.width;
174-
fmt->pitch = data->csi_config.linePitch_Bytes;
175-
176-
return 0;
170+
return -EIO;
177171
}
178172

179173
static int video_mcux_csi_stream_start(const struct device *dev)

0 commit comments

Comments
 (0)