From patchwork Fri Mar 10 06:23:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Irui Wang X-Patchwork-Id: 661982 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8934FC6FA99 for ; Fri, 10 Mar 2023 06:24:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229800AbjCJGYM (ORCPT ); Fri, 10 Mar 2023 01:24:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbjCJGYL (ORCPT ); Fri, 10 Mar 2023 01:24:11 -0500 Received: from mailgw01.mediatek.com (unknown [60.244.123.138]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D9BC10460F; Thu, 9 Mar 2023 22:24:08 -0800 (PST) X-UUID: 270e06bebf0c11eda06fc9ecc4dadd91-20230310 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=E32PwqnhE80CiZUxZ6uWYUqazqWNe/vh/gd6x779/5A=; b=DqVFk4vPbygg17f21tDvW13YRRiCDbYWIR9AR2lZdhAvrII+XOo9xKK2Pblmmkn3Z7DRvATs8ua+uFT1RDosreiVoPWnQ3A/GD0/yl4cMM0SilthzEfv9pjmYUQFJN/BGGPC7fGr00olTeU9AnkBJQJITx2KOwKExAogBKSkKhs=; X-CID-P-RULE: Spam_GS6885AD X-CID-O-INFO: VERSION:1.1.20, REQID:16942212-4267-4ed4-ade8-eaa7e6f945b1, IP:0, U RL:0,TC:0,Content:0,EDM:25,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS6885AD,ACT ION:quarantine,TS:120 X-CID-INFO: VERSION:1.1.20, REQID:16942212-4267-4ed4-ade8-eaa7e6f945b1, IP:0, URL :0,TC:0,Content:0,EDM:25,RT:0,SF:95,FILE:0,BULK:0,RULE:Spam_GS981B3D,ACTIO N:quarantine,TS:120 X-CID-META: VersionHash:25b5999, CLOUDID:4503d2b2-beed-4dfc-bd9c-e1b22fa6ccc4, B ulkID:2303101035130178WOE0,BulkQuantity:5,Recheck:0,SF:38|29|28|17|19|48,T C:nil,Content:0,EDM:5,IP:nil,URL:11|1,File:nil,Bulk:40,QS:nil,BEC:nil,COL: 0,OSI:0,OSA:0,AV:0 X-CID-BVR: 0,NGT X-UUID: 270e06bebf0c11eda06fc9ecc4dadd91-20230310 Received: from mtkmbs13n1.mediatek.inc [(172.21.101.193)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1959498361; Fri, 10 Mar 2023 14:24:03 +0800 Received: from mtkmbs11n2.mediatek.inc (172.21.101.187) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.25; Fri, 10 Mar 2023 14:24:01 +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.25 via Frontend Transport; Fri, 10 Mar 2023 14:24:00 +0800 From: Irui Wang To: Hans Verkuil , Mauro Carvalho Chehab , Matthias Brugger , , , kyrie wu CC: , , , , , Tomasz Figa , , , Yunfei Dong , "Irui Wang" Subject: [V2,4/7] media: mtk-jpeg: reconstructs the initialization mode of worker Date: Fri, 10 Mar 2023 14:23:52 +0800 Message-ID: <20230310062355.9963-5-irui.wang@mediatek.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230310062355.9963-1-irui.wang@mediatek.com> References: <20230310062355.9963-1-irui.wang@mediatek.com> MIME-Version: 1.0 X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org From: kyrie wu exclude is_jpgenc_multihw or is_jpgdec_multihw for judgment, and re-initialize jpeg worker. Signed-off-by: kyrie wu Signed-off-by: irui wang --- drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c | 9 +++------ drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c index d940dc5ede74..e89195f1989c 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1575,12 +1575,7 @@ static int mtk_jpeg_open(struct file *file) goto free; } - if (jpeg->is_jpgenc_multihw) - INIT_WORK(&ctx->jpeg_work, mtk_jpegenc_worker); - - if (jpeg->is_jpgdec_multihw) - INIT_WORK(&ctx->jpeg_work, mtk_jpegdec_worker); - + INIT_WORK(&ctx->jpeg_work, jpeg->variant->jpeg_worker); INIT_LIST_HEAD(&ctx->dst_done_queue); spin_lock_init(&ctx->done_queue_lock); v4l2_fh_init(&ctx->fh, vfd); @@ -1901,6 +1896,7 @@ static struct mtk_jpeg_variant mtk8195_jpegenc_drvdata = { .out_q_default_fourcc = V4L2_PIX_FMT_YUYV, .cap_q_default_fourcc = V4L2_PIX_FMT_JPEG, .multi_core = true, + .jpeg_worker = mtk_jpegenc_worker, }; static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata = { @@ -1913,6 +1909,7 @@ static const struct mtk_jpeg_variant mtk8195_jpegdec_drvdata = { .out_q_default_fourcc = V4L2_PIX_FMT_JPEG, .cap_q_default_fourcc = V4L2_PIX_FMT_YUV420M, .multi_core = true, + .jpeg_worker = mtk_jpegdec_worker, }; #if defined(CONFIG_OF) diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h index f87358cc9f47..e118a0175f75 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h @@ -61,6 +61,7 @@ enum mtk_jpeg_ctx_state { * @out_q_default_fourcc: output queue default fourcc * @cap_q_default_fourcc: capture queue default fourcc * @multi_core: mark jpeg hw is multi_core or not + * @jpeg_worker: jpeg dec or enc worker */ struct mtk_jpeg_variant { struct clk_bulk_data *clks; @@ -76,6 +77,7 @@ struct mtk_jpeg_variant { u32 out_q_default_fourcc; u32 cap_q_default_fourcc; bool multi_core; + void (*jpeg_worker)(struct work_struct *work); }; struct mtk_jpeg_src_buf {