Commit a3de90af authored by Jammy Huang's avatar Jammy Huang Committed by Mauro Carvalho Chehab

media: aspeed: use v4l2_info/v4l2_warn/v4l2_dbg for log

The debug log level, 0~3, is controlled by module_param, debug.
The higher the value, the more the information.
  0: off
  1: info
  2: debug
  3: register operations
Signed-off-by: default avatarJammy Huang <jammy_huang@aspeedtech.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 932de2cd
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <media/v4l2-event.h> #include <media/v4l2-event.h>
#include <media/v4l2-ioctl.h> #include <media/v4l2-ioctl.h>
#include <media/videobuf2-dma-contig.h> #include <media/videobuf2-dma-contig.h>
#include <linux/videodev2.h>
#define DEVICE_NAME "aspeed-video" #define DEVICE_NAME "aspeed-video"
...@@ -411,6 +412,8 @@ static const struct v4l2_dv_timings_cap aspeed_video_timings_cap = { ...@@ -411,6 +412,8 @@ static const struct v4l2_dv_timings_cap aspeed_video_timings_cap = {
}, },
}; };
static unsigned int debug;
static void aspeed_video_init_jpeg_table(u32 *table, bool yuv420) static void aspeed_video_init_jpeg_table(u32 *table, bool yuv420)
{ {
int i; int i;
...@@ -458,23 +461,23 @@ static void aspeed_video_update(struct aspeed_video *video, u32 reg, u32 clear, ...@@ -458,23 +461,23 @@ static void aspeed_video_update(struct aspeed_video *video, u32 reg, u32 clear,
t &= ~clear; t &= ~clear;
t |= bits; t |= bits;
writel(t, video->base + reg); writel(t, video->base + reg);
dev_dbg(video->dev, "update %03x[%08x -> %08x]\n", reg, before, v4l2_dbg(3, debug, &video->v4l2_dev, "update %03x[%08x -> %08x]\n",
readl(video->base + reg)); reg, before, readl(video->base + reg));
} }
static u32 aspeed_video_read(struct aspeed_video *video, u32 reg) static u32 aspeed_video_read(struct aspeed_video *video, u32 reg)
{ {
u32 t = readl(video->base + reg); u32 t = readl(video->base + reg);
dev_dbg(video->dev, "read %03x[%08x]\n", reg, t); v4l2_dbg(3, debug, &video->v4l2_dev, "read %03x[%08x]\n", reg, t);
return t; return t;
} }
static void aspeed_video_write(struct aspeed_video *video, u32 reg, u32 val) static void aspeed_video_write(struct aspeed_video *video, u32 reg, u32 val)
{ {
writel(val, video->base + reg); writel(val, video->base + reg);
dev_dbg(video->dev, "write %03x[%08x]\n", reg, v4l2_dbg(3, debug, &video->v4l2_dev, "write %03x[%08x]\n", reg,
readl(video->base + reg)); readl(video->base + reg));
} }
static void update_perf(struct aspeed_video_perf *p) static void update_perf(struct aspeed_video_perf *p)
...@@ -495,13 +498,13 @@ static int aspeed_video_start_frame(struct aspeed_video *video) ...@@ -495,13 +498,13 @@ static int aspeed_video_start_frame(struct aspeed_video *video)
u32 seq_ctrl = aspeed_video_read(video, VE_SEQ_CTRL); u32 seq_ctrl = aspeed_video_read(video, VE_SEQ_CTRL);
if (video->v4l2_input_status) { if (video->v4l2_input_status) {
dev_dbg(video->dev, "No signal; don't start frame\n"); v4l2_warn(&video->v4l2_dev, "No signal; don't start frame\n");
return 0; return 0;
} }
if (!(seq_ctrl & VE_SEQ_CTRL_COMP_BUSY) || if (!(seq_ctrl & VE_SEQ_CTRL_COMP_BUSY) ||
!(seq_ctrl & VE_SEQ_CTRL_CAP_BUSY)) { !(seq_ctrl & VE_SEQ_CTRL_CAP_BUSY)) {
dev_dbg(video->dev, "Engine busy; don't start frame\n"); v4l2_warn(&video->v4l2_dev, "Engine busy; don't start frame\n");
return -EBUSY; return -EBUSY;
} }
...@@ -510,7 +513,7 @@ static int aspeed_video_start_frame(struct aspeed_video *video) ...@@ -510,7 +513,7 @@ static int aspeed_video_start_frame(struct aspeed_video *video)
struct aspeed_video_buffer, link); struct aspeed_video_buffer, link);
if (!buf) { if (!buf) {
spin_unlock_irqrestore(&video->lock, flags); spin_unlock_irqrestore(&video->lock, flags);
dev_dbg(video->dev, "No buffers; don't start frame\n"); v4l2_warn(&video->v4l2_dev, "No buffers; don't start frame\n");
return -EPROTO; return -EPROTO;
} }
...@@ -590,7 +593,7 @@ static void aspeed_video_bufs_done(struct aspeed_video *video, ...@@ -590,7 +593,7 @@ static void aspeed_video_bufs_done(struct aspeed_video *video,
static void aspeed_video_irq_res_change(struct aspeed_video *video, ulong delay) static void aspeed_video_irq_res_change(struct aspeed_video *video, ulong delay)
{ {
dev_dbg(video->dev, "Resolution changed; resetting\n"); v4l2_dbg(1, debug, &video->v4l2_dev, "Resolution changed; resetting\n");
set_bit(VIDEO_RES_CHANGE, &video->flags); set_bit(VIDEO_RES_CHANGE, &video->flags);
clear_bit(VIDEO_FRAME_INPRG, &video->flags); clear_bit(VIDEO_FRAME_INPRG, &video->flags);
...@@ -787,8 +790,8 @@ static void aspeed_video_calc_compressed_size(struct aspeed_video *video, ...@@ -787,8 +790,8 @@ static void aspeed_video_calc_compressed_size(struct aspeed_video *video,
aspeed_video_write(video, VE_STREAM_BUF_SIZE, aspeed_video_write(video, VE_STREAM_BUF_SIZE,
compression_buffer_size_reg); compression_buffer_size_reg);
dev_dbg(video->dev, "Max compressed size: %x\n", v4l2_dbg(1, debug, &video->v4l2_dev, "Max compressed size: %#x\n",
video->max_compressed_size); video->max_compressed_size);
} }
#define res_check(v) test_and_clear_bit(VIDEO_MODE_DETECT_DONE, &(v)->flags) #define res_check(v) test_and_clear_bit(VIDEO_MODE_DETECT_DONE, &(v)->flags)
...@@ -825,7 +828,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) ...@@ -825,7 +828,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video)
res_check(video), res_check(video),
MODE_DETECT_TIMEOUT); MODE_DETECT_TIMEOUT);
if (!rc) { if (!rc) {
dev_dbg(video->dev, "Timed out; first mode detect\n"); v4l2_warn(&video->v4l2_dev, "Timed out; first mode detect\n");
clear_bit(VIDEO_RES_DETECT, &video->flags); clear_bit(VIDEO_RES_DETECT, &video->flags);
return; return;
} }
...@@ -839,7 +842,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) ...@@ -839,7 +842,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video)
MODE_DETECT_TIMEOUT); MODE_DETECT_TIMEOUT);
clear_bit(VIDEO_RES_DETECT, &video->flags); clear_bit(VIDEO_RES_DETECT, &video->flags);
if (!rc) { if (!rc) {
dev_dbg(video->dev, "Timed out; second mode detect\n"); v4l2_warn(&video->v4l2_dev, "Timed out; second mode detect\n");
return; return;
} }
...@@ -873,7 +876,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) ...@@ -873,7 +876,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video)
} while (invalid_resolution && (tries++ < INVALID_RESOLUTION_RETRIES)); } while (invalid_resolution && (tries++ < INVALID_RESOLUTION_RETRIES));
if (invalid_resolution) { if (invalid_resolution) {
dev_dbg(video->dev, "Invalid resolution detected\n"); v4l2_warn(&video->v4l2_dev, "Invalid resolution detected\n");
return; return;
} }
...@@ -890,8 +893,8 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) ...@@ -890,8 +893,8 @@ static void aspeed_video_get_resolution(struct aspeed_video *video)
aspeed_video_update(video, VE_SEQ_CTRL, 0, aspeed_video_update(video, VE_SEQ_CTRL, 0,
VE_SEQ_CTRL_AUTO_COMP | VE_SEQ_CTRL_EN_WATCHDOG); VE_SEQ_CTRL_AUTO_COMP | VE_SEQ_CTRL_EN_WATCHDOG);
dev_dbg(video->dev, "Got resolution: %dx%d\n", det->width, v4l2_dbg(1, debug, &video->v4l2_dev, "Got resolution: %dx%d\n",
det->height); det->width, det->height);
} }
static void aspeed_video_set_resolution(struct aspeed_video *video) static void aspeed_video_set_resolution(struct aspeed_video *video)
...@@ -1516,7 +1519,7 @@ static void aspeed_video_stop_streaming(struct vb2_queue *q) ...@@ -1516,7 +1519,7 @@ static void aspeed_video_stop_streaming(struct vb2_queue *q)
!test_bit(VIDEO_FRAME_INPRG, &video->flags), !test_bit(VIDEO_FRAME_INPRG, &video->flags),
STOP_TIMEOUT); STOP_TIMEOUT);
if (!rc) { if (!rc) {
dev_dbg(video->dev, "Timed out when stopping streaming\n"); v4l2_warn(&video->v4l2_dev, "Timed out when stopping streaming\n");
/* /*
* Need to force stop any DMA and try and get HW into a good * Need to force stop any DMA and try and get HW into a good
...@@ -1875,6 +1878,9 @@ static struct platform_driver aspeed_video_driver = { ...@@ -1875,6 +1878,9 @@ static struct platform_driver aspeed_video_driver = {
module_platform_driver(aspeed_video_driver); module_platform_driver(aspeed_video_driver);
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Debug level (0=off,1=info,2=debug,3=reg ops)");
MODULE_DESCRIPTION("ASPEED Video Engine Driver"); MODULE_DESCRIPTION("ASPEED Video Engine Driver");
MODULE_AUTHOR("Eddie James"); MODULE_AUTHOR("Eddie James");
MODULE_LICENSE("GPL v2"); MODULE_LICENSE("GPL v2");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment