Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp274419pxb; Wed, 27 Oct 2021 02:50:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCyegRRXQYnciU4XCxCIHAIS7v0HAir8hsceLWG8vrt99wYl1PmacRMmuEJ7hZ3nsiUN5j X-Received: by 2002:a17:90b:1c8e:: with SMTP id oo14mr4744151pjb.224.1635328233449; Wed, 27 Oct 2021 02:50:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635328233; cv=none; d=google.com; s=arc-20160816; b=0tE6zzLQ3+azEXPL4n3Bw4ZHAIieXwbiDkttkw9+eZWaIdUBI/hA7kJq38ZcvxaeiF TlnY21qnzJcIdbp+pp1c9gGWioZJ+eGqaguU/tK3tjXCIH1+74zIKqzY/Rui+Db7p4/U WolAUWjCAGzbkus1yVMEKJDRSFhZkxUmwDOLCFiff2V9gmLksRvKGFC+xGVH65Dnon2B /YSZCKCEHmHNRUnuBgnc/J+itRvbTGYdgfytdBPgbVhcaMd1SnwbCXYKoo4KVHkobXr3 MxbmPYou8WYvdei5El9fsbfiWpkJxsS+KzQ07Dv725UR7OguAzLvVpqytz4hOR6lCZcA s4XQ== 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:cc:to:from :dkim-signature; bh=hut926V20OH93089sBQ+FiKkhdXp4O3nTh6QgQgaA7A=; b=Ypw8T3TzELBbQZ8RVw+IGXTrZeBidRd0ql1jsW1jVEWNeC1LrQhjuZD8Is13lewqBo HzFew2DSIeaCTDK46kDkhdMuIDTxtk0prQ/zabW8hjyeBquPU1fdTV3h7Hhj4p8eXV5s TsW78LXVMbUQ3z9uRKIAcaw0CMhBIGSP7d81BjBnIv7BZs1iNX9lDt5/xUKig2Cl/2Eo EJi6YS4A98ni6ez523TNyKjao4wmTpcRKjhyptWr6yOrpw8IK7pNdzVjgus8huTSc9Kf 0/1lQAnUCiPini28KmjWZplijwLUDo88D1f2uwcsJ1xOhUAb2PN1pi7Al+O/7nB5xfpU XVhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=hwYicRb0; 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 u6si4160683pjm.44.2021.10.27.02.49.35; Wed, 27 Oct 2021 02:50:33 -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; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=hwYicRb0; 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 S238903AbhJZThG (ORCPT + 99 others); Tue, 26 Oct 2021 15:37:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238831AbhJZTgu (ORCPT ); Tue, 26 Oct 2021 15:36:50 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5393AC061220 for ; Tue, 26 Oct 2021 12:34:25 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id d10so180741wrb.1 for ; Tue, 26 Oct 2021 12:34:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hut926V20OH93089sBQ+FiKkhdXp4O3nTh6QgQgaA7A=; b=hwYicRb0OS5eN08waXU1zgwff1mW40qKsbV1jA3ufWbrmPO0WPZiu72m7rqcxsy29H SPQtiQW+kgnSXoLcG0ldncL9HAIPxArkazHr780V9pJdqzC4MES8yYAuzAllVfdEjaXB 1YP10luLrWQx065ohS933ohmOdpnlL9iZhfuILLvxTR80aEzydOcNW3epM8WL0x+yeM0 t1HKtKNv76Qlo7rM7Yb6AS5I0mIk/UgnqHMDXHONZ7EsqvUGKfJTwxo39xp+uNbdBSxA AuVAjPPY16D5/oh0ke7fI/D5y1/XGulQKI+5/11KkwqkyOtkDRUtLInTAdpOY3h1SV8i PvGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hut926V20OH93089sBQ+FiKkhdXp4O3nTh6QgQgaA7A=; b=dKeI7s3V3y3V1LP2JGizPITrCnnvBI3VIEWdXhWmRbk+wBU18Og+RfBoNRK//uI5v3 IlJLNVoPKAmQQuWouLB5J2k4Hi1u3Jm7z9T3oKf9xEcdgyTeilEcNz1g1q1dCPEb8Z2B T0yQKIz/7PM7vx5tV4sgdq1b5pZCtRfjr9sgDVdUleALEx5nX7bQJI3kexjCvpZ/EuZj dNMZvzdoPPiNqrkKoClCxPyb+1KQXZM08FMwYJqIAYFo+NmAXGR3cg2Rpq8LKEDpDP+p Js1EZtb7zeAtkx2uICTh5SQ1USeoMJHoUvzJhR3rt/x1MPOt1b/f5ZuPy4O5QARsRtq7 jEng== X-Gm-Message-State: AOAM53048/bfbeKRVpx/OXeUoVc2CCMVGiCLaQg1BEmygVIHwp1HgEhD LLpXheSlBdiALpRpFjXvzEux6A== X-Received: by 2002:adf:f84b:: with SMTP id d11mr640730wrq.51.1635276863965; Tue, 26 Oct 2021 12:34:23 -0700 (PDT) Received: from localhost.localdomain (laubervilliers-658-1-213-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.googlemail.com with ESMTPSA id s18sm17676123wrb.95.2021.10.26.12.34.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Oct 2021 12:34:23 -0700 (PDT) From: Corentin Labbe To: mchehab@kernel.org, hverkuil@xs4all.nl, gregkh@linuxfoundation.org Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-staging@lists.linux.dev, mjpeg-users@lists.sourceforge.net, Corentin Labbe Subject: [PATCH v3 04/14] staging: media: zoran: add debugfs Date: Tue, 26 Oct 2021 19:34:06 +0000 Message-Id: <20211026193416.1176797-5-clabbe@baylibre.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211026193416.1176797-1-clabbe@baylibre.com> References: <20211026193416.1176797-1-clabbe@baylibre.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add debugfs for displaying zoran debug and stats information. Signed-off-by: Corentin Labbe --- drivers/staging/media/zoran/Kconfig | 1 + drivers/staging/media/zoran/zoran.h | 2 ++ drivers/staging/media/zoran/zoran_card.c | 36 ++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/drivers/staging/media/zoran/Kconfig b/drivers/staging/media/zoran/Kconfig index 7874842033ca..6d6e4c93f873 100644 --- a/drivers/staging/media/zoran/Kconfig +++ b/drivers/staging/media/zoran/Kconfig @@ -2,6 +2,7 @@ config VIDEO_ZORAN tristate "Zoran ZR36057/36067 Video For Linux (Deprecated)" depends on PCI && I2C_ALGOBIT && VIDEO_V4L2 depends on !ALPHA + depends on DEBUG_FS select VIDEOBUF2_DMA_CONTIG help Say Y for support for MJPEG capture cards based on the Zoran diff --git a/drivers/staging/media/zoran/zoran.h b/drivers/staging/media/zoran/zoran.h index b1ad2a2b914c..981cb63ac9af 100644 --- a/drivers/staging/media/zoran/zoran.h +++ b/drivers/staging/media/zoran/zoran.h @@ -18,6 +18,7 @@ #ifndef _BUZ_H_ #define _BUZ_H_ +#include #include #include #include @@ -295,6 +296,7 @@ struct zoran { struct list_head queued_bufs; spinlock_t queued_bufs_lock; /* Protects queued_bufs */ struct zr_buffer *inuse[BUZ_NUM_STAT_COM * 2]; + struct dentry *dbgfs_dir; }; static inline struct zoran *to_zoran(struct v4l2_device *v4l2_dev) diff --git a/drivers/staging/media/zoran/zoran_card.c b/drivers/staging/media/zoran/zoran_card.c index f1465fbf98af..28a3363a8838 100644 --- a/drivers/staging/media/zoran/zoran_card.c +++ b/drivers/staging/media/zoran/zoran_card.c @@ -945,6 +945,8 @@ static void zoran_remove(struct pci_dev *pdev) if (!zr->initialized) goto exit_free; + debugfs_remove_recursive(zr->dbgfs_dir); + zoran_queue_exit(zr); /* unregister videocodec bus */ @@ -1051,6 +1053,37 @@ static const struct v4l2_ctrl_ops zoran_video_ctrl_ops = { .s_ctrl = zoran_video_set_ctrl, }; +static int zoran_debugfs_show(struct seq_file *seq, void *v) +{ + struct zoran *zr = seq->private; + + seq_printf(seq, "Running mode %x\n", zr->running); + seq_printf(seq, "Codec mode %x\n", zr->codec_mode); + seq_printf(seq, "Norm %llx\n", zr->norm); + seq_printf(seq, "Input %d\n", zr->input); + seq_printf(seq, "Buffersize %d\n", zr->buffer_size); + + seq_printf(seq, "V4L width %dx%d\n", zr->v4l_settings.width, zr->v4l_settings.height); + seq_printf(seq, "V4L bytesperline %d\n", zr->v4l_settings.bytesperline); + + seq_printf(seq, "JPG decimation %u\n", zr->jpg_settings.decimation); + seq_printf(seq, "JPG hor_dcm %u\n", zr->jpg_settings.hor_dcm); + seq_printf(seq, "JPG ver_dcm %u\n", zr->jpg_settings.ver_dcm); + seq_printf(seq, "JPG tmp_dcm %u\n", zr->jpg_settings.tmp_dcm); + seq_printf(seq, "JPG odd_even %u\n", zr->jpg_settings.odd_even); + seq_printf(seq, "JPG crop %dx%d %d %d\n", + zr->jpg_settings.img_x, + zr->jpg_settings.img_y, + zr->jpg_settings.img_width, + zr->jpg_settings.img_height); + + seq_printf(seq, "Prepared %u\n", zr->prepared); + seq_printf(seq, "Queued %u\n", zr->queued); + return 0; +} + +DEFINE_SHOW_ATTRIBUTE(zoran_debugfs); + /* * Scan for a Buz card (actually for the PCI controller ZR36057), * request the irq and map the io memory @@ -1286,6 +1319,9 @@ static int zoran_probe(struct pci_dev *pdev, const struct pci_device_id *ent) zr->map_mode = ZORAN_MAP_MODE_RAW; + zr->dbgfs_dir = debugfs_create_dir(ZR_DEVNAME(zr), NULL); + debugfs_create_file("debug", 0444, zr->dbgfs_dir, zr, + &zoran_debugfs_fops); return 0; zr_detach_vfe: -- 2.32.0