From patchwork Thu Feb 22 15:41:10 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: 204829 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp26517dyb; Thu, 22 Feb 2024 07:46:17 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXjYYEIxdo51mRiOZnpvEHhamnXG7K5is420Kqsbr2ER551OqU37iNCiIP3lnMahGhd6haYMEoAjEm0DnwgMwcO7wZwKA== X-Google-Smtp-Source: AGHT+IH7MDhINMlW02E91S/PhJFun/cJ7SG25pfT3LDe7kCFfHAu+9UPD91g9O6t91nv5UyolBDU X-Received: by 2002:a05:6358:d391:b0:178:a555:c312 with SMTP id mp17-20020a056358d39100b00178a555c312mr21042551rwb.32.1708616776913; Thu, 22 Feb 2024 07:46:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708616776; cv=pass; d=google.com; s=arc-20160816; b=MmoW0frYJ5GcnKXdYIpcOWXEYifNbrD8oImSRcZX5LGbLz+EznsHaXGWwWObTZMtht dbKNN9NX0NRZC0PxGpkX34dRH+QQIN8BGUQq1X1X/ufvRIFQqi4h710qxtzbrSJa62uG DG9+5gyNkmt+mEhh+cxZ8A2tKm5zW9IsWSdIszeJnEqGkI1kTIUf1S7dija4dHSwqQO1 EgFyODUnY3E1PvykDR5Ev+HRyWV8YU5MpAVNPne2XvDWBIZ1LWy5bAfWgIDjfDaChK9H p38HhnQtmMseol7HNDjpyMQFHL1yLsUoyiOeRIG5WygEsO8TiAqRN4MrF8QnwC2CDULO wKuA== 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=Uy9W0eC2DM+jsJntcnJJQTqaXwEfCNzBzC9jlP8GIlk=; fh=vD8tJ9d2mp7H51jNKyMUDglMjHY1Ew4hzsuiSabS+YY=; b=SQGUiw5QGeoITw41KUKc0D6r+EOzDIcEwkxoYH8E82fMb638bYgeFVB3K39ocGTvOM LiqsDY6yWuMI2gN7keTY7GcPT30uLLdbKrKjNx86SfQ9+YF7cMje7EigRsQTakAXdWPg 9RCgVa5slESiiGn3IO4xU5lX3DP4I2gJpBT3w5n19TUZdJ6R7Juz7zA4AWAPilfehfqq ilNVylxNwYclXy79SwU6bCIOxtaZ7hFG+myrtGrR7XR9Lbtn0kZe3M9BXHTcbkpZNzGN 8eipZyfL1d5YgJj/hMJLQDQtftz46zlYIe51PzEyvHwfjAnMAlTHUcMXrsBdGCapsb+y 64JA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=tiBlVyOC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76798-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76798-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 k21-20020a6568d5000000b005cdfd4aa8b3si10233893pgt.193.2024.02.22.07.46.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 07:46:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-76798-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=tiBlVyOC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-76798-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-76798-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 CC033B26909 for ; Thu, 22 Feb 2024 15:43:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6012A153BD7; Thu, 22 Feb 2024 15:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="tiBlVyOC" 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 C4C871534F8; Thu, 22 Feb 2024 15:41:35 +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=1708616495; cv=none; b=dnbE0XTukdQMKwQ2SSKuZQvlXuCM1HHgJxjd7URlII+HfikkXXouBeGYlaWybazL4TI79QGRLjPocW72Su337xQi6FlTh5NBmzABiDB+TvExAZ5a02IBlU97Y+RZyyzQmisSXBvz24MSIs6kymsHiFwqw6q/uqqiDTIEPvdTakI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708616495; c=relaxed/simple; bh=RuWY1cv8Dhz18Wxup/ZL/5dm4lWX9+YTDfCxalcnNUo=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Elcb0XDhVdJKPCtyf8OH2MWHrGJnPgnKbF8cW/UpWWtwwwNl03R9ieCqRVzhzLYkAE5I7DLHTVffCc/PHfh9KYqA6sDZTZQu+ZDvwGFtzysATsUkPK8MRbV+hWNpkVVUNo6uTWV/Zv7XDHQvSlz2VnuYKN+qTVWg1TycCU34sXs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=tiBlVyOC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5700C43394; Thu, 22 Feb 2024 15:41:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1708616495; bh=RuWY1cv8Dhz18Wxup/ZL/5dm4lWX9+YTDfCxalcnNUo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tiBlVyOCYtJPgJOPH/yQz3yHhsu5izAVu0rXFmi6w6IQTdn8PtsC8zim0x2V6KkLn gFG1gOFuwAKXl+Rp3793LnwLN268Tqmd38WhnUKQL0CrQN59BgC49LbtWhMxfYs87B TAYruJfJ/809V40bGe6y4NHi/Cf8AwxlYazgBLacAuyNQDdUjXyRF22XftDqeekqjV e02JE4zBp0nyDnjUCLKau6xDlPHsswTho8YevEGNB5ABJy/T7UO8Fib5hKNBMidEha SWDtS3AHAMQfcThlt1R1u6kw9JwECb30RwkQkRwT0EfAFBVTOR1yv3cOoKHKRX5kdU pmzIdAqmVsXiw== 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 02/12] soc: mediatek: cmdq: Add parameter shift_pa to cmdq_pkt_jump() Date: Thu, 22 Feb 2024 15:41:10 +0000 Message-Id: <20240222154120.16959-3-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: 1791614545778132563 X-GMAIL-MSGID: 1791614545778132563 In original design, cmdq_pkt_jump() call cmdq_get_shift_pa() every time to get shift_pa. But the shift_pa is constant value for each SoC, so client driver just need to call cmdq_get_shift_pa() once and pass shift_pa to cmdq_pkt_jump() to prevent frequent function call. Signed-off-by: Chun-Kuang Hu --- drivers/soc/mediatek/mtk-cmdq-helper.c | 5 ++--- include/linux/soc/mediatek/mtk-cmdq.h | 6 ++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/soc/mediatek/mtk-cmdq-helper.c b/drivers/soc/mediatek/mtk-cmdq-helper.c index 0b2e5690dacf..3380e56dd69b 100644 --- a/drivers/soc/mediatek/mtk-cmdq-helper.c +++ b/drivers/soc/mediatek/mtk-cmdq-helper.c @@ -393,14 +393,13 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value) } EXPORT_SYMBOL(cmdq_pkt_assign); -int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) +int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) { struct cmdq_instruction inst = {}; inst.op = CMDQ_CODE_JUMP; inst.offset = CMDQ_JUMP_ABSOLUTE; - inst.value = addr >> - cmdq_get_shift_pa(((struct cmdq_client *)pkt->cl)->chan); + inst.value = addr >> shift_pa; return cmdq_pkt_append_command(pkt, inst); } EXPORT_SYMBOL(cmdq_pkt_jump); diff --git a/include/linux/soc/mediatek/mtk-cmdq.h b/include/linux/soc/mediatek/mtk-cmdq.h index 649955d2cf5c..72adfd867cd9 100644 --- a/include/linux/soc/mediatek/mtk-cmdq.h +++ b/include/linux/soc/mediatek/mtk-cmdq.h @@ -253,10 +253,12 @@ int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value); * a physical address which should contains more instruction. * @pkt: the CMDQ packet * @addr: physical address of target instruction buffer + * @shift_pa: shift bits of physical address in CMDQ instruction. This value + * is got by cmdq_get_shift_pa(). * * Return: 0 for success; else the error code is returned */ -int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr); +int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa); /** * cmdq_pkt_finalize() - Append EOC and jump command to pkt. @@ -374,7 +376,7 @@ static inline int cmdq_pkt_assign(struct cmdq_pkt *pkt, u16 reg_idx, u32 value) return -EINVAL; } -static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr) +static inline int cmdq_pkt_jump(struct cmdq_pkt *pkt, dma_addr_t addr, u8 shift_pa) { return -EINVAL; }