From patchwork Fri Aug 23 21:31:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 822028 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 5BE5413B5B6; Fri, 23 Aug 2024 21:31:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724448712; cv=pass; b=Q69Y5+/IKYXf7l6DLLn+vP9QzFRVf5SHhe+ojiv6syIeFfICnWTzbHlBRhdFY6bNHT0ibhaCUKr5g1j7Aztf+LjSWmiHWgyfAXwbQfxFjyDroB6wcZmrLQ3V2Mt0qk/e4GRptSJg091Mc3S8A2oHOteaTKwgm7B7Icwdx+PM5fE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724448712; c=relaxed/simple; bh=YqTPbgaA5eZ1nhKC0woyE//cSqM+PYTGXlROAJBRxn4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JficnCNYkyz4cFBdyQQloABRbyw8g3LvKkb82005NxE7vYQfQFm7fX0d+elaTDZrdzaAApeccInV4PU6RzVrNAs/nP+8E9RoMhDF7N7AdhGDrJ0yofRRr3OzoiEUz7kRn5ZQEKiY3r8ADGmwIim9xatbCYXtZK6bXFZ+6lIesEM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nfraprado@collabora.com header.b=LvD3C93z; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nfraprado@collabora.com header.b="LvD3C93z" ARC-Seal: i=1; a=rsa-sha256; t=1724448699; cv=none; d=zohomail.com; s=zohoarc; b=bc3Y1MAMdL+bJFRNLbhh5euirsEVbGfLEuczVIOxaaZtHNKsoJcSrfeqQtMKBMur7gxYOnqisz2zgfvCN/eMaQxwDz/Pep/ZZHvSkd6ndOVhDb3Plo2GWSOkF06DkqkpHp0LcoLzECXsXvunfxgwyB85BzFbajf5OwA3d11Y79w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724448699; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=vQfV5/7F8iCB8hgaB5SKkH1VV5uYwJvQlWEsE/ftnPk=; b=XxH5E5NPuP0vkvkD1b6IX0fP/nBnEY786/CNVusmqBiqM2ZZ63LnxmbAbNJGEkHFmI2qRvUA7ekfBeADGXt9+IIyNjdLmtuKysZp4BZ2eIHdo0y+kHE6IxQfvzya9awsECrRDqGo1dN++Bo8T1WGH3ShnrAm1lAs6MlX8op81o4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nfraprado@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1724448699; s=zohomail; d=collabora.com; i=nfraprado@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=vQfV5/7F8iCB8hgaB5SKkH1VV5uYwJvQlWEsE/ftnPk=; b=LvD3C93zfuQxcENbtnK/RwA4Ri78vdFp4E1aZ2LnRl5/NE2aVaNtHXcj4jSZD0Q4 ccU8e5uv2zxaCl2H6OniKuo3ODVC/ejNjgXTToMFJ5gF/1Gb0jqvp+QY2YH2rAjyDui OHNRm80rrh1cIAZvyV+mTyQp4ULHkAfqTOf7XePA= Received: by mx.zohomail.com with SMTPS id 1724448699135452.7212113854729; Fri, 23 Aug 2024 14:31:39 -0700 (PDT) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Fri, 23 Aug 2024 17:31:21 -0400 Subject: [PATCH 1/4] media: platform: mtk-mdp3: Use cmdq_pkt_write when no mask is needed Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240823-mdp3-comp-cleanups-v1-1-1f8c1395ecd3@collabora.com> References: <20240823-mdp3-comp-cleanups-v1-0-1f8c1395ecd3@collabora.com> In-Reply-To: <20240823-mdp3-comp-cleanups-v1-0-1f8c1395ecd3@collabora.com> To: Mauro Carvalho Chehab , Matthias Brugger , AngeloGioacchino Del Regno Cc: kernel@collabora.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJh?= =?utf-8?b?ZG8=?= X-Mailer: b4 0.14.1 X-ZohoMailClient: External cmdq_pkt_write_mask() boils down to a cmdq_pkt_write() when the mask is 0xFFFFFFFF. Call cmdq_pkt_write() directly in those cases to simplify the code. Suggested-by: AngeloGioacchino Del Regno Signed-off-by: NĂ­colas F. R. A. Prado --- drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c index ea2ea119dd2a..90658a22a525 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c @@ -325,8 +325,7 @@ static int mdp_path_config_subfrm(struct mdp_cmdq_cmd *cmd, /* Enable mux settings */ for (index = 0; index < ctrl->num_sets; index++) { set = &ctrl->sets[index]; - cmdq_pkt_write_mask(&cmd->pkt, set->subsys_id, set->reg, - set->value, 0xFFFFFFFF); + cmdq_pkt_write(&cmd->pkt, set->subsys_id, set->reg, set->value); } /* Config sub-frame information */ for (index = (num_comp - 1); index >= 0; index--) { @@ -381,8 +380,7 @@ static int mdp_path_config_subfrm(struct mdp_cmdq_cmd *cmd, /* Disable mux settings */ for (index = 0; index < ctrl->num_sets; index++) { set = &ctrl->sets[index]; - cmdq_pkt_write_mask(&cmd->pkt, set->subsys_id, set->reg, - 0, 0xFFFFFFFF); + cmdq_pkt_write(&cmd->pkt, set->subsys_id, set->reg, 0); } return 0; From patchwork Fri Aug 23 21:31:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= X-Patchwork-Id: 822027 Received: from sender4-pp-f112.zoho.com (sender4-pp-f112.zoho.com [136.143.188.112]) (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 4B8CD1C8FBC; Fri, 23 Aug 2024 21:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=136.143.188.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724448716; cv=pass; b=o4O1KIHo1CPrbdI5P1K+B9dTdYYuwvkDzCcfe0+cHjE8G6nVUX/puW8/TDB4V/Sr/bHihQhYX0esYVaG1AFz4HdxVTfpHtqwFNGCERDrqA0hAAjzxslM3P2rycs5cCjtzplI3inGRNeWOqH8oo7/zmURhz4a17+IAj7XWwk6+8M= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724448716; c=relaxed/simple; bh=Bo6rQzkZtS3x3e4JPLfvWkMk8vfJdNw3tSqb/DecZE4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=poazaoyscg81X3rsoBnR/NZ3hoYUd5Zu6kUGIpeH65pcdgX9T9rlPtQJKgYkebaAJpxrmBor1eQzLu5Id/8D9BHZjN4mkkPUZB/brlKXI8JFuk6+3hs8N4hI344MJjgidAek+F5SetK+QMhyDY/nSOjuVbxyuxX/UTQbfHVFfMk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (1024-bit key) header.d=collabora.com header.i=nfraprado@collabora.com header.b=Ga1rBetl; arc=pass smtp.client-ip=136.143.188.112 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=collabora.com header.i=nfraprado@collabora.com header.b="Ga1rBetl" ARC-Seal: i=1; a=rsa-sha256; t=1724448703; cv=none; d=zohomail.com; s=zohoarc; b=DDQQRYhhiCJGa3UUoM7LJWgJ8tuzXpfaQnsXeBG8Uo733fPrsYIqg5Qp0MDIqENVlDpR/oKD4W4J6A+FrYLKNYo/fneHg9ic6NanxqEI85YG1nf5r9lxz8DMDgkffDaAZMNm2QDnVxuCy9ZERpcGfuPjLClOrlg1qtjFLDig/VA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724448703; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=bghG0Z8WKTUpCr2IR0n/BuI53Cd5ntTMy8ZyoEuZYcs=; b=kE9VEII0s0o3G0t3sERmqizCAR6ToobopklZb/SZ/rJHBqrXzcaSpmox0BPUiIuFCRHeLFG+EOrLbWSyzZQW6AN9mZP+TfuV2Sh7cVopBrqwxicsRFlTQgTjQ05x2xsyj3ee6zOQjqODTP/5nt+J+SoyVm3OT2l2bVmzqnikL0k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nfraprado@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1724448703; s=zohomail; d=collabora.com; i=nfraprado@collabora.com; h=From:From:Date:Date:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Message-Id:References:In-Reply-To:To:To:Cc:Cc:Reply-To; bh=bghG0Z8WKTUpCr2IR0n/BuI53Cd5ntTMy8ZyoEuZYcs=; b=Ga1rBetlEZVoSEzxsmjSO/OCtfcBeNwUjffIADkql65TyuOw9pAMusOzD7i+ySLj wGAw/FevS8+1dIJW99ffXbDJE6VzDyr14hEl66caZcyJ83/U43DlHwg0kLVNxsn8tS7 Tng6Xpd/++YodL0tA0rgN1QC5D2a16SI5SPzPlC0= Received: by mx.zohomail.com with SMTPS id 1724448702562223.08283998342017; Fri, 23 Aug 2024 14:31:42 -0700 (PDT) From: =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJhZG8=?= Date: Fri, 23 Aug 2024 17:31:24 -0400 Subject: [PATCH 4/4] media: platform: mtk-mdp3: Remove mask parameter from MM_REG_POLL macro Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240823-mdp3-comp-cleanups-v1-4-1f8c1395ecd3@collabora.com> References: <20240823-mdp3-comp-cleanups-v1-0-1f8c1395ecd3@collabora.com> In-Reply-To: <20240823-mdp3-comp-cleanups-v1-0-1f8c1395ecd3@collabora.com> To: Mauro Carvalho Chehab , Matthias Brugger , AngeloGioacchino Del Regno Cc: kernel@collabora.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, =?utf-8?b?TsOtY29sYXMgRi4gUi4gQS4gUHJh?= =?utf-8?b?ZG8=?= X-Mailer: b4 0.14.1 X-ZohoMailClient: External Just like was done with MM_REG_WRITE, remove the mask from the MM_REG_POLL macro, leaving MM_REG_POLL_MASK to be used when a mask is required, and update the call sites accordingly. In this case, all calls require a mask, so MM_REG_POLL remains unused, but at least this makes the MM_REG_POLL macros consistent with the MM_REG_WRITE ones. Signed-off-by: NĂ­colas F. R. A. Prado --- drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c | 8 ++++---- drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h | 13 +++++-------- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c index beb29ad0b048..683c066ed975 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.c @@ -78,7 +78,7 @@ static int init_rdma(struct mdp_comp_ctx *ctx, struct mdp_cmdq_cmd *cmd) /* Reset RDMA */ MM_REG_WRITE_MASK(cmd, subsys_id, base, MDP_RDMA_RESET, BIT(0), BIT(0)); - MM_REG_POLL(cmd, subsys_id, base, MDP_RDMA_MON_STA_1, BIT(8), BIT(8)); + MM_REG_POLL_MASK(cmd, subsys_id, base, MDP_RDMA_MON_STA_1, BIT(8), BIT(8)); MM_REG_WRITE_MASK(cmd, subsys_id, base, MDP_RDMA_RESET, 0x0, BIT(0)); return 0; } @@ -634,14 +634,14 @@ static int init_wrot(struct mdp_comp_ctx *ctx, struct mdp_cmdq_cmd *cmd) /* Reset WROT */ MM_REG_WRITE_MASK(cmd, subsys_id, base, VIDO_SOFT_RST, BIT(0), BIT(0)); - MM_REG_POLL(cmd, subsys_id, base, VIDO_SOFT_RST_STAT, BIT(0), BIT(0)); + MM_REG_POLL_MASK(cmd, subsys_id, base, VIDO_SOFT_RST_STAT, BIT(0), BIT(0)); /* Reset setting */ if (CFG_CHECK(MT8195, p_id)) MM_REG_WRITE(cmd, subsys_id, base, VIDO_CTRL, 0x0); MM_REG_WRITE_MASK(cmd, subsys_id, base, VIDO_SOFT_RST, 0x0, BIT(0)); - MM_REG_POLL(cmd, subsys_id, base, VIDO_SOFT_RST_STAT, 0x0, BIT(0)); + MM_REG_POLL_MASK(cmd, subsys_id, base, VIDO_SOFT_RST_STAT, 0x0, BIT(0)); return 0; } @@ -871,7 +871,7 @@ static int init_wdma(struct mdp_comp_ctx *ctx, struct mdp_cmdq_cmd *cmd) /* Reset WDMA */ MM_REG_WRITE_MASK(cmd, subsys_id, base, WDMA_RST, BIT(0), BIT(0)); - MM_REG_POLL(cmd, subsys_id, base, WDMA_FLOW_CTRL_DBG, BIT(0), BIT(0)); + MM_REG_POLL_MASK(cmd, subsys_id, base, WDMA_FLOW_CTRL_DBG, BIT(0), BIT(0)); MM_REG_WRITE_MASK(cmd, subsys_id, base, WDMA_RST, 0x0, BIT(0)); return 0; } diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h index 902006d7c4ba..681906c16419 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-comp.h @@ -53,16 +53,13 @@ do { \ do { \ typeof(_mask) (_m) = (_mask); \ cmdq_pkt_poll_mask(&((cmd)->pkt), id, \ - (base) + (ofst), (val), (_m)); \ + (base) + (ofst), (val), \ + (((_m) & (ofst##_MASK)) == (ofst##_MASK)) ? \ + (0xffffffff) : (_m)); \ } while (0) -#define MM_REG_POLL(cmd, id, base, ofst, val, mask) \ -do { \ - typeof(mask) (m) = (mask); \ - MM_REG_POLL_MASK((cmd), id, base, ofst, val, \ - (((m) & (ofst##_MASK)) == (ofst##_MASK)) ? \ - (0xffffffff) : (m)); \ -} while (0) +#define MM_REG_POLL(cmd, id, base, ofst, val) \ + cmdq_pkt_poll(&((cmd)->pkt), id, (base) + (ofst), (val)) enum mtk_mdp_comp_id { MDP_COMP_NONE = -1, /* Invalid engine */