From patchwork Thu Feb 15 00:49:25 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: 201213 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:b825:b0:106:860b:bbdd with SMTP id da37csp85995dyb; Wed, 14 Feb 2024 16:51:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVtqDiTkgsQYlKBiMG3Gk7dnrjL1iIiwxm+RbsZaPO7AwD7W6dNPcuYo7Yz9lb5tRkFnTLn/dWIwKh5cpFdqo27RAYnlw== X-Google-Smtp-Source: AGHT+IEq/GV6NRE7rInDYr3zaRavgQJTpoATgrUKWBeq7eDHqJ9Dxh3CW1pl+z+hTf8rhSixT4x3 X-Received: by 2002:a05:620a:468d:b0:785:d952:af50 with SMTP id bq13-20020a05620a468d00b00785d952af50mr507824qkb.76.1707958309729; Wed, 14 Feb 2024 16:51:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707958309; cv=pass; d=google.com; s=arc-20160816; b=kF9eEu/QUeKlN6Hcz2jLB02BGQ7qow6UFGBQrfjPUj33J9nLJXKZjSzeBpVLcPPlTF xZjBN6KYY/zQk6HB6DZjrwN0TGEqkpG+RT9bxPjlYNczQvW9FwZ2RejglKbKZVaqMwSF Iuuqk6v2I5FR+2yWVZgIrJk/H2yEoxDN8yYApJLLCOU4t5QrSc355n92jJFIe+KFdJNi Af8q76fxrK8lUooIjGA9/shAQVDMHzcFxhnzIMnpRJ2YT/jcJ+e39Z4WmyH2l6aq4mUg IgcbFLEI8UuIvs4M4/1Ybcc+R/9fTXVpg37ZMq9Rgf95Fb0T9IGiilJXp6nbjpQlHxe3 TMxw== 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=wktiZ7HUtb2+Q2NhWcelGAYCc1x/knQvGbZ7CeUFnZM=; fh=5fJ5HuOhQ8tDYrJs098Y1CAol/Fv56LtamixBAqCzME=; b=Hx9n3htMA2sVkr+RtW6ga6Ni1knDfrdzwel+Ge6IXTVjgnO6n9AUVyuY2rrT+wCDJ8 1M6toR32ssiqeHg/NuGZbIsEoa6FnM5djWezVY5lNwrOmGEvaeqDnIQafihSmTigxQgy vFTRjZFseViX6q5kljzTH+EZm2RHSgWaaaua4uBHQjnlmyPt3T0rE9Nk918CEAtNpfLm ap9ITB1vQy7rPstl08Nr9C/6WU1okE9D4brgu3fY8+y04IFWYB3GyB+kQbhs+m636vkM zffwsZ4px/3MTcGrgdA2vq5hw71rPBJ/e1+ic6gev+20DfCcwWisa+r2CJHnZI2aKUsx QJIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EdY468GL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-66198-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66198-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id g7-20020a05620a218700b007872453d88bsi345042qka.289.2024.02.14.16.51.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 16:51:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66198-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EdY468GL; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-66198-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66198-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A81821C29FC4 for ; Thu, 15 Feb 2024 00:51:12 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3CD36EDE; Thu, 15 Feb 2024 00:50:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="EdY468GL" 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 B576A611B; Thu, 15 Feb 2024 00:50:08 +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=1707958208; cv=none; b=MlIcA3xBWUWVYT+HygqZkSXoOeTUVeWbqM6TWJXD6Y1Ir3zYfP/V8LyNI/o2of2gUlfLK9SjA1l29tqTYGRZkugUSL932O9VEVMclXW57UgQOXRY+Lv+1lNenR1vECLuQEo06cheX0yF6oqjQKdWsDAQmEqjqhyzFxJbM/YBIC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707958208; c=relaxed/simple; bh=RwnPPmbshIPrHAhqt6nvIojZaFpX1mNKJof+jE1wWoo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=flUBZrbKQo9IUMwby5yvGVXv0AZvrV5aQpKM/MMN6+dSLBLLe8FwC0KInxlq9/9uDhZjy9KLdcg1Irj/C2eC7v5ngk/KXI7YOliNE0fAVxh6b91mxGllOkMkO9kHu1lD3KEX527eT8n1r1BjYsTkpzTVZxSZjxXBOrNuSsNV0QY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EdY468GL; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AAE18C43390; Thu, 15 Feb 2024 00:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707958208; bh=RwnPPmbshIPrHAhqt6nvIojZaFpX1mNKJof+jE1wWoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EdY468GL32M/G+gwv+w8ZLQRt22cvdi4p+clmYR7lBpR8Hz6COfk4WHL1LBt7E4pm rCoGXVDTvlEr0RmzBpPCzDXjLkU7MWi0a0FBD494UymBcfDtsylmYnXgy6pa+HhaOo V0+5zDNIK+lNekTH0wRZ5oUasQf9nGNaIAviARu649+NmdxAck0HrDrZtN49YYFtSf XdvvPIENaud4rOP+MiXn+TpoEobLUoG/FseG+mML8ErNSHc8qcUXpmoknhmTS+T9by azP5czVyz3ekp1ybTf1gJBsffPFcxUaYjVqhxx/udbcNPmsjkvOC5yLjv0CQvhzt5z SQ+VXFjLwmO/A== From: Chun-Kuang Hu To: Matthias Brugger , AngeloGioacchino Del Regno , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Cc: Chun-Kuang Hu Subject: [PATCH 3/9] soc: mediatek: cmdq: Add cmdq_pkt_eoc() helper function Date: Thu, 15 Feb 2024 00:49:25 +0000 Message-Id: <20240215004931.3808-4-chunkuang.hu@kernel.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215004931.3808-1-chunkuang.hu@kernel.org> References: <20240215004931.3808-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: 1790924092608948362 X-GMAIL-MSGID: 1790924092608948362 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. Signed-off-by: Chun-Kuang Hu Reviewed-by: AngeloGioacchino Del Regno --- drivers/soc/mediatek/mtk-cmdq-helper.c | 10 ++++++++++ include/linux/soc/mediatek/mtk-cmdq.h | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index ed4ef95adf5b..e982997117c2 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -359,6 +359,16 @@ int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) } EXPORT_SYMBOL(cmdq_pkt_jump); +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 6215191a328d..a67f719dec0b 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -245,6 +245,16 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value); */ int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa); +/** + * cmdq_pkt_eoc() - Append eoc command to the CMDQ packet, ask GCE + * to generate IRQ. It's usually appended to the end of + * packet to notify that all command in the packet is done. + * @pkt: the CMDQ packet + * + * Return: 0 for success; else the error code is returned + */ +int cmdq_pkt_eoc(struct cmdq_pkt *pkt); + /** * cmdq_pkt_finalize() - Append EOC and jump command to pkt. * @pkt: the CMDQ packet @@ -346,6 +356,11 @@ static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_ 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;