From 00e067a37b8c66d9b29905d8f0769223c98e865f Mon Sep 17 00:00:00 2001 From: Josuah Demangeon Date: Sun, 28 Jul 2024 17:29:07 +0200 Subject: [PATCH] drivers: video: introduce CONFIG_VIDEO_LOG_LEVEL Zephyr drivers have typically one log level defined per class. The video drivers were making exception. This adds the missing log level for video drivers. Since all headers had to be modified, this also: - Update the log initialization to the new syntax defined in commit 5e34681 - Sort the #include list to something like #41543 Signed-off-by: Josuah Demangeon --- drivers/video/Kconfig | 4 ++++ drivers/video/Kconfig.stm32_dcmi | 4 ---- drivers/video/mt9m114.c | 8 +++----- drivers/video/ov2640.c | 7 +++---- drivers/video/ov5640.c | 10 ++++------ drivers/video/ov7670.c | 5 ++--- drivers/video/ov7725.c | 8 +++----- drivers/video/video_common.c | 2 +- drivers/video/video_mcux_csi.c | 7 +++---- drivers/video/video_mcux_mipi_csi2rx.c | 9 ++++----- drivers/video/video_stm32_dcmi.c | 7 ++++--- drivers/video/video_sw_generator.c | 9 +++++---- 12 files changed, 36 insertions(+), 44 deletions(-) diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index d6a6bd3ccce669e..fb1fda2a7ff104e 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -13,6 +13,10 @@ menuconfig VIDEO if VIDEO +module = VIDEO +module-str = video +source "subsys/logging/Kconfig.template.log_config" + config VIDEO_INIT_PRIORITY int "Video initialization priority" default 60 diff --git a/drivers/video/Kconfig.stm32_dcmi b/drivers/video/Kconfig.stm32_dcmi index 8f0c11a42c74c54..8cb1edce56cf901 100644 --- a/drivers/video/Kconfig.stm32_dcmi +++ b/drivers/video/Kconfig.stm32_dcmi @@ -16,7 +16,3 @@ config VIDEO_STM32_DCMI select USE_STM32_HAL_DMA_EX if $(DT_STM32_DCMI_HAS_DMA) help Enable driver for STM32 Digital camera interface periheral. - -module = STM32_DCMI -module-str = stm32_dcmi -source "subsys/logging/Kconfig.template.log_config" diff --git a/drivers/video/mt9m114.c b/drivers/video/mt9m114.c index 01c22feb005edfd..96f6673a96a94a0 100644 --- a/drivers/video/mt9m114.c +++ b/drivers/video/mt9m114.c @@ -6,17 +6,15 @@ */ #define DT_DRV_COMPAT aptina_mt9m114 + #include #include - +#include #include - #include #include -#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL -#include -LOG_MODULE_REGISTER(mt9m114); +LOG_MODULE_REGISTER(video_mt9m114, CONFIG_VIDEO_LOG_LEVEL); #define MT9M114_CHIP_ID_VAL 0x2481 diff --git a/drivers/video/ov2640.c b/drivers/video/ov2640.c index c9da591fa424744..6787f5d32412260 100644 --- a/drivers/video/ov2640.c +++ b/drivers/video/ov2640.c @@ -5,16 +5,15 @@ */ #define DT_DRV_COMPAT ovti_ov2640 + #include #include - +#include #include #include #include -#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL -#include -LOG_MODULE_REGISTER(ov2640); +LOG_MODULE_REGISTER(video_ov2640, CONFIG_VIDEO_LOG_LEVEL); /* DSP register bank FF=0x00*/ #define QS 0x44 diff --git a/drivers/video/ov5640.c b/drivers/video/ov5640.c index 7c76c7b88c93c21..d5ee05a66b00047 100644 --- a/drivers/video/ov5640.c +++ b/drivers/video/ov5640.c @@ -6,17 +6,15 @@ #define DT_DRV_COMPAT ovti_ov5640 +#include #include +#include +#include #include #include #include -#include -#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL -#include -LOG_MODULE_REGISTER(ov5640); - -#include +LOG_MODULE_REGISTER(video_ov5640, CONFIG_VIDEO_LOG_LEVEL); #define CHIP_ID_REG 0x300a #define CHIP_ID_VAL 0x5640 diff --git a/drivers/video/ov7670.c b/drivers/video/ov7670.c index 96cb3f860db1f1c..5d71f0670770b2e 100644 --- a/drivers/video/ov7670.c +++ b/drivers/video/ov7670.c @@ -9,10 +9,9 @@ #include #include #include - -#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL #include -LOG_MODULE_REGISTER(ov7670); + +LOG_MODULE_REGISTER(video_ov7670, CONFIG_VIDEO_LOG_LEVEL); /* Initialization register structure */ struct ov7670_reg { diff --git a/drivers/video/ov7725.c b/drivers/video/ov7725.c index 40d6b19dc8e6c17..55f7bde751edfc6 100644 --- a/drivers/video/ov7725.c +++ b/drivers/video/ov7725.c @@ -5,18 +5,16 @@ */ #define DT_DRV_COMPAT ovti_ov7725 + #include #include - #include - +#include #include #include #include -#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL -#include -LOG_MODULE_REGISTER(ov7725); +LOG_MODULE_REGISTER(video_ov7725, CONFIG_VIDEO_LOG_LEVEL); #define OV7725_REVISION 0x7721U diff --git a/drivers/video/video_common.c b/drivers/video/video_common.c index 5b1359ec7bcb52d..fdb35e633933f17 100644 --- a/drivers/video/video_common.c +++ b/drivers/video/video_common.c @@ -3,8 +3,8 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#include +#include #include K_HEAP_DEFINE(video_buffer_pool, diff --git a/drivers/video/video_mcux_csi.c b/drivers/video/video_mcux_csi.c index 2e8e4d505084ae1..f1df8f090f5d8a4 100644 --- a/drivers/video/video_mcux_csi.c +++ b/drivers/video/video_mcux_csi.c @@ -7,6 +7,9 @@ #define DT_DRV_COMPAT nxp_imx_csi #include +#include +#include +#include #include @@ -14,10 +17,6 @@ #include #endif -#include -#include -#include - struct video_mcux_csi_config { CSI_Type *base; const struct device *source_dev; diff --git a/drivers/video/video_mcux_mipi_csi2rx.c b/drivers/video/video_mcux_mipi_csi2rx.c index 6d9dc5729edc35d..b673a1b369798a0 100644 --- a/drivers/video/video_mcux_mipi_csi2rx.c +++ b/drivers/video/video_mcux_mipi_csi2rx.c @@ -6,14 +6,13 @@ #define DT_DRV_COMPAT nxp_mipi_csi2rx -#include - #include #include - -#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL #include -LOG_MODULE_REGISTER(mipi_csi); + +#include + +LOG_MODULE_REGISTER(video_mipi_csi2rx, CONFIG_VIDEO_LOG_LEVEL); /* * Two data lanes are set by default as 2-lanes camera sensors are diff --git a/drivers/video/video_stm32_dcmi.c b/drivers/video/video_stm32_dcmi.c index d8f875b76731b5b..28a5598bc9848da 100644 --- a/drivers/video/video_stm32_dcmi.c +++ b/drivers/video/video_stm32_dcmi.c @@ -7,10 +7,12 @@ #define DT_DRV_COMPAT st_stm32_dcmi #include + #include +#include +#include #include #include -#include #include #include #include @@ -18,8 +20,7 @@ #include -#include -LOG_MODULE_REGISTER(video_stm32_dcmi, CONFIG_STM32_DCMI_LOG_LEVEL); +LOG_MODULE_REGISTER(video_stm32_dcmi, CONFIG_VIDEO_LOG_LEVEL); K_HEAP_DEFINE(video_stm32_buffer_pool, CONFIG_VIDEO_BUFFER_POOL_SZ_MAX); diff --git a/drivers/video/video_sw_generator.c b/drivers/video/video_sw_generator.c index 9b0f3e238b5f30a..141ea0a52999903 100644 --- a/drivers/video/video_sw_generator.c +++ b/drivers/video/video_sw_generator.c @@ -3,13 +3,14 @@ * * SPDX-License-Identifier: Apache-2.0 */ -#include -#include +#define DT_DRV_COMPAT zephyr_sw_generator -#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL +#include +#include #include -LOG_MODULE_REGISTER(video_sw_generator); + +LOG_MODULE_REGISTER(video_sw_generator, CONFIG_VIDEO_LOG_LEVEL); #define VIDEO_PATTERN_COLOR_BAR 0 #define VIDEO_PATTERN_FPS 30