From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796294092; b=VX/JePbyeI0GU1Mhl5XDc67WC6xyu7/yU48rvhUF1zLdwK1iZvVXDW4+rEuN1YP3+n0K ZTvnWXl+LNqjrM1Mw6A3Yp7t2fYgTe7CDwevlwzfVMGEt9dJnLpkuC9XJH2i9FEP47WiW ss9Lz/YARf3thSoQZ2klj312PVoVCDSi8FDdzN+Fhp2/XVeiWrp5dBsyduU559eg7FhGo 1G2M9RtJP4IFu//1Z8dbztwcezgy2BIctmUY/59qWhuj+TiavO2v9yYNvoZNXfucAVF24 D5Ip7Kduqc3GAQXDF6RTyH6OBIWAx6kCFhJtKbHmyQUuyV6sX9/41W9ZPvaBuOxeZxw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796294092; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From:Date: Subject:MIME-Version:Content-Type:Content-Transfer-Encoding: Message-Id:References:In-Reply-To:To:Cc:X-Mailer: X-Developer-Signature:X-Developer-Key:X-Authority-Analysis: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-Spam-Info: X-Proofpoint-ORIG-GUID:X-Proofpoint-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=uxJXwJf/7ZcFG9O9FROl8oAdijDHpA09EWgsEtVllEU=; b=U1KBzjYToIKYsjgkXRpQGNYg6KY3AqsUA7W9++uzn7sUJ6f5XkA2FoSUqlZOdcVM7639 SlOYLzwxnm8uem6Q+k5rF12DBF757RRycOmw7VRLT/y96wjuhUmWMEpbgE62wVHe0PO8Q HKEWHtD3l/G+0V0BEB/xI7Et8U3OSufIm6TdVYvz+dCldgjDMJH6kQyAwRddnb7CHE7+e CRns3DXUgEv1iJotCIVKJAEVsro6z+pZDK6xB8KPNlbKcklUZR9E/Sg3+DkbsZSUBeqgg j5VNuVzkc/li/NDE4JAJP7CZZWP9eEzFnhptkMvZ+CQ8/BO19vklUVTcENwnXdq6Suw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=XATKQDsH; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=PPKHU2NY; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 17CCA606A322 for ; Thu, 3 Dec 2026 10:34:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 17CCA606A322 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=XATKQDsH; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=PPKHU2NY Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B3AFuwa3964788 for ; Thu, 3 Dec 2026 10:34:51 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= uxJXwJf/7ZcFG9O9FROl8oAdijDHpA09EWgsEtVllEU=; b=XATKQDsHpf/c576U 3+OGo2Agmy3lK7SRtblvzdE83jyjw0t594cscw2TM75cegD5JcmD1ZGHsUuNNU3r xJ6ue30p6o325NIzquQMv/KwSZeFPoqka/+1gE2Vdhd9zrWoDIHUhAItNMYdmi5n HFLCdJ/F96QUsIdjwOSqsVNpHePH1YVsdv3CCjH9UE59IXbFeS/TfjXQIqBt4y0/ 4Y1FBWpUhIVw7mqAKKkdUGBArkMK1vreIIQGfDrJlc7faPog91a14WAgtMNFZCwz EbPvraidD9bg5RsEaL9krknZ2vyEuE9NOFv+HeAj9aaZGMxv1ryM0nSSUD7uAxAv Su2f7w== Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jb395h153-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Thu, 03 Dec 2026 10:34:51 +0000 (GMT) Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-9210bbc04abso269716906d6.2 for ; Thu, 03 Dec 2026 02:34:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796294090; x=1796898890; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=uxJXwJf/7ZcFG9O9FROl8oAdijDHpA09EWgsEtVllEU=; b=PPKHU2NY1g5ONExpqQHYU4FGcyMTyAQywYXgL3TfFoi3yqVDt6O8fEvZFXH6UBlmAy uCFRFS2LlYNkQ34MMvrc5QQqRD8FwGxFHuH08uW0dDm3jLuoXtx+CMIoyHClfU35giW3 jdYMybnCKCrdOmSjsE6lflHshRhTyU17+lcheanLjzzykIgeB0S+5X/SSfGUkiivatt+ n4Wqc2XrAVhhx7t4qJXvQRxk2c1hku+38ubPK52443s9so/6xpO6IFq7PEpgr2nopVFP r9/7P7u8C2SJXF/O9MlDVahKXmSxi2hasHJ5hc92pKZWaLRBQFFzNhoZ4U/Q7hLXEZOV L6Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796294090; x=1796898890; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :content-type:mime-version:subject:date:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=uxJXwJf/7ZcFG9O9FROl8oAdijDHpA09EWgsEtVllEU=; b=ZSHGL62v5R2aIThWPpsBL2Y9//zh8lTlP8sqbVVM4+d9LvgmTGUnZai6UEfsfpEPcX P2cOgN4AZmLIUFVdlylIqghJBC7s1g9NEkoW4BFYGVJhaw2FXgnMQigC+fNy3iDULR6n BE2OjlbjmlezlLCmkI/KHqyDbHummLJGLMDOaNixz49arVTtbNGm2VB+SaJ5UOHqTe7Q ZUtQ/Bq+IFOgeuZMt1sH65och2mE3gNKT6WOpqpXyJurNf4QG1hdc9kaKlz95jVr3S/K 77Yk59Unb3bfTUOFmJlho23zTjIhm1TV0dAmGHvj8rFulYyJ6I0sPSsufolLmTjEUD64 MLYg== X-Forwarded-Encrypted: i=1; AL+hErHW43SvAk0qsY5xPgD9MrkGFZTDUeyikcmRIJQ8na4LKWdhzcYECHFG/pI3H7yezOkrJzWk3iWNlsm8aiU=@vger.kernel.org X-Gm-Message-State: APuU4Z8RqvnvX/d+Do+9XYAAvp9EO1CZ/JfTnW511vcEYwijVAEY6Xje /a/Qxb13ZPqK1TG48Bg0czMDkfhAsXmV1dCoj/mRGE6DgVokrpAxjcQ4HjFtvZe34AT8xnSLE8/ y9B2aAXN3rTZmFkhAyg+xMeqn1YjBDDuWiPy95VjbKPXlFln0fZtl/4Zm1HzpC3Fj49g= X-Gm-Gg: AZFdTZeX7lFkql4X+Pj4CnExR+a1eg84N2tsVkltJXAgTowIVDdJAL0WxPlK1I4CcQ8 0v1B7oYcZrQbGsYMv3NYWG16LyJaJA2mMCHsKKLU7wgWY9UmdOWOUB1fcTeZ7ycbJT8lXkH2Q+9 Le82kBSABPiFKYc8BYlLKqXW9Fy5cvt0Cow46RRob93cHipsDR+DpFuWc+CWK02MFsC20qw+EUA vSOmmHxE0DzJrxMrC6ZL1WBVR+Kq+TnrsIFRwFhwQ1OXhrEyyAVu4mBwARXibXAvYkDgRZffK1s GRNGUKb5g82evnFYtkmGkin2qFE0ffvKl3SqL9XCkqsR5HoFnbhbmdRdY4TuzMpv4kI4jg8B0sS 7yVuweulBdgZKNxSe62m+TThcqJgLopeSeiMcdC5BTqWEPCrIiw2GWY3rV03+XQMFS80mIGSZGr yTMC/yKcudh0CcTboyk98ReKl8u4ZKs3Me43APZBtX X-Received: by 2002:a05:622a:1f8b:b0:535:e5f1:393b with SMTP id d75a77b69052e-55d7690b5b1mr776376901cf.4.1796294089949; Thu, 03 Dec 2026 02:34:49 -0800 (PST) X-Received: by 2002:a05:622a:1f8b:b0:535:e5f1:393b with SMTP id d75a77b69052e-55d7690b5b1mr776376741cf.4.1796294089394; Thu, 03 Dec 2026 02:34:49 -0800 (PST) Received: from WENMLIU-LAB01.ap.qualcomm.com (Global_NAT1_IAD_FW.qualcomm.com. [129.46.232.65]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d7884d01csm359578881cf.21.2026.12.03.02.34.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2026 02:34:48 -0800 (PST) From: Wenmeng Liu Date: Thu, 03 Dec 2026 18:34:34 +0800 Subject: [PATCH RFC 1/3] media: qcom: camss: vfe: gen3: Describe the register layout with a struct X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261203-camss-vfe-v1-1-d306e66476d4@oss.qualcomm.com> References: <20261203-camss-vfe-v1-0-d306e66476d4@oss.qualcomm.com> In-Reply-To: <20261203-camss-vfe-v1-0-d306e66476d4@oss.qualcomm.com> To: Bryan O'Donoghue , Vladimir Zapolskiy , Loic Poulain , Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Wenmeng Liu X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1796294081; l=13610; i=wenmeng.liu@oss.qualcomm.com; s=20250925; h=from:subject:message-id; bh=L8yBPlNARXkwopjuXQHXegex8x1gFMd1kipMWX8Pzkw=; b=xVyMzwp0V8vZtrE2wwWUzjJy1Jc7mxsZQgRzQsazff04sFE7KwwN9xHixgrmUDGmZcWmp4lKb VhHCzNXfpGeDNtoZuit3QCHcuyK1oLzi4GWnfBhrNdfmVkcMn5HpWaG X-Developer-Key: i=wenmeng.liu@oss.qualcomm.com; a=ed25519; pk=fQJjf9C3jGDjE1zj2kO3NQLTbQEaZObVcXAzx5WLPX0= X-Authority-Analysis: v=2.4 cv=DK8acCNb c=1 sm=1 tr=0 ts=6b1145cb cx=c_pps a=7E5Bxpl4vBhpaufnMqZlrw==:117 a=C3Dk8TwHQYyIj7nOf9RCJw==:17 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=Um2Pa8k9VHT-vaBCBUpS:22 a=EUspDBNiAAAA:8 a=AelhhiFrdE5ItQlALf0A:9 a=QEXdDO2ut3YA:10 a=pJ04lnu7RYOZP9TFuWaZ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjAzMDA0MSBTYWx0ZWRfX+naax6NPj2HN HII7JK87cyujx3lxEyewrKTW6c0In5apJ4Txi4eqeRdRpTMSsolptbXlmhjGL+LFPvvkL50GzTX QVexsAS0zdxWF4twh3B1R4P44Unp+0pANPh/oAK2Z5gbt1Kq0170DlZS0YgXKquKs+Wlj5xBdNy MygWVw0wwzT5Z11p6ezc36dQNnPY3FnpA4ENVcOI8iTnU0048VmIETT0njbsCZuY6HacuVIQrmG juwKZ93dO2cqfx3+/lNwcDsBxXlZQeWk12RZJmIGgwV9kIlgKMfdKRXNm8hTv71uw2gMW17YMzk MtciazAh/wTyVEzBcZoZFrb59atnpvaMvuYsKGXR1bt4LcDsOWAvTISyNXMrPmE10f/Yl6OUGpY W9qmx+W40ddXF7vthDstEmWOHX2cE9dxyhsv5U031b9Za0HhfRsEqvHMMUAdf2+oilSZWEmdkAn Or+d/45c1Zx4kyIMO9w== X-Proofpoint-Spam-Info: AW1haW4tMjYxMjAzMDA0MSBTYWx0ZWRfXyuCNfCIBrr1K NRyOeXgJo1woB8t1vTliVzRQ0YJjw2m0sXoxtVHSUaAG2QpyaZe7A0GNolmkzMz+XcBZpipcqgM bpYkhZHyqCCnCPVNBrFX3WQmrN/LaKc= X-Proofpoint-ORIG-GUID: QPG-EwN7pQpTNgyowiTXr-p1Ke74bwEF X-Proofpoint-GUID: QPG-EwN7pQpTNgyowiTXr-p1Ke74bwEF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-12-03_03,2026-12-02_07,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 impostorscore=0 suspectscore=0 adultscore=0 phishscore=0 clxscore=1015 spamscore=0 bulkscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612030041 VFE 690 and VFE 780 only differ in the bus register layout, the RDI write master client IDs, the address units and the downscaler configuration. Describe them with a struct vfe_gen3_cfg referenced from the VFE resources instead of checking the CAMSS version. Signed-off-by: Wenmeng Liu --- drivers/media/platform/qcom/camss/camss-vfe-gen3.c | 101 +++++++++++++-------- drivers/media/platform/qcom/camss/camss-vfe.h | 6 ++ drivers/media/platform/qcom/camss/camss.c | 17 ++++ 3 files changed, 84 insertions(+), 40 deletions(-) diff --git a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c index 22579617def78457d057e5ba413ae481843a18ad..afbef045ed91b11277895b5a38e0f2576a77b33f 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe-gen3.c +++ b/drivers/media/platform/qcom/camss/camss-vfe-gen3.c @@ -12,26 +12,36 @@ #include "camss.h" #include "camss-vfe.h" -#define IS_VFE_690(vfe) \ - ((vfe->camss->res->version == CAMSS_8775P) \ - || (vfe->camss->res->version == CAMSS_8300)) - -#define BUS_REG_BASE_690 \ - (vfe_is_lite(vfe) ? 0x480 : 0x400) -#define BUS_REG_BASE_780 \ - (vfe_is_lite(vfe) ? 0x200 : 0xC00) +/** + * struct vfe_gen3_cfg - VFE register layout + * @bus_base_full: bus register base on a full VFE + * @bus_base_lite: bus register base on a VFE lite + * @test_bus_ctrl: offset of the WM test bus control register from the bus base + * @wm_base: offset of the first WM register block from the bus base + * @rdi_wm_full: WM client ID of RDI0 on a full VFE, it is 0 on a VFE lite + * @addr_shift: right shift applied to the image address and frame increment + * @disable_ds: disable the DS4 and DS16 downscalers + */ +struct vfe_gen3_cfg { + u32 bus_base_full; + u32 bus_base_lite; + u32 test_bus_ctrl; + u32 wm_base; + u8 rdi_wm_full; + u8 addr_shift; + bool disable_ds; +}; + +#define GEN3_CFG (vfe->res->gen3_cfg) + #define BUS_REG_BASE \ - (IS_VFE_690(vfe) ? BUS_REG_BASE_690 : BUS_REG_BASE_780) + (vfe_is_lite(vfe) ? GEN3_CFG->bus_base_lite : GEN3_CFG->bus_base_full) #define VFE_TOP_CORE_CFG (0x24) #define VFE_DISABLE_DSCALING_DS4 BIT(21) #define VFE_DISABLE_DSCALING_DS16 BIT(22) -#define VFE_BUS_WM_TEST_BUS_CTRL_690 (BUS_REG_BASE + 0xFC) -#define VFE_BUS_WM_TEST_BUS_CTRL_780 (BUS_REG_BASE + 0xDC) -#define VFE_BUS_WM_TEST_BUS_CTRL \ - (IS_VFE_690(vfe) ? VFE_BUS_WM_TEST_BUS_CTRL_690 \ - : VFE_BUS_WM_TEST_BUS_CTRL_780) +#define VFE_BUS_WM_TEST_BUS_CTRL (BUS_REG_BASE + GEN3_CFG->test_bus_ctrl) /* * Bus client mapping: * @@ -43,32 +53,31 @@ * VFE_690 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4, 5 = RDI5 * VFE_780 : 0 = RDI0, 1 = RDI1, 2 = RDI2, 3 = RDI3, 4 = RDI4 */ -#define RDI_WM_690(n) ((vfe_is_lite(vfe) ? 0x0 : 0x10) + (n)) -#define RDI_WM_780(n) ((vfe_is_lite(vfe) ? 0x0 : 0x17) + (n)) -#define RDI_WM(n) (IS_VFE_690(vfe) ? RDI_WM_690(n) : RDI_WM_780(n)) +#define RDI_WM(n) ((vfe_is_lite(vfe) ? 0x0 : GEN3_CFG->rdi_wm_full) + (n)) #define VFE_BUS_WM_CGC_OVERRIDE (BUS_REG_BASE + 0x08) #define WM_CGC_OVERRIDE_ALL (0x7FFFFFF) -#define VFE_BUS_WM_CFG(n) (BUS_REG_BASE + 0x200 + (n) * 0x100) +#define VFE_BUS_WM(n) (BUS_REG_BASE + GEN3_CFG->wm_base + (n) * 0x100) +#define VFE_BUS_WM_CFG(n) VFE_BUS_WM(n) #define WM_CFG_EN BIT(0) #define WM_VIR_FRM_EN BIT(1) #define WM_CFG_MODE BIT(16) -#define VFE_BUS_WM_IMAGE_ADDR(n) (BUS_REG_BASE + 0x204 + (n) * 0x100) -#define VFE_BUS_WM_FRAME_INCR(n) (BUS_REG_BASE + 0x208 + (n) * 0x100) -#define VFE_BUS_WM_IMAGE_CFG_0(n) (BUS_REG_BASE + 0x20c + (n) * 0x100) +#define VFE_BUS_WM_IMAGE_ADDR(n) (VFE_BUS_WM(n) + 0x04) +#define VFE_BUS_WM_FRAME_INCR(n) (VFE_BUS_WM(n) + 0x08) +#define VFE_BUS_WM_IMAGE_CFG_0(n) (VFE_BUS_WM(n) + 0x0c) #define WM_IMAGE_CFG_0_DEFAULT_WIDTH (0xFFFF) -#define VFE_BUS_WM_IMAGE_CFG_2(n) (BUS_REG_BASE + 0x214 + (n) * 0x100) +#define VFE_BUS_WM_IMAGE_CFG_2(n) (VFE_BUS_WM(n) + 0x14) #define WM_IMAGE_CFG_2_DEFAULT_STRIDE (0xFFFF) -#define VFE_BUS_WM_PACKER_CFG(n) (BUS_REG_BASE + 0x218 + (n) * 0x100) +#define VFE_BUS_WM_PACKER_CFG(n) (VFE_BUS_WM(n) + 0x18) -#define VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(n) (BUS_REG_BASE + 0x230 + (n) * 0x100) -#define VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(n) (BUS_REG_BASE + 0x234 + (n) * 0x100) -#define VFE_BUS_WM_FRAMEDROP_PERIOD(n) (BUS_REG_BASE + 0x238 + (n) * 0x100) -#define VFE_BUS_WM_FRAMEDROP_PATTERN(n) (BUS_REG_BASE + 0x23c + (n) * 0x100) +#define VFE_BUS_WM_IRQ_SUBSAMPLE_PERIOD(n) (VFE_BUS_WM(n) + 0x30) +#define VFE_BUS_WM_IRQ_SUBSAMPLE_PATTERN(n) (VFE_BUS_WM(n) + 0x34) +#define VFE_BUS_WM_FRAMEDROP_PERIOD(n) (VFE_BUS_WM(n) + 0x38) +#define VFE_BUS_WM_FRAMEDROP_PATTERN(n) (VFE_BUS_WM(n) + 0x3c) -#define VFE_BUS_WM_MMU_PREFETCH_CFG(n) (BUS_REG_BASE + 0x260 + (n) * 0x100) -#define VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(n) (BUS_REG_BASE + 0x264 + (n) * 0x100) +#define VFE_BUS_WM_MMU_PREFETCH_CFG(n) (VFE_BUS_WM(n) + 0x60) +#define VFE_BUS_WM_MMU_PREFETCH_MAX_OFFSET(n) (VFE_BUS_WM(n) + 0x64) static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line) { @@ -82,12 +91,8 @@ static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line) writel(0x0, vfe->base + VFE_BUS_WM_TEST_BUS_CTRL); - if (IS_VFE_690(vfe)) - writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height, - vfe->base + VFE_BUS_WM_FRAME_INCR(wm)); - else - writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height >> 8, - vfe->base + VFE_BUS_WM_FRAME_INCR(wm)); + writel(ALIGN(pix->plane_fmt[0].bytesperline, 16) * pix->height >> + GEN3_CFG->addr_shift, vfe->base + VFE_BUS_WM_FRAME_INCR(wm)); writel((WM_IMAGE_CFG_0_DEFAULT_WIDTH & 0xFFFF), vfe->base + VFE_BUS_WM_IMAGE_CFG_0(wm)); @@ -96,7 +101,7 @@ static void vfe_wm_start(struct vfe_device *vfe, u8 wm, struct vfe_line *line) writel(0, vfe->base + VFE_BUS_WM_PACKER_CFG(wm)); /* TOP CORE CFG */ - if (IS_VFE_690(vfe)) + if (GEN3_CFG->disable_ds) writel(VFE_DISABLE_DSCALING_DS4 | VFE_DISABLE_DSCALING_DS16, vfe->base + VFE_TOP_CORE_CFG); @@ -123,10 +128,7 @@ static void vfe_wm_update(struct vfe_device *vfe, u8 wm, u32 addr, { wm = RDI_WM(wm); - if (IS_VFE_690(vfe)) - writel(addr, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm)); - else - writel((addr >> 8), vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm)); + writel(addr >> GEN3_CFG->addr_shift, vfe->base + VFE_BUS_WM_IMAGE_ADDR(wm)); dev_dbg(vfe->camss->dev, "wm:%d, image buf addr:0x%x\n", wm, addr); @@ -174,6 +176,25 @@ static int vfe_halt(struct vfe_device *vfe) return 0; } +const struct vfe_gen3_cfg vfe_gen3_cfg_690 = { + .bus_base_full = 0x400, + .bus_base_lite = 0x480, + .test_bus_ctrl = 0xFC, + .wm_base = 0x200, + .rdi_wm_full = 0x10, + .addr_shift = 0, + .disable_ds = true, +}; + +const struct vfe_gen3_cfg vfe_gen3_cfg_780 = { + .bus_base_full = 0xC00, + .bus_base_lite = 0x200, + .test_bus_ctrl = 0xDC, + .wm_base = 0x200, + .rdi_wm_full = 0x17, + .addr_shift = 8, +}; + const struct vfe_hw_ops vfe_ops_gen3 = { .global_reset = vfe_global_reset, .hw_version = vfe_hw_version, diff --git a/drivers/media/platform/qcom/camss/camss-vfe.h b/drivers/media/platform/qcom/camss/camss-vfe.h index c37526caf9a6fc052c3f4ab4215e635167f6da95..159a7c4f5ceb3b57f26a0e03e515776a158a7b7c 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.h +++ b/drivers/media/platform/qcom/camss/camss-vfe.h @@ -98,6 +98,7 @@ struct vfe_line { }; struct vfe_device; +struct vfe_gen3_cfg; struct vfe_hw_ops { void (*addr_update)(struct vfe_device *vfe, enum vfe_line_id line_id); @@ -143,6 +144,8 @@ struct vfe_subdev_resources { bool has_vbif; char *vbif_name; const struct vfe_hw_ops *hw_ops; + /* VFE gen3 and later register layout */ + const struct vfe_gen3_cfg *gen3_cfg; const struct camss_formats *formats_rdi; const struct camss_formats *formats_pix; }; @@ -255,6 +258,9 @@ extern const struct vfe_hw_ops vfe_ops_680; extern const struct vfe_hw_ops vfe_ops_1080; extern const struct vfe_hw_ops vfe_ops_gen3; +extern const struct vfe_gen3_cfg vfe_gen3_cfg_690; +extern const struct vfe_gen3_cfg vfe_gen3_cfg_780; + int vfe_get(struct vfe_device *vfe); void vfe_put(struct vfe_device *vfe); diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 3a5b7c665d3a913e06489e985348b38af97c2f39..7df72ed72959fcf08041d9ff990a98e334d2440d 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -3560,6 +3560,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = { .has_pd = true, .pd_name = "ife0", .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -3584,6 +3585,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = { .has_pd = true, .pd_name = "ife1", .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -3608,6 +3610,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = { .has_pd = true, .pd_name = "ife2", .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -3629,6 +3632,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = { .line_num = 4, .is_lite = true, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -3650,6 +3654,7 @@ static const struct camss_subdev_resources vfe_res_8550[] = { .line_num = 4, .is_lite = true, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -3936,6 +3941,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = { .has_pd = true, .pd_name = "ife0", .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 }, @@ -3963,6 +3969,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = { .has_pd = true, .pd_name = "ife1", .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 }, @@ -3990,6 +3997,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = { .has_pd = true, .pd_name = "ife2", .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 }, @@ -4015,6 +4023,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = { .line_num = 4, .is_lite = true, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 }, @@ -4040,6 +4049,7 @@ static const struct camss_subdev_resources vfe_res_sm8650[] = { .line_num = 4, .is_lite = true, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_780, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 }, @@ -4352,6 +4362,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = { .has_pd = false, .pd_name = NULL, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_690, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -4380,6 +4391,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = { .has_pd = false, .pd_name = NULL, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_690, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -4406,6 +4418,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = { .line_num = 4, .is_lite = true, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_690, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -4432,6 +4445,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = { .line_num = 4, .is_lite = true, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_690, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -4458,6 +4472,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = { .line_num = 4, .is_lite = true, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_690, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -4484,6 +4499,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = { .line_num = 4, .is_lite = true, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_690, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } @@ -4510,6 +4526,7 @@ static const struct camss_subdev_resources vfe_res_8775p[] = { .line_num = 4, .is_lite = true, .hw_ops = &vfe_ops_gen3, + .gen3_cfg = &vfe_gen3_cfg_690, .formats_rdi = &vfe_formats_rdi_845, .formats_pix = &vfe_formats_pix_845 } -- 2.34.1