Skip to content

Commit f547fb1

Browse files
Alain Volmatjhedberg
authored andcommitted
video: dcmipp: put Pipe1 / pipe2 caps within preproc if statement
Correct compilation error due to usage of DCMIPP_PIPE1 / DCMIPP_PIPE2 on platform which do not have pixel pipes by putting those caps under #if defined(STM32_DCMIPP_HAS_PIXEL_PIPES) Put also DCMIPP_VIDEO_FORMAT_CAP macro inside since this is only used for AUX / MAIN pipes. Fixes: 126aaf6 ("video: dcmipp: expose dcmipp caps for all 3 pipes.") Signed-off-by: Alain Volmat <[email protected]>
1 parent 8db71e3 commit f547fb1

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

drivers/video/video_stm32_dcmipp.c

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1344,18 +1344,6 @@ static int stm32_dcmipp_dequeue(const struct device *dev, struct video_buffer **
13441344
#define DCMIPP_CEIL_DIV(val, div) \
13451345
(((val) + (div) - 1) / (div))
13461346

1347-
#define DCMIPP_VIDEO_FORMAT_CAP(format, pixmul) { \
1348-
.pixelformat = VIDEO_PIX_FMT_##format, \
1349-
.width_min = DCMIPP_CEIL_DIV_ROUND_UP_MUL(CONFIG_VIDEO_STM32_DCMIPP_SENSOR_WIDTH, \
1350-
STM32_DCMIPP_MAX_PIPE_SCALE_FACTOR, \
1351-
pixmul), \
1352-
.width_max = CONFIG_VIDEO_STM32_DCMIPP_SENSOR_WIDTH / (pixmul) * (pixmul), \
1353-
.height_min = DCMIPP_CEIL_DIV(CONFIG_VIDEO_STM32_DCMIPP_SENSOR_HEIGHT, \
1354-
STM32_DCMIPP_MAX_PIPE_SCALE_FACTOR), \
1355-
.height_max = CONFIG_VIDEO_STM32_DCMIPP_SENSOR_HEIGHT, \
1356-
.width_step = pixmul, .height_step = 1, \
1357-
}
1358-
13591347
static const struct video_format_cap stm32_dcmipp_dump_fmt[] = {
13601348
{
13611349
.pixelformat = VIDEO_FOURCC_FROM_STR(CONFIG_VIDEO_STM32_DCMIPP_SENSOR_PIXEL_FORMAT),
@@ -1368,6 +1356,19 @@ static const struct video_format_cap stm32_dcmipp_dump_fmt[] = {
13681356
{0},
13691357
};
13701358

1359+
#if defined(STM32_DCMIPP_HAS_PIXEL_PIPES)
1360+
#define DCMIPP_VIDEO_FORMAT_CAP(format, pixmul) { \
1361+
.pixelformat = VIDEO_PIX_FMT_##format, \
1362+
.width_min = DCMIPP_CEIL_DIV_ROUND_UP_MUL(CONFIG_VIDEO_STM32_DCMIPP_SENSOR_WIDTH, \
1363+
STM32_DCMIPP_MAX_PIPE_SCALE_FACTOR, \
1364+
pixmul), \
1365+
.width_max = CONFIG_VIDEO_STM32_DCMIPP_SENSOR_WIDTH / (pixmul) * (pixmul), \
1366+
.height_min = DCMIPP_CEIL_DIV(CONFIG_VIDEO_STM32_DCMIPP_SENSOR_HEIGHT, \
1367+
STM32_DCMIPP_MAX_PIPE_SCALE_FACTOR), \
1368+
.height_max = CONFIG_VIDEO_STM32_DCMIPP_SENSOR_HEIGHT, \
1369+
.width_step = pixmul, .height_step = 1, \
1370+
}
1371+
13711372
static const struct video_format_cap stm32_dcmipp_main_fmts[] = {
13721373
DCMIPP_VIDEO_FORMAT_CAP(RGB565, 8),
13731374
DCMIPP_VIDEO_FORMAT_CAP(YUYV, 8),
@@ -1401,6 +1402,7 @@ static const struct video_format_cap stm32_dcmipp_aux_fmts[] = {
14011402
DCMIPP_VIDEO_FORMAT_CAP(BGRA32, 4),
14021403
{0},
14031404
};
1405+
#endif
14041406

14051407
static int stm32_dcmipp_get_caps(const struct device *dev, struct video_caps *caps)
14061408
{
@@ -1410,12 +1412,14 @@ static int stm32_dcmipp_get_caps(const struct device *dev, struct video_caps *ca
14101412
case DCMIPP_PIPE0:
14111413
caps->format_caps = stm32_dcmipp_dump_fmt;
14121414
break;
1415+
#if defined(STM32_DCMIPP_HAS_PIXEL_PIPES)
14131416
case DCMIPP_PIPE1:
14141417
caps->format_caps = stm32_dcmipp_main_fmts;
14151418
break;
14161419
case DCMIPP_PIPE2:
14171420
caps->format_caps = stm32_dcmipp_aux_fmts;
14181421
break;
1422+
#endif
14191423
default:
14201424
CODE_UNREACHABLE;
14211425
}

0 commit comments

Comments
 (0)