From patchwork Fri Dec 1 14:04:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13475885 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 097C9C4167B for ; Fri, 1 Dec 2023 14:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=cKiL1wlSliAaKuNiZCkjI5bGRIYxef/i8jqLQFyLPN4=; b=AtqK4oaCE9Guui 8GXAq1vBLJ9KQcX0FGvEeDFJOpfxpNZwVqNQG6AKbfkqRwThZLkrYiA37CwGkUrfMd8E7H8L4c5nZ R1Kvl7h2KeeRe7VbKmD9T96MGAcIkasTZ3bDMGXwQl2ANAN/XXFszMfM+KKBJmiX2r142UcrhppT4 ZQg3DFQXuxl3zQGJgWZAvU0/v5vCsmGAZXq0fmr1YT8DW1vvlQnfzurVTNQh7g6FtFns6FBlCskcq b2A6jfTjQFSdr5ClbowE+2OpXTaHbvy/JL5b87ezN9HhJWIiLHyebrQ5/SxglHk3NBhjcmZwY+SzQ IKQcgEeWUKazayQQ8KjA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r948Y-00DtCF-2v; Fri, 01 Dec 2023 14:04:58 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r948V-00DtBI-2f; Fri, 01 Dec 2023 14:04:57 +0000 Received: from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp [175.177.49.156]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 22F67138C; Fri, 1 Dec 2023 15:04:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701439457; bh=6zAIEj5ay2gT7+AvgvT+WUyzdRwwv76PYE4uLNb3qOg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bs4yQcW/vUdx9xaVmGD7CpLkHEu69wWuVl/djvZU0fy+fZTmDBUhNtZ6czqnNIUPs aM1PGitQ4siHqyu2UvsLCVLdAXLNbiG2JcPzLNTDHDBj5CZhF0NJ5R8ZKW+DSb8sKo gMcrmimq8GEvoBE0Pn+B+/SeLldJcmSmUX1T9/3Q= From: Paul Elder To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org Cc: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, tomi.valkeinen@ideasonboard.com, umang.jain@ideasonboard.com, Paul Elder , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 1/4] media: rkisp1: regs: Consolidate MI interrupt wrap fields Date: Fri, 1 Dec 2023 23:04:30 +0900 Message-Id: <20231201140433.2126011-2-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231201140433.2126011-1-paul.elder@ideasonboard.com> References: <20231201140433.2126011-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231201_060456_002506_A267BB50 X-CRM114-Status: UNSURE ( 9.97 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Consolidate the wraparound fields in the memory interface interrupt status registers, so that it can be more succinctly expressed by taking the stream ID (main or self) as a parameter. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h index 350f452e676f..bea69a0d766a 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-regs.h @@ -172,12 +172,9 @@ #define RKISP1_CIF_MI_FRAME(stream) BIT((stream)->id) #define RKISP1_CIF_MI_MBLK_LINE BIT(2) #define RKISP1_CIF_MI_FILL_MP_Y BIT(3) -#define RKISP1_CIF_MI_WRAP_MP_Y BIT(4) -#define RKISP1_CIF_MI_WRAP_MP_CB BIT(5) -#define RKISP1_CIF_MI_WRAP_MP_CR BIT(6) -#define RKISP1_CIF_MI_WRAP_SP_Y BIT(7) -#define RKISP1_CIF_MI_WRAP_SP_CB BIT(8) -#define RKISP1_CIF_MI_WRAP_SP_CR BIT(9) +#define RKISP1_CIF_MI_WRAP_Y(stream) BIT(4 + (stream)->id * 3) +#define RKISP1_CIF_MI_WRAP_CB(stream) BIT(5 + (stream)->id * 3) +#define RKISP1_CIF_MI_WRAP_CR(stream) BIT(6 + (stream)->id * 3) #define RKISP1_CIF_MI_DMA_READY BIT(11) /* MI_STATUS */ From patchwork Fri Dec 1 14:04:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13475884 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2B0B1C10DCE for ; Fri, 1 Dec 2023 14:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=MCX1xdx3izNRQ5y3LvYYqWKq3JI1CImzLF2Y3aI7z/s=; b=LbHgEkAgBXsxOw JhT/oNXOim9aG+qJcaDPKokwWiNpHCbfEqbGYY0Ypj2MiNOHbOzl6KKACSzW4ElagFM1yCzTgKaw0 0HjwjjKI5j/tTynbKNuj/thxdM4dPKTDtDUsoCfeTfjzhrg8Pz3670+EtjmKUe4+w0OgWBehy7P2k LS5TPj8p1wNsWfcy6Qthqoq1eyjwHotxCduMTqiYxHAUGhkfasScwbF83xycCOS0PL53mHjJBAJC1 SqhhBrKatdju8U9De4+Tg0F7tyuImUGEcdejMKmXOfepokrshsHAqkhTGVjCQh4t1FSO0yjkiBQFZ HXBoyEEcJR+ppLybih0w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r948d-00DtET-1J; Fri, 01 Dec 2023 14:05:03 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r948a-00DtCL-0W; Fri, 01 Dec 2023 14:05:01 +0000 Received: from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp [175.177.49.156]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id E3A3118A2; Fri, 1 Dec 2023 15:04:17 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701439462; bh=GCySINWmuCR5JodNHhNRp4B30t3rx5GHASe7kUWliPk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bn5kQflYY6ZjgS3HSwJuWGk06QH7hZbvaEufHauqZ8LtlOMT0f3Ob9ErzD5scA+MX i+DjWr/Z8tjLamXiSMxFBHzBdYekA3spRIeZiAMLD2E15GempKuwoQNWg5Gmi/yQCh Nw7LbxSuHjE/MCUOV1LqL//sPyfgn8pSkDDCloVo= From: Paul Elder To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org Cc: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, tomi.valkeinen@ideasonboard.com, umang.jain@ideasonboard.com, Paul Elder , Alexander Stein , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 2/4] media: rkisp1: debug: Add register dump for IS Date: Fri, 1 Dec 2023 23:04:31 +0900 Message-Id: <20231201140433.2126011-3-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231201140433.2126011-1-paul.elder@ideasonboard.com> References: <20231201140433.2126011-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231201_060500_338998_84C83E14 X-CRM114-Status: UNSURE ( 9.97 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add register dump for the ISP image stabilizer module to debugfs. This helps debugging issues related to digital zoom. Signed-off-by: Paul Elder Tested-by: Alexander Stein Reviewed-by: Kieran Bingham Signed-off-by: Laurent Pinchart --- Changes in v2: - Move from IS debugfs file into the ISP debugfs file drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c index 71df3dc95e6f..d2fbed42164e 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c @@ -92,6 +92,10 @@ static int rkisp1_debug_dump_isp_regs_show(struct seq_file *m, void *p) RKISP1_DEBUG_REG(ISP_FLAGS_SHD), RKISP1_DEBUG_REG(ISP_RIS), RKISP1_DEBUG_REG(ISP_ERR), + RKISP1_DEBUG_SHD_REG(ISP_IS_H_OFFS), + RKISP1_DEBUG_SHD_REG(ISP_IS_V_OFFS), + RKISP1_DEBUG_SHD_REG(ISP_IS_H_SIZE), + RKISP1_DEBUG_SHD_REG(ISP_IS_V_SIZE), { /* Sentinel */ }, }; struct rkisp1_device *rkisp1 = m->private; From patchwork Fri Dec 1 14:04:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13475886 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C6700C4167B for ; Fri, 1 Dec 2023 14:05:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WFKBrNuYi109WAzYGyK4Ca6oC4FgL2OovRQ+xDniYc4=; b=dITqdXNllhuW2J 9NhIuFOzA1+8tdFj64ZB4LtA+UK3f6a5ybORhAD20pAkZJDcTFon6AdKLMRjSSmla4XNW8TV7gpg9 iIsJZ3HLCPsdNFwMsUz/q1r7oYPsn9s+or0uUNfaOij0M/FR0e5HGPcat1Y4QW+l1iChdQWv2lbjL ltZX1WlrTvGNtS/uL9KoDeBYmCl53dxiVEoV+U8Z+3pvvgHC/TWCtzbRSwRiPLw8ZJkraEsnY22Cm moltOTR1AzcGPyfFLrqHob7f+3pDnmfEWuNSBGzk9TJ2yDmutiazxy7sufMLuiuORvLpV8LTH+0lU ifZdAVKhGU8ZY6ZC0eWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r948i-00DtHR-1W; Fri, 01 Dec 2023 14:05:08 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r948f-00DtFR-1g; Fri, 01 Dec 2023 14:05:06 +0000 Received: from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp [175.177.49.156]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D4D64FAD; Fri, 1 Dec 2023 15:04:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701439467; bh=MFcStENnnolCSllpVqU3n3QSpfDjGV2JE1o/1bWj2kw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qa1SZLwHWB9/IALx/ETlJuQtmJcmv5BtbnooiP5QzYVp2ZvlKKBZCcfPb68UruJXw ivdpwxsKhv0P/FQovfBYBo5c0pAAqsN+bsLefogBotizdxhN02TTJzA/bL4c4GqbGu nU6qoldIDPqXTwj+U8f2MxesCQRgs4fsohKGDDy0= From: Paul Elder To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org Cc: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, tomi.valkeinen@ideasonboard.com, umang.jain@ideasonboard.com, Paul Elder , Alexander Stein , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 3/4] media: rkisp1: debug: Count completed frame interrupts Date: Fri, 1 Dec 2023 23:04:32 +0900 Message-Id: <20231201140433.2126011-4-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231201140433.2126011-1-paul.elder@ideasonboard.com> References: <20231201140433.2126011-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231201_060505_694685_86A7C901 X-CRM114-Status: GOOD ( 11.10 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add a counter to debugfs to count the number of frame-end interrupts. Signed-off-by: Paul Elder Reviewed-by: Alexander Stein Reviewed-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- drivers/media/platform/rockchip/rkisp1/rkisp1-common.h | 1 + drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c | 2 ++ drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c | 2 ++ 3 files changed, 5 insertions(+) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h index 1e7cea1bea5e..be69173958a4 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h @@ -417,6 +417,7 @@ struct rkisp1_debug { unsigned long stats_error; unsigned long stop_timeout[2]; unsigned long frame_drop[2]; + unsigned long complete_frames; }; /* diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c index d2fbed42164e..79cda589d935 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c @@ -221,6 +221,8 @@ void rkisp1_debug_init(struct rkisp1_device *rkisp1) &debug->frame_drop[RKISP1_MAINPATH]); debugfs_create_ulong("sp_frame_drop", 0444, debug->debugfs_dir, &debug->frame_drop[RKISP1_SELFPATH]); + debugfs_create_ulong("complete_frames", 0444, debug->debugfs_dir, + &debug->complete_frames); debugfs_create_file("input_status", 0444, debug->debugfs_dir, rkisp1, &rkisp1_debug_input_status_fops); diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c index 88ca8b2283b7..bd3acd926410 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c @@ -989,6 +989,8 @@ irqreturn_t rkisp1_isp_isr(int irq, void *ctx) if (status & RKISP1_CIF_ISP_FRAME) { u32 isp_ris; + rkisp1->debug.complete_frames++; + /* New frame from the sensor received */ isp_ris = rkisp1_read(rkisp1, RKISP1_CIF_ISP_RIS); if (isp_ris & RKISP1_STATS_MEAS_MASK) From patchwork Fri Dec 1 14:04:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Elder X-Patchwork-Id: 13475887 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 92443C4167B for ; Fri, 1 Dec 2023 14:05:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=BhZA6INqTJ8lYf867GiHPbSSj4MdgoCtCQ1gUbq9wCU=; b=zhaFa9R7bxlYyv okQUK2kitcXZBWr1teq5j1NhUsRL5lTedHxLOsvDheN9GqIs2fBjRUu6160RWG1lSccEe0s24Rk+d CieWIy6Dl6oqFniPr4FI6s4gOee/IRlgxToX2uApi1XvUJUalsFhIPIDuo6rIWNtta24Jar6P4J3g MPQmo+fkcFNASlZYvEpuY9xRkeuSotGpbUI6OoCHPF7abjbMPSvMS5cjfD14D0XlODMnOhYhqsGys EYdoG5qBOWjHwxHe6maAFaXux+1C/HxTYayZB3XouUbHyC5jpcCIYZHFGyo/sAB7vezKJzJzLrt5m KKm2bchA88sMWnrIaiKw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r948n-00DtLG-0W; Fri, 01 Dec 2023 14:05:13 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r948k-00DtIx-1Z; Fri, 01 Dec 2023 14:05:12 +0000 Received: from pyrite.hamster-moth.ts.net (h175-177-049-156.catv02.itscom.jp [175.177.49.156]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 177711AC0; Fri, 1 Dec 2023 15:04:27 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1701439472; bh=ZafNoeEiTkEMR2Mskz+/jeQsiJ1/6DAgbgEgbXTgowE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qbcU8xmdrlGoFSKZSapRmFb5mN6wxgBgyBtw3jGhhvjuWlMyiSa3xr/86Uw8GAyc3 jIgWdDs+AnUSdDqrBDx5zx+kJJbVg37eWM/B0SEUXZCpvuJIzKJAp3bW01smF0ezfB X4PgbnegCsiBOt1IpV5NOnpwqyloJ4o4C13LJLlM= From: Paul Elder To: linux-media@vger.kernel.org, linux-rockchip@lists.infradead.org Cc: laurent.pinchart@ideasonboard.com, kieran.bingham@ideasonboard.com, tomi.valkeinen@ideasonboard.com, umang.jain@ideasonboard.com, Paul Elder , Dafna Hirschfeld , Mauro Carvalho Chehab , Heiko Stuebner , linux-arm-kernel@lists.infradead.org (moderated list:ARM/Rockchip SoC support), linux-kernel@vger.kernel.org (open list) Subject: [PATCH v2 4/4] media: rkisp1: debug: Consolidate counter debugfs files Date: Fri, 1 Dec 2023 23:04:33 +0900 Message-Id: <20231201140433.2126011-5-paul.elder@ideasonboard.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20231201140433.2126011-1-paul.elder@ideasonboard.com> References: <20231201140433.2126011-1-paul.elder@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231201_060510_661440_58C163C7 X-CRM114-Status: GOOD ( 14.56 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Consolidate all the debugfs files that were each a single counter into a single "counters" file. While at it, reset the counters at stream on time to make it easier for to interpret the values in userspace. Signed-off-by: Paul Elder Reviewed-by: Kieran Bingham --- New in v2 .../platform/rockchip/rkisp1/rkisp1-capture.c | 2 + .../platform/rockchip/rkisp1/rkisp1-common.h | 4 ++ .../platform/rockchip/rkisp1/rkisp1-debug.c | 69 ++++++++++++------- 3 files changed, 50 insertions(+), 25 deletions(-) diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c index c6d7e01c8949..67b2e94dfd67 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-capture.c @@ -1030,6 +1030,8 @@ rkisp1_vb2_start_streaming(struct vb2_queue *queue, unsigned int count) struct media_entity *entity = &cap->vnode.vdev.entity; int ret; + rkisp1_debug_reset_counters(cap->rkisp1); + mutex_lock(&cap->rkisp1->stream_lock); ret = video_device_pipeline_start(&cap->vnode.vdev, &cap->rkisp1->pipe); diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h index be69173958a4..789259fb304a 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h @@ -599,9 +599,13 @@ int rkisp1_params_register(struct rkisp1_device *rkisp1); void rkisp1_params_unregister(struct rkisp1_device *rkisp1); #if IS_ENABLED(CONFIG_DEBUG_FS) +void rkisp1_debug_reset_counters(struct rkisp1_device *rkisp1); void rkisp1_debug_init(struct rkisp1_device *rkisp1); void rkisp1_debug_cleanup(struct rkisp1_device *rkisp1); #else +static inline void rkisp1_debug_reset_counters(struct rkisp1_device *rkisp1) +{ +} static inline void rkisp1_debug_init(struct rkisp1_device *rkisp1) { } diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c index 79cda589d935..4358ed1367ed 100644 --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-debug.c @@ -25,6 +25,11 @@ struct rkisp1_debug_register { const char * const name; }; +struct rkisp1_debug_counter { + const char * const name; + unsigned long *value; +}; + #define RKISP1_DEBUG_REG(name) { RKISP1_CIF_##name, 0, #name } #define RKISP1_DEBUG_SHD_REG(name) { \ RKISP1_CIF_##name, RKISP1_CIF_##name##_SHD, #name \ @@ -191,6 +196,43 @@ static int rkisp1_debug_input_status_show(struct seq_file *m, void *p) } DEFINE_SHOW_ATTRIBUTE(rkisp1_debug_input_status); +static int rkisp1_debug_counters_show(struct seq_file *m, void *p) +{ + struct rkisp1_device *rkisp1 = m->private; + struct rkisp1_debug *debug = &rkisp1->debug; + + const struct rkisp1_debug_counter counters[] = { + { "data_loss", &debug->data_loss }, + { "outform_size_err", &debug->outform_size_error }, + { "img_stabilization_size_error", &debug->img_stabilization_size_error }, + { "inform_size_error", &debug->inform_size_error }, + { "irq_delay", &debug->irq_delay }, + { "mipi_error", &debug->mipi_error }, + { "stats_error", &debug->stats_error }, + { "mp_stop_timeout", &debug->stop_timeout[RKISP1_MAINPATH] }, + { "sp_stop_timeout", &debug->stop_timeout[RKISP1_SELFPATH] }, + { "mp_frame_drop", &debug->frame_drop[RKISP1_MAINPATH] }, + { "sp_frame_drop", &debug->frame_drop[RKISP1_SELFPATH] }, + { "complete_frames", &debug->complete_frames }, + { /* Sentinel */ }, + }; + + const struct rkisp1_debug_counter *counter = counters; + + for (; counter->name; ++counter) + seq_printf(m, "%s: %lu\n", counter->name, *counter->value); + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(rkisp1_debug_counters); + +void rkisp1_debug_reset_counters(struct rkisp1_device *rkisp1) +{ + struct dentry *debugfs_dir = rkisp1->debug.debugfs_dir; + memset(&rkisp1->debug, 0, sizeof(rkisp1->debug)); + rkisp1->debug.debugfs_dir = debugfs_dir; +} + void rkisp1_debug_init(struct rkisp1_device *rkisp1) { struct rkisp1_debug *debug = &rkisp1->debug; @@ -198,31 +240,8 @@ void rkisp1_debug_init(struct rkisp1_device *rkisp1) debug->debugfs_dir = debugfs_create_dir(dev_name(rkisp1->dev), NULL); - debugfs_create_ulong("data_loss", 0444, debug->debugfs_dir, - &debug->data_loss); - debugfs_create_ulong("outform_size_err", 0444, debug->debugfs_dir, - &debug->outform_size_error); - debugfs_create_ulong("img_stabilization_size_error", 0444, - debug->debugfs_dir, - &debug->img_stabilization_size_error); - debugfs_create_ulong("inform_size_error", 0444, debug->debugfs_dir, - &debug->inform_size_error); - debugfs_create_ulong("irq_delay", 0444, debug->debugfs_dir, - &debug->irq_delay); - debugfs_create_ulong("mipi_error", 0444, debug->debugfs_dir, - &debug->mipi_error); - debugfs_create_ulong("stats_error", 0444, debug->debugfs_dir, - &debug->stats_error); - debugfs_create_ulong("mp_stop_timeout", 0444, debug->debugfs_dir, - &debug->stop_timeout[RKISP1_MAINPATH]); - debugfs_create_ulong("sp_stop_timeout", 0444, debug->debugfs_dir, - &debug->stop_timeout[RKISP1_SELFPATH]); - debugfs_create_ulong("mp_frame_drop", 0444, debug->debugfs_dir, - &debug->frame_drop[RKISP1_MAINPATH]); - debugfs_create_ulong("sp_frame_drop", 0444, debug->debugfs_dir, - &debug->frame_drop[RKISP1_SELFPATH]); - debugfs_create_ulong("complete_frames", 0444, debug->debugfs_dir, - &debug->complete_frames); + debugfs_create_file("counters", 0444, debug->debugfs_dir, rkisp1, + &rkisp1_debug_counters_fops); debugfs_create_file("input_status", 0444, debug->debugfs_dir, rkisp1, &rkisp1_debug_input_status_fops);