Skip to content

Commit

Permalink
drivers: video: introduce CONFIG_VIDEO_LOG_LEVEL
Browse files Browse the repository at this point in the history
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 from 5e34681

- Sort the #include list to something like zephyrproject-rtos#41543

Signed-off-by: Josuah Demangeon <me@josuah.net>
  • Loading branch information
josuah authored and nagelkl committed Sep 16, 2024
1 parent 734a19c commit 94b0a3e
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 44 deletions.
4 changes: 4 additions & 0 deletions drivers/video/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions drivers/video/Kconfig.stm32_dcmi
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,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"
8 changes: 3 additions & 5 deletions drivers/video/mt9m114.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@
*/

#define DT_DRV_COMPAT aptina_mt9m114

#include <zephyr/kernel.h>
#include <zephyr/device.h>

#include <zephyr/logging/log.h>
#include <zephyr/sys/byteorder.h>

#include <zephyr/drivers/video.h>
#include <zephyr/drivers/i2c.h>

#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(mt9m114);
LOG_MODULE_REGISTER(video_mt9m114, CONFIG_VIDEO_LOG_LEVEL);

#define MT9M114_CHIP_ID_VAL 0x2481

Expand Down
7 changes: 3 additions & 4 deletions drivers/video/ov2640.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,15 @@
*/

#define DT_DRV_COMPAT ovti_ov2640

#include <zephyr/kernel.h>
#include <zephyr/device.h>

#include <zephyr/logging/log.h>
#include <zephyr/drivers/video.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/gpio.h>

#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(ov2640);
LOG_MODULE_REGISTER(video_ov2640, CONFIG_VIDEO_LOG_LEVEL);

/* DSP register bank FF=0x00*/
#define QS 0x44
Expand Down
10 changes: 4 additions & 6 deletions drivers/video/ov5640.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,15 @@

#define DT_DRV_COMPAT ovti_ov5640

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/logging/log.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/video.h>
#include <zephyr/kernel.h>

#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(ov5640);

#include <zephyr/sys/byteorder.h>
LOG_MODULE_REGISTER(video_ov5640, CONFIG_VIDEO_LOG_LEVEL);

#define CHIP_ID_REG 0x300a
#define CHIP_ID_VAL 0x5640
Expand Down
5 changes: 2 additions & 3 deletions drivers/video/ov7670.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/video.h>

#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(ov7670);

LOG_MODULE_REGISTER(video_ov7670, CONFIG_VIDEO_LOG_LEVEL);

/* Initialization register structure */
struct ov7670_reg {
Expand Down
8 changes: 3 additions & 5 deletions drivers/video/ov7725.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,16 @@
*/

#define DT_DRV_COMPAT ovti_ov7725

#include <zephyr/kernel.h>
#include <zephyr/device.h>

#include <zephyr/sys/byteorder.h>

#include <zephyr/logging/log.h>
#include <zephyr/drivers/video.h>
#include <zephyr/drivers/i2c.h>
#include <zephyr/drivers/gpio.h>

#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(ov7725);
LOG_MODULE_REGISTER(video_ov7725, CONFIG_VIDEO_LOG_LEVEL);

#define OV7725_REVISION 0x7721U

Expand Down
2 changes: 1 addition & 1 deletion drivers/video/video_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>

#include <zephyr/kernel.h>
#include <zephyr/drivers/video.h>

K_HEAP_DEFINE(video_buffer_pool,
Expand Down
7 changes: 3 additions & 4 deletions drivers/video/video_mcux_csi.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@
#define DT_DRV_COMPAT nxp_imx_csi

#include <zephyr/kernel.h>
#include <zephyr/irq.h>
#include <zephyr/drivers/video.h>
#include <zephyr/drivers/pinctrl.h>

#include <fsl_csi.h>

#ifdef CONFIG_HAS_MCUX_CACHE
#include <fsl_cache.h>
#endif

#include <zephyr/drivers/video.h>
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/irq.h>

struct video_mcux_csi_config {
CSI_Type *base;
const struct device *source_dev;
Expand Down
9 changes: 4 additions & 5 deletions drivers/video/video_mcux_mipi_csi2rx.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@

#define DT_DRV_COMPAT nxp_mipi_csi2rx

#include <fsl_mipi_csi2rx.h>

#include <zephyr/drivers/video.h>
#include <zephyr/kernel.h>

#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(mipi_csi);

#include <fsl_mipi_csi2rx.h>

LOG_MODULE_REGISTER(video_mipi_csi2rx, CONFIG_VIDEO_LOG_LEVEL);

/*
* Two data lanes are set by default as 2-lanes camera sensors are
Expand Down
7 changes: 4 additions & 3 deletions drivers/video/video_stm32_dcmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,20 @@
#define DT_DRV_COMPAT st_stm32_dcmi

#include <errno.h>

#include <zephyr/kernel.h>
#include <zephyr/irq.h>
#include <zephyr/logging/log.h>
#include <zephyr/drivers/video.h>
#include <zephyr/drivers/pinctrl.h>
#include <zephyr/irq.h>
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
#include <zephyr/drivers/clock_control.h>
#include <zephyr/drivers/dma.h>
#include <zephyr/drivers/dma/dma_stm32.h>

#include <stm32_ll_dma.h>

#include <zephyr/logging/log.h>
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);

Expand Down
9 changes: 5 additions & 4 deletions drivers/video/video_sw_generator.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/kernel.h>

#include <zephyr/drivers/video.h>
#define DT_DRV_COMPAT zephyr_sw_generator

#define LOG_LEVEL CONFIG_LOG_DEFAULT_LEVEL
#include <zephyr/kernel.h>
#include <zephyr/drivers/video.h>
#include <zephyr/logging/log.h>
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
Expand Down

0 comments on commit 94b0a3e

Please sign in to comment.