From nobody Tue Sep 9 21:32:26 2025 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 F0BED13D503; Sun, 7 Sep 2025 22:04: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=1757282676; cv=none; b=kqry0AH45roqG/qLxfVKBKQugGYd//rAttZ2Mr2QklQZ2SJ/9TWCGitH2pJVEhFujUPy9gDvZsv7kS47HkSCDL7ZhF57Nzrg4zIzn/0pt2crLmwoVtPpHXs7L1GZwsPcaa/PZQidGal0ExZFJ6sIyVr7+Iu3L4kcgw0nxfWjEJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757282676; c=relaxed/simple; bh=Jw8mPMFfqYMcbXvtMrCiDLWsQNiLvB3pNdrkghWYm04=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GWf/mak+ZkplXF9/PCqMXPmiezEmbY2IPmIWSpEKUGwlQtcS6hD5cIb1/8qYjFl3GxHHZP+S+qukW/s/AfnLgCJY9wSsruAyVLoEN4Kiv2uHIcBgjh/GwT2YYtl2QjtZkMd0Pq3yaistjuH+IxGVsVsx27M4kEON4Jftn1dGnf4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fGzcLJis; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fGzcLJis" Received: by smtp.kernel.org (Postfix) with ESMTPS id 823DEC4CEFA; Sun, 7 Sep 2025 22:04:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1757282675; bh=Jw8mPMFfqYMcbXvtMrCiDLWsQNiLvB3pNdrkghWYm04=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=fGzcLJisCeBL3hWwFksuNstWkaUQc/Xs2mJHnsg+AQapqYO/Cqt0uNeBiskfAtqoF 32DUt/3QtYqfLja/ghYffRBDQGOHsH3zguxDE8PSuBGBJtOWPPSzotnedZ5iqXZuFK EHixafTcvmUG9ptszrPAh7S9eUkJF+AX4eC5B68EhYQl6Y7/2d9oaMEUnY97XDoAPw U3On4I2OFhqhpiSvQbzw80UTFCm4wlft+t9uDJI1c4Q1ZNFLB7rkYkd684nhrzixtl boAzTbwmyit6CWaHTtP88eQNr7pCjW67kdX9kIhpdTKreYTnN3pFgCMB9ocW4Cw2pT kgP8z/gMpRJGA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6EDC5CA101F; Sun, 7 Sep 2025 22:04:35 +0000 (UTC) From: =?utf-8?q?Andr=C3=A9_Apitzsch_via_B4_Relay?= Date: Mon, 08 Sep 2025 00:04:16 +0200 Subject: [PATCH 2/4] media: qcom: camss: vfe: Add VBIF setting support Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20250908-camss-8x39-vbif-v1-2-f198c9fd0d4d@apitzsch.eu> References: <20250908-camss-8x39-vbif-v1-0-f198c9fd0d4d@apitzsch.eu> In-Reply-To: <20250908-camss-8x39-vbif-v1-0-f198c9fd0d4d@apitzsch.eu> To: Robert Foss , Todor Tomov , Bryan O'Donoghue , Vladimir Zapolskiy , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio Cc: ~postmarketos/upstreaming@lists.sr.ht, phone-devel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vincent Knecht , =?utf-8?q?Andr=C3=A9_Apitzsch?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1757282673; l=5754; i=git@apitzsch.eu; s=20240325; h=from:subject:message-id; bh=ebmqD+SzWjo0K53+kBRQiZXPfrlcyeidPuYYpwnhFGU=; b=KLp/PQlK/VpazRVvugJqsI76429FJQoAWavn4RyPp0DuQfAtpA1cI6z0wA6OSn0UycqPmDhmh 1oR8hmLJCcuBUmMRAlJsNsz0bQkIj9juK9OjHdp4LizCKoeGFmESFXQ X-Developer-Key: i=git@apitzsch.eu; a=ed25519; pk=wxovcZRfvNYBMcTw4QFFtNEP4qv39gnBfnfyImXZxiU= X-Endpoint-Received: by B4 Relay for git@apitzsch.eu/20240325 with auth_id=142 X-Original-From: =?utf-8?q?Andr=C3=A9_Apitzsch?= Reply-To: git@apitzsch.eu From: Vincent Knecht Some devices need writing values to VFE VBIF registers. Add helper functions to do this. Reviewed-by: Bryan O'Donoghue Signed-off-by: Vincent Knecht Signed-off-by: Andr=C3=A9 Apitzsch --- drivers/media/platform/qcom/camss/Makefile | 1 + drivers/media/platform/qcom/camss/camss-vfe-4-1.c | 12 +++++++++++ drivers/media/platform/qcom/camss/camss-vfe-vbif.c | 25 ++++++++++++++++++= ++++ drivers/media/platform/qcom/camss/camss-vfe-vbif.h | 19 ++++++++++++++++ drivers/media/platform/qcom/camss/camss-vfe.c | 9 ++++++++ drivers/media/platform/qcom/camss/camss-vfe.h | 3 +++ 6 files changed, 69 insertions(+) diff --git a/drivers/media/platform/qcom/camss/Makefile b/drivers/media/pla= tform/qcom/camss/Makefile index d26a9c24a430a831e0d865db4d96142da5276653..4c66d29ae505ae5adc717ae98f7= 7fb736a6e15b9 100644 --- a/drivers/media/platform/qcom/camss/Makefile +++ b/drivers/media/platform/qcom/camss/Makefile @@ -21,6 +21,7 @@ qcom-camss-objs +=3D \ camss-vfe-680.o \ camss-vfe-780.o \ camss-vfe-gen1.o \ + camss-vfe-vbif.o \ camss-vfe.o \ camss-video.o \ camss-format.o \ diff --git a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c b/drivers/me= dia/platform/qcom/camss/camss-vfe-4-1.c index 901677293d971cf761944a660ef719af38203f22..9cf1ccdb2fe7ca9bf89b746af83= 6e1035b457a8f 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-4-1.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-4-1.c @@ -15,6 +15,7 @@ #include "camss.h" #include "camss-vfe.h" #include "camss-vfe-gen1.h" +#include "camss-vfe-vbif.h" =20 #define VFE_0_HW_VERSION 0x000 =20 @@ -733,6 +734,7 @@ static void vfe_set_qos(struct vfe_device *vfe) { u32 val =3D VFE_0_BUS_BDG_QOS_CFG_0_CFG; u32 val7 =3D VFE_0_BUS_BDG_QOS_CFG_7_CFG; + int ret; =20 writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_0); writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_1); @@ -742,6 +744,16 @@ static void vfe_set_qos(struct vfe_device *vfe) writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_5); writel_relaxed(val, vfe->base + VFE_0_BUS_BDG_QOS_CFG_6); writel_relaxed(val7, vfe->base + VFE_0_BUS_BDG_QOS_CFG_7); + + /* SoC-specific VBIF settings */ + if (vfe->res->has_vbif) { + ret =3D vfe_vbif_apply_settings(vfe); + if (ret < 0) { + dev_err_ratelimited(vfe->camss->dev, + "VFE: VBIF error %d\n", + ret); + } + } } =20 static void vfe_set_ds(struct vfe_device *vfe) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-vbif.c b/drivers/m= edia/platform/qcom/camss/camss-vfe-vbif.c new file mode 100644 index 0000000000000000000000000000000000000000..691335f231a6001e6c535431a18= b2e21ddc832c9 --- /dev/null +++ b/drivers/media/platform/qcom/camss/camss-vfe-vbif.c @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * camss-vfe-vbif.c + * + * Qualcomm MSM Camera Subsystem - VFE VBIF Module + * + * Copyright (c) 2025, The Linux Foundation. All rights reserved. + * + */ + +#include + +#include "camss.h" +#include "camss-vfe.h" +#include "camss-vfe-vbif.h" + +void vfe_vbif_write_reg(struct vfe_device *vfe, u32 reg, u32 val) +{ + writel_relaxed(val, vfe->vbif_base + reg); +} + +int vfe_vbif_apply_settings(struct vfe_device *vfe) +{ + return 0; +} diff --git a/drivers/media/platform/qcom/camss/camss-vfe-vbif.h b/drivers/m= edia/platform/qcom/camss/camss-vfe-vbif.h new file mode 100644 index 0000000000000000000000000000000000000000..502db629e961f67723b14a7c8c9= ca973fe4c267c --- /dev/null +++ b/drivers/media/platform/qcom/camss/camss-vfe-vbif.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * camss-vfe-vbif.h + * + * Qualcomm MSM Camera Subsystem - VFE VBIF Module + * + * Copyright (c) 2025, The Linux Foundation. All rights reserved. + * + */ +#ifndef QC_MSM_CAMSS_VFE_VBIF_H +#define QC_MSM_CAMSS_VFE_VBIF_H + +#include "camss-vfe.h" + +void vfe_vbif_write_reg(struct vfe_device *vfe, u32 reg, u32 val); + +int vfe_vbif_apply_settings(struct vfe_device *vfe); + +#endif /* QC_MSM_CAMSS_VFE_VBIF_H */ diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/= platform/qcom/camss/camss-vfe.c index 4bca6c3abaff9b898ea879674a3ff8f3592d3139..ac8e5e9471a426bec5d989abd5e= 082f5fa027364 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -1807,6 +1807,15 @@ int msm_vfe_subdev_init(struct camss *camss, struct = vfe_device *vfe, return PTR_ERR(vfe->base); } =20 + if (vfe->res->has_vbif) { + vfe->vbif_base =3D devm_platform_ioremap_resource_byname(pdev, + vfe->res->vbif_name); + if (IS_ERR(vfe->vbif_base)) { + dev_err(dev, "could not map vbif memory\n"); + return PTR_ERR(vfe->vbif_base); + } + } + /* Interrupt */ =20 ret =3D platform_get_irq_byname(pdev, res->interrupt[0]); diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/= platform/qcom/camss/camss-vfe.h index a23f666be7531e0366c73faea44ed245e7a8e30f..614e932c33da78e02e0800ce653= 4af7b14822f83 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -136,6 +136,8 @@ struct vfe_subdev_resources { u8 line_num; bool has_pd; char *pd_name; + bool has_vbif; + char *vbif_name; const struct vfe_hw_ops *hw_ops; const struct camss_formats *formats_rdi; const struct camss_formats *formats_pix; @@ -145,6 +147,7 @@ struct vfe_device { struct camss *camss; u8 id; void __iomem *base; + void __iomem *vbif_base; u32 irq; char irq_name[30]; struct camss_clock *clock; --=20 2.51.0