From patchwork Thu Feb 22 15:41:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chun-Kuang Hu X-Patchwork-Id: 204832 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp27279dyb; Thu, 22 Feb 2024 07:47:48 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX0EMNrr37yJwAW9UtrMBP2aC9Nx2zgyIEGavJLWTWiIgetCEtLCR1ZF4C/RgnIQjJK8zFLZv42rQmQPXdDGA59gKo5vg== X-Google-Smtp-Source: AGHT+IFMMraVtEzp8fSP7hGzFGJnByLg/sM0MupRkt5MgGpHJK/oRtXhseJ/cakMq4yUAlC4giNT X-Received: by 2002:a05:6a00:2387:b0:6e4:c8cc:adce with SMTP id f7-20020a056a00238700b006e4c8ccadcemr3261484pfc.26.1708616868071; Thu, 22 Feb 2024 07:47:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616868; cv=pass; d=google.com; s=arc-20160816; b=vrIRJ8Q2xqhBp0IZ2Rb5NtbO4Yz4z+BsWlPHwOBtATmcZzNAiBs12qpdY9Mbe/EM6h vuhlr5c93ew1eiVq1FyQrdLUtPBoQHf/yH9JkrpSyff0UTc6QlP7Xia3rHAMomH+cfXd mNCr/XEseC7wWehXC5JuiBfBbuVx7OSyg6PqxLrlwzV8+nICev50al0UXRSpUa3A+ewg L9WN/8mNYPKsj3NVQUtDy0ydwPo3RDMxBmu4mdu7VBRJgwbpEBSYRlrjfolVzG8d9nyx a94UlZhEc0Vj+DMWnclxkA+bPY8/va3LQoU3r2hLnBMEg9EBUnqZxgXtsyfcmDu5i0YY sKYg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=QPqXgewCfZe0W2aD2P/HGNDKtXkbfRHvg6TYmGgfd8I=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=qEaFQ+QIEwaI7LhSPVM2GhfCLkFzwDu3LnCEU9+w6OQhqX401/YmmnHUCjf2aIczcj XCxf7vBOxtv5jH3pygblSjrwiFva4Dl2r35IH7zq0L8K3kohl23YMf3EPJLZ9AKQKAjo GXZwS+EEK2LnQ7S8+Rct6RGit533/Jrl7m0IzWo2BS7CkeTS+zHpwSBxpSMYUyOkRp6B q/CGVnu4XDlzU09VDd9tXNjneACRq56s+QuxTKrWn8ndYOwg0Zkt/N91/8bHxUUBKFPn 03HXUuw7n7Cud6ilpOuQ4eKut2CA051wRUvG+NS85Y9UoGhZkOq2TT6iM0rmA9cvzFxl rZ1w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SX0BMFOx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id n51-20020a056a000d7300b006e396759fa7si9198535pfv.172.2024.02.22.07.47.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:47:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=SX0BMFOx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76802-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id E221FB276A2 for ; Thu, 22 Feb 2024 15:44:06 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8BE4215099F; Thu, 22 Feb 2024 15:41:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="SX0BMFOx" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB9AF154C0A; Thu, 22 Feb 2024 15:41:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616505; cv=none; b=qdsxDg4joc4Q3AeUALcomXOCZKjlHnXOyAoum0kzMmONnRHzLA3w6Pdmm2QFw6k8PUixXKIRnelneQCNZrezz1Lx6sOeciY98fW090f7x3C6UXoTnaletNXm1tO0/tMuutiBdcWi9NmMY6fx7h7kSP6Es47ErBTQDyHYsZtEvyE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616505; c=relaxed/simple; bh=nDJV3H5ien5JKkaRFl6YIw977BIcRyhSssibdZZbNS0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DdQBj+mRmFwktrhZ04vEhp+pupMXvDVfXYgIqUne53QtzmcmxtrUpizAxiaf3Rxot7NqULju6T1Uos2NoY2cG2dyyfZpIOBUrv77pSzjQzXKUv0s/kApRpPHUAJUrJl4ejwiEsbb8SHYTd2bj1t+aPQkDoCEDC6Kk7dyy+GqB6c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=SX0BMFOx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B1EB1C433C7; Thu, 22 Feb 2024 15:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616504; bh=nDJV3H5ien5JKkaRFl6YIw977BIcRyhSssibdZZbNS0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SX0BMFOx6A7QuL23OjGPgrhtp4wl94MOyaFh5GXEeo2EooTQMADyzw49eslKGwAhN 3EB8LW7Bu0Nlwqew+qd2UPkhMWeJYO4Ty8PxJ51VhXGfyCrQ/11COqa0l0GTGZe8eE XeAwwP4EVI/6I7hUjU/Dak0EBzOD5BNLevXL/Sd86iOhFzmmzKLKqUd0wxhpYCN2tF 7wzImDW7aud3DtY69Xs4Xd+e590SV7485TjKcQ148H5VK2LgencYiHnv4rE/XQxbQg j3ps7o0ECniy5n2qHhn7SiKZK9Wuzpyau6Wjup4wsjqVa5LGLpbCgJEyf6VSBgrnZl B8EmhyPJDJw2w== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , Moudy Ho , "Jason-JH . Lin" , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH v2 05/12] soc: mediatek: cmdq: Add cmdq_pkt_eoc() helper function Date: Thu, 22 Feb 2024 15:41:13 +0000 Message-Id: <20240222154120.16959-6-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240222154120.16959-1-chunkuang.hu@kernel.org> References: <20240222154120.16959-1-chunkuang.hu@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791614641069288909 X-GMAIL-MSGID: 1791614641069288909 cmdq_pkt_eoc() append eoc command to CMDQ packet. eoc command would ask GCE to generate IRQ. It's usually appended to the end of packet to notify all command in the packet is done. Reviewed-by: AngeloGioacchino Del Regno Signed-off-by: Chun-Kuang Hu --- drivers/soc/mediatek/mtk-cmdq-helper.c | 10 ++++++++++ include/linux/soc/mediatek/mtk-cmdq.h | 19 +++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 678db09983d4..766dbafaef62 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -414,6 +414,16 @@ int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa) } EXPORT_SYMBOL(cmdq_pkt_jump_rel); +int cmdq_pkt_eoc(struct cmdq_pkt *pkt) +{ + struct cmdq_instruction inst = { {0} }; + + inst.op = CMDQ_CODE_EOC; + inst.value = CMDQ_EOC_IRQ_EN; + return cmdq_pkt_append_command(pkt, inst); +} +EXPORT_SYMBOL(cmdq_pkt_eoc); + int cmdq_pkt_finalize(struct cmdq_pkt *pkt) { struct cmdq_instruction inst = { {0} }; diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index a935cd69d80f..45110494ee9d 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -275,6 +275,20 @@ int cmdq_pkt_jump_abs(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa); */ int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_pa); +/** + * cmdq_pkt_eoc() - Append EOC and ask GCE to generate an IRQ at end of execution + * @pkt: The CMDQ packet + * + * Appends an End Of Code (EOC) command to the CMDQ packet and asks the GCE + * to generate an interrupt at the end of the execution of all commands in + * the pipeline. + * The EOC command is usually appended to the end of the pipeline to notify + * that all commands are done. + * + * Return: 0 for success or negative error number + */ +int cmdq_pkt_eoc(struct cmdq_pkt *pkt); + /** * cmdq_pkt_finalize() - Append EOC and jump command to pkt. * @pkt: the CMDQ packet @@ -401,6 +415,11 @@ static inline int cmdq_pkt_jump_rel(struct cmdq_pkt *pkt, s32 offset, u8 shift_p return -EINVAL; } +static inline int cmdq_pkt_eoc(struct cmdq_pkt *pkt) +{ + return -EINVAL; +} + static inline int cmdq_pkt_finalize(struct cmdq_pkt *pkt) { return -EINVAL;