Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp422026rdb; Thu, 22 Feb 2024 07:51:24 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX5wukwZ8jOmmKUgCtlIoyAsduu0kcwl9bzMy0UrZusG63Ca957W4y0CHcJ8DVJPFKiuvdzEaMUq84F+p4Vlo5nVRkx6leA81EEarMPaA== X-Google-Smtp-Source: AGHT+IEiaZgkhooepsFBjufS8b1EGLSlqswQwU79C9zgDTKg5b02mTgFrHeg0/Rsia04nm5EJ0B1 X-Received: by 2002:a05:6a20:c992:b0:1a0:9117:5892 with SMTP id gy18-20020a056a20c99200b001a091175892mr20141598pzb.15.1708617083695; Thu, 22 Feb 2024 07:51:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708617083; cv=pass; d=google.com; s=arc-20160816; b=KU21GSXooVuAsmARBGEAOFT7ur5E/go+2SeTbz6dnvRRiae4ee+n/WZoUu7a5j8Vow DF9wG+ofH9Evm4W8a/cn3RjjWune/Cw/GCMqI7of4cmHx2XOrQx4ok+NvhDeu22lo85Y 70SZY2WBuiP5JLlpgtomjTIu3jKHsZyjCw3UVv4ChUmosLZfpDSEpA7SlqwldUL+U89M E+M/kbqPf0AZI8d4+6rBMZGSCx03tMKw1Ma7TNVyMypJuQXBkihGQqWQnGYYBn7U4mHV ka3CVL0LVz9Tsb7bRcktyNxyds0zmYT3C5I9YRB6MceQC74IDnnuX+TVbPztY3RBsmtt 1weQ== 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76802-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m16-20020a635810000000b005dc3614f98asi10445064pgb.542.2024.02.22.07.51.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:51:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76802-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; 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-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76802-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 2C11F28B3C2 for ; Thu, 22 Feb 2024 15:43:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C44B515530F; Thu, 22 Feb 2024 15:41:45 +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 Content-Transfer-Encoding: 8bit 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; -- 2.34.1