Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2814737pxb; Mon, 18 Oct 2021 02:24:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwp2FQB8lW5TRBwoGjrhTwMv+jUCIxhQd7tY0sgWw6VE0H+YNJE+oZO5jZkz92A1QM5uBjT X-Received: by 2002:a17:906:684e:: with SMTP id a14mr28453535ejs.142.1634549080491; Mon, 18 Oct 2021 02:24:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634549080; cv=none; d=google.com; s=arc-20160816; b=cL7AYtqcHxKUuc51gZB4Qe8hiQdWcPrNAMsKw816t+wpadLMDtH4zf/9NatA0a9yBm ttw5FtMGRra8sf3ODmWwtIt16ewjAsPgq8bDOnyHDL5grXeO23U+211A3zHD/ODaCa2h G0BgZAWKIjOARgv7GDigFDdSvgLnQHGiFN5vIqbGDX+cc3Oz2xgKmEaZaj69AyDP729W 3vgK/Che25qYHHz9Z84Qlzpa7Wi9YRHtDTyGSTLGu06Y7Z2d7+HilORY5gYTlXmh3jiT 1oAIuj0FYBGTou5JIRYlyx3iNBmWZRvb4kcNGV1oBn8IqyhHlxB6K13+npk2sowrgmtN iLvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from; bh=aY6jCnUGOsmcTjxWrEa8MStnOfPuo2HqVLkKcUWHKFU=; b=VsWGHWDDbILLRYCoqfKSBdy/tPDPPL8m116+BMyTBFzzv6mtflGgt+5EhprI/kqEMh iG0Fyuq78XwqOQy3Rded0IIY/HyO7gPVZ8equXC1AKDGs1xUHP1b28SI5KobeZlv9ROq nj4VzpLFAnOfeozTlS2NVmtILf+cl/qfKwT4Eew2+aSWuPMzPgZcBHkneM3tB9QwnjXq 8Owj3cbpp19CrAtufI+RtrPM/R1JKWwsCeCeEQZ29TmCjAtE0Nn4Q230th6PUSXVOrX0 b1CgV7zaX7r/9os3gNafWPj+SGSrXLBdKWqhOBCgkI++US9+0GdyLafkNrY0o2z9DnUL DDsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y13si29031499edd.94.2021.10.18.02.24.15; Mon, 18 Oct 2021 02:24:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231422AbhJRJYe (ORCPT + 99 others); Mon, 18 Oct 2021 05:24:34 -0400 Received: from twspam01.aspeedtech.com ([211.20.114.71]:54382 "EHLO twspam01.aspeedtech.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231327AbhJRJYa (ORCPT ); Mon, 18 Oct 2021 05:24:30 -0400 Received: from mail.aspeedtech.com ([192.168.0.24]) by twspam01.aspeedtech.com with ESMTP id 19I90GS3071199; Mon, 18 Oct 2021 17:00:16 +0800 (GMT-8) (envelope-from jammy_huang@aspeedtech.com) Received: from JammyHuang-PC.aspeed.com (192.168.2.115) by TWMBX02.aspeed.com (192.168.0.24) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 18 Oct 2021 17:22:11 +0800 From: Jammy Huang To: , , , , , , , , Subject: [PATCH v2 2/7] media: aspeed: use v4l2_info/v4l2_warn/v4l2_dbg for log Date: Mon, 18 Oct 2021 17:22:02 +0800 Message-ID: <20211018092207.13336-3-jammy_huang@aspeedtech.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211018092207.13336-1-jammy_huang@aspeedtech.com> References: <20211018092207.13336-1-jammy_huang@aspeedtech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [192.168.2.115] X-ClientProxiedBy: TWMBX02.aspeed.com (192.168.0.24) To TWMBX02.aspeed.com (192.168.0.24) X-DNSRBL: X-MAIL: twspam01.aspeedtech.com 19I90GS3071199 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The debug log level, 0~3, is controlled by module_param, debug. Higher the value, more the information. Signed-off-by: Jammy Huang --- drivers/media/platform/aspeed-video.c | 40 +++++++++++++++------------ 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/drivers/media/platform/aspeed-video.c b/drivers/media/platform/aspeed-video.c index 6259cf17a7cc..642ca96c8c52 100644 --- a/drivers/media/platform/aspeed-video.c +++ b/drivers/media/platform/aspeed-video.c @@ -30,6 +30,7 @@ #include #include #include +#include #define DEVICE_NAME "aspeed-video" @@ -390,6 +391,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) { int i; @@ -437,23 +440,23 @@ static void aspeed_video_update(struct aspeed_video *video, u32 reg, u32 clear, t &= ~clear; t |= bits; writel(t, video->base + reg); - dev_dbg(video->dev, "update %03x[%08x -> %08x]\n", reg, before, - readl(video->base + reg)); + v4l2_dbg(3, debug, &video->v4l2_dev, "update %03x[%08x -> %08x]\n", + reg, before, readl(video->base + reg)); } static u32 aspeed_video_read(struct aspeed_video *video, u32 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; } static void aspeed_video_write(struct aspeed_video *video, u32 reg, u32 val) { writel(val, video->base + reg); - dev_dbg(video->dev, "write %03x[%08x]\n", reg, - readl(video->base + reg)); + v4l2_dbg(3, debug, &video->v4l2_dev, "write %03x[%08x]\n", reg, + readl(video->base + reg)); } static void update_perf(struct aspeed_video_perf *p) @@ -474,13 +477,13 @@ static int aspeed_video_start_frame(struct aspeed_video *video) u32 seq_ctrl = aspeed_video_read(video, VE_SEQ_CTRL); 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; } if (!(seq_ctrl & VE_SEQ_CTRL_COMP_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; } @@ -489,7 +492,7 @@ static int aspeed_video_start_frame(struct aspeed_video *video) struct aspeed_video_buffer, link); if (!buf) { 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; } @@ -565,7 +568,7 @@ static void aspeed_video_bufs_done(struct aspeed_video *video, 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); clear_bit(VIDEO_FRAME_INPRG, &video->flags); @@ -766,8 +769,8 @@ static void aspeed_video_calc_compressed_size(struct aspeed_video *video, aspeed_video_write(video, VE_STREAM_BUF_SIZE, compression_buffer_size_reg); - dev_dbg(video->dev, "Max compressed size: %x\n", - video->max_compressed_size); + v4l2_dbg(1, debug, &video->v4l2_dev, "Max compressed size: %#x\n", + video->max_compressed_size); } #define res_check(v) test_and_clear_bit(VIDEO_MODE_DETECT_DONE, &(v)->flags) @@ -804,7 +807,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) res_check(video), MODE_DETECT_TIMEOUT); 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); return; } @@ -822,7 +825,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) MODE_DETECT_TIMEOUT); clear_bit(VIDEO_RES_DETECT, &video->flags); if (!rc) { - dev_dbg(video->dev, "Timed out; second mode detect\n"); + v4l2_warn(&video->v4l2_dev, "Timed out; second mode detect\n"); return; } @@ -856,7 +859,7 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) } while (invalid_resolution && (tries++ < INVALID_RESOLUTION_RETRIES)); if (invalid_resolution) { - dev_dbg(video->dev, "Invalid resolution detected\n"); + v4l2_warn(&video->v4l2_dev, "Invalid resolution detected\n"); return; } @@ -873,8 +876,8 @@ static void aspeed_video_get_resolution(struct aspeed_video *video) aspeed_video_update(video, VE_SEQ_CTRL, 0, VE_SEQ_CTRL_AUTO_COMP | VE_SEQ_CTRL_EN_WATCHDOG); - dev_dbg(video->dev, "Got resolution: %dx%d\n", det->width, - det->height); + v4l2_dbg(1, debug, &video->v4l2_dev, "Got resolution: %dx%d\n", + det->width, det->height); } static void aspeed_video_set_resolution(struct aspeed_video *video) @@ -1501,7 +1504,7 @@ static void aspeed_video_stop_streaming(struct vb2_queue *q) !test_bit(VIDEO_FRAME_INPRG, &video->flags), STOP_TIMEOUT); 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 @@ -1856,6 +1859,9 @@ static struct platform_driver aspeed_video_driver = { module_platform_driver(aspeed_video_driver); +module_param(debug, int, 0644); +MODULE_PARM_DESC(debug, "Debug level (0-3)"); + MODULE_DESCRIPTION("ASPEED Video Engine Driver"); MODULE_AUTHOR("Eddie James"); MODULE_LICENSE("GPL v2"); -- 2.25.1