Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp4446260rwd; Tue, 30 May 2023 05:41:24 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ531h0XfOUQIXEYfLwnaHGhNLKv9HxGdMb+B0IuEl40pr2f1sV9tsqg7vgQKa+NHIFWzNe3 X-Received: by 2002:a05:6a00:2344:b0:644:c365:50d5 with SMTP id j4-20020a056a00234400b00644c36550d5mr2531220pfj.6.1685450484048; Tue, 30 May 2023 05:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685450484; cv=none; d=google.com; s=arc-20160816; b=t3IhULsEvBTisK2LAvhBRX6V1BSeJxTGIjK9ecnJjI5ulYff2CXP1hxBIfzVeD7FKF T2t3qMTILu1zE6BcblEATW7xx3njuDJ+3KaX3KxSI8+3YI1tOfcG8Hfeqn4H/mzuBE+p WVtl43b2yTVevbBzOUhzDX4JjeaWgPO7LyRg5CPxEiJAJJsolmuueCmnkIpDfaeTjbC4 4jnsRfrrQjSl+DeR8Jf+x8RtyOFpV1XkFoKeKDsrrxl49+zSmTBqNxZ3Myi/R+4TMTQg OgGZrGOGaeZGS5Jawyfwdu7cijII5iTLZaEgd5UvLcf6RBYErQiSii0JSR/YLwCPGBIy ByWQ== 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=RRHVElMyL6UjQ1vvoJ2Fmm9xm1wJ7Rkni4XIZBAGM5Y=; b=iCvrjt84G51T3Z/GTVvXNPJuIdHR8kFK15/cDV+RaI7wHtftyBKm5exLVhvt1Q8uYf d6zU57BVPVivTQY9rCVtVAjPDjNLfBuxxN8rHpvoQ4rfmT2SmHOG5oq/gGE/c6nPb81T MhugRNhlAGpoYCMpHiopbiZltm20W1Svy64ZI+Z1IX3H7b+AmsW5+orR5mUHa7yqh1Re fJkcLsKZ8E+UpR0Jxlmgp8QiVnIXs9rpoPOvB2CJi3JlNQJHu6aPWW0XUV2tpiSYl085 vLdWT1662iMlLZrcnV/sSgE7Bf4vRJVTuB98BUCCP5B2hH7L/Uf7oQXRqvKnnjpQ2D3Y 4hQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=LLA02G9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w3-20020a626203000000b0064d7336c80dsi1610068pfb.385.2023.05.30.05.41.11; Tue, 30 May 2023 05:41:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=LLA02G9Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231466AbjE3Mab (ORCPT + 99 others); Tue, 30 May 2023 08:30:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229627AbjE3M34 (ORCPT ); Tue, 30 May 2023 08:29:56 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B59E211C; Tue, 30 May 2023 05:29:42 -0700 (PDT) X-UUID: 9996ee8afee511edb20a276fd37b9834-20230530 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=RRHVElMyL6UjQ1vvoJ2Fmm9xm1wJ7Rkni4XIZBAGM5Y=; b=LLA02G9ZPFL7LQXajqa0uFHQm0pRLgrph/rw071Xm5c78qZG2SYcXGsmPFohIMMwQ9maq5XG3j/Uv9H1xReOry3oT4yD+gblxKH+Wr/M20Yeuz8W8dwrvgayHN4Hmx4zq+WWwAz+T96CQ45ckQtazu1+fpJgCB0eGoIV53CqnRc=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.25,REQID:b75b9dd3-c482-45f9-aba1-4e9fe77a2273,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Release_Ham,ACTIO N:release,TS:90 X-CID-INFO: VERSION:1.1.25,REQID:b75b9dd3-c482-45f9-aba1-4e9fe77a2273,IP:0,URL :0,TC:0,Content:-5,EDM:0,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:90 X-CID-META: VersionHash:d5b0ae3,CLOUDID:7cae023d-7aa7-41f3-a6bd-0433bee822f3,B ulkID:230530202922IKVOD16G,BulkQuantity:0,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:-3,IP:nil,URL:0,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 ,OSI:0,OSA:0,AV:0 X-CID-BVR: 0 X-CID-BAS: 0,_,0,_ X-UUID: 9996ee8afee511edb20a276fd37b9834-20230530 Received: from mtkmbs10n1.mediatek.inc [(172.21.101.34)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 615932227; Tue, 30 May 2023 20:29:19 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 30 May 2023 20:29:18 +0800 Received: from mhfsdcap04.gcn.mediatek.inc (10.17.3.154) by mtkmbs11n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 30 May 2023 20:29:17 +0800 From: Yunfei Dong To: Chen-Yu Tsai , Nicolas Dufresne , Hans Verkuil , AngeloGioacchino Del Regno , Benjamin Gaignard , =?UTF-8?q?N=C3=ADcolas=20F=20=2E=20R=20=2E=20A=20=2E=20Prado?= , Nathan Hebert CC: Yunfei Dong , Hsin-Yi Wang , Fritz Koenig , Daniel Vetter , Steve Cho , , , , , , Subject: [PATCH v6,8/8] media: mediatek: vcodec: Add dbgfs help function Date: Tue, 30 May 2023 20:29:08 +0800 Message-ID: <20230530122908.19267-9-yunfei.dong@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230530122908.19267-1-yunfei.dong@mediatek.com> References: <20230530122908.19267-1-yunfei.dong@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-MTK: N X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Getting dbgfs help information with command "echo -help > vdec" or "echo > vdec". Signed-off-by: Yunfei Dong Reviewed-by: AngeloGioacchino Del Regno --- .../mediatek/vcodec/mtk_vcodec_dbgfs.c | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c index 688884db651e..2151c3967684 100644 --- a/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c +++ b/drivers/media/platform/mediatek/vcodec/mtk_vcodec_dbgfs.c @@ -52,6 +52,23 @@ static void mtk_vdec_dbgfs_get_format_type(struct mtk_vcodec_ctx *ctx, char *buf *used += curr_len; } +static void mtk_vdec_dbgfs_get_help(char *buf, int *used, int total) +{ + int curr_len; + + curr_len = snprintf(buf + *used, total - *used, + "help: (1: echo -'info' > vdec 2: cat vdec)\n"); + *used += curr_len; + + curr_len = snprintf(buf + *used, total - *used, + "\t-picinfo: get resolution\n"); + *used += curr_len; + + curr_len = snprintf(buf + *used, total - *used, + "\t-format: get output & capture queue format\n"); + *used += curr_len; +} + static ssize_t mtk_vdec_dbgfs_write(struct file *filp, const char __user *ubuf, size_t count, loff_t *ppos) { @@ -83,6 +100,11 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf, if (!buf) return -ENOMEM; + if (strstr(dbgfs->dbgfs_buf, "-help") || dbgfs->buf_size == 1) { + mtk_vdec_dbgfs_get_help(buf, &used_len, total_len); + goto read_buffer; + } + if (strstr(dbgfs->dbgfs_buf, "-picinfo")) dbgfs_index[MTK_VDEC_DBGFS_PICINFO] = true; @@ -109,7 +131,7 @@ static ssize_t mtk_vdec_dbgfs_read(struct file *filp, char __user *ubuf, mtk_vdec_dbgfs_get_format_type(ctx, buf, &used_len, total_len); } mutex_unlock(&dbgfs->dbgfs_lock); - +read_buffer: ret = simple_read_from_buffer(ubuf, count, ppos, buf, used_len); kfree(buf); return ret; -- 2.18.0