From nobody Mon Feb 9 07:43:11 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 8F2A33314BC for ; Fri, 17 Oct 2025 14:17:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710636; cv=none; b=Hm0rvIw3sugCmOwrb+Qerj4dtyx13vBnIiRizc8yePrmy8NLRxasJ7Tt3TekXaE9pdC1gZT6MGaZZ43Ye+PU4Vx8ntHau0qaA8FqTuJsXvjrkSuHMZFAPB4+LI7CYpPcaeWWtQy8ByvU/ykMzyznAamsf1ArhsqYsWLyeiwnL9Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710636; c=relaxed/simple; bh=72jcWFIJd6Qv/5MnF332OCgW8Ho4jjpJCX56AAe3DfA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uPSVIzAbdIpK3jbdRyzac8jj7tuLLCaF2yNdk706QHITf9h5cw4CHhUB1cmvfk7c0xyViUgGuhgSQ8nCDIcxEo6MOcYqSdSo5ky+iEQPRhRQdERvMTLgr1i0fZ0aPbaxZYIBulFxNSsV3Mt9XJhFPtPthhfxfu66BBwRj9h0V/8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=ksVIdIX+; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="ksVIdIX+" Received: from pps.filterd (m0279865.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59H8aH7g009754 for ; Fri, 17 Oct 2025 14:17:13 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= b9PFflkAtVJRpfpE3Yzpa+7mIsDW3V2ORmjF0IuhOA4=; b=ksVIdIX+SGUUSq7V nuP4z6jDMSPeAJILfl6u8bHKlATBRunEQDAX9ajgFNRkBiChjPAWgYKYP42wX4Ys +mPsQkTvlMyF3ZR1QvopT43qp31egOx9VfjzK64epAoF88kQ0IUNp51rw/sXa1k3 2jgmB9M1Vi3DXgSPKs2VY/rIiMpcYE78p6Vgw0DzXAwQ+YuUZVmxocsISE0wCCld wfVIHLwmoynEzasIa4lnN+RigWpM0VcquSJqRXhaVgt5xlgUJm9XldkI4HT1BCbh pvWyajUQH9mIb1J6TpoRF3vnsUy3SERPKOTjkIzD+NR1kAbjI0c/tokHdpo98qDG xdRo0A== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49rw1arpdt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 14:17:13 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-78038ed99d9so3623701b3a.2 for ; Fri, 17 Oct 2025 07:17:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760710632; x=1761315432; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=b9PFflkAtVJRpfpE3Yzpa+7mIsDW3V2ORmjF0IuhOA4=; b=Y4FViydM1ddK2Ou9xYtAzvliq2NYmIRiM1cLwb/9qB6GhVx4S50/VasHyQbFM6TOKU vJVHeGDslfhk6w9eqrnzE/UUYwanQZCTvKX4tJkELyCJP9+Z8fQxGFD4Dp1TKqfBCqQe lcV9gUuUr4DPq0bc7eh+EUjpI1Cwx6ivUJXmXtUmXc4TwFXAD+E3/MG4nfhtDMp+P4zs NqQxE2hcsiKQIT+Rdw68gM3cxvDF/XrzABS85ta01MJ6aRMxXdR0NJdHOYJkHFBAb+rm kYIMj377wf68OwZ4RlY5VPIulyLOzWghAvjFrS77YQuW5vazOdrl1gZ7FCCPlB3LPWdW UHtw== X-Forwarded-Encrypted: i=1; AJvYcCXbe7SxRCnz+MYAifGL/QB3phjsHyuFWRjww/y+SP7U5neCoR92VEP9uzJHdMnDg5GgCmNnmzYeEimjunU=@vger.kernel.org X-Gm-Message-State: AOJu0YxUWFvUQhW14V5xe6k947ZIuO3s1jae5lPAYjbu0I1MfunwrX/D KjPE3++HEOnO2xz7h4JR7SkE7UopIPxEcmME/wfmayO9hlIhWhTB3NbFeE8lC2g7RZesMTtnL2w kmDhdz/0lHaahpb5X4030WJ4nlyKR13yUPkIZz2kLJdjEfkwGvfr+KZ1B1cHVy9hxqAM= X-Gm-Gg: ASbGnctKIdceon9ezBMIrSzMpVD5nGbZ/QgzN70nVFJ1BQU02Jc2qXnFfTFMJ/FCG2q id1NjiSz54w/PkioKTWdpAXhV8664H8cgaO+Mq+cBl5GXP2Dc9XF1a48NnTLbI1IsAP8nORvWvL Ci/i/PbA1KzxAXDZ7JxehdlIZ21pK2iEas5Qm79eJ3zGLPnW4fBv9qL0XU56DyDBuXzPxdDYM/F VZWwlSMGfvEcbWICEQlllPSA7BixAuW2L/ZdVR+HJTjWxEgQmanwSh0zMn18aF8qw9BiIGX1kBz 4A60YCQw4Fr3xsDK4RFKiCIhM/jyC5JKu07Vv7LFUXT4csr083pbkYsx8tRnhmvRFY0G1hdFzms 6XjF/XNYcBCCUGn4ER74LCO9SxieStiUgVw== X-Received: by 2002:a05:6a00:2308:b0:792:52ab:d9fe with SMTP id d2e1a72fcca58-7a220440d9fmr4704422b3a.0.1760710632132; Fri, 17 Oct 2025 07:17:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFjZRj5ZyQFOhYmQRHuqsCpIa44cpaXsfGnaIpdn6/nIeJLyWuvEPAPc2/DAAHinIIkU95Bcg== X-Received: by 2002:a05:6a00:2308:b0:792:52ab:d9fe with SMTP id d2e1a72fcca58-7a220440d9fmr4704371b3a.0.1760710631533; Fri, 17 Oct 2025 07:17:11 -0700 (PDT) Received: from hu-vgarodia-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0966d7sm25895826b3a.40.2025.10.17.07.17.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 07:17:10 -0700 (PDT) From: Vikash Garodia Date: Fri, 17 Oct 2025 19:46:22 +0530 Subject: [PATCH v2 1/8] media: dt-bindings: qcom-kaanapali-iris: Add kaanapali video codec binding 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: <20251017-knp_video-v2-1-f568ce1a4be3@oss.qualcomm.com> References: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> In-Reply-To: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> To: Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Dmitry Baryshkov , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy , Vikash Garodia X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760710621; l=8066; i=vikash.garodia@oss.qualcomm.com; s=20241104; h=from:subject:message-id; bh=72jcWFIJd6Qv/5MnF332OCgW8Ho4jjpJCX56AAe3DfA=; b=fvZ+lCuHo9++0WCLHV0KchY9s9Iz58ORtsoSp1H3UaLox0IHXAN/URpics1VqI01vpi/M2xeW Bcw5Hzrjur4D6Ryd3Ws1QMcNAC6lgVhjbjp/l43tRCIh5wzE66ICutw X-Developer-Key: i=vikash.garodia@oss.qualcomm.com; a=ed25519; pk=LY9Eqp4KiHWxzGNKGHbwRFEJOfRCSzG/rxQNmvZvaKE= X-Authority-Analysis: v=2.4 cv=K88v3iWI c=1 sm=1 tr=0 ts=68f24fe9 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=gEfo2CItAAAA:8 a=EUspDBNiAAAA:8 a=PIz1-sESaiOoqeWa7OYA:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 a=sptkURWiP4Gy88Gu7hUp:22 X-Proofpoint-GUID: rzBIRd4WlRkMtNrfPbVJvyIIN4qlUtvl X-Proofpoint-ORIG-GUID: rzBIRd4WlRkMtNrfPbVJvyIIN4qlUtvl X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDEzMDAzNSBTYWx0ZWRfX2SQAkGL6EJJS ObXEOQNlNmNOfb9P1FsGFbixSYZ3JQEftzPJs9sNQqf9/vQvID34mhv/1Yjt9MH2GqvPtUEsP2v 6qiqkkHAuDcihEQDALQblUWpZWeiQ3dH80RDm6iy8NJrRSOltdvkhu01g6hqCwC6wYyGNOK0j9D ZOaBq+H82iTaKoltGlQmnzqqWVXcKBx9r5HLsXM1gTurCxL+bprMQiwWlYpk9scVoxk2vpJMXLo h0pPd5D8bD0jCcjtYK0URBs+588MQxMjptXFSRVXhuOYvaUIpFIfqbXozyAn7a662+QmYvL54YE bPqobJNr6LkhB4HoB9wFVniWYfcf5iM2dwKJqvE8ZFqrLAxpB/luDb696nZvgX6DdeLlhwkA0Jx zyE+ristWW2hu3eGm1kOpwQFSbdHkg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_05,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 impostorscore=0 priorityscore=1501 phishscore=0 adultscore=0 clxscore=1015 bulkscore=0 suspectscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510130035 Kaanapali SOC brings in the new generation of video IP i.e iris4. When compared to previous generation, iris3x, it has, - separate power domains for stream and pixel processing hardware blocks (bse and vpp). - additional power domain for apv codec. - power domains for individual pipes (VPPx). - different clocks and reset lines. Iommus include all the different stream-ids which can be possibly generated by vpu4 video hardware in both secure and non secure execution mode. The vpu have reserved iova, i.e some portion of the addressable range is reserved for IO registers. Iris_resv would describe the acceptable address range. Signed-off-by: Vikash Garodia --- .../bindings/media/qcom,kaanapali-iris.yaml | 231 +++++++++++++++++= ++++ 1 file changed, 231 insertions(+) diff --git a/Documentation/devicetree/bindings/media/qcom,kaanapali-iris.ya= ml b/Documentation/devicetree/bindings/media/qcom,kaanapali-iris.yaml new file mode 100644 index 0000000000000000000000000000000000000000..39e9ac9dad2212e5ae8dc3d45e7= 64418fe7d358d --- /dev/null +++ b/Documentation/devicetree/bindings/media/qcom,kaanapali-iris.yaml @@ -0,0 +1,231 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/media/qcom,kaanapali-iris.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Qualcomm Kaanapali Iris video encoder and decoder + +maintainers: + - Vikash Garodia + - Dikshita Agarwal + +description: + The iris video processing unit is a video encode and decode accelerator + present on Qualcomm Kaanapali SoC. + +properties: + compatible: + const: qcom,kaanapali-iris + + reg: + maxItems: 1 + + clocks: + maxItems: 10 + + clock-names: + items: + - const: iface + - const: core + - const: vcodec0_core + - const: iface1 + - const: core_freerun + - const: vcodec0_core_freerun + - const: vcodec_bse + - const: vcodec_vpp0 + - const: vcodec_vpp1 + - const: vcodec_apv + + dma-coherent: true + + firmware-name: + maxItems: 1 + + interconnects: + maxItems: 2 + + interconnect-names: + items: + - const: cpu-cfg + - const: video-mem + + interrupts: + maxItems: 1 + + iommus: + minItems: 3 + maxItems: 8 + + memory-region: + minItems: 1 + maxItems: 2 + + operating-points-v2: true + opp-table: + type: object + + power-domains: + maxItems: 7 + + power-domain-names: + items: + - const: venus + - const: vcodec0 + - const: mxc + - const: mmcx + - const: vpp0 + - const: vpp1 + - const: apv + + resets: + maxItems: 4 + + reset-names: + items: + - const: bus0 + - const: bus1 + - const: core_freerun_reset + - const: vcodec0_core_freerun_reset + +required: + - compatible + - reg + - clocks + - clock-names + - dma-coherent + - interconnects + - interconnect-names + - interrupts + - iommus + - power-domains + - power-domain-names + - resets + - reset-names + +unevaluatedProperties: false + +examples: + - | + #include + #include + + video-codec@2000000 { + compatible =3D "qcom,kaanapali-iris"; + reg =3D <0x02000000 0xf0000>; + + clocks =3D <&gcc_video_axi0_clk>, + <&video_cc_mvs0c_clk>, + <&video_cc_mvs0_clk>, + <&gcc_video_axi1_clk>, + <&video_cc_mvs0c_freerun_clk>, + <&video_cc_mvs0_freerun_clk>, + <&video_cc_mvs0b_clk>, + <&video_cc_mvs0_vpp0_clk>, + <&video_cc_mvs0_vpp1_clk>, + <&video_cc_mvs0a_clk>; + clock-names =3D "iface", + "core", + "vcodec0_core", + "iface1", + "core_freerun", + "vcodec0_core_freerun", + "vcodec_bse", + "vcodec_vpp0", + "vcodec_vpp1", + "vcodec_apv"; + + dma-coherent; + + interconnects =3D <&gem_noc_master_appss_proc &config_noc_slave_ve= nus_cfg>, + <&mmss_noc_master_video_mvp &mc_virt_slave_ebi1>; + interconnect-names =3D "cpu-cfg", + "video-mem"; + + interrupts =3D ; + + iommus =3D <&apps_smmu 0x1940 0x0>, + <&apps_smmu 0x1944 0x0>, + <&apps_smmu 0x1a20 0x0>, + <&apps_smmu 0x1943 0x0>; + + operating-points-v2 =3D <&iris_opp_table>; + + memory-region =3D <&video_mem>, <&iris_resv>; + + power-domains =3D <&video_cc_mvs0c_gdsc>, + <&video_cc_mvs0_gdsc>, + <&rpmhpd RPMHPD_MXC>, + <&rpmhpd RPMHPD_MMCX>, + <&video_cc_mvs0_vpp0_gdsc>, + <&video_cc_mvs0_vpp1_gdsc>, + <&video_cc_mvs0a_gdsc>; + power-domain-names =3D "venus", + "vcodec0", + "mxc", + "mmcx", + "vpp0", + "vpp1", + "apv"; + + resets =3D <&gcc_video_axi0_clk_ares>, + <&gcc_video_axi1_clk_ares>, + <&video_cc_mvs0c_freerun_clk_ares>, + <&video_cc_mvs0_freerun_clk_ares>; + reset-names =3D "bus0", + "bus1", + "core_freerun_reset", + "vcodec0_core_freerun_reset"; + + iris_opp_table: opp-table { + compatible =3D "operating-points-v2"; + + opp-240000000 { + opp-hz =3D /bits/ 64 <240000000 240000000 240000000 360000= 000>; + required-opps =3D <&rpmhpd_opp_low_svs_d1>, + <&rpmhpd_opp_low_svs_d1>; + }; + + opp-338000000 { + opp-hz =3D /bits/ 64 <338000000 338000000 338000000 507000= 000>; + required-opps =3D <&rpmhpd_opp_low_svs>, + <&rpmhpd_opp_low_svs>; + }; + + opp-420000000 { + opp-hz =3D /bits/ 64 <420000000 420000000 420000000 630000= 000>; + required-opps =3D <&rpmhpd_opp_svs>, + <&rpmhpd_opp_svs>; + }; + + opp-444000000 { + opp-hz =3D /bits/ 64 <444000000 444000000 444000000 666000= 000>; + required-opps =3D <&rpmhpd_opp_svs_l1>, + <&rpmhpd_opp_svs_l1>; + }; + + opp-533000000 { + opp-hz =3D /bits/ 64 <533000000 533000000 533000000 800000= 000>; + required-opps =3D <&rpmhpd_opp_nom>, + <&rpmhpd_opp_nom>; + }; + + opp-630000000 { + opp-hz =3D /bits/ 64 <630000000 630000000 630000000 110400= 0000>; + required-opps =3D <&rpmhpd_opp_turbo>, + <&rpmhpd_opp_turbo>; + }; + + opp-800000000 { + opp-hz =3D /bits/ 64 <800000000 630000000 630000000 126000= 0000>; + required-opps =3D <&rpmhpd_opp_turbo_l0>, + <&rpmhpd_opp_turbo_l0>; + }; + + opp-1000000000 { + opp-hz =3D /bits/ 64 <1000000000 630000000 850000000 12600= 00000>; + required-opps =3D <&rpmhpd_opp_turbo_l1>, + <&rpmhpd_opp_turbo_l1>; + }; + }; + }; --=20 2.34.1 From nobody Mon Feb 9 07:43:11 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 62CBA36999B for ; Fri, 17 Oct 2025 14:17:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710641; cv=none; b=ncp10rtKl+WK7wt7mu2vjsp34wYbKx/Lo0a634i5iUR4SRBrGBA5pcnT1f6dIQW6WCZReiTPUl9Dk+VZxz+dL2TxgIMQuU/YakC1xDvM0ZiH9iRemRojhT1UvMv0FS859Zw0JSCQj5Iq3z8EkfOG7jZoLdIj+XgI26l08X9OgZM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710641; c=relaxed/simple; bh=WP9OBR6Y+0+UpuwyFmyJHcFpInOnfMsFjcVkN7vPJcI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EKm3cjvzSevPRFvKhPYev3Dcd3lwEEr8BGm9BJj+hR2sAIe2OofJnp4f/L9h01T8JbWunYSRgrYvq8dSNrpBl2/uKUSJUOxRBt0xkZ8CaOP4Lg6hsQvbzKWwFrUKHizKCHQSpyPTcl9c+VuYjQBHDsNEw813Af/XniJiFgwSs0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=EYynz5X3; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="EYynz5X3" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59H8ATPg001691 for ; Fri, 17 Oct 2025 14:17:18 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= zhaJ8oV0RRnbTyCGCQikuU/kjIzXOpMayfs+Qj5W+hw=; b=EYynz5X3jrcJqVok 48l9PRmdGITc2K77t26OxFXeOXgn0+jBgs7DJHvKm/4Rni3S3bL7RHlkxS2EM7cc mnjfoRb0shrv0rk4xLcdviEVgAlWVK+Ov6IntOCVZP7l8Ll4TdrxZ7Vbn5JuWs2y 89Bwc/wbY4jGicNVAiobhoyTmLfJFoJ0rKFIpYfgAub1YJaUhnrRnBXleNm7pOUa Ao6EIjSoc6rQTEy0mYWO7RkOyNWChmx0C31OnNn8LBUNenE/JtUtt5UWbaeHReD+ vKjTupEztBMQnkKpEPDQAMLpJWIr89wo71m1pwP4UVXaREHXEeWHBkFVZFqgPSxa jGQPmg== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49qfd9chs6-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 14:17:18 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-78117fbda6eso1880203b3a.3 for ; Fri, 17 Oct 2025 07:17:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760710637; x=1761315437; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zhaJ8oV0RRnbTyCGCQikuU/kjIzXOpMayfs+Qj5W+hw=; b=RCU0hFOgwJLw/LSs5NdWo1ab6pDbFv1nFtcvjisQdwM88oYfaRFoOTofAB9QWtvH72 RnXeQqBLZoxZqZF//0ti/Cdia6fUKsQCsbzfanv+cU/q1IFLWCQM3eH69aTAu78yXapD fYAIiFUYs2o25BH7Y/nFkYEMfTBzbqWR8vy0N2w4Rbj7izXYvuAPP8yk3+c3zfUihXfe jwsRYv9P1G23MhBX2aa1uD5wo1PFSSubV4s7Q/r2ACu7saOCzGZ3CbW9jJljJ90W2tSU wQvwGMdpWDFCe5j39RrFXKyK9QgdsC+bLgimQ2un3StCnt8ctfnFixVKI0F+QM3BiH8Z C//g== X-Forwarded-Encrypted: i=1; AJvYcCUkOb2GwhSzz9CQ9VzKcceKWJsdg5tQPWeVV1WwtWanM4I5yk9hiNiwYfRTJ6CZzgVkuZUbxx85bmapeFE=@vger.kernel.org X-Gm-Message-State: AOJu0Ywqr7xk4dndc8TN3S/OHfWuR+wJ5YzqP2NgnW1dO+F47Vf5HIX7 HuEdt2tBG+X/IIKn2mjS38x/njY3vMWvLWvniBIqsomyq3bgydP7BV3dCcero+ATgX1qd9Neo0V W1qq2QZh7vqTIPqyry3H20V9q6s9X2ZwhXABSN4wJwpitdAqSBiqgINj0Epc93DKX11Y= X-Gm-Gg: ASbGnctUgfbwSXQd4pBSWi4hxrISwk2nqdVnksCRc2PuSIQ0CrAzvQ7EqPWH1/7D2ri /KghJ8DnYlkHSbD3orOrQ75cZdm3x2UjbI8AzYnCIeaw7Ix7+ouEscGSRJCsQ9rjiuw4/guEo81 xUvB3/DfmfYcufAhp49fd6NcQCSZCQP4vrHXsnR6D27M+9ivQfvm/cHifrLcNGJbYwT1KPrjjnA /NmFx8Pn/VwfOu2oebR7aGJz0k5xWZFyrSSXod6smWZ/VnWkoW517skBHtDkKYhJgdDOtD7AiNY KWosxmEHqDD9vswSZCN5zozE19zi0EW/G59A0KfDFIZhisgo9+nWjkO4zU1TIy5PCU14xwNOb+D PxnneawSmmzF3HO9RbCzRhr4lD8NVPWLQRQ== X-Received: by 2002:a05:6a00:188c:b0:781:1f28:eadd with SMTP id d2e1a72fcca58-7a220a98d31mr4021644b3a.20.1760710637177; Fri, 17 Oct 2025 07:17:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFzplU11+GApbuMSP2HrSj8pu6QcgJGFUkCxqgZCedcbE1dBZcyTBt2LNaHoDa21DgSL8EPpQ== X-Received: by 2002:a05:6a00:188c:b0:781:1f28:eadd with SMTP id d2e1a72fcca58-7a220a98d31mr4021590b3a.20.1760710636493; Fri, 17 Oct 2025 07:17:16 -0700 (PDT) Received: from hu-vgarodia-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0966d7sm25895826b3a.40.2025.10.17.07.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 07:17:15 -0700 (PDT) From: Vikash Garodia Date: Fri, 17 Oct 2025 19:46:23 +0530 Subject: [PATCH v2 2/8] media: iris: Add support for multiple clock sources 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: <20251017-knp_video-v2-2-f568ce1a4be3@oss.qualcomm.com> References: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> In-Reply-To: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> To: Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Dmitry Baryshkov , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy , Vikash Garodia X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760710621; l=10127; i=vikash.garodia@oss.qualcomm.com; s=20241104; h=from:subject:message-id; bh=WP9OBR6Y+0+UpuwyFmyJHcFpInOnfMsFjcVkN7vPJcI=; b=D416JzZgIC/IMhtyLiYB90tnq4qzsYumYUICQYs5/sWiwwdCbYg64TqU+Rskvx3JU+Qal6RIb YccTHH+EJC9DvBrNFynWThtxDz1yV1nKG/cHUgn5OKpl7T7V/nrfSm+ X-Developer-Key: i=vikash.garodia@oss.qualcomm.com; a=ed25519; pk=LY9Eqp4KiHWxzGNKGHbwRFEJOfRCSzG/rxQNmvZvaKE= X-Proofpoint-ORIG-GUID: CDFl5tgP-dnsY6xCniGzCtwaMgzZvwiB X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDExMDAxOCBTYWx0ZWRfX6ur4+b7Gkw1j UztvB6/4aLDJas+kpgvm2+xvAdkUWm/h+TiGm+lOJXFgg4swMvBbui31T4b3Nhzuv2xLHf9bDhq mOyeRR2zW3dYoTp0mXyNIUz59ymKWfJcGVYtTAUasKTIJhymBsI4zq2IHg+6VCmk204evPQAuj4 6B78WJ0ZhYYjbrNYK/Gu51xe+4g1iNvqwwIJhdAQvmj2px7jhnArspDZ7yrZoXZxs1crAVRg5xN ilIsJBkxgzo7AIJ5OBmwH7zs9DIruoTlVz46q2p6dTYCL+pLFEtCE8ux+Jd8w0GGTzZkfBXL4Xc FD0CZIOEpttJQIftN+1La00maYYmtW3i6p0gJ3GGJ+V5IxGryDI8+GwBG2Z4Ppjass6SE0dyFpB S89QCDiO/KQX6EvLZQI/sv+74Tt7ZQ== X-Proofpoint-GUID: CDFl5tgP-dnsY6xCniGzCtwaMgzZvwiB X-Authority-Analysis: v=2.4 cv=PdTyRyhd c=1 sm=1 tr=0 ts=68f24fee cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=yaBBUlST2TKB7NfxEUYA:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_05,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 bulkscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510110018 vpu4 depends on more than one clock source. Thus far hardware versions up to vpu3x have been clocked by a single source. This adds support for multiple clocks by, - Adding a lookup table - Configuring OPP table for video device with different video clocks - Setting OPP for multiple clocks during dev_pm_opp_set_opp() This patch extends the support for multiple clocks in driver, which would be used in subsequent patch for kaanapali, when the platform data is prepared. Co-developed-by: Vishnu Reddy Signed-off-by: Vishnu Reddy Signed-off-by: Vikash Garodia Reviewed-by: Bryan O'Donoghue --- .../media/platform/qcom/iris/iris_platform_common.h | 1 + .../media/platform/qcom/iris/iris_platform_gen2.c | 9 +++++++++ .../media/platform/qcom/iris/iris_platform_sm8250.c | 6 ++++++ drivers/media/platform/qcom/iris/iris_power.c | 2 +- drivers/media/platform/qcom/iris/iris_probe.c | 20 ++++++++--------= ---- drivers/media/platform/qcom/iris/iris_resources.c | 16 ++++++++++++++-- drivers/media/platform/qcom/iris/iris_resources.h | 1 + drivers/media/platform/qcom/iris/iris_vpu_common.c | 4 ++-- 8 files changed, 42 insertions(+), 17 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/driv= ers/media/platform/qcom/iris/iris_platform_common.h index 58d05e0a112eed25faea027a34c719c89d6c3897..df03de08c44839c1b6c137874eb= 7273c638d5f2c 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -206,6 +206,7 @@ struct iris_platform_data { const char * const *opp_pd_tbl; unsigned int opp_pd_tbl_size; const struct platform_clk_data *clk_tbl; + const char * const *opp_clk_tbl; unsigned int clk_tbl_size; const char * const *clk_rst_tbl; unsigned int clk_rst_tbl_size; diff --git a/drivers/media/platform/qcom/iris/iris_platform_gen2.c b/driver= s/media/platform/qcom/iris/iris_platform_gen2.c index 36d69cc73986b74534a2912524c8553970fd862e..fea800811a389a58388175c733a= d31c4d9c636b0 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_gen2.c +++ b/drivers/media/platform/qcom/iris/iris_platform_gen2.c @@ -633,6 +633,11 @@ static const struct platform_clk_data sm8550_clk_table= [] =3D { {IRIS_HW_CLK, "vcodec0_core" }, }; =20 +static const char * const sm8550_opp_clk_table[] =3D { + "vcodec0_core", + NULL, +}; + static struct ubwc_config_data ubwc_config_sm8550 =3D { .max_channels =3D 8, .mal_length =3D 32, @@ -756,6 +761,7 @@ struct iris_platform_data sm8550_data =3D { .opp_pd_tbl_size =3D ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl =3D sm8550_clk_table, .clk_tbl_size =3D ARRAY_SIZE(sm8550_clk_table), + .opp_clk_tbl =3D sm8550_opp_clk_table, /* Upper bound of DMA address range */ .dma_mask =3D 0xe0000000 - 1, .fwname =3D "qcom/vpu/vpu30_p4.mbn", @@ -848,6 +854,7 @@ struct iris_platform_data sm8650_data =3D { .opp_pd_tbl_size =3D ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl =3D sm8550_clk_table, .clk_tbl_size =3D ARRAY_SIZE(sm8550_clk_table), + .opp_clk_tbl =3D sm8550_opp_clk_table, /* Upper bound of DMA address range */ .dma_mask =3D 0xe0000000 - 1, .fwname =3D "qcom/vpu/vpu33_p4.mbn", @@ -930,6 +937,7 @@ struct iris_platform_data sm8750_data =3D { .opp_pd_tbl_size =3D ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl =3D sm8750_clk_table, .clk_tbl_size =3D ARRAY_SIZE(sm8750_clk_table), + .opp_clk_tbl =3D sm8550_opp_clk_table, /* Upper bound of DMA address range */ .dma_mask =3D 0xe0000000 - 1, .fwname =3D "qcom/vpu/vpu35_p4.mbn", @@ -1017,6 +1025,7 @@ struct iris_platform_data qcs8300_data =3D { .opp_pd_tbl_size =3D ARRAY_SIZE(sm8550_opp_pd_table), .clk_tbl =3D sm8550_clk_table, .clk_tbl_size =3D ARRAY_SIZE(sm8550_clk_table), + .opp_clk_tbl =3D sm8550_opp_clk_table, /* Upper bound of DMA address range */ .dma_mask =3D 0xe0000000 - 1, .fwname =3D "qcom/vpu/vpu30_p4_s6.mbn", diff --git a/drivers/media/platform/qcom/iris/iris_platform_sm8250.c b/driv= ers/media/platform/qcom/iris/iris_platform_sm8250.c index 16486284f8acccf6a95a27f6003e885226e28f4d..1b1b6aa751106ee0b0bc71bb0df= 2e78340190e66 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_sm8250.c +++ b/drivers/media/platform/qcom/iris/iris_platform_sm8250.c @@ -273,6 +273,11 @@ static const struct platform_clk_data sm8250_clk_table= [] =3D { {IRIS_HW_CLK, "vcodec0_core" }, }; =20 +static const char * const sm8250_opp_clk_table[] =3D { + "vcodec0_core", + NULL, +}; + static struct tz_cp_config tz_cp_config_sm8250 =3D { .cp_start =3D 0, .cp_size =3D 0x25800000, @@ -333,6 +338,7 @@ struct iris_platform_data sm8250_data =3D { .opp_pd_tbl_size =3D ARRAY_SIZE(sm8250_opp_pd_table), .clk_tbl =3D sm8250_clk_table, .clk_tbl_size =3D ARRAY_SIZE(sm8250_clk_table), + .opp_clk_tbl =3D sm8250_opp_clk_table, /* Upper bound of DMA address range */ .dma_mask =3D 0xe0000000 - 1, .fwname =3D "qcom/vpu-1.0/venus.mbn", diff --git a/drivers/media/platform/qcom/iris/iris_power.c b/drivers/media/= platform/qcom/iris/iris_power.c index dbca42df0910fd3c0fb253dbfabf1afa2c3d32ad..91aa21d4070ebcebbe2ed127a03= e5e49b9a2bd5c 100644 --- a/drivers/media/platform/qcom/iris/iris_power.c +++ b/drivers/media/platform/qcom/iris/iris_power.c @@ -91,7 +91,7 @@ static int iris_set_clocks(struct iris_inst *inst) } =20 core->power.clk_freq =3D freq; - ret =3D dev_pm_opp_set_rate(core->dev, freq); + ret =3D iris_opp_set_rate(core->dev, freq); mutex_unlock(&core->lock); =20 return ret; diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/= platform/qcom/iris/iris_probe.c index 00e99be16e087c4098f930151fd76cd381d721ce..ad82a62f8b923d818ffe77c131d= 7eb6da8c34002 100644 --- a/drivers/media/platform/qcom/iris/iris_probe.c +++ b/drivers/media/platform/qcom/iris/iris_probe.c @@ -40,8 +40,6 @@ static int iris_init_icc(struct iris_core *core) =20 static int iris_init_power_domains(struct iris_core *core) { - const struct platform_clk_data *clk_tbl; - u32 clk_cnt, i; int ret; =20 struct dev_pm_domain_attach_data iris_pd_data =3D { @@ -56,6 +54,11 @@ static int iris_init_power_domains(struct iris_core *cor= e) .pd_flags =3D PD_FLAG_DEV_LINK_ON | PD_FLAG_REQUIRED_OPP, }; =20 + struct dev_pm_opp_config iris_opp_clk_data =3D { + .clk_names =3D core->iris_platform_data->opp_clk_tbl, + .config_clks =3D dev_pm_opp_config_clks_simple, + }; + ret =3D devm_pm_domain_attach_list(core->dev, &iris_pd_data, &core->pmdom= ain_tbl); if (ret < 0) return ret; @@ -64,16 +67,9 @@ static int iris_init_power_domains(struct iris_core *cor= e) if (ret < 0) return ret; =20 - clk_tbl =3D core->iris_platform_data->clk_tbl; - clk_cnt =3D core->iris_platform_data->clk_tbl_size; - - for (i =3D 0; i < clk_cnt; i++) { - if (clk_tbl[i].clk_type =3D=3D IRIS_HW_CLK) { - ret =3D devm_pm_opp_set_clkname(core->dev, clk_tbl[i].clk_name); - if (ret) - return ret; - } - } + ret =3D devm_pm_opp_set_config(core->dev, &iris_opp_clk_data); + if (ret) + return ret; =20 return devm_pm_opp_of_add_table(core->dev); } diff --git a/drivers/media/platform/qcom/iris/iris_resources.c b/drivers/me= dia/platform/qcom/iris/iris_resources.c index cf32f268b703c1c042a9bcf146e444fff4f4990d..939f6617f2631503fa8cb3e874b= 9de6b2fbe7b76 100644 --- a/drivers/media/platform/qcom/iris/iris_resources.c +++ b/drivers/media/platform/qcom/iris/iris_resources.c @@ -4,6 +4,7 @@ */ =20 #include +#include #include #include #include @@ -58,11 +59,22 @@ int iris_unset_icc_bw(struct iris_core *core) return icc_bulk_set_bw(core->icc_count, core->icc_tbl); } =20 +int iris_opp_set_rate(struct device *dev, unsigned long freq) +{ + struct dev_pm_opp *opp __free(put_opp); + + opp =3D devfreq_recommended_opp(dev, &freq, 0); + if (IS_ERR(opp)) + return PTR_ERR(opp); + + return dev_pm_opp_set_opp(dev, opp); +} + int iris_enable_power_domains(struct iris_core *core, struct device *pd_de= v) { int ret; =20 - ret =3D dev_pm_opp_set_rate(core->dev, ULONG_MAX); + ret =3D iris_opp_set_rate(core->dev, ULONG_MAX); if (ret) return ret; =20 @@ -77,7 +89,7 @@ int iris_disable_power_domains(struct iris_core *core, st= ruct device *pd_dev) { int ret; =20 - ret =3D dev_pm_opp_set_rate(core->dev, 0); + ret =3D iris_opp_set_rate(core->dev, 0); if (ret) return ret; =20 diff --git a/drivers/media/platform/qcom/iris/iris_resources.h b/drivers/me= dia/platform/qcom/iris/iris_resources.h index f723dfe5bd81a9c9db22d53bde4e18743d771210..6bfbd2dc6db095ec05e53c894e0= 48285f82446c6 100644 --- a/drivers/media/platform/qcom/iris/iris_resources.h +++ b/drivers/media/platform/qcom/iris/iris_resources.h @@ -8,6 +8,7 @@ =20 struct iris_core; =20 +int iris_opp_set_rate(struct device *dev, unsigned long freq); int iris_enable_power_domains(struct iris_core *core, struct device *pd_de= v); int iris_disable_power_domains(struct iris_core *core, struct device *pd_d= ev); int iris_unset_icc_bw(struct iris_core *core); diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/m= edia/platform/qcom/iris/iris_vpu_common.c index bb98950e018fadf69ac4f41b3037f7fd6ac33c5b..bbd999a41236dca5cf5700e452a= 6fed69f4fc922 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_common.c +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.c @@ -266,7 +266,7 @@ void iris_vpu_power_off_hw(struct iris_core *core) =20 void iris_vpu_power_off(struct iris_core *core) { - dev_pm_opp_set_rate(core->dev, 0); + iris_opp_set_rate(core->dev, 0); core->iris_platform_data->vpu_ops->power_off_hw(core); core->iris_platform_data->vpu_ops->power_off_controller(core); iris_unset_icc_bw(core); @@ -352,7 +352,7 @@ int iris_vpu_power_on(struct iris_core *core) freq =3D core->power.clk_freq ? core->power.clk_freq : (u32)ULONG_MAX; =20 - dev_pm_opp_set_rate(core->dev, freq); + iris_opp_set_rate(core->dev, freq); =20 core->iris_platform_data->set_preset_registers(core); =20 --=20 2.34.1 From nobody Mon Feb 9 07:43:11 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 8FCBD36CE16 for ; Fri, 17 Oct 2025 14:17:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710646; cv=none; b=kO5DVGeRPcJMXV/m3sEguVX/ZMGPBNWVzNrAyWDC1Q+DujNiSJZQyDmIXYFUbsVpYZG59UKgXt+10hmTVVZY6+rHfJVaZ4qoeTjaMkF07dl/2zBnFRZHUWdWjaQhRXl28mJfKBj24SSASg8XSLoYZUImd/acITEOrzjomJHF1KY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710646; c=relaxed/simple; bh=aQhwVL5OkKZpJNwoBgyA4DOV0LM9OQwDpkWUVApVJPo=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=UsLQgDDftNdM2/m+CgGJUReGOUpOHO1iR4PFLCKIGvzmowGHK3aqEaq8U3cb51etXffTSUwnp2e0dPVXnwtROMsuXytxNCe+G/URIRqdDkJbXMna+p8NHhr35ihdY2y2Pg+V31AoFbpXJUExTZDEiO6fmcGsaGin5k2co0mf6Ag= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=co35y+nJ; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="co35y+nJ" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59H8EFYA025257 for ; Fri, 17 Oct 2025 14:17:23 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= 0hhcR/alBkgYZiip4OaGyRrX8Ez+m6UUaOpdYtIN+/w=; b=co35y+nJ6M+GAvQQ Awhc8RH7d4jOZ4QPNpYoGm1s9Z7e6RtdRsTZVqBJriShKwy8zM7ACLYH614sIuRE kDrNcWRKly7SW4LJp48ckZzFAkVvopWn/k0n8ahIjCxbbAOJlP9iSqVwGFi5ay+B gi2ZejHakBBLxENLq9mRZaXifcfD1jru2bsBTZyhHoe0F+JwM7hbzBPquFd7vVSy AFeYWljVQLLq9uSYDVTbn5/wGV4uPO29WfKDuQE3z5Ie6TMVdOa5z8PGjUOVLrFO DRte8TDg+9PPqVIh37RYmQ89cK3u9iJkfu5+Gx1tp5GPvUBGHZNTVNwFU8wvUjRG S3bldA== Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49qfdkmey4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 14:17:23 +0000 (GMT) Received: by mail-pg1-f197.google.com with SMTP id 41be03b00d2f7-b67c546a6e3so4179496a12.0 for ; Fri, 17 Oct 2025 07:17:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760710642; x=1761315442; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=0hhcR/alBkgYZiip4OaGyRrX8Ez+m6UUaOpdYtIN+/w=; b=dokkrczBKeuw2sgPUdLL15SA229QUOlq0q8rOq/D19XpjeItjRonUIFhWJh7bLtaMf GPr9KYOHXmoih7nkcq2dAsR4lCrYd5XX+y0cBYKM0ztXjT+M0sRKXwxcNSHztLllv+SP 8/CuNWbvHIAUL7xdpmSDpcdutzWTPgitxGdXVu8XKuRKniMzdqCIeP+wv/x5mNWHMrXx Wdrjv1rqWDJZCWst2TjUymz7TGZJA7Sg02QBZWA9QpgcDpvFRHzcAZOgXG2US7kAhmMS jMdkeAHkTSfF5BCrjUFSecjPjHZFXpvv8gWWTdt1Tu14oFF/ATnyRtz0tsPnpefrahAv cA/w== X-Forwarded-Encrypted: i=1; AJvYcCVSJSCkNFlFdOOPriuykGE/SQ8q1eQrQdhhHjZGAR1uKPqtpYRdRNhNjrv/we2cfEebQvGKp78DKj7vQgs=@vger.kernel.org X-Gm-Message-State: AOJu0Yx/LwmANN6aKysBgQQ0AjQcRNenC9xAy0e1jm9g+lL58UONvNb+ pgmPOYnHfUJPnz4jUlHjFPrjaSTbOtWcUOKBYdcY9hj/X4q4ettMbumrZLTphv7T+k4tw9DUWUF hVRB3X8RQlnvFBbec+Ch5AOl0xRte8/WDDV1ZOeWv3g8rV9GpjokLPxW90dsvrCTZpTI= X-Gm-Gg: ASbGnctVRwxJnq4E05Pgzi7gDBBtw+PMI5UU0tPgRpyp9r05m+uvO8jXCygqBY4x/uF ARpLiZsYmcqgOla8D50TdfHco0fRkfPHVk22fS5TTfSYH2j7LQ1NW4rDlMbSXMsHMHk+//cJ1JF Eynqmk7jTRH6RrCQmKcWfmvlvYB/RRYfqL7r3sXBAd4Tldp+Tr3X0UZwX4K8oVOaJ2lc/zyWp4Z hw/+RPz8Rq9TCghv9C5mcYdbdkYOletH8kGAbfHALwKSaGebOgV8CcVUofbHO+w/dWJSZSl8VMw jlYQDZqtPob+AvP8QdinmtCrJy91eklCBMjzuAkbBS9nk+1OYUHPxinHQTmTwmHMQlLzoxk52nB 6DTEY5Xmi1SI2g1qpfCvrICdAS34+HI9U/A== X-Received: by 2002:a05:6a20:914b:b0:2be:81e3:1124 with SMTP id adf61e73a8af0-334a8534446mr5461838637.2.1760710642076; Fri, 17 Oct 2025 07:17:22 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxXc274Kq5egMI1bqkuLdN79CwK6f2yYhs31cKxtIElWJMGzwLejgYYnr/BS6HvoRiDPX2yg== X-Received: by 2002:a05:6a20:914b:b0:2be:81e3:1124 with SMTP id adf61e73a8af0-334a8534446mr5461793637.2.1760710641536; Fri, 17 Oct 2025 07:17:21 -0700 (PDT) Received: from hu-vgarodia-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0966d7sm25895826b3a.40.2025.10.17.07.17.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 07:17:20 -0700 (PDT) From: Vikash Garodia Date: Fri, 17 Oct 2025 19:46:24 +0530 Subject: [PATCH v2 3/8] media: iris: Add support for multiple TZ content protection(CP) configs 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: <20251017-knp_video-v2-3-f568ce1a4be3@oss.qualcomm.com> References: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> In-Reply-To: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> To: Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Dmitry Baryshkov , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy , Vikash Garodia , Bryan O'Donoghue X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760710621; l=7561; i=vikash.garodia@oss.qualcomm.com; s=20241104; h=from:subject:message-id; bh=aQhwVL5OkKZpJNwoBgyA4DOV0LM9OQwDpkWUVApVJPo=; b=JXyQFNP4KcwlCETxfTyyCz2BppopYai97qQmcOvMwTeQOaifksZLbH1EGKjYpjxIxo7E37N5Q EHMThwhZ0KlAnnFsGJd8EaFumae2QDu5Y94D7xslt1Nyu+mwihClPWu X-Developer-Key: i=vikash.garodia@oss.qualcomm.com; a=ed25519; pk=LY9Eqp4KiHWxzGNKGHbwRFEJOfRCSzG/rxQNmvZvaKE= X-Proofpoint-ORIG-GUID: 0uuuTJgQShrsOhHOH6le1HJJhhl2nt0Y X-Authority-Analysis: v=2.4 cv=MrNfKmae c=1 sm=1 tr=0 ts=68f24ff3 cx=c_pps a=rz3CxIlbcmazkYymdCej/Q==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=EUspDBNiAAAA:8 a=KKAkSRfTAAAA:8 a=COk6AnOGAAAA:8 a=Jj_6bxtXlEvj8rQV6ZgA:9 a=QEXdDO2ut3YA:10 a=bFCP_H2QrGi7Okbo017w:22 a=cvBusfyB2V15izCimMoJ:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: 0uuuTJgQShrsOhHOH6le1HJJhhl2nt0Y X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDExMDAxOCBTYWx0ZWRfX/ZEyO3VwhGHs 0PkSWEaPlN9zY48FeixtKI+QwOvUstvCqaUbAimgB/2HswbE1Q1RvMLPJNYSgiE9shbQgyPfFY8 eGuK818drIHtOFQuCd5NXECILYfgRnY6h+X70AEi/O1VI2FA4yaDE+1VMqtysTq6L502rHQ7ToC luhrD4Lvm6nf4YgUQOLtDcnahu/MshKpaiaYdxW2Fk5Y8dSfjl+hMCNNx6OUwiOUQZmPWjzTm04 J6GoFOU73hmRS9uRl2hGvCpmDzndRsY13aMgyMTAV5Bi1u6Sc0uSIfCo+bJGY2pC852wqJn0jdX h1wn9MRT88+V2z3TxNfwBCdnW1q6aTPvSMXLZqeGs1N/VMMAMtQAIcNXds8wpIVEaDn6+0UnaKP xt+HoEh7ZhyNWYP4eY01nlj7x5kP2A== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_05,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 clxscore=1015 adultscore=0 phishscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510110018 vpu4 needs an additional configuration with respect to CP regions. Make the CP configuration as array such that the multiple configuration can be managed per platform. Reviewed-by: Konrad Dybcio Reviewed-by: Bryan O'Donoghue Co-developed-by: Vishnu Reddy Signed-off-by: Vishnu Reddy Signed-off-by: Vikash Garodia --- drivers/media/platform/qcom/iris/iris_firmware.c | 23 ++++++++++++------= --- .../platform/qcom/iris/iris_platform_common.h | 3 ++- .../media/platform/qcom/iris/iris_platform_gen2.c | 24 ++++++++++++++----= ---- .../platform/qcom/iris/iris_platform_sm8250.c | 15 ++++++++------ 4 files changed, 39 insertions(+), 26 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_firmware.c b/drivers/med= ia/platform/qcom/iris/iris_firmware.c index 9ab499fad946446a87036720f49c9c8d311f3060..9186e0144dc0df4045c9995adc5= fc93993cc3fba 100644 --- a/drivers/media/platform/qcom/iris/iris_firmware.c +++ b/drivers/media/platform/qcom/iris/iris_firmware.c @@ -70,9 +70,9 @@ static int iris_load_fw_to_memory(struct iris_core *core,= const char *fw_name) =20 int iris_fw_load(struct iris_core *core) { - struct tz_cp_config *cp_config =3D core->iris_platform_data->tz_cp_config= _data; + const struct tz_cp_config *cp_config; const char *fwpath =3D NULL; - int ret; + int i, ret; =20 ret =3D of_property_read_string_index(core->dev->of_node, "firmware-name"= , 0, &fwpath); @@ -91,14 +91,17 @@ int iris_fw_load(struct iris_core *core) return ret; } =20 - ret =3D qcom_scm_mem_protect_video_var(cp_config->cp_start, - cp_config->cp_size, - cp_config->cp_nonpixel_start, - cp_config->cp_nonpixel_size); - if (ret) { - dev_err(core->dev, "protect memory failed\n"); - qcom_scm_pas_shutdown(core->iris_platform_data->pas_id); - return ret; + for (i =3D 0; i < core->iris_platform_data->tz_cp_config_data_size; i++) { + cp_config =3D &core->iris_platform_data->tz_cp_config_data[i]; + ret =3D qcom_scm_mem_protect_video_var(cp_config->cp_start, + cp_config->cp_size, + cp_config->cp_nonpixel_start, + cp_config->cp_nonpixel_size); + if (ret) { + dev_err(core->dev, "qcom_scm_mem_protect_video_var failed: %d\n", ret); + qcom_scm_pas_shutdown(core->iris_platform_data->pas_id); + return ret; + } } =20 return ret; diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/driv= ers/media/platform/qcom/iris/iris_platform_common.h index df03de08c44839c1b6c137874eb7273c638d5f2c..ae49e95ba2252fc1442f7c81d80= 10dbfd86da0da 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -220,7 +220,8 @@ struct iris_platform_data { u32 inst_fw_caps_dec_size; struct platform_inst_fw_cap *inst_fw_caps_enc; u32 inst_fw_caps_enc_size; - struct tz_cp_config *tz_cp_config_data; + const struct tz_cp_config *tz_cp_config_data; + u32 tz_cp_config_data_size; u32 core_arch; u32 hw_response_timeout; struct ubwc_config_data *ubwc_config; diff --git a/drivers/media/platform/qcom/iris/iris_platform_gen2.c b/driver= s/media/platform/qcom/iris/iris_platform_gen2.c index fea800811a389a58388175c733ad31c4d9c636b0..00c6b9021b98aac80612b1bb973= 4c8dac8146bd9 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_gen2.c +++ b/drivers/media/platform/qcom/iris/iris_platform_gen2.c @@ -648,11 +648,13 @@ static struct ubwc_config_data ubwc_config_sm8550 =3D= { .bank_spreading =3D 1, }; =20 -static struct tz_cp_config tz_cp_config_sm8550 =3D { - .cp_start =3D 0, - .cp_size =3D 0x25800000, - .cp_nonpixel_start =3D 0x01000000, - .cp_nonpixel_size =3D 0x24800000, +static const struct tz_cp_config tz_cp_config_sm8550[] =3D { + { + .cp_start =3D 0, + .cp_size =3D 0x25800000, + .cp_nonpixel_start =3D 0x01000000, + .cp_nonpixel_size =3D 0x24800000, + }, }; =20 static const u32 sm8550_vdec_input_config_params_default[] =3D { @@ -771,7 +773,8 @@ struct iris_platform_data sm8550_data =3D { .inst_fw_caps_dec_size =3D ARRAY_SIZE(inst_fw_cap_sm8550_dec), .inst_fw_caps_enc =3D inst_fw_cap_sm8550_enc, .inst_fw_caps_enc_size =3D ARRAY_SIZE(inst_fw_cap_sm8550_enc), - .tz_cp_config_data =3D &tz_cp_config_sm8550, + .tz_cp_config_data =3D tz_cp_config_sm8550, + .tz_cp_config_data_size =3D ARRAY_SIZE(tz_cp_config_sm8550), .core_arch =3D VIDEO_ARCH_LX, .hw_response_timeout =3D HW_RESPONSE_TIMEOUT_VALUE, .ubwc_config =3D &ubwc_config_sm8550, @@ -864,7 +867,8 @@ struct iris_platform_data sm8650_data =3D { .inst_fw_caps_dec_size =3D ARRAY_SIZE(inst_fw_cap_sm8550_dec), .inst_fw_caps_enc =3D inst_fw_cap_sm8550_enc, .inst_fw_caps_enc_size =3D ARRAY_SIZE(inst_fw_cap_sm8550_enc), - .tz_cp_config_data =3D &tz_cp_config_sm8550, + .tz_cp_config_data =3D tz_cp_config_sm8550, + .tz_cp_config_data_size =3D ARRAY_SIZE(tz_cp_config_sm8550), .core_arch =3D VIDEO_ARCH_LX, .hw_response_timeout =3D HW_RESPONSE_TIMEOUT_VALUE, .ubwc_config =3D &ubwc_config_sm8550, @@ -947,7 +951,8 @@ struct iris_platform_data sm8750_data =3D { .inst_fw_caps_dec_size =3D ARRAY_SIZE(inst_fw_cap_sm8550_dec), .inst_fw_caps_enc =3D inst_fw_cap_sm8550_enc, .inst_fw_caps_enc_size =3D ARRAY_SIZE(inst_fw_cap_sm8550_enc), - .tz_cp_config_data =3D &tz_cp_config_sm8550, + .tz_cp_config_data =3D tz_cp_config_sm8550, + .tz_cp_config_data_size =3D ARRAY_SIZE(tz_cp_config_sm8550), .core_arch =3D VIDEO_ARCH_LX, .hw_response_timeout =3D HW_RESPONSE_TIMEOUT_VALUE, .ubwc_config =3D &ubwc_config_sm8550, @@ -1035,7 +1040,8 @@ struct iris_platform_data qcs8300_data =3D { .inst_fw_caps_dec_size =3D ARRAY_SIZE(inst_fw_cap_qcs8300_dec), .inst_fw_caps_enc =3D inst_fw_cap_qcs8300_enc, .inst_fw_caps_enc_size =3D ARRAY_SIZE(inst_fw_cap_qcs8300_enc), - .tz_cp_config_data =3D &tz_cp_config_sm8550, + .tz_cp_config_data =3D tz_cp_config_sm8550, + .tz_cp_config_data_size =3D ARRAY_SIZE(tz_cp_config_sm8550), .core_arch =3D VIDEO_ARCH_LX, .hw_response_timeout =3D HW_RESPONSE_TIMEOUT_VALUE, .ubwc_config =3D &ubwc_config_sm8550, diff --git a/drivers/media/platform/qcom/iris/iris_platform_sm8250.c b/driv= ers/media/platform/qcom/iris/iris_platform_sm8250.c index 1b1b6aa751106ee0b0bc71bb0df2e78340190e66..8927c3ff59dab59c7d2cbcd9255= 0f9ee3a2b5c1e 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_sm8250.c +++ b/drivers/media/platform/qcom/iris/iris_platform_sm8250.c @@ -278,11 +278,13 @@ static const char * const sm8250_opp_clk_table[] =3D { NULL, }; =20 -static struct tz_cp_config tz_cp_config_sm8250 =3D { - .cp_start =3D 0, - .cp_size =3D 0x25800000, - .cp_nonpixel_start =3D 0x01000000, - .cp_nonpixel_size =3D 0x24800000, +static const struct tz_cp_config tz_cp_config_sm8250[] =3D { + { + .cp_start =3D 0, + .cp_size =3D 0x25800000, + .cp_nonpixel_start =3D 0x01000000, + .cp_nonpixel_size =3D 0x24800000, + }, }; =20 static const u32 sm8250_vdec_input_config_param_default[] =3D { @@ -348,7 +350,8 @@ struct iris_platform_data sm8250_data =3D { .inst_fw_caps_dec_size =3D ARRAY_SIZE(inst_fw_cap_sm8250_dec), .inst_fw_caps_enc =3D inst_fw_cap_sm8250_enc, .inst_fw_caps_enc_size =3D ARRAY_SIZE(inst_fw_cap_sm8250_enc), - .tz_cp_config_data =3D &tz_cp_config_sm8250, + .tz_cp_config_data =3D tz_cp_config_sm8250, + .tz_cp_config_data_size =3D ARRAY_SIZE(tz_cp_config_sm8250), .hw_response_timeout =3D HW_RESPONSE_TIMEOUT_VALUE, .num_vpp_pipe =3D 4, .max_session_count =3D 16, --=20 2.34.1 From nobody Mon Feb 9 07:43:11 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 4B9DB369989 for ; Fri, 17 Oct 2025 14:17:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710651; cv=none; b=RaPOOKD9MstRIp03GVMeQTT/YoHHwjGyGZIwwIR7CCn9Sw9H9EW3oTHvg4sK4nlfRlODLZVBWhiNPMelWIc9Hish3J1cZDchVRYwTY43mYvZzJSy7iox8/9ol/2gq/iQhLuASf6QJxWazY554b8IZspaVYUQ+K13I5d2EfXHVDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710651; c=relaxed/simple; bh=QUCzrQ27jWi4zu3mz4a5d4iizr3a4+2aOvcFaEdgCmI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MPmkHqWfNvBJP3+3btPJUop4YxlidxbAukgxgZSKOG/Hos4uaJSiK31SfG4c5TQeFFcc1hS/F+9y4Zd6gWVp3JYa1GNNqOQSRxgtraFgzxo5FK6kkJCRCLrvAttWVZoIdBW+AqRxd33xwzX3HDFCFdBHdYn69O+LA52Tynisiec= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Bfga0AP1; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="Bfga0AP1" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59H8EA0o006211 for ; Fri, 17 Oct 2025 14:17:28 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= p8SSPCNuUvsxVPD7C7eu+wivyoPxKDv1UCAhhnoPljM=; b=Bfga0AP1rudXbDsP EzfeXCiX3DqWqOFoQOSZ8Dx8mLHb+Ji5Q1lJHE7euKo0C74pZl/mRyDqGAwpZdRo 6UtKgLdOzKxtpLhaSRhoPNjhd4kM2ITqtJTVechhx0xpopb0eeBAhrsf6d/pOp6X eqYpqIkdIfv84wUhErOY0WGMcMB9tT3tB+phr4NkdIJJ5ePGKC9G+t/lzs1hHWji 5wWRqBmrIqzcMdAqE2kbIHSq2voeQyLkZwVUKt52KDO4r8ZsdZ7Ap3b5EuxfQcOZ txr874TKfb2tWgjpH33INgixXgnbXzOU2q5r4IrT5zmEGhP7LNsU89+Msg0ZXbI/ riPuUQ== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49s6mwxtan-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 14:17:28 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-782063922ceso2015727b3a.0 for ; Fri, 17 Oct 2025 07:17:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760710647; x=1761315447; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=p8SSPCNuUvsxVPD7C7eu+wivyoPxKDv1UCAhhnoPljM=; b=Aui0ytStKzEynYdWNkMne6TRVOdmQbX3nv9e2zmMGm+GPH/BnyhJP1Qvhgk5jZy1tR 7dNy8x2sECPEIPsPoJeIDFQAyYhNA4t3+R1Y8RcIqQtLE8om21gIw7En18A70T3P2/jk 8pH2XwpzWzdj/PI6dzlD2uMcp1pNntkidsUMAPVr9kaNBjhznvsISzs9etP04uFrRZ16 sphCW5F/7Kw5CkQAjm6jgy54M4SvxX5WwUUKe9o+bGGoxd7bJnIhC0i0eKGZ5ZdazL46 SdVgl1C9SYqeojcolRM6sLRCeaX6UkSCIxUNiM9p9tP95XA5801VJLD8K323grfnFs2Y gwQA== X-Forwarded-Encrypted: i=1; AJvYcCXm/y4ePS2bauuQ3GXZwh4ZJmVHFkY6YlwYhkWIYxM9TXAK+mLEboNWp+urSEcQZ8FKt3tdoZi/kXldDL4=@vger.kernel.org X-Gm-Message-State: AOJu0Yy4EjFPE0IowfyA7Awxzjrn4Fj4HjZuq+D/9qm550RhsJUHqoPx Y2tqfhJGWA6vncYkdOVB892QE61FuAQOLIQv9oAAnmT6G2B6MeMI92KsL9HANxJZukDJUq1oXrt nps4d2r32kNp1lwhLi0cbfwf73IwrHHyYrarairBL/LWoruCiuOnRq41CIs6WVlOM1GE= X-Gm-Gg: ASbGncsh66x6ihFacHZFdgFxytkIBfmjF6QZMMTgXSyX3ymM6upeg4Lp/ag1MXnzZSv oOlWzzZWb3UNqKRx0cPel0eUzy5GA2qmueLWXoZnQAO2ka67K8XwKg1SPQ4d0IHhBbrP7vd16XY OXRT4DoxM9cLd3kjU17btoODfGeU43REyz12dc5uBRCE7bkaldcH70PAchLWrKk/6gvUSqAcNOb r4iHuLxIBZZ/F9Hf2BTChnXv/YsxQJyMpINT4m6YMbF21UdghRXD4o/d+FTKvyF42L6Vfv56px3 s8Z0kVPi2vPB+B9glEA+fKTNGDU+TTiqIAD2eVoRXSnvUzlqBRnltDZq0+QHXSQ9TffDBqk3Rf9 07+WvUEwtt4TgPsf8vOkz9xqX2KdCBvrQEg== X-Received: by 2002:a05:6a00:1911:b0:78c:97fa:6170 with SMTP id d2e1a72fcca58-7a220b10732mr5221903b3a.17.1760710647059; Fri, 17 Oct 2025 07:17:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGvyCAohehHJDVOVN0iZeGAsZf0UHakRxKtJsk8yoISo7GKWPbIiZed8kVj6CE7hAJIXFAXcA== X-Received: by 2002:a05:6a00:1911:b0:78c:97fa:6170 with SMTP id d2e1a72fcca58-7a220b10732mr5221824b3a.17.1760710646387; Fri, 17 Oct 2025 07:17:26 -0700 (PDT) Received: from hu-vgarodia-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0966d7sm25895826b3a.40.2025.10.17.07.17.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 07:17:25 -0700 (PDT) From: Vikash Garodia Date: Fri, 17 Oct 2025 19:46:25 +0530 Subject: [PATCH v2 4/8] media: iris: Introduce buffer size calculations for vpu4 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: <20251017-knp_video-v2-4-f568ce1a4be3@oss.qualcomm.com> References: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> In-Reply-To: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> To: Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Dmitry Baryshkov , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy , Vikash Garodia X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760710621; l=19297; i=vikash.garodia@oss.qualcomm.com; s=20241104; h=from:subject:message-id; bh=QUCzrQ27jWi4zu3mz4a5d4iizr3a4+2aOvcFaEdgCmI=; b=eTkbvfThChqSxdWxxDjVnYxnzgbHc96WXIv9/oEjvlqiS1V3uABW3ZpD8F5YrS7wcyCsQ6jwj yd4CDYOimyCBpYmUHxNzfbFjm7YuBwc8Zj+gc8XjbIUoqEr8XNYzuZ5 X-Developer-Key: i=vikash.garodia@oss.qualcomm.com; a=ed25519; pk=LY9Eqp4KiHWxzGNKGHbwRFEJOfRCSzG/rxQNmvZvaKE= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDEzMDA4MyBTYWx0ZWRfXz5ozWKQNb4MF 3rtgNdMDcZpUHBIBiaS2wEOJ8gyzCnvQu8zVd6Zp4F01YWIjoBbVzUApdv+kjcqbhBLZ99c2tGB Be2KQ6ujxPyjppDE28xeHZUwAypSesRkm1Kn6BU3xz0oobFsT4fVw8t9Wx0i0JJ9/T+QrY/HdF+ TNyuOhD5I4VLzPTp/yw6OYjn/tAs+Xi/OtNdkfJPiPoxy1Hyv9nQ4gnz9i2v7nGmpM6wBJQb2q0 Pw2zAd8Pcx4pkGX9C3AzGA7gt4vHQW02pE3li93s7f4smbRoBRy+7BB5D5183KSYEtRRLdxmLkz 16t0xl6L7dbwoZOe7a08BH5SU2Pxh2fl/ZQiBQjEEXX39ErndycAjQQr8CEX18pQ4V9cc9NLxW2 PZ/9JnMYXZZ728RlO28zpt6obl37Fg== X-Authority-Analysis: v=2.4 cv=Fr4IPmrq c=1 sm=1 tr=0 ts=68f24ff8 cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=BpuH9DVPwUbd3VYPi08A:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: TWcGH7F_n3npRRZQz48l3N5YWN4v8ESC X-Proofpoint-ORIG-GUID: TWcGH7F_n3npRRZQz48l3N5YWN4v8ESC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_05,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510130083 Introduces vp4 buffer size calculation for both encoder and decoder. Reuse the buffer size calculation which are common, while adding the vpu4 ones separately. Co-developed-by: Vishnu Reddy Signed-off-by: Vishnu Reddy Signed-off-by: Vikash Garodia --- drivers/media/platform/qcom/iris/iris_vpu_buffer.c | 345 +++++++++++++++++= ++++ drivers/media/platform/qcom/iris/iris_vpu_buffer.h | 15 + 2 files changed, 360 insertions(+) diff --git a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c b/drivers/m= edia/platform/qcom/iris/iris_vpu_buffer.c index 4463be05ce165adef6b152eb0c155d2e6a7b3c36..8cc52d7aba3ffb968191519c1a1= a10e326403205 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_buffer.c +++ b/drivers/media/platform/qcom/iris/iris_vpu_buffer.c @@ -1408,6 +1408,307 @@ static u32 iris_vpu_enc_vpss_size(struct iris_inst = *inst) return hfi_buffer_vpss_enc(width, height, ds_enable, 0, 0); } =20 +static inline u32 size_dpb_opb(u32 height, u32 lcu_size) +{ + u32 max_tile_height =3D ((height + lcu_size - 1) / lcu_size) * lcu_size += 8; + u32 dpb_opb =3D 3 * ((max_tile_height >> 3) * DMA_ALIGNMENT); + u32 num_luma_chrome_plane =3D 2; + + return dpb_opb =3D num_luma_chrome_plane * ALIGN(dpb_opb, DMA_ALIGNMENT); +} + +static u32 hfi_vpu4x_vp9d_lb_size(u32 frame_width, u32 frame_height, u32 n= um_vpp_pipes) +{ + u32 vp9_top_lb, vp9_fe_left_lb, vp9_se_left_lb, dpb_opb, vp9d_qp, num_lcu= _per_pipe; + u32 lcu_size =3D 64, fe_top_ctrl_line_numbers =3D 3, fe_top_data_luma_lin= e_numbers =3D 2, + fe_top_data_chroma_line_numbers =3D 3, fe_lft_ctrl_line_numbers =3D 4, + fe_lft_db_data_line_numbers =3D 2, fe_lft_lr_data_line_numbers =3D 4; + + vp9_top_lb =3D ALIGN(size_vp9d_lb_vsp_top(frame_width, frame_height), DMA= _ALIGNMENT); + vp9_top_lb +=3D ALIGN(size_vpxd_lb_se_top_ctrl(frame_width, frame_height)= , DMA_ALIGNMENT); + vp9_top_lb +=3D max3(DIV_ROUND_UP(frame_width, BUFFER_ALIGNMENT_16_BYTES)= * + MAX_PE_NBR_DATA_LCU16_LINE_BUFFER_SIZE, + DIV_ROUND_UP(frame_width, BUFFER_ALIGNMENT_32_BYTES) * + MAX_PE_NBR_DATA_LCU32_LINE_BUFFER_SIZE, + DIV_ROUND_UP(frame_width, BUFFER_ALIGNMENT_64_BYTES) * + MAX_PE_NBR_DATA_LCU64_LINE_BUFFER_SIZE); + vp9_top_lb =3D ALIGN(vp9_top_lb, DMA_ALIGNMENT); + vp9_top_lb +=3D ALIGN((DMA_ALIGNMENT * DIV_ROUND_UP(frame_width, lcu_size= )), + DMA_ALIGNMENT) * fe_top_ctrl_line_numbers; + vp9_top_lb +=3D ALIGN(DMA_ALIGNMENT * 8 * DIV_ROUND_UP(frame_width, lcu_s= ize), + DMA_ALIGNMENT) * (fe_top_data_luma_line_numbers + + fe_top_data_chroma_line_numbers); + + num_lcu_per_pipe =3D (DIV_ROUND_UP(frame_height, lcu_size) / num_vpp_pipe= s) + + (DIV_ROUND_UP(frame_height, lcu_size) % num_vpp_pipes); + vp9_fe_left_lb =3D ALIGN((DMA_ALIGNMENT * num_lcu_per_pipe), DMA_ALIGNMEN= T) * + fe_lft_ctrl_line_numbers; + vp9_fe_left_lb +=3D ((ALIGN((DMA_ALIGNMENT * 8 * num_lcu_per_pipe), DMA_A= LIGNMENT) * + fe_lft_db_data_line_numbers) + + ALIGN((DMA_ALIGNMENT * 3 * num_lcu_per_pipe), DMA_ALIGNMENT) + + ALIGN((DMA_ALIGNMENT * 4 * num_lcu_per_pipe), DMA_ALIGNMENT) + + (ALIGN((DMA_ALIGNMENT * 24 * num_lcu_per_pipe), DMA_ALIGNMENT) * + fe_lft_lr_data_line_numbers)); + vp9_fe_left_lb =3D vp9_fe_left_lb * num_vpp_pipes; + + vp9_se_left_lb =3D ALIGN(size_vpxd_lb_se_left_ctrl(frame_width, frame_hei= ght), + DMA_ALIGNMENT); + dpb_opb =3D size_dpb_opb(frame_height, lcu_size); + vp9d_qp =3D ALIGN(size_vp9d_qp(frame_width, frame_height), DMA_ALIGNMENT); + + return vp9_top_lb + vp9_fe_left_lb + (vp9_se_left_lb * num_vpp_pipes) + + (dpb_opb * num_vpp_pipes) + vp9d_qp; +} + +static u32 hfi_vpu4x_buffer_line_vp9d(u32 frame_width, u32 frame_height, u= 32 _yuv_bufcount_min, + bool is_opb, u32 num_vpp_pipes) +{ + u32 lb_size =3D hfi_vpu4x_vp9d_lb_size(frame_width, frame_height, num_vpp= _pipes); + u32 dpb_obp_size =3D 0, lcu_size =3D 64; + + if (is_opb) + dpb_obp_size =3D size_dpb_opb(frame_height, lcu_size) * num_vpp_pipes; + + return lb_size + dpb_obp_size; +} + +static u32 iris_vpu4x_dec_line_size(struct iris_inst *inst) +{ + u32 num_vpp_pipes =3D inst->core->iris_platform_data->num_vpp_pipe; + u32 out_min_count =3D inst->buffers[BUF_OUTPUT].min_count; + struct v4l2_format *f =3D inst->fmt_src; + u32 height =3D f->fmt.pix_mp.height; + u32 width =3D f->fmt.pix_mp.width; + bool is_opb =3D false; + + if (iris_split_mode_enabled(inst)) + is_opb =3D true; + + if (inst->codec =3D=3D V4L2_PIX_FMT_H264) + return hfi_buffer_line_h264d(width, height, is_opb, num_vpp_pipes); + else if (inst->codec =3D=3D V4L2_PIX_FMT_HEVC) + return hfi_buffer_line_h265d(width, height, is_opb, num_vpp_pipes); + else if (inst->codec =3D=3D V4L2_PIX_FMT_VP9) + return hfi_vpu4x_buffer_line_vp9d(width, height, out_min_count, is_opb, + num_vpp_pipes); + + return 0; +} + +static u32 hfi_vpu4x_buffer_persist_h265d(u32 rpu_enabled) +{ + return ALIGN((SIZE_SLIST_BUF_H265 * NUM_SLIST_BUF_H265 + H265_NUM_FRM_INF= O * + H265_DISPLAY_BUF_SIZE + (H265_NUM_TILE * sizeof(u32)) + (NUM_HW_PIC_BUF * + (SIZE_SEI_USERDATA + SIZE_H265D_ARP + SIZE_THREE_DIMENSION_USERDATA)) + + rpu_enabled * NUM_HW_PIC_BUF * SIZE_DOLBY_RPU_METADATA), DMA_ALIGNMENT); +} + +static u32 hfi_vpu4x_buffer_persist_vp9d(void) +{ + return ALIGN(VP9_NUM_PROBABILITY_TABLE_BUF * VP9_PROB_TABLE_SIZE, DMA_ALI= GNMENT) + + (ALIGN(hfi_iris3_vp9d_comv_size(), DMA_ALIGNMENT) * 2) + + ALIGN(MAX_SUPERFRAME_HEADER_LEN, DMA_ALIGNMENT) + + ALIGN(VP9_UDC_HEADER_BUF_SIZE, DMA_ALIGNMENT) + + ALIGN(VP9_NUM_FRAME_INFO_BUF * CCE_TILE_OFFSET_SIZE, DMA_ALIGNMENT) + + ALIGN(VP9_NUM_FRAME_INFO_BUF * VP9_FRAME_INFO_BUF_SIZE_VPU4X, DMA_ALIGNM= ENT) + + HDR10_HIST_EXTRADATA_SIZE; +} + +static u32 iris_vpu4x_dec_persist_size(struct iris_inst *inst) +{ + if (inst->codec =3D=3D V4L2_PIX_FMT_H264) + return hfi_buffer_persist_h264d(); + else if (inst->codec =3D=3D V4L2_PIX_FMT_HEVC) + return hfi_vpu4x_buffer_persist_h265d(0); + else if (inst->codec =3D=3D V4L2_PIX_FMT_VP9) + return hfi_vpu4x_buffer_persist_vp9d(); + + return 0; +} + +static u32 size_se_lb(u32 standard, u32 num_vpp_pipes_enc, + u32 frame_width_coded, u32 frame_height_coded) +{ + u32 se_tlb_size =3D ALIGN(frame_width_coded, DMA_ALIGNMENT); + u32 se_llb_size =3D (standard =3D=3D HFI_CODEC_ENCODE_HEVC) ? + ((frame_height_coded + BUFFER_ALIGNMENT_32_BYTES - 1) / + BUFFER_ALIGNMENT_32_BYTES) * LOG2_16 * LLB_UNIT_SIZE : + ((frame_height_coded + BUFFER_ALIGNMENT_16_BYTES - 1) / + BUFFER_ALIGNMENT_16_BYTES) * LOG2_32 * LLB_UNIT_SIZE; + + se_llb_size =3D ALIGN(se_llb_size, BUFFER_ALIGNMENT_32_BYTES); + + if (num_vpp_pipes_enc > 1) + se_llb_size =3D ALIGN(se_llb_size + BUFFER_ALIGNMENT_512_BYTES, + DMA_ALIGNMENT) * num_vpp_pipes_enc; + + return ALIGN(se_tlb_size + se_llb_size, DMA_ALIGNMENT); +} + +static u32 size_te_lb(bool is_ten_bit, u32 num_vpp_pipes_enc, u32 width_in= _lcus, + u32 frame_height_coded, u32 frame_width_coded) +{ + u32 num_pixel_10_bit =3D 3, num_pixel_8_bit =3D 2, num_pixel_te_llb =3D 3; + u32 te_llb_col_rc_size =3D ALIGN(32 * width_in_lcus / num_vpp_pipes_enc, + DMA_ALIGNMENT) * num_vpp_pipes_enc; + u32 te_tlb_recon_data_size =3D ALIGN((is_ten_bit ? num_pixel_10_bit : num= _pixel_8_bit) * + frame_width_coded, DMA_ALIGNMENT); + u32 te_llb_recon_data_size =3D ((1 + is_ten_bit) * num_pixel_te_llb * fra= me_height_coded + + num_vpp_pipes_enc - 1) / num_vpp_pipes_enc; + te_llb_recon_data_size =3D ALIGN(te_llb_recon_data_size, DMA_ALIGNMENT) *= num_vpp_pipes_enc; + + return ALIGN(te_llb_recon_data_size + te_llb_col_rc_size + te_tlb_recon_d= ata_size, + DMA_ALIGNMENT); +} + +static inline u32 calc_fe_tlb_size(u32 size_per_lcu, bool is_ten_bit) +{ + u32 num_pixels_fe_tlb_10_bit =3D 128, num_pixels_fe_tlb_8_bit =3D 64; + + return is_ten_bit ? (num_pixels_fe_tlb_10_bit * (size_per_lcu + 1)) : + (size_per_lcu * num_pixels_fe_tlb_8_bit); +} + +static u32 size_fe_lb(bool is_ten_bit, u32 standard, u32 num_vpp_pipes_enc, + u32 frame_height_coded, u32 frame_width_coded) +{ + u32 log2_lcu_size, num_cu_in_height_pipe, num_cu_in_width, + fb_llb_db_ctrl_size, fb_llb_db_luma_size, fb_llb_db_chroma_size, + fb_tlb_db_ctrl_size, fb_tlb_db_luma_size, fb_tlb_db_chroma_size, + fb_llb_sao_ctrl_size, fb_llb_sao_luma_size, fb_llb_sao_chroma_size, + fb_tlb_sao_ctrl_size, fb_tlb_sao_luma_size, fb_tlb_sao_chroma_size, + fb_lb_top_sdc_size, fb_lb_se_ctrl_size, fe_tlb_size, size_per_lcu; + u32 fe_sdc_data_per_block =3D 16, se_ctrl_data_per_block =3D 2020; + + log2_lcu_size =3D (standard =3D=3D HFI_CODEC_ENCODE_HEVC) ? 5 : 4; + num_cu_in_height_pipe =3D ((frame_height_coded >> log2_lcu_size) + num_vp= p_pipes_enc - 1) / + num_vpp_pipes_enc; + num_cu_in_width =3D frame_width_coded >> log2_lcu_size; + + size_per_lcu =3D 2; + fe_tlb_size =3D calc_fe_tlb_size(size_per_lcu, 1); + fb_llb_db_ctrl_size =3D ALIGN(fe_tlb_size, DMA_ALIGNMENT) * num_cu_in_hei= ght_pipe; + fb_llb_db_ctrl_size =3D ALIGN(fb_llb_db_ctrl_size, DMA_ALIGNMENT) * num_v= pp_pipes_enc; + + size_per_lcu =3D (1 << (log2_lcu_size - 3)); + fe_tlb_size =3D calc_fe_tlb_size(size_per_lcu, is_ten_bit); + fb_llb_db_luma_size =3D ALIGN(fe_tlb_size, DMA_ALIGNMENT) * num_cu_in_hei= ght_pipe; + fb_llb_db_luma_size =3D ALIGN(fb_llb_db_luma_size, DMA_ALIGNMENT) * num_v= pp_pipes_enc; + + size_per_lcu =3D ((1 << (log2_lcu_size - 4)) * 2); + fe_tlb_size =3D calc_fe_tlb_size(size_per_lcu, is_ten_bit); + fb_llb_db_chroma_size =3D ALIGN(fe_tlb_size, DMA_ALIGNMENT) * num_cu_in_h= eight_pipe; + fb_llb_db_chroma_size =3D ALIGN(fb_llb_db_chroma_size, DMA_ALIGNMENT) * n= um_vpp_pipes_enc; + + size_per_lcu =3D 1; + fe_tlb_size =3D calc_fe_tlb_size(size_per_lcu, 1); + fb_tlb_db_ctrl_size =3D ALIGN(fe_tlb_size, DMA_ALIGNMENT) * num_cu_in_wid= th; + fb_llb_sao_ctrl_size =3D ALIGN(fe_tlb_size, DMA_ALIGNMENT) * num_cu_in_he= ight_pipe; + fb_llb_sao_ctrl_size =3D fb_llb_sao_ctrl_size * num_vpp_pipes_enc; + fb_tlb_sao_ctrl_size =3D ALIGN(fe_tlb_size, DMA_ALIGNMENT) * num_cu_in_wi= dth; + + size_per_lcu =3D ((1 << (log2_lcu_size - 3)) + 1); + fe_tlb_size =3D calc_fe_tlb_size(size_per_lcu, is_ten_bit); + fb_tlb_db_luma_size =3D ALIGN(fe_tlb_size, DMA_ALIGNMENT) * num_cu_in_wid= th; + + size_per_lcu =3D (2 * ((1 << (log2_lcu_size - 4)) + 1)); + fe_tlb_size =3D calc_fe_tlb_size(size_per_lcu, is_ten_bit); + fb_tlb_db_chroma_size =3D ALIGN(fe_tlb_size, DMA_ALIGNMENT) * num_cu_in_w= idth; + + fb_llb_sao_luma_size =3D BUFFER_ALIGNMENT_256_BYTES * num_vpp_pipes_enc; + fb_llb_sao_chroma_size =3D BUFFER_ALIGNMENT_256_BYTES * num_vpp_pipes_enc; + fb_tlb_sao_luma_size =3D BUFFER_ALIGNMENT_256_BYTES; + fb_tlb_sao_chroma_size =3D BUFFER_ALIGNMENT_256_BYTES; + fb_lb_top_sdc_size =3D ALIGN((fe_sdc_data_per_block * (frame_width_coded = >> 5)), + DMA_ALIGNMENT); + fb_lb_se_ctrl_size =3D ALIGN((se_ctrl_data_per_block * (frame_width_coded= >> 5)), + DMA_ALIGNMENT); + + return fb_llb_db_ctrl_size + fb_llb_db_luma_size + fb_llb_db_chroma_size + + fb_tlb_db_ctrl_size + fb_tlb_db_luma_size + fb_tlb_db_chroma_size + + fb_llb_sao_ctrl_size + fb_llb_sao_luma_size + fb_llb_sao_chroma_size + + fb_tlb_sao_ctrl_size + fb_tlb_sao_luma_size + fb_tlb_sao_chroma_size + + fb_lb_top_sdc_size + fb_lb_se_ctrl_size; +} + +static u32 size_md_lb(u32 standard, u32 frame_width_coded, + u32 frame_height_coded, u32 num_vpp_pipes_enc) +{ + u32 md_tlb_size =3D ALIGN(frame_width_coded, DMA_ALIGNMENT); + u32 md_llb_size =3D (standard =3D=3D HFI_CODEC_ENCODE_HEVC) ? + ((frame_height_coded + BUFFER_ALIGNMENT_32_BYTES - 1) / + BUFFER_ALIGNMENT_32_BYTES) * LOG2_16 * LLB_UNIT_SIZE : + ((frame_height_coded + BUFFER_ALIGNMENT_16_BYTES - 1) / + BUFFER_ALIGNMENT_16_BYTES) * LOG2_32 * LLB_UNIT_SIZE; + + md_llb_size =3D ALIGN(md_llb_size, BUFFER_ALIGNMENT_32_BYTES); + + if (num_vpp_pipes_enc > 1) + md_llb_size =3D ALIGN(md_llb_size + BUFFER_ALIGNMENT_512_BYTES, + DMA_ALIGNMENT) * num_vpp_pipes_enc; + + md_llb_size =3D ALIGN(md_llb_size, DMA_ALIGNMENT); + + return ALIGN(md_tlb_size + md_llb_size, DMA_ALIGNMENT); +} + +static u32 size_dma_opb_lb(u32 num_vpp_pipes_enc, u32 frame_width_coded, + u32 frame_height_coded) +{ + u32 opb_packet_bytes =3D 128, opb_bpp =3D 128, opb_size_per_row =3D 6; + u32 dma_opb_wr_tlb_y_size =3D DIV_ROUND_UP(frame_width_coded, 16) * opb_p= acket_bytes; + u32 dma_opb_wr_tlb_uv_size =3D DIV_ROUND_UP(frame_width_coded, 16) * opb_= packet_bytes; + u32 dma_opb_wr2_tlb_y_size =3D ALIGN((opb_bpp * opb_size_per_row * frame_= height_coded / 8), + DMA_ALIGNMENT) * num_vpp_pipes_enc; + u32 dma_opb_wr2_tlb_uv_size =3D ALIGN((opb_bpp * opb_size_per_row * frame= _height_coded / 8), + DMA_ALIGNMENT) * num_vpp_pipes_enc; + + dma_opb_wr2_tlb_y_size =3D max(dma_opb_wr2_tlb_y_size, dma_opb_wr_tlb_y_s= ize << 1); + dma_opb_wr2_tlb_uv_size =3D max(dma_opb_wr2_tlb_uv_size, dma_opb_wr_tlb_u= v_size << 1); + + return ALIGN(dma_opb_wr_tlb_y_size + dma_opb_wr_tlb_uv_size + dma_opb_wr2= _tlb_y_size + + dma_opb_wr2_tlb_uv_size, DMA_ALIGNMENT); +} + +static u32 hfi_vpu4x_buffer_line_enc(u32 frame_width, u32 frame_height, + bool is_ten_bit, u32 num_vpp_pipes_enc, + u32 lcu_size, u32 standard) +{ + u32 width_in_lcus =3D (frame_width + lcu_size - 1) / lcu_size; + u32 height_in_lcus =3D (frame_height + lcu_size - 1) / lcu_size; + u32 frame_width_coded =3D width_in_lcus * lcu_size; + u32 frame_height_coded =3D height_in_lcus * lcu_size; + + u32 se_lb_size =3D size_se_lb(standard, num_vpp_pipes_enc, frame_width_co= ded, + frame_height_coded); + u32 te_lb_size =3D size_te_lb(is_ten_bit, num_vpp_pipes_enc, width_in_lcu= s, + frame_height_coded, frame_width_coded); + u32 fe_lb_size =3D size_fe_lb(is_ten_bit, standard, num_vpp_pipes_enc, fr= ame_height_coded, + frame_width_coded); + u32 md_lb_size =3D size_md_lb(standard, frame_width_coded, frame_height_c= oded, + num_vpp_pipes_enc); + u32 dma_opb_lb_size =3D size_dma_opb_lb(num_vpp_pipes_enc, frame_width_co= ded, + frame_height_coded); + u32 dse_lb_size =3D ALIGN((256 + (16 * (frame_width_coded >> 4))), DMA_AL= IGNMENT); + u32 size_vpss_lb_enc =3D size_vpss_line_buf_vpu33(num_vpp_pipes_enc, fram= e_width_coded, + frame_height_coded); + + return se_lb_size + te_lb_size + fe_lb_size + md_lb_size + dma_opb_lb_siz= e + + dse_lb_size + size_vpss_lb_enc; +} + +static u32 iris_vpu4x_enc_line_size(struct iris_inst *inst) +{ + u32 num_vpp_pipes =3D inst->core->iris_platform_data->num_vpp_pipe; + u32 lcu_size =3D inst->codec =3D=3D V4L2_PIX_FMT_HEVC ? 32 : 16; + struct v4l2_format *f =3D inst->fmt_dst; + u32 height =3D f->fmt.pix_mp.height; + u32 width =3D f->fmt.pix_mp.width; + + return hfi_vpu4x_buffer_line_enc(width, height, 0, num_vpp_pipes, + lcu_size, inst->codec); +} + static int output_min_count(struct iris_inst *inst) { int output_min_count =3D 4; @@ -1503,6 +1804,50 @@ u32 iris_vpu33_buf_size(struct iris_inst *inst, enum= iris_buffer_type buffer_typ return size; } =20 +u32 iris_vpu4x_buf_size(struct iris_inst *inst, enum iris_buffer_type buff= er_type) +{ + const struct iris_vpu_buf_type_handle *buf_type_handle_arr =3D NULL; + u32 size =3D 0, buf_type_handle_size =3D 0, i; + + static const struct iris_vpu_buf_type_handle dec_internal_buf_type_handle= [] =3D { + {BUF_BIN, iris_vpu_dec_bin_size }, + {BUF_COMV, iris_vpu_dec_comv_size }, + {BUF_NON_COMV, iris_vpu_dec_non_comv_size }, + {BUF_LINE, iris_vpu4x_dec_line_size }, + {BUF_PERSIST, iris_vpu4x_dec_persist_size }, + {BUF_DPB, iris_vpu_dec_dpb_size }, + {BUF_SCRATCH_1, iris_vpu_dec_scratch1_size }, + }; + + static const struct iris_vpu_buf_type_handle enc_internal_buf_type_handle= [] =3D { + {BUF_BIN, iris_vpu_enc_bin_size }, + {BUF_COMV, iris_vpu_enc_comv_size }, + {BUF_NON_COMV, iris_vpu_enc_non_comv_size }, + {BUF_LINE, iris_vpu4x_enc_line_size }, + {BUF_ARP, iris_vpu_enc_arp_size }, + {BUF_VPSS, iris_vpu_enc_vpss_size }, + {BUF_SCRATCH_1, iris_vpu_enc_scratch1_size }, + {BUF_SCRATCH_2, iris_vpu_enc_scratch2_size }, + }; + + if (inst->domain =3D=3D DECODER) { + buf_type_handle_size =3D ARRAY_SIZE(dec_internal_buf_type_handle); + buf_type_handle_arr =3D dec_internal_buf_type_handle; + } else if (inst->domain =3D=3D ENCODER) { + buf_type_handle_size =3D ARRAY_SIZE(enc_internal_buf_type_handle); + buf_type_handle_arr =3D enc_internal_buf_type_handle; + } + + for (i =3D 0; i < buf_type_handle_size; i++) { + if (buf_type_handle_arr[i].type =3D=3D buffer_type) { + size =3D buf_type_handle_arr[i].handle(inst); + break; + } + } + + return size; +} + static u32 internal_buffer_count(struct iris_inst *inst, enum iris_buffer_type buffer_type) { diff --git a/drivers/media/platform/qcom/iris/iris_vpu_buffer.h b/drivers/m= edia/platform/qcom/iris/iris_vpu_buffer.h index 04f0b7400a1e4e1d274d690a2761b9e57778e8b7..15037e99914afc19de9f0d38eb7= 78ef63363463b 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_buffer.h +++ b/drivers/media/platform/qcom/iris/iris_vpu_buffer.h @@ -47,7 +47,12 @@ struct iris_inst; #define VP9_NUM_PROBABILITY_TABLE_BUF (VP9_NUM_FRAME_INFO_BUF + 4) #define VP9_PROB_TABLE_SIZE (3840) #define VP9_FRAME_INFO_BUF_SIZE (6144) +#define VP9_FRAME_INFO_BUF_SIZE_VPU4X (6400) +#define BUFFER_ALIGNMENT_16_BYTES 16 #define BUFFER_ALIGNMENT_32_BYTES 32 +#define BUFFER_ALIGNMENT_64_BYTES 64 +#define BUFFER_ALIGNMENT_256_BYTES 256 +#define BUFFER_ALIGNMENT_512_BYTES 512 #define CCE_TILE_OFFSET_SIZE ALIGN(32 * 4 * 4, BUFFER_ALIGNMENT_32_BYTES) #define MAX_SUPERFRAME_HEADER_LEN (34) #define MAX_FE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE 64 @@ -66,6 +71,8 @@ struct iris_inst; #define H265_CABAC_HDR_RATIO_HD_TOT 2 #define H265_CABAC_RES_RATIO_HD_TOT 2 #define SIZE_H265D_VPP_CMD_PER_BUF (256) +#define SIZE_THREE_DIMENSION_USERDATA 768 +#define SIZE_H265D_ARP 9728 =20 #define VPX_DECODER_FRAME_CONCURENCY_LVL (2) #define VPX_DECODER_FRAME_BIN_HDR_BUDGET 1 @@ -76,6 +83,9 @@ struct iris_inst; =20 #define SIZE_H264D_HW_PIC_T (BIT(11)) =20 +#define MAX_PE_NBR_DATA_LCU16_LINE_BUFFER_SIZE 96 +#define MAX_PE_NBR_DATA_LCU32_LINE_BUFFER_SIZE 192 + #define MAX_FE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE 64 #define MAX_SE_NBR_CTRL_LCU64_LINE_BUFFER_SIZE 16 #define MAX_PE_NBR_DATA_LCU64_LINE_BUFFER_SIZE 384 @@ -96,6 +106,10 @@ struct iris_inst; =20 #define HFI_BUFFER_ARP_ENC 204800 =20 +#define LOG2_16 4 +#define LOG2_32 5 +#define LLB_UNIT_SIZE 16 + #define MAX_WIDTH 4096 #define MAX_HEIGHT 2304 #define NUM_MBS_4K (DIV_ROUND_UP(MAX_WIDTH, 16) * DIV_ROUND_UP(MAX_HEIGHT,= 16)) @@ -148,6 +162,7 @@ static inline u32 size_h264d_qp(u32 frame_width, u32 fr= ame_height) =20 u32 iris_vpu_buf_size(struct iris_inst *inst, enum iris_buffer_type buffer= _type); u32 iris_vpu33_buf_size(struct iris_inst *inst, enum iris_buffer_type buff= er_type); +u32 iris_vpu4x_buf_size(struct iris_inst *inst, enum iris_buffer_type buff= er_type); int iris_vpu_buf_count(struct iris_inst *inst, enum iris_buffer_type buffe= r_type); =20 #endif --=20 2.34.1 From nobody Mon Feb 9 07:43:11 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 A0A29236435 for ; Fri, 17 Oct 2025 14:17:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710655; cv=none; b=OwSnToryR1V20nmoBubu+dmelSbueE1liMBHi5rsa0igULhox8w+y2ezJ07wqzUOJV7MylgRvb/fF8T5NgJ14VW0NSuEj/ulC21IuS8k5FR/XwZP90zmDsmXSNQ39cXsTlcb+HPJN87+x7D+nxZbQiNI8CI5XhuOm7dBHBXJW7M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710655; c=relaxed/simple; bh=pBrsDZpLfL2DuOuLyCbchUHfirFeA+d/Ce9BNWCP3jM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=p4w916HfVu7uK74FipCloEaxYIxvcfNDAXKs/GrUBrcPCaWOmWiQ1z3I6OdlozjGLnNxQsfC6R8WglKUGJDzGTKngt7J4/9GL4jH2tdAHw7hRJ99x5ScjO8Zp7kDqFCBtsHiByURBRRY6qOluStusvmjnnFjix9CT8SW9Ed05nE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=bXntRByV; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="bXntRByV" Received: from pps.filterd (m0279867.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59H8HZB7001756 for ; Fri, 17 Oct 2025 14:17:33 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= gq+CWg2ZAfiAxiT7FSp+YhSs1Q22gW+tEiLpgbOOJTk=; b=bXntRByV5Y602KlH xenneFlDl4ikbNiGGtSX0+Gc0GRUOVm7o83csk5RBOY41moOBJ0UCeZKZ8+S3EW/ g5LLk/DDe2MdYS4LkitAoeRQTEoVAkkzjjBBFjXND9aO3wHmPiWHuhf7WDaKnkyw kyRfdA3K8nKeOcscse0WIqgK5CX/2M1Nf13MrQ0PZA923mb0FzqPxvnipuj1MuZc lGmoIwynFFGftksVnFgi2ztmmjTMb4Z6gwItqLfDm0mQSrNHpcjBhRZ0jQMQ8lLJ fEdEOTpkq2rO3cnhlMrKAaIMyne0WQdIwLBWpF+/vVDN0gPtVh+wJw3mF50BjfX6 ls9w8w== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49qfd9chss-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 14:17:32 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-78106e63bc9so2270278b3a.0 for ; Fri, 17 Oct 2025 07:17:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760710652; x=1761315452; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gq+CWg2ZAfiAxiT7FSp+YhSs1Q22gW+tEiLpgbOOJTk=; b=LYLmiZ+p3FvczOvlYF7DIpGT6dkvKpVZ33TcLXnG3gliYw9FsZp7AnTTqocMtMPoSw JUjC7rpmAo/n8XeH/a7Rwm22qxbu3hjW2MHG4fQV7nqem6KWGhLOpiDFyvqZpdTTh5XP lExD7JBu25XU+rQnSH9zOgUlkKFkQGpW9JBFj28iElb7rBg9bxyaH/QXFTbIdL2Fh/DU z2bZfuuau71kVGhg1HSqBNlmvsN+D0lt/sOSnT2BlkAMDK/meKfCasuF0XQT5QaoVOBW JvFrcOhKCBu7g2agD2Kmb0x30ApIQtRarx5DM0w1KAt0N352RvnVP1z+gS9pznDYWfyK z1Zw== X-Forwarded-Encrypted: i=1; AJvYcCUY0eGfbSgymSthX3okPUHesbvPF4jHjT6n4F5N2ITsTHAMpW70ucl/frMGjREPb8dRIGNc9lVHr6aIzRc=@vger.kernel.org X-Gm-Message-State: AOJu0YzMfRPJtpJfT+OjDqj+7B04SNfUNJmcWW5jIw7OZzUv4Y+qS7ob 5zlzV/LLnukRziysgM0+0iHt7MADh9wPuTbuB0T3ewAF/gbFHdT5V/pOcfS27/+3qU+Yo/OsEOh e6QqiRk1zpjfefko9NfOD/vrQkyTJFQrU21RkzxqpoSKi7vc22YBuRSiK5CZRrDNBIFE= X-Gm-Gg: ASbGncuek46r2gP6Kvp/pVraZR+s2ERBd/VD2GViamDkQJOWt66O3vTAx/UH3u1wDrH HbeXG6dGFR7e0QxOE2FJ9lADmGMR5vD1Pmqd2Omyx4Ec12gB1eKBGFqFXLio452CrBXlb/fYyXv 2yvl7FkU7qBFXK976jnwj1bde+FUcG3LlBayLSFOyfXRDvulNg/m4Ei04dHKU84pVsEfWf60LK3 uD+pLc/ybUuvDhxsdhF82L+J7IMd9qIQ8v9SDGGcOA1b2JncDF2YIs8O+Y96XT8wD3l0XLo8FOt olHfAHb+B/6xBh9IgCczcKyKT8tDQhCkrewzTDgSAb+sKyj/ovaXZm/6KBo60kMESSwpKIDVNyv yqeTpnFqGOgg/pbhG5JyNzIl/klim5M2LsA== X-Received: by 2002:a05:6a00:9501:b0:783:7de9:d3c5 with SMTP id d2e1a72fcca58-7a220d377d9mr4913414b3a.29.1760710651643; Fri, 17 Oct 2025 07:17:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEso39skOdGnHnIdhnxRSYveSiPHXARNShqQv5LqtIDC99FC4CfH49L1jFLwA6JO2/fdGHrg== X-Received: by 2002:a05:6a00:9501:b0:783:7de9:d3c5 with SMTP id d2e1a72fcca58-7a220d377d9mr4913366b3a.29.1760710651146; Fri, 17 Oct 2025 07:17:31 -0700 (PDT) Received: from hu-vgarodia-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0966d7sm25895826b3a.40.2025.10.17.07.17.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 07:17:30 -0700 (PDT) From: Vikash Garodia Date: Fri, 17 Oct 2025 19:46:26 +0530 Subject: [PATCH v2 5/8] media: iris: Move vpu register defines to common header file 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: <20251017-knp_video-v2-5-f568ce1a4be3@oss.qualcomm.com> References: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> In-Reply-To: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> To: Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Dmitry Baryshkov , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy , Vikash Garodia X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760710621; l=7259; i=vikash.garodia@oss.qualcomm.com; s=20241104; h=from:subject:message-id; bh=pBrsDZpLfL2DuOuLyCbchUHfirFeA+d/Ce9BNWCP3jM=; b=AzUJ1y/C5COJb4mjwvfT40x9nZGReqDaRJqKTGjuCniFToydUWcs+6EZao0os4P95RDydmIuh azgEGW4NUdQDg3GumwF/075X78wGlxwDJ8Ter1DdeQR7+8aI0A74px3 X-Developer-Key: i=vikash.garodia@oss.qualcomm.com; a=ed25519; pk=LY9Eqp4KiHWxzGNKGHbwRFEJOfRCSzG/rxQNmvZvaKE= X-Proofpoint-ORIG-GUID: dbbIvEDBrRu39eNiowpfzDAZMmaV-bSf X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDExMDAxOCBTYWx0ZWRfX8kowabJt89wH ET71RdcJvu8IZMTatsSo9P1aghA4+zEnOXv7iLi0HexeboG0mzqqFNMVp6ryOmfdOYqF8lx5hcT chYXq3msHBq92NUyBOzeOPihPahz2SB9MVc2K2WJGKuLjtCQK7Jsg7Y4SV45gXlRhoFHgs0AG1y ZGQBExCvpYoQ3usEAc0PAcGh+79q6zuS8wyMSGdv8rmyx+Kw/zTxbadCLn1PI9Ohb+tkYetx4SK DlMuG7Kmn7wRX1dHpASadg4some++scRlF3tA9bDAPZ5NIA9oKIVVNIJr7HZcWiZJq5/rGy7i3E gZhnKcXCoWOH5V0v1c8jezqsCsDZiZE+YzWkUJ71UDLGxiIYMFPCGUqmsUE9PaBS3Etyxj/yK5t Mv2DdF8YyjYtsCLCi5J3LCjkXiR5pg== X-Proofpoint-GUID: dbbIvEDBrRu39eNiowpfzDAZMmaV-bSf X-Authority-Analysis: v=2.4 cv=PdTyRyhd c=1 sm=1 tr=0 ts=68f24ffc cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=jbzpjpOmXXXxM5nbaMUA:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_05,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 phishscore=0 bulkscore=0 clxscore=1015 adultscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510110018 Some of vpu4 register defines are common with vpu3x. Move those into the common register defines header. This is done to reuse the defines for vpu4 in subsequent patch which enables the power sequence for vpu4. Co-developed-by: Vishnu Reddy Signed-off-by: Vishnu Reddy Signed-off-by: Vikash Garodia Reviewed-by: Bryan O'Donoghue --- drivers/media/platform/qcom/iris/iris_vpu3x.c | 36 ------------------= ---- drivers/media/platform/qcom/iris/iris_vpu_common.c | 23 -------------- .../platform/qcom/iris/iris_vpu_register_defines.h | 32 +++++++++++++++++++ 3 files changed, 32 insertions(+), 59 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_vpu3x.c b/drivers/media/= platform/qcom/iris/iris_vpu3x.c index 339776a0b4672e246848c3a6a260eb83c7da6a60..0ac6373c33b7ced75ac94ac86a1= a8fc303f28b5d 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu3x.c +++ b/drivers/media/platform/qcom/iris/iris_vpu3x.c @@ -11,48 +11,12 @@ #include "iris_vpu_common.h" #include "iris_vpu_register_defines.h" =20 -#define WRAPPER_TZ_BASE_OFFS 0x000C0000 -#define AON_BASE_OFFS 0x000E0000 -#define AON_MVP_NOC_RESET 0x0001F000 - -#define WRAPPER_DEBUG_BRIDGE_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x54) -#define WRAPPER_DEBUG_BRIDGE_LPI_STATUS (WRAPPER_BASE_OFFS + 0x58) -#define WRAPPER_IRIS_CPU_NOC_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x5C) -#define REQ_POWER_DOWN_PREP BIT(0) -#define WRAPPER_IRIS_CPU_NOC_LPI_STATUS (WRAPPER_BASE_OFFS + 0x60) -#define NOC_LPI_STATUS_DONE BIT(0) /* Indicates the NOC handshake is com= plete */ -#define NOC_LPI_STATUS_DENY BIT(1) /* Indicates the NOC handshake is den= ied */ -#define NOC_LPI_STATUS_ACTIVE BIT(2) /* Indicates the NOC is active */ -#define WRAPPER_CORE_CLOCK_CONFIG (WRAPPER_BASE_OFFS + 0x88) #define CORE_CLK_RUN 0x0 /* VPU v3.5 */ #define WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0 (WRAPPER_BASE_OFFS + 0x78) =20 -#define WRAPPER_TZ_CTL_AXI_CLOCK_CONFIG (WRAPPER_TZ_BASE_OFFS + 0x14) -#define CTL_AXI_CLK_HALT BIT(0) -#define CTL_CLK_HALT BIT(1) - -#define WRAPPER_TZ_QNS4PDXFIFO_RESET (WRAPPER_TZ_BASE_OFFS + 0x18) -#define RESET_HIGH BIT(0) - -#define CPU_CS_AHB_BRIDGE_SYNC_RESET (CPU_CS_BASE_OFFS + 0x160) -#define CORE_BRIDGE_SW_RESET BIT(0) -#define CORE_BRIDGE_HW_RESET_DISABLE BIT(1) - -#define CPU_CS_X2RPMH (CPU_CS_BASE_OFFS + 0x168) -#define MSK_SIGNAL_FROM_TENSILICA BIT(0) -#define MSK_CORE_POWER_ON BIT(1) - -#define AON_WRAPPER_MVP_NOC_RESET_REQ (AON_MVP_NOC_RESET + 0x000) #define VIDEO_NOC_RESET_REQ (BIT(0) | BIT(1)) =20 -#define AON_WRAPPER_MVP_NOC_RESET_ACK (AON_MVP_NOC_RESET + 0x004) - -#define VCODEC_SS_IDLE_STATUSN (VCODEC_BASE_OFFS + 0x70) - -#define AON_WRAPPER_MVP_NOC_LPI_CONTROL (AON_BASE_OFFS) -#define AON_WRAPPER_MVP_NOC_LPI_STATUS (AON_BASE_OFFS + 0x4) - #define AON_WRAPPER_MVP_NOC_CORE_SW_RESET (AON_BASE_OFFS + 0x18) #define SW_RESET BIT(0) #define AON_WRAPPER_MVP_NOC_CORE_CLK_CONTROL (AON_BASE_OFFS + 0x20) diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/m= edia/platform/qcom/iris/iris_vpu_common.c index bbd999a41236dca5cf5700e452a6fed69f4fc922..a7b1fb8173e02d22e6f2af4ea17= 0738c6408f65b 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_common.c +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.c @@ -11,9 +11,6 @@ #include "iris_vpu_common.h" #include "iris_vpu_register_defines.h" =20 -#define WRAPPER_TZ_BASE_OFFS 0x000C0000 -#define AON_BASE_OFFS 0x000E0000 - #define CPU_IC_BASE_OFFS (CPU_BASE_OFFS) =20 #define CPU_CS_A2HSOFTINTCLR (CPU_CS_BASE_OFFS + 0x1C) @@ -38,10 +35,6 @@ #define CPU_CS_H2XSOFTINTEN (CPU_CS_BASE_OFFS + 0x148) #define HOST2XTENSA_INTR_ENABLE BIT(0) =20 -#define CPU_CS_X2RPMH (CPU_CS_BASE_OFFS + 0x168) -#define MSK_SIGNAL_FROM_TENSILICA BIT(0) -#define MSK_CORE_POWER_ON BIT(1) - #define CPU_IC_SOFTINT (CPU_IC_BASE_OFFS + 0x150) #define CPU_IC_SOFTINT_H2A_SHFT 0x0 =20 @@ -53,23 +46,7 @@ #define WRAPPER_INTR_MASK_A2HWD_BMSK BIT(3) #define WRAPPER_INTR_MASK_A2HCPU_BMSK BIT(2) =20 -#define WRAPPER_DEBUG_BRIDGE_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x54) -#define WRAPPER_DEBUG_BRIDGE_LPI_STATUS (WRAPPER_BASE_OFFS + 0x58) -#define WRAPPER_IRIS_CPU_NOC_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x5C) -#define WRAPPER_IRIS_CPU_NOC_LPI_STATUS (WRAPPER_BASE_OFFS + 0x60) - #define WRAPPER_TZ_CPU_STATUS (WRAPPER_TZ_BASE_OFFS + 0x10) -#define WRAPPER_TZ_CTL_AXI_CLOCK_CONFIG (WRAPPER_TZ_BASE_OFFS + 0x14) -#define CTL_AXI_CLK_HALT BIT(0) -#define CTL_CLK_HALT BIT(1) - -#define WRAPPER_TZ_QNS4PDXFIFO_RESET (WRAPPER_TZ_BASE_OFFS + 0x18) -#define RESET_HIGH BIT(0) - -#define AON_WRAPPER_MVP_NOC_LPI_CONTROL (AON_BASE_OFFS) -#define REQ_POWER_DOWN_PREP BIT(0) - -#define AON_WRAPPER_MVP_NOC_LPI_STATUS (AON_BASE_OFFS + 0x4) =20 static void iris_vpu_interrupt_init(struct iris_core *core) { diff --git a/drivers/media/platform/qcom/iris/iris_vpu_register_defines.h b= /drivers/media/platform/qcom/iris/iris_vpu_register_defines.h index fe8a39e5e5a3fc68dc3a706ffdba07a5558163cf..bfe7ecceda894f6464970f9db25= 78c92dcb6c1ad 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_register_defines.h +++ b/drivers/media/platform/qcom/iris/iris_vpu_register_defines.h @@ -9,9 +9,41 @@ #define VCODEC_BASE_OFFS 0x00000000 #define CPU_BASE_OFFS 0x000A0000 #define WRAPPER_BASE_OFFS 0x000B0000 +#define AON_BASE_OFFS 0x000E0000 +#define AON_MVP_NOC_RESET 0x0001F000 +#define WRAPPER_TZ_BASE_OFFS 0x000C0000 + +#define AON_WRAPPER_MVP_NOC_LPI_CONTROL (AON_BASE_OFFS) +#define AON_WRAPPER_MVP_NOC_LPI_STATUS (AON_BASE_OFFS + 0x4) +#define AON_WRAPPER_MVP_NOC_RESET_REQ (AON_MVP_NOC_RESET + 0x000) +#define AON_WRAPPER_MVP_NOC_RESET_ACK (AON_MVP_NOC_RESET + 0x004) =20 #define CPU_CS_BASE_OFFS (CPU_BASE_OFFS) +#define CPU_CS_AHB_BRIDGE_SYNC_RESET (CPU_CS_BASE_OFFS + 0x160) +#define CPU_CS_X2RPMH (CPU_CS_BASE_OFFS + 0x168) + +#define VCODEC_SS_IDLE_STATUSN (VCODEC_BASE_OFFS + 0x70) =20 +#define WRAPPER_TZ_CTL_AXI_CLOCK_CONFIG (WRAPPER_TZ_BASE_OFFS + 0x14) +#define WRAPPER_TZ_QNS4PDXFIFO_RESET (WRAPPER_TZ_BASE_OFFS + 0x18) + +#define WRAPPER_DEBUG_BRIDGE_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x54) +#define WRAPPER_DEBUG_BRIDGE_LPI_STATUS (WRAPPER_BASE_OFFS + 0x58) +#define WRAPPER_IRIS_CPU_NOC_LPI_CONTROL (WRAPPER_BASE_OFFS + 0x5C) +#define WRAPPER_IRIS_CPU_NOC_LPI_STATUS (WRAPPER_BASE_OFFS + 0x60) #define WRAPPER_CORE_POWER_STATUS (WRAPPER_BASE_OFFS + 0x80) +#define WRAPPER_CORE_CLOCK_CONFIG (WRAPPER_BASE_OFFS + 0x88) + +#define CORE_BRIDGE_SW_RESET BIT(0) +#define CORE_BRIDGE_HW_RESET_DISABLE BIT(1) +#define MSK_SIGNAL_FROM_TENSILICA BIT(0) +#define MSK_CORE_POWER_ON BIT(1) +#define CTL_AXI_CLK_HALT BIT(0) +#define CTL_CLK_HALT BIT(1) +#define REQ_POWER_DOWN_PREP BIT(0) +#define RESET_HIGH BIT(0) +#define NOC_LPI_STATUS_DONE BIT(0) /* Indicates the NOC handshake is com= plete */ +#define NOC_LPI_STATUS_DENY BIT(1) /* Indicates the NOC handshake is den= ied */ +#define NOC_LPI_STATUS_ACTIVE BIT(2) /* Indicates the NOC is active */ =20 #endif --=20 2.34.1 From nobody Mon Feb 9 07:43:11 2026 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (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 4F2EA335079 for ; Fri, 17 Oct 2025 14:17:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710660; cv=none; b=dYRIAZP0A2l3OKU0JVp/ZUBsl3itNQxK9fMamGKy3wu9ZA7aGtgY3sqmj9z+kGJJUshjUNQM7o6AYwYAebB7avRot4Lf5sqwKMnBCyFViiJmfB1jv7vw4So00hKUJloqtodbssmGxGQWQqvwEFN3yR7HXfw8tS+35s75Gqvo26A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710660; c=relaxed/simple; bh=XwjJpuMOMq7BISJ4RPudOTebpQlxQfmd6veQP0wZOgg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CY80vFRppJUbx5Jzelp5PDMp5iXif8SsURvwiyJxzj+6u9k3X3dCF06gV7EmHC4GKNH9XnlIfo51wx+7Ykn7cRI4bowc/S4yXPg7xX7b/B48l+AQ+LiaQ0Fj+ykvGOyQHFEwo9ytxIOIRSo++kP2ErUtKRjXTkC+pueruLQjpx4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=XuX5RrM7; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="XuX5RrM7" Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59H8IgGK006342 for ; Fri, 17 Oct 2025 14:17:37 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= dbK0nLOoJgC562Sre9RiWxXhq9DvCscrdLVA2y+RRqA=; b=XuX5RrM7PUduLgNo kTdfLsq2+/mYb39+XwzUjlRTUlbxLLhjMKqLPCunMuomgCV8h3yNDoBKgo+lSSAX ysoDFuMhR7FWU4Szfh5EfV2YeYgKGvw88+uh4lfwxBt7irUb34cLEiO7gg35MSFV Qy8IEUMFq3EgjCjnU1nDapQ9gErL9/0nwA+Zt46q/i24H72mzS0kgYp/vRXYys1J 7tLnJZQL9jO1I2L+YpguGi4buiw2rpqFelRaX+QC0yC0L/Fhio9Ue4PKpqgG+rgr IzTSU/iFPooyoNg1APfR2iGTm1cSAzuYBuw9pnJJS2wFPOX9FkrpNnTJhL7RvbG0 5C24Ow== Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49s6mwxtb9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 14:17:37 +0000 (GMT) Received: by mail-pf1-f200.google.com with SMTP id d2e1a72fcca58-7810e5a22f3so3992422b3a.1 for ; Fri, 17 Oct 2025 07:17:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760710657; x=1761315457; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dbK0nLOoJgC562Sre9RiWxXhq9DvCscrdLVA2y+RRqA=; b=b0X4PgktHhOVxMKw8v/ETU3k/r2N3HrjhviHm8/7ZcoxytgspWSIbIhWr60FfPB2Um 5dEANX8kfOEDiZSVIIdGtYgoue2iCEewLPX1A4lPqfdmNlX9v5vfSNPDlGIVLq9SEoV9 gvPq3Yx4O+pfGwUM74I+WmGEOUUNhT1NJE7Regff+K3w2GTxMGiunX0wA6FZ8hz2Amlb 9Zn+XkakLetyZQe7rLnjsOc4ds4/z5SciLukw8XneCNw5yJiHypnGE3JsdtT9yPVJQmg 2foeSefL5gTBUSfhf1Iaypx5zni7RGV4YZYy/N9+QleWDyDjh7ZOLIs2+CjRJeWTNH+/ 96IA== X-Forwarded-Encrypted: i=1; AJvYcCWBrdKKWMEXUjxyzhDUW76RrTnFBoZvKCBGu0oVHXNOAWA1Z7dJoSqXmuCuog+LWtznSLmXhEMg9g617m4=@vger.kernel.org X-Gm-Message-State: AOJu0YztwSrwMCIXh/s3fcWEHfZ8tEVGMO6ZZhMAp2xwEMBKs8gQ0Fxc P99QF/3eouKO8ybLsoqFwMOHSvrlov6Pqf1hmTdMMkq+wPO8/j5TAoiMhVe5oRbImRlYXe1oCVN yHVCkzdWTShRiicW2MbeVc4//BtoQkYdzSvpxY3qYgX1DQ5hclvDmwNIDra+qT6HIc9M= X-Gm-Gg: ASbGncsKuiYS2fFAXYuv0vsZftiiT4px6Di6xJaEH1JsNEGtoDxmUqeD8iDYayJz7rB tUqsczBnJwERHRiUH/h75NKOttOFY5gv3y3S3XAbBsN4KRYtM4crKwUPQSbS4fjVWfz1J7q2R+g KRRnziOLOPIqMHBnPE14Mf+WlCiO9TkXzx5UomxtGcNp81v7k2ThgFHdlpbl1OqtnFD0Uy70+9F rIFvlY4Z5NvVhWqCSpuJMV+bGoy8+AisxlXXg8thgFZM3VviJjCnJFUEGG/TsMkjZzbMPMNyq1E Xepur9z/2J4UHpEit67hiaD9R5eKiIZ02bBAnKGJQpfCyErTUfxLMEejT3ZGP4vIFAnsaYSJNf8 tT9iyNG10pXghDtWGRUng9IJFBcAl2OnMxQ== X-Received: by 2002:a05:6a00:182a:b0:781:8680:3175 with SMTP id d2e1a72fcca58-7a220adb84cmr3939316b3a.21.1760710656521; Fri, 17 Oct 2025 07:17:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGuaa8+Dsf/MnYS+GbTx2sKQcxyr6H6Ypdpgab2zxTSrSkY6vf2MwCMQXh5GcliS/Sv+OiO6A== X-Received: by 2002:a05:6a00:182a:b0:781:8680:3175 with SMTP id d2e1a72fcca58-7a220adb84cmr3939263b3a.21.1760710655979; Fri, 17 Oct 2025 07:17:35 -0700 (PDT) Received: from hu-vgarodia-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0966d7sm25895826b3a.40.2025.10.17.07.17.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 07:17:35 -0700 (PDT) From: Vikash Garodia Date: Fri, 17 Oct 2025 19:46:27 +0530 Subject: [PATCH v2 6/8] media: iris: Move vpu35 specific api to common to use for vpu4 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: <20251017-knp_video-v2-6-f568ce1a4be3@oss.qualcomm.com> References: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> In-Reply-To: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> To: Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Dmitry Baryshkov , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy , Vikash Garodia X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760710621; l=14083; i=vikash.garodia@oss.qualcomm.com; s=20241104; h=from:subject:message-id; bh=XwjJpuMOMq7BISJ4RPudOTebpQlxQfmd6veQP0wZOgg=; b=T4huyblTD3We+dZdsh6vTRkf3pnO8MMUjVfsUAqDrmuJtxmC4Fb1xN9agReSdwKrSQiUjnk5M cdzRvEQicC4Bmr7Df8lgiZEohkctpuzyPs7XOtv5Z/aHBfxzc/UBCaJ X-Developer-Key: i=vikash.garodia@oss.qualcomm.com; a=ed25519; pk=LY9Eqp4KiHWxzGNKGHbwRFEJOfRCSzG/rxQNmvZvaKE= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDEzMDA4MyBTYWx0ZWRfX6tPS25QeW4f3 kSn1bp+IEpAk4dygcFuWQSXwNUGIqrFT4QXJpV3UnpVn9ABgxrM2gk3NJJRP+9qgv79+RbZqQ3v CToak+RBiM1MYHHeB7b5WkQPvVfjZn6pjfKXoGw4altKHXhw8zM21Z8aPFnwlVYfe+MOJf8GUuT /AZmC5M4sgOE8vF8OPjbZUihJQAp9vY+WpFR9eYmyAPN3VIeeRrA4BmI5qrD5ItGO14mDID5/ZU 25S+Ti0aYTXsB26VajFqh2DxwvZALXlOh2e+FZnc8DRACgeYH7Befjm8XCvEsGc+ONayknr9fBJ /1FptEAXWfPz2uhtj1leGqXBDxDF/BNn0Pt6mD0URs47WEPUoPvkH0rb5aHLQc81nA2AKFM4mL2 XedNJWPMrsWGSxFbppD0FE0cspPTQA== X-Authority-Analysis: v=2.4 cv=Fr4IPmrq c=1 sm=1 tr=0 ts=68f25001 cx=c_pps a=mDZGXZTwRPZaeRUbqKGCBw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=PEWMjObkg-UKx6eyHxAA:9 a=QEXdDO2ut3YA:10 a=zc0IvFSfCIW2DFIPzwfm:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: ELbjMzfNNppE9uYCwsRFM65Am-vDMAQO X-Proofpoint-ORIG-GUID: ELbjMzfNNppE9uYCwsRFM65Am-vDMAQO X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_05,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 impostorscore=0 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 suspectscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510130083 Some of the sequence and calculations for vpu4 is identical to vpu35, namely power sequence for vpu controller and the clock frequency calculation. Move those to common file that can be shared for both vpu35 and vpu4. This patch prepares for power sequence for vpu4 which is added in subsequent patch. Co-developed-by: Vishnu Reddy Signed-off-by: Vishnu Reddy Signed-off-by: Vikash Garodia Reviewed-by: Bryan O'Donoghue --- drivers/media/platform/qcom/iris/iris_vpu3x.c | 159 +----------------= ---- drivers/media/platform/qcom/iris/iris_vpu_common.c | 143 ++++++++++++++++++ drivers/media/platform/qcom/iris/iris_vpu_common.h | 4 + 3 files changed, 153 insertions(+), 153 deletions(-) diff --git a/drivers/media/platform/qcom/iris/iris_vpu3x.c b/drivers/media/= platform/qcom/iris/iris_vpu3x.c index 0ac6373c33b7ced75ac94ac86a1a8fc303f28b5d..3abfb74dbb10974c8fe3cedaf67= e8b4fca421015 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu3x.c +++ b/drivers/media/platform/qcom/iris/iris_vpu3x.c @@ -12,8 +12,6 @@ #include "iris_vpu_register_defines.h" =20 #define CORE_CLK_RUN 0x0 -/* VPU v3.5 */ -#define WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0 (WRAPPER_BASE_OFFS + 0x78) =20 #define VIDEO_NOC_RESET_REQ (BIT(0) | BIT(1)) =20 @@ -22,8 +20,6 @@ #define AON_WRAPPER_MVP_NOC_CORE_CLK_CONTROL (AON_BASE_OFFS + 0x20) #define NOC_HALT BIT(0) #define AON_WRAPPER_SPARE (AON_BASE_OFFS + 0x28) -#define AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_CONTROL (AON_BASE_OFFS + 0x2C) -#define AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_STATUS (AON_BASE_OFFS + 0x30) =20 static bool iris_vpu3x_hw_power_collapsed(struct iris_core *core) { @@ -268,155 +264,12 @@ static void iris_vpu35_power_off_hw(struct iris_core= *core) iris_disable_unprepare_clock(core, IRIS_AXI_CLK); } =20 -static int iris_vpu35_power_off_controller(struct iris_core *core) -{ - u32 clk_rst_tbl_size =3D core->iris_platform_data->clk_rst_tbl_size; - unsigned int count =3D 0; - u32 val =3D 0; - bool handshake_done, handshake_busy; - int ret; - - writel(MSK_SIGNAL_FROM_TENSILICA | MSK_CORE_POWER_ON, core->reg_base + CP= U_CS_X2RPMH); - - writel(REQ_POWER_DOWN_PREP, core->reg_base + WRAPPER_IRIS_CPU_NOC_LPI_CON= TROL); - - ret =3D readl_poll_timeout(core->reg_base + WRAPPER_IRIS_CPU_NOC_LPI_STAT= US, - val, val & BIT(0), 200, 2000); - if (ret) - goto disable_power; - - writel(0, core->reg_base + WRAPPER_IRIS_CPU_NOC_LPI_CONTROL); - - /* Retry up to 1000 times as recommended by hardware documentation */ - do { - /* set MNoC to low power */ - writel(REQ_POWER_DOWN_PREP, core->reg_base + AON_WRAPPER_MVP_VIDEO_CTL_N= OC_LPI_CONTROL); - - udelay(15); - - val =3D readl(core->reg_base + AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_STATUS); - - handshake_done =3D val & NOC_LPI_STATUS_DONE; - handshake_busy =3D val & (NOC_LPI_STATUS_DENY | NOC_LPI_STATUS_ACTIVE); - - if (handshake_done || !handshake_busy) - break; - - writel(0, core->reg_base + AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_CONTROL); - - udelay(15); - - } while (++count < 1000); - - if (!handshake_done && handshake_busy) - dev_err(core->dev, "LPI handshake timeout\n"); - - ret =3D readl_poll_timeout(core->reg_base + AON_WRAPPER_MVP_VIDEO_CTL_NOC= _LPI_STATUS, - val, val & BIT(0), 200, 2000); - if (ret) - goto disable_power; - - writel(0, core->reg_base + AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_CONTROL); - - writel(0, core->reg_base + WRAPPER_DEBUG_BRIDGE_LPI_CONTROL); - - ret =3D readl_poll_timeout(core->reg_base + WRAPPER_DEBUG_BRIDGE_LPI_STAT= US, - val, val =3D=3D 0, 200, 2000); - if (ret) - goto disable_power; - -disable_power: - iris_disable_unprepare_clock(core, IRIS_CTRL_CLK); - iris_disable_unprepare_clock(core, IRIS_CTRL_FREERUN_CLK); - iris_disable_unprepare_clock(core, IRIS_AXI1_CLK); - - iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_PO= WER_DOMAIN]); - - reset_control_bulk_reset(clk_rst_tbl_size, core->resets); - - return 0; -} - -static int iris_vpu35_power_on_controller(struct iris_core *core) -{ - int ret; - - ret =3D iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_= CTRL_POWER_DOMAIN]); - if (ret) - return ret; - - ret =3D iris_prepare_enable_clock(core, IRIS_AXI1_CLK); - if (ret) - goto err_disable_power; - - ret =3D iris_prepare_enable_clock(core, IRIS_CTRL_FREERUN_CLK); - if (ret) - goto err_disable_axi1_clk; - - ret =3D iris_prepare_enable_clock(core, IRIS_CTRL_CLK); - if (ret) - goto err_disable_ctrl_free_clk; - - return 0; - -err_disable_ctrl_free_clk: - iris_disable_unprepare_clock(core, IRIS_CTRL_FREERUN_CLK); -err_disable_axi1_clk: - iris_disable_unprepare_clock(core, IRIS_AXI1_CLK); -err_disable_power: - iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_PO= WER_DOMAIN]); - - return ret; -} - -static void iris_vpu35_program_bootup_registers(struct iris_core *core) -{ - writel(0x1, core->reg_base + WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0); -} - -static u64 iris_vpu3x_calculate_frequency(struct iris_inst *inst, size_t d= ata_size) -{ - struct platform_inst_caps *caps =3D inst->core->iris_platform_data->inst_= caps; - struct v4l2_format *inp_f =3D inst->fmt_src; - u32 height, width, mbs_per_second, mbpf; - u64 fw_cycles, fw_vpp_cycles; - u64 vsp_cycles, vpp_cycles; - u32 fps =3D DEFAULT_FPS; - - width =3D max(inp_f->fmt.pix_mp.width, inst->crop.width); - height =3D max(inp_f->fmt.pix_mp.height, inst->crop.height); - - mbpf =3D NUM_MBS_PER_FRAME(height, width); - mbs_per_second =3D mbpf * fps; - - fw_cycles =3D fps * caps->mb_cycles_fw; - fw_vpp_cycles =3D fps * caps->mb_cycles_fw_vpp; - - vpp_cycles =3D mult_frac(mbs_per_second, caps->mb_cycles_vpp, (u32)inst->= fw_caps[PIPE].value); - /* 21 / 20 is minimum overhead factor */ - vpp_cycles +=3D max(div_u64(vpp_cycles, 20), fw_vpp_cycles); - - /* 1.059 is multi-pipe overhead */ - if (inst->fw_caps[PIPE].value > 1) - vpp_cycles +=3D div_u64(vpp_cycles * 59, 1000); - - vsp_cycles =3D fps * data_size * 8; - vsp_cycles =3D div_u64(vsp_cycles, 2); - /* VSP FW overhead 1.05 */ - vsp_cycles =3D div_u64(vsp_cycles * 21, 20); - - if (inst->fw_caps[STAGE].value =3D=3D STAGE_1) - vsp_cycles =3D vsp_cycles * 3; - - return max3(vpp_cycles, vsp_cycles, fw_cycles); -} - const struct vpu_ops iris_vpu3_ops =3D { .power_off_hw =3D iris_vpu3_power_off_hardware, .power_on_hw =3D iris_vpu_power_on_hw, .power_off_controller =3D iris_vpu_power_off_controller, .power_on_controller =3D iris_vpu_power_on_controller, - .calc_freq =3D iris_vpu3x_calculate_frequency, + .calc_freq =3D iris_vpu3x_vpu4x_calculate_frequency, }; =20 const struct vpu_ops iris_vpu33_ops =3D { @@ -424,14 +277,14 @@ const struct vpu_ops iris_vpu33_ops =3D { .power_on_hw =3D iris_vpu_power_on_hw, .power_off_controller =3D iris_vpu33_power_off_controller, .power_on_controller =3D iris_vpu_power_on_controller, - .calc_freq =3D iris_vpu3x_calculate_frequency, + .calc_freq =3D iris_vpu3x_vpu4x_calculate_frequency, }; =20 const struct vpu_ops iris_vpu35_ops =3D { .power_off_hw =3D iris_vpu35_power_off_hw, .power_on_hw =3D iris_vpu35_power_on_hw, - .power_off_controller =3D iris_vpu35_power_off_controller, - .power_on_controller =3D iris_vpu35_power_on_controller, - .program_bootup_registers =3D iris_vpu35_program_bootup_registers, - .calc_freq =3D iris_vpu3x_calculate_frequency, + .power_off_controller =3D iris_vpu35_vpu4x_power_off_controller, + .power_on_controller =3D iris_vpu35_vpu4x_power_on_controller, + .program_bootup_registers =3D iris_vpu35_vpu4x_program_bootup_registers, + .calc_freq =3D iris_vpu3x_vpu4x_calculate_frequency, }; diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.c b/drivers/m= edia/platform/qcom/iris/iris_vpu_common.c index a7b1fb8173e02d22e6f2af4ea170738c6408f65b..dd0990d143a624d83e241d99702= 97ce1abe37f74 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_common.c +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.c @@ -8,6 +8,7 @@ #include =20 #include "iris_core.h" +#include "iris_instance.h" #include "iris_vpu_common.h" #include "iris_vpu_register_defines.h" =20 @@ -48,6 +49,10 @@ =20 #define WRAPPER_TZ_CPU_STATUS (WRAPPER_TZ_BASE_OFFS + 0x10) =20 +#define WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0 (WRAPPER_BASE_OFFS + 0x78) +#define AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_CONTROL (AON_BASE_OFFS + 0x2C) +#define AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_STATUS (AON_BASE_OFFS + 0x30) + static void iris_vpu_interrupt_init(struct iris_core *core) { u32 mask_val; @@ -309,6 +314,144 @@ int iris_vpu_power_on_hw(struct iris_core *core) return ret; } =20 +int iris_vpu35_vpu4x_power_off_controller(struct iris_core *core) +{ + u32 clk_rst_tbl_size =3D core->iris_platform_data->clk_rst_tbl_size; + bool handshake_done, handshake_busy; + u32 count =3D 0, val =3D 0; + int ret; + + writel(MSK_SIGNAL_FROM_TENSILICA | MSK_CORE_POWER_ON, core->reg_base + CP= U_CS_X2RPMH); + + writel(REQ_POWER_DOWN_PREP, core->reg_base + WRAPPER_IRIS_CPU_NOC_LPI_CON= TROL); + + ret =3D readl_poll_timeout(core->reg_base + WRAPPER_IRIS_CPU_NOC_LPI_STAT= US, + val, val & BIT(0), 200, 2000); + if (ret) + goto disable_power; + + writel(0, core->reg_base + WRAPPER_IRIS_CPU_NOC_LPI_CONTROL); + + /* Retry up to 1000 times as recommended by hardware documentation */ + do { + /* set MNoC to low power */ + writel(REQ_POWER_DOWN_PREP, core->reg_base + + AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_CONTROL); + usleep_range(10, 20); + val =3D readl(core->reg_base + AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_STATUS); + + handshake_done =3D val & NOC_LPI_STATUS_DONE; + handshake_busy =3D val & (NOC_LPI_STATUS_DENY | NOC_LPI_STATUS_ACTIVE); + + if (handshake_done || !handshake_busy) + break; + + writel(0, core->reg_base + AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_CONTROL); + usleep_range(10, 20); + + } while (++count < 1000); + + if (!handshake_done && handshake_busy) + dev_err(core->dev, "LPI handshake timeout\n"); + + ret =3D readl_poll_timeout(core->reg_base + AON_WRAPPER_MVP_VIDEO_CTL_NOC= _LPI_STATUS, + val, val & BIT(0), 200, 2000); + if (ret) + goto disable_power; + + writel(0, core->reg_base + AON_WRAPPER_MVP_VIDEO_CTL_NOC_LPI_CONTROL); + + writel(0, core->reg_base + WRAPPER_DEBUG_BRIDGE_LPI_CONTROL); + + readl_poll_timeout(core->reg_base + WRAPPER_DEBUG_BRIDGE_LPI_STATUS, + val, val =3D=3D 0, 200, 2000); + +disable_power: + iris_disable_unprepare_clock(core, IRIS_CTRL_CLK); + iris_disable_unprepare_clock(core, IRIS_CTRL_FREERUN_CLK); + iris_disable_unprepare_clock(core, IRIS_AXI1_CLK); + + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_PO= WER_DOMAIN]); + + reset_control_bulk_reset(clk_rst_tbl_size, core->resets); + + return 0; +} + +int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core) +{ + int ret; + + ret =3D iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_= CTRL_POWER_DOMAIN]); + if (ret) + return ret; + + ret =3D iris_prepare_enable_clock(core, IRIS_AXI1_CLK); + if (ret) + goto err_disable_power; + + ret =3D iris_prepare_enable_clock(core, IRIS_CTRL_FREERUN_CLK); + if (ret) + goto err_disable_axi1_clk; + + ret =3D iris_prepare_enable_clock(core, IRIS_CTRL_CLK); + if (ret) + goto err_disable_ctrl_free_clk; + + return 0; + +err_disable_ctrl_free_clk: + iris_disable_unprepare_clock(core, IRIS_CTRL_FREERUN_CLK); +err_disable_axi1_clk: + iris_disable_unprepare_clock(core, IRIS_AXI1_CLK); +err_disable_power: + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_CTRL_PO= WER_DOMAIN]); + + return ret; +} + +void iris_vpu35_vpu4x_program_bootup_registers(struct iris_core *core) +{ + writel(0x1, core->reg_base + WRAPPER_IRIS_VCODEC_VPU_WRAPPER_SPARE_0); +} + +u64 iris_vpu3x_vpu4x_calculate_frequency(struct iris_inst *inst, size_t da= ta_size) +{ + struct platform_inst_caps *caps =3D inst->core->iris_platform_data->inst_= caps; + struct v4l2_format *inp_f =3D inst->fmt_src; + u32 height, width, mbs_per_second, mbpf; + u64 fw_cycles, fw_vpp_cycles; + u64 vsp_cycles, vpp_cycles; + u32 fps =3D DEFAULT_FPS; + + width =3D max(inp_f->fmt.pix_mp.width, inst->crop.width); + height =3D max(inp_f->fmt.pix_mp.height, inst->crop.height); + + mbpf =3D NUM_MBS_PER_FRAME(height, width); + mbs_per_second =3D mbpf * fps; + + fw_cycles =3D fps * caps->mb_cycles_fw; + fw_vpp_cycles =3D fps * caps->mb_cycles_fw_vpp; + + vpp_cycles =3D mult_frac(mbs_per_second, caps->mb_cycles_vpp, (u32)inst->= fw_caps[PIPE].value); + /* 21 / 20 is minimum overhead factor */ + vpp_cycles +=3D max(div_u64(vpp_cycles, 20), fw_vpp_cycles); + + /* 1.059 is multi-pipe overhead */ + if (inst->fw_caps[PIPE].value > 1) + vpp_cycles +=3D div_u64(vpp_cycles * 59, 1000); + + vsp_cycles =3D fps * data_size * 8; + vsp_cycles =3D div_u64(vsp_cycles, 2); + /* VSP FW overhead 1.05 */ + vsp_cycles =3D div_u64(vsp_cycles * 21, 20); + + if (inst->fw_caps[STAGE].value =3D=3D STAGE_1) + vsp_cycles =3D vsp_cycles * 3; + + return max3(vpp_cycles, vsp_cycles, fw_cycles); +} + int iris_vpu_power_on(struct iris_core *core) { u32 freq; diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.h b/drivers/m= edia/platform/qcom/iris/iris_vpu_common.h index d636e287457adf0c44540af5c85cfa69decbca8b..7cf4304604cca590544a938c7e8= 11c202cea3d93 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_common.h +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.h @@ -33,5 +33,9 @@ int iris_vpu_power_on(struct iris_core *core); int iris_vpu_power_off_controller(struct iris_core *core); void iris_vpu_power_off_hw(struct iris_core *core); void iris_vpu_power_off(struct iris_core *core); +int iris_vpu35_vpu4x_power_off_controller(struct iris_core *core); +int iris_vpu35_vpu4x_power_on_controller(struct iris_core *core); +void iris_vpu35_vpu4x_program_bootup_registers(struct iris_core *core); +u64 iris_vpu3x_vpu4x_calculate_frequency(struct iris_inst *inst, size_t da= ta_size); =20 #endif --=20 2.34.1 From nobody Mon Feb 9 07:43:11 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 CC2EF36CE17 for ; Fri, 17 Oct 2025 14:17:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710665; cv=none; b=ck50C3dNPcYDKoSDwiHaPu9Ob2kvX+Q7dFZzcf2NSFQPbni6a47FykIPqmpZ6cJD/13X+ywwOBQjYq3syIP0X9yl5Cmord+o8rOKBW2Pqt5fk1BggtCGIHFrJbPPfeoyEBn4kYYPT/UnaLR0OgDdQzPwtFltyLrut0DE0G2FmqU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710665; c=relaxed/simple; bh=ZRzKQTaEbVIIvIehiMq8D+/8y/lZkfqQ6d+kBFPkY2Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lj3F5PpuuzWWXPkYTDWwxHzakoreCPJ25oNlIsUucVY2MB4qPgb1TScI36lStrhIiikxtwGf4B0LolM/WW7f4WGt5c0/moGXSGGiKfpQd+EkNDe3VPqChe2o/dw8WsdtieWdhZ+hX+HivpXqCBh72I5H2b6wSNVbeGjYYUrA3Yk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=Q4T0L+ad; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="Q4T0L+ad" Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59H8GCv9025396 for ; Fri, 17 Oct 2025 14:17:43 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= S9P/spMWDSvK8n5V3j1/tJefjc0pI9i/ss95ltdubpA=; b=Q4T0L+adlEY8Oype FkCNZqkBRsgO8gGuv5gKoSk2KJ/FSnft2QYnMJzWouippMhNjbNasiIRy0klqFcr QzdeebLD+7opExc8AtN13Sai6DkokRJZQqbZkCTlv6lqWJzP2qT6UbgBQvzfgivZ 4YCd6q17I66IDJXCVHqSDciss+NKPl9/32S2evv3f16JuUhCMCtfehqgRmt5APp4 Mdy9Q2L/QmTquD3vwE5eL+ie9uFQ2m0oox6Vldx95H0be7bJaQtGDB3pOuQVOB4H eWZ7Doj7m/ie9a19vKTzW0Y0IT6B4Nd8fJqCSc90lr559Beu7IwNbjrgbHJ1E5n2 xjORIw== Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49qfdkmeyy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 14:17:42 +0000 (GMT) Received: by mail-pf1-f198.google.com with SMTP id d2e1a72fcca58-783c3400b5dso1477668b3a.1 for ; Fri, 17 Oct 2025 07:17:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760710661; x=1761315461; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=S9P/spMWDSvK8n5V3j1/tJefjc0pI9i/ss95ltdubpA=; b=LWgDarHfzwwLq5K+9/F6SxSno4YWRmVaiWgqfj91FDlWJW/psNca8w0guHEkRaPP2b SXLs8IHQVQG6//5DDUSIcRyJzMLYSgkJXLvAfoa75m97R55y/fs7nggsPFtNlmzDIcq1 8FGb6R5biiQrkdZP6tC4ieeKJtunhWXB/hhG2KrDhKqFDvvIRuW3yFGbEOIzTjDDisNs 4LlYaeBH4iPeHtAss+g304TzDmLGoYbsoQS/3Ko+lwulafBQ7mgi6zLEwxaQPsVAwPX3 WsTVIYk8vhuXcmU2WVFGXt+mwp7HW793J4X8ES+7QzTPz5VQ5iNos/1qCiTK5Z6XQox3 7Tfg== X-Forwarded-Encrypted: i=1; AJvYcCWzfWOgjIeburKlPjRwT7LTNlXiIkkRmBSOrNGRwQASScsufw8iwiiqVW8eKIydz3Btqtx/qmhy6UnMKqI=@vger.kernel.org X-Gm-Message-State: AOJu0YzJK17dH8VBVqwTrsqfMF02LzXVQF1j4WtV+MHyRFljBMq5UM1g 5pR/XJY76gAb9CAoNqST87R4qDlWyVvWLg1LfG97DHHuu71X/kfFXL/5W6tl6ein0jL0BiIDuBe DyCtjW1yrCy5pSwCRwsc6IloPArcFBoxcKC3yKJnZHGf/CkrzPoQ+3Q3O/80zMoqj5KI= X-Gm-Gg: ASbGncspeQ8fzZrwLzZJ/i8EiREPEgjMhcsc6mBid0d8DCJ0Xcdf6ePH8nXOIvAASNB yiF0pZ5nZKFKN1IJcTDQBZDTaGwWXCwU+NbhakNVmr/EPvJvUCLYKN4h1G5Fj6cBBn8W1HZDwn1 tbERidJleEbrb6yd3I0BbPhlhwLc48oNlFhO/b/KFYngdj54FRIUL160juh8jYQqg4ucrIrHslj 9lAd8cL1heeZ+R1FwWYnGAjfyUZTwrk+c+nGlAMRjJGYSEUDzDpXkSbytYK1paBzMEZh4grdVVn rVitQvRtg1tbKDzqKH5pazr1k5eRzeIgPhT2pY1vyWyrpfKMQ2+l1yR58UviUaxvyg7Z2D1sP2S J51Mq2kNTb4hkZCz77BPthPGUFBtjV5qUbw== X-Received: by 2002:a05:6a21:99a0:b0:2e5:655c:7f86 with SMTP id adf61e73a8af0-334a8607807mr5478485637.39.1760710661359; Fri, 17 Oct 2025 07:17:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHcoOAhExBAilUBBlvofBF8gyCFAX8gtWT/CWRRCPM9s2CiYNdJfbxqhmC/5FcOsP1jM+Sukg== X-Received: by 2002:a05:6a21:99a0:b0:2e5:655c:7f86 with SMTP id adf61e73a8af0-334a8607807mr5478446637.39.1760710660847; Fri, 17 Oct 2025 07:17:40 -0700 (PDT) Received: from hu-vgarodia-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0966d7sm25895826b3a.40.2025.10.17.07.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 07:17:40 -0700 (PDT) From: Vikash Garodia Date: Fri, 17 Oct 2025 19:46:28 +0530 Subject: [PATCH v2 7/8] media: iris: Introduce vpu ops for vpu4 with necessary hooks 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: <20251017-knp_video-v2-7-f568ce1a4be3@oss.qualcomm.com> References: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> In-Reply-To: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> To: Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Dmitry Baryshkov , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy , Vikash Garodia X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760710621; l=14953; i=vikash.garodia@oss.qualcomm.com; s=20241104; h=from:subject:message-id; bh=ZRzKQTaEbVIIvIehiMq8D+/8y/lZkfqQ6d+kBFPkY2Y=; b=qNSZHNJgGpC4RMuj3gqjMrhF3zKar7SBorln9NUQ944/pGv9r6ey/yqhfdyH5JDEcFk47EGZC L+yfYQdZ1gUCAa5DHG68jqfLyeY9AoqYu+v5bPV8Rh2/QOL7iO1BnKh X-Developer-Key: i=vikash.garodia@oss.qualcomm.com; a=ed25519; pk=LY9Eqp4KiHWxzGNKGHbwRFEJOfRCSzG/rxQNmvZvaKE= X-Proofpoint-ORIG-GUID: m0u5tYD8-130f_2cWl-Yb-Q7xyDQttSF X-Authority-Analysis: v=2.4 cv=MrNfKmae c=1 sm=1 tr=0 ts=68f25006 cx=c_pps a=m5Vt/hrsBiPMCU0y4gIsQw==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=V7PGPLsNbH-VDMjO_1gA:9 a=QEXdDO2ut3YA:10 a=IoOABgeZipijB_acs4fv:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: m0u5tYD8-130f_2cWl-Yb-Q7xyDQttSF X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDExMDAxOCBTYWx0ZWRfX3wq3OKva20wv JJlXztIlWmBxc3bRQVObW3PmJ/HM4pPDjhcZ58pXoMTws88e90mDZAZDy4wZEUVc61FTnk2WFXo WEJ/16MSjVREx8469wqmxHzSrfKIzbsQAunJ6043/he4spmMaQXu4imG716QTvaYeUbo3EhwhfV LTQ7Hg3Zj7gJxaYAiwzvtcrNvPr8DzWW0tb3IovSUxCwYtZ1gDLZOKod4KSgjGss2RIgfecdQDy 2xUr6haq6SLn3pHiDa7VPAiZUM/xOadiOJLHF8bex6RV7FsFXZZnIciOt67V7iRACAZ1GoOawoD 592xANlFkx25Jqu7TQS7sF4xkQXIq52LEXb5qoYXb7lzARuc8Jl8Na8vP4jp5FieSJTcgXAxSB8 yyWTGCbgX2DR75BlwfFxkQrBvrrEzA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_05,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 bulkscore=0 clxscore=1015 adultscore=0 phishscore=0 impostorscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510110018 Add power sequence for vpu4 by reusing from previous generation wherever possible. Hook up vpu4 op with vpu4 specific implemtation or resue from earlier generation wherever feasible, like clock calculation in this case. Co-developed-by: Vishnu Reddy Signed-off-by: Vishnu Reddy Signed-off-by: Vikash Garodia --- drivers/media/platform/qcom/iris/Makefile | 1 + .../platform/qcom/iris/iris_platform_common.h | 7 + drivers/media/platform/qcom/iris/iris_vpu4x.c | 358 +++++++++++++++++= ++++ drivers/media/platform/qcom/iris/iris_vpu_common.h | 1 + 4 files changed, 367 insertions(+) diff --git a/drivers/media/platform/qcom/iris/Makefile b/drivers/media/plat= form/qcom/iris/Makefile index 13270cd6d899852dded675b33d37f5919b81ccba..1446f5732ab51db85ea4f52636d= 29e36d82b7a8f 100644 --- a/drivers/media/platform/qcom/iris/Makefile +++ b/drivers/media/platform/qcom/iris/Makefile @@ -22,6 +22,7 @@ qcom-iris-objs +=3D iris_buffer.o \ iris_venc.o \ iris_vpu2.o \ iris_vpu3x.o \ + iris_vpu4x.o \ iris_vpu_buffer.o \ iris_vpu_common.o \ =20 diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/driv= ers/media/platform/qcom/iris/iris_platform_common.h index ae49e95ba2252fc1442f7c81d8010dbfd86da0da..d6d4a9fdfc189797f903dfeb56d= 931741b405ee2 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -54,6 +54,10 @@ enum platform_clk_type { IRIS_AXI1_CLK, IRIS_CTRL_FREERUN_CLK, IRIS_HW_FREERUN_CLK, + IRIS_BSE_HW_CLK, + IRIS_VPP0_HW_CLK, + IRIS_VPP1_HW_CLK, + IRIS_APV_HW_CLK, }; =20 struct platform_clk_data { @@ -188,6 +192,9 @@ struct icc_vote_data { enum platform_pm_domain_type { IRIS_CTRL_POWER_DOMAIN, IRIS_HW_POWER_DOMAIN, + IRIS_VPP0_HW_POWER_DOMAIN, + IRIS_VPP1_HW_POWER_DOMAIN, + IRIS_APV_HW_POWER_DOMAIN, }; =20 struct iris_platform_data { diff --git a/drivers/media/platform/qcom/iris/iris_vpu4x.c b/drivers/media/= platform/qcom/iris/iris_vpu4x.c new file mode 100644 index 0000000000000000000000000000000000000000..fa72f16ac38dcbc061698e3d496= a1d2bbf17be27 --- /dev/null +++ b/drivers/media/platform/qcom/iris/iris_vpu4x.c @@ -0,0 +1,358 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#include +#include + +#include "iris_instance.h" +#include "iris_vpu_common.h" +#include "iris_vpu_register_defines.h" + +#define AON_WRAPPER_MVP_NOC_RESET_SYNCRST (AON_MVP_NOC_RESET + 0x08) +#define CPU_CS_APV_BRIDGE_SYNC_RESET (CPU_BASE_OFFS + 0x174) +#define MVP_NOC_RESET_REQ_MASK 0x70103 +#define VPU_IDLE_BITS 0x7103 +#define WRAPPER_EFUSE_MONITOR (WRAPPER_BASE_OFFS + 0x08) + +#define APV_CLK_HALT BIT(1) +#define CORE_CLK_HALT BIT(0) +#define CORE_PWR_ON BIT(1) +#define DISABLE_VIDEO_APV_BIT BIT(27) +#define DISABLE_VIDEO_VPP1_BIT BIT(28) +#define DISABLE_VIDEO_VPP0_BIT BIT(29) + +static int iris_vpu4x_genpd_set_hwmode(struct iris_core *core, bool hw_mod= e, u32 efuse_value) +{ + int ret; + + ret =3D dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_HW_POWER= _DOMAIN], hw_mode); + if (ret) + return ret; + + if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) { + ret =3D dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs + [IRIS_VPP0_HW_POWER_DOMAIN], hw_mode); + if (ret) + goto restore_hw_domain_mode; + } + + if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT)) { + ret =3D dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs + [IRIS_VPP1_HW_POWER_DOMAIN], hw_mode); + if (ret) + goto restore_vpp0_domain_mode; + } + + if (!(efuse_value & DISABLE_VIDEO_APV_BIT)) { + ret =3D dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs + [IRIS_APV_HW_POWER_DOMAIN], hw_mode); + if (ret) + goto restore_vpp1_domain_mode; + } + + return 0; + +restore_vpp1_domain_mode: + if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT)) + dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_VPP1_HW_POWER_D= OMAIN], + !hw_mode); +restore_vpp0_domain_mode: + if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) + dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_VPP0_HW_POWER_D= OMAIN], + !hw_mode); +restore_hw_domain_mode: + dev_pm_genpd_set_hwmode(core->pmdomain_tbl->pd_devs[IRIS_HW_POWER_DOMAIN]= , !hw_mode); + + return ret; +} + +static int iris_vpu4x_power_on_apv(struct iris_core *core) +{ + int ret; + + ret =3D iris_enable_power_domains(core, + core->pmdomain_tbl->pd_devs[IRIS_APV_HW_POWER_DOMAIN]); + if (ret) + return ret; + + ret =3D iris_prepare_enable_clock(core, IRIS_APV_HW_CLK); + if (ret) + goto disable_apv_hw_power_domain; + + return 0; + +disable_apv_hw_power_domain: + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_APV_HW_= POWER_DOMAIN]); + + return ret; +} + +static void iris_vpu4x_power_off_apv(struct iris_core *core) +{ + bool handshake_done, handshake_busy; + u32 value, count =3D 0; + + value =3D readl(core->reg_base + WRAPPER_CORE_CLOCK_CONFIG); + + if (value & APV_CLK_HALT) + writel(0x0, core->reg_base + WRAPPER_CORE_CLOCK_CONFIG); + + do { + writel(REQ_POWER_DOWN_PREP, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CON= TROL); + usleep_range(10, 20); + value =3D readl(core->reg_base + AON_WRAPPER_MVP_NOC_LPI_STATUS); + + handshake_done =3D value & NOC_LPI_STATUS_DONE; + handshake_busy =3D value & (NOC_LPI_STATUS_DENY | NOC_LPI_STATUS_ACTIVE); + + if (handshake_done || !handshake_busy) + break; + + writel(0x0, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL); + usleep_range(10, 20); + + } while (++count < 1000); + + if (!handshake_done && handshake_busy) + dev_err(core->dev, "LPI handshake timeout\n"); + + writel(0x080200, core->reg_base + AON_WRAPPER_MVP_NOC_RESET_REQ); + readl_poll_timeout(core->reg_base + AON_WRAPPER_MVP_NOC_RESET_ACK, + value, value & 0x080200, 200, 2000); + + writel(0x0, core->reg_base + AON_WRAPPER_MVP_NOC_RESET_SYNCRST); + writel(0x0, core->reg_base + AON_WRAPPER_MVP_NOC_RESET_REQ); + readl_poll_timeout(core->reg_base + AON_WRAPPER_MVP_NOC_RESET_ACK, + value, value =3D=3D 0x0, 200, 2000); + + writel(CORE_BRIDGE_SW_RESET | CORE_BRIDGE_HW_RESET_DISABLE, core->reg_bas= e + + CPU_CS_APV_BRIDGE_SYNC_RESET); + writel(CORE_BRIDGE_HW_RESET_DISABLE, core->reg_base + CPU_CS_APV_BRIDGE_S= YNC_RESET); + writel(0x0, core->reg_base + CPU_CS_APV_BRIDGE_SYNC_RESET); + + iris_disable_unprepare_clock(core, IRIS_APV_HW_CLK); + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_APV_HW_= POWER_DOMAIN]); +} + +static void iris_vpu4x_ahb_sync_reset_apv(struct iris_core *core) +{ + writel(CORE_BRIDGE_SW_RESET | CORE_BRIDGE_HW_RESET_DISABLE, core->reg_bas= e + + CPU_CS_APV_BRIDGE_SYNC_RESET); + writel(CORE_BRIDGE_HW_RESET_DISABLE, core->reg_base + CPU_CS_APV_BRIDGE_S= YNC_RESET); + writel(0x0, core->reg_base + CPU_CS_APV_BRIDGE_SYNC_RESET); +} + +static void iris_vpu4x_ahb_sync_reset_hardware(struct iris_core *core) +{ + writel(CORE_BRIDGE_SW_RESET | CORE_BRIDGE_HW_RESET_DISABLE, core->reg_bas= e + + CPU_CS_AHB_BRIDGE_SYNC_RESET); + writel(CORE_BRIDGE_HW_RESET_DISABLE, core->reg_base + CPU_CS_AHB_BRIDGE_S= YNC_RESET); + writel(0x0, core->reg_base + CPU_CS_AHB_BRIDGE_SYNC_RESET); +} + +static int iris_vpu4x_enable_hardware_clocks(struct iris_core *core, u32 e= fuse_value) +{ + int ret; + + ret =3D iris_prepare_enable_clock(core, IRIS_AXI_CLK); + if (ret) + return ret; + + ret =3D iris_prepare_enable_clock(core, IRIS_HW_FREERUN_CLK); + if (ret) + goto disable_axi_clock; + + ret =3D iris_prepare_enable_clock(core, IRIS_HW_CLK); + if (ret) + goto disable_hw_free_run_clock; + + ret =3D iris_prepare_enable_clock(core, IRIS_BSE_HW_CLK); + if (ret) + goto disable_hw_clock; + + if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) { + ret =3D iris_prepare_enable_clock(core, IRIS_VPP0_HW_CLK); + if (ret) + goto disable_bse_hw_clock; + } + + if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT)) { + ret =3D iris_prepare_enable_clock(core, IRIS_VPP1_HW_CLK); + if (ret) + goto disable_vpp0_hw_clock; + } + + return 0; + +disable_vpp0_hw_clock: + if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) + iris_disable_unprepare_clock(core, IRIS_VPP0_HW_CLK); +disable_bse_hw_clock: + iris_disable_unprepare_clock(core, IRIS_BSE_HW_CLK); +disable_hw_clock: + iris_disable_unprepare_clock(core, IRIS_HW_CLK); +disable_hw_free_run_clock: + iris_disable_unprepare_clock(core, IRIS_HW_FREERUN_CLK); +disable_axi_clock: + iris_disable_unprepare_clock(core, IRIS_AXI_CLK); + + return ret; +} + +static void iris_vpu4x_disable_hardware_clocks(struct iris_core *core, u32= efuse_value) +{ + if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT)) + iris_disable_unprepare_clock(core, IRIS_VPP1_HW_CLK); + + if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) + iris_disable_unprepare_clock(core, IRIS_VPP0_HW_CLK); + + iris_disable_unprepare_clock(core, IRIS_BSE_HW_CLK); + iris_disable_unprepare_clock(core, IRIS_HW_CLK); + iris_disable_unprepare_clock(core, IRIS_HW_FREERUN_CLK); + iris_disable_unprepare_clock(core, IRIS_AXI_CLK); +} + +static int iris_vpu4x_power_on_hardware(struct iris_core *core) +{ + u32 efuse_value =3D readl(core->reg_base + WRAPPER_EFUSE_MONITOR); + int ret; + + ret =3D iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_= HW_POWER_DOMAIN]); + if (ret) + return ret; + + if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) { + ret =3D iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs + [IRIS_VPP0_HW_POWER_DOMAIN]); + if (ret) + goto disable_hw_power_domain; + } + + if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT)) { + ret =3D iris_enable_power_domains(core, core->pmdomain_tbl->pd_devs + [IRIS_VPP1_HW_POWER_DOMAIN]); + if (ret) + goto disable_vpp0_power_domain; + } + + ret =3D iris_vpu4x_enable_hardware_clocks(core, efuse_value); + if (ret) + goto disable_vpp1_power_domain; + + if (!(efuse_value & DISABLE_VIDEO_APV_BIT)) { + ret =3D iris_vpu4x_power_on_apv(core); + if (ret) + goto disable_hw_clocks; + + iris_vpu4x_ahb_sync_reset_apv(core); + } + + iris_vpu4x_ahb_sync_reset_hardware(core); + + ret =3D iris_vpu4x_genpd_set_hwmode(core, true, efuse_value); + if (ret) + goto disable_apv_power_domain; + + return 0; + +disable_apv_power_domain: + if (!(efuse_value & DISABLE_VIDEO_APV_BIT)) + iris_vpu4x_power_off_apv(core); +disable_hw_clocks: + iris_vpu4x_disable_hardware_clocks(core, efuse_value); +disable_vpp1_power_domain: + if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT)) + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs + [IRIS_VPP1_HW_POWER_DOMAIN]); +disable_vpp0_power_domain: + if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs + [IRIS_VPP0_HW_POWER_DOMAIN]); +disable_hw_power_domain: + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWE= R_DOMAIN]); + + return ret; +} + +static void iris_vpu4x_power_off_hardware(struct iris_core *core) +{ + u32 efuse_value =3D readl(core->reg_base + WRAPPER_EFUSE_MONITOR); + bool handshake_done, handshake_busy; + u32 value, count =3D 0; + + iris_vpu4x_genpd_set_hwmode(core, false, efuse_value); + + if (!(efuse_value & DISABLE_VIDEO_APV_BIT)) + iris_vpu4x_power_off_apv(core); + + value =3D readl(core->reg_base + WRAPPER_CORE_POWER_STATUS); + + if (!(value & CORE_PWR_ON)) + goto disable_clocks_and_power; + + value =3D readl(core->reg_base + WRAPPER_CORE_CLOCK_CONFIG); + + if (value & CORE_CLK_HALT) + writel(0x0, core->reg_base + WRAPPER_CORE_CLOCK_CONFIG); + + readl_poll_timeout(core->reg_base + VCODEC_SS_IDLE_STATUSN, value, + value & VPU_IDLE_BITS, 2000, 20000); + + do { + writel(REQ_POWER_DOWN_PREP, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CON= TROL); + usleep_range(10, 20); + value =3D readl(core->reg_base + AON_WRAPPER_MVP_NOC_LPI_STATUS); + + handshake_done =3D value & NOC_LPI_STATUS_DONE; + handshake_busy =3D value & (NOC_LPI_STATUS_DENY | NOC_LPI_STATUS_ACTIVE); + + if (handshake_done || !handshake_busy) + break; + + writel(0x0, core->reg_base + AON_WRAPPER_MVP_NOC_LPI_CONTROL); + usleep_range(10, 20); + + } while (++count < 1000); + + if (!handshake_done && handshake_busy) + dev_err(core->dev, "LPI handshake timeout\n"); + + writel(MVP_NOC_RESET_REQ_MASK, core->reg_base + AON_WRAPPER_MVP_NOC_RESET= _REQ); + readl_poll_timeout(core->reg_base + AON_WRAPPER_MVP_NOC_RESET_ACK, + value, value =3D=3D MVP_NOC_RESET_REQ_MASK, 200, 2000); + + writel(0x0, core->reg_base + AON_WRAPPER_MVP_NOC_RESET_SYNCRST); + writel(0x0, core->reg_base + AON_WRAPPER_MVP_NOC_RESET_REQ); + readl_poll_timeout(core->reg_base + AON_WRAPPER_MVP_NOC_RESET_ACK, + value, value =3D=3D 0x0, 200, 2000); + + writel(CORE_BRIDGE_SW_RESET | CORE_BRIDGE_HW_RESET_DISABLE, core->reg_bas= e + + CPU_CS_AHB_BRIDGE_SYNC_RESET); + writel(CORE_BRIDGE_HW_RESET_DISABLE, core->reg_base + CPU_CS_AHB_BRIDGE_S= YNC_RESET); + writel(0x0, core->reg_base + CPU_CS_AHB_BRIDGE_SYNC_RESET); + +disable_clocks_and_power: + iris_vpu4x_disable_hardware_clocks(core, efuse_value); + + if (!(efuse_value & DISABLE_VIDEO_VPP1_BIT)) + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs + [IRIS_VPP1_HW_POWER_DOMAIN]); + + if (!(efuse_value & DISABLE_VIDEO_VPP0_BIT)) + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs + [IRIS_VPP0_HW_POWER_DOMAIN]); + + iris_disable_power_domains(core, core->pmdomain_tbl->pd_devs[IRIS_HW_POWE= R_DOMAIN]); +} + +const struct vpu_ops iris_vpu4x_ops =3D { + .power_off_hw =3D iris_vpu4x_power_off_hardware, + .power_on_hw =3D iris_vpu4x_power_on_hardware, + .power_off_controller =3D iris_vpu35_vpu4x_power_off_controller, + .power_on_controller =3D iris_vpu35_vpu4x_power_on_controller, + .program_bootup_registers =3D iris_vpu35_vpu4x_program_bootup_registers, + .calc_freq =3D iris_vpu3x_vpu4x_calculate_frequency, +}; diff --git a/drivers/media/platform/qcom/iris/iris_vpu_common.h b/drivers/m= edia/platform/qcom/iris/iris_vpu_common.h index 7cf4304604cca590544a938c7e811c202cea3d93..f6dffc613b822341fb21e12de6b= 1395202f62cde 100644 --- a/drivers/media/platform/qcom/iris/iris_vpu_common.h +++ b/drivers/media/platform/qcom/iris/iris_vpu_common.h @@ -12,6 +12,7 @@ extern const struct vpu_ops iris_vpu2_ops; extern const struct vpu_ops iris_vpu3_ops; extern const struct vpu_ops iris_vpu33_ops; extern const struct vpu_ops iris_vpu35_ops; +extern const struct vpu_ops iris_vpu4x_ops; =20 struct vpu_ops { void (*power_off_hw)(struct iris_core *core); --=20 2.34.1 From nobody Mon Feb 9 07:43:11 2026 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 056A0336EFF for ; Fri, 17 Oct 2025 14:17:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710670; cv=none; b=Gchgh2g2nJgkFWJlJ0gUeesAgMOJ4jAAw5gD9ayCx4QU7LzgbeKcGLEUJcui1eCyICg2lhA0lY0d4U4Mp4cQQbv6ONU8/Sox5lnTJLyh47XuTsi+Vyuwo2MrJFtpufQeympVlR+QhNVM2kWUqdrvZ4MnfiVQNlFQzfy2XxEwbVU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1760710670; c=relaxed/simple; bh=94zn2oaEs2/tPLmKQcuLmcTARdo0LUWMIIHm7rC4jyI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qoIY7NvWmnYoRFnwEfnnE9mEWqJbZvpL2+JysSbfL7pX56fMco4k3dNfVU953xGaK+jmSIVvOLOTFnESlvY/lNmTAV23gzREDgaWjueMICP1UMyWPGsogDb8EwGI6kF8JhFpesyEyWHzVR7WULb7f7cCLKHKNcLlsAni036bspE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=IH+kjjnK; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject 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.b="IH+kjjnK" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 59H8DUpY022287 for ; Fri, 17 Oct 2025 14:17:48 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= ZkUetV3KJGXhfQiLm06E+7IVEXhrZeYr95rdHWhTFog=; b=IH+kjjnKhPTI9d7I uHwlosNjcSa6+EsiiBnIEhaSsYnUOUXBp91TwSJ3DszSs78yO/towp0XHbjRpuDx KrjqoK6HFq+sI+L6Uwlo2aJP5/VJzwa62jAmdkC84V3vksXZ+of9FX8H1k2Ddfkn eqNBh9+tp2mNDtoc0TE3UXClIv+SSECUKkqzvXK53PXZ+UzY2tlpejfgWG0zvlyG kcUn55iZPerGq73bSk8uIZ4vSnnE8Ya+UKWn7zVJLqzd6ZlyHdJyaZvGWe7DwFn5 QtX/TSk5cAKZyaVzSL6ShnqHI0xAJtijcG1sbpcLHcL/MwHf93Bf2w8sPnJyd6Tt VS/WeQ== Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 49rtrthffy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Fri, 17 Oct 2025 14:17:48 +0000 (GMT) Received: by mail-pf1-f199.google.com with SMTP id d2e1a72fcca58-7811a602576so2787876b3a.0 for ; Fri, 17 Oct 2025 07:17:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1760710667; x=1761315467; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZkUetV3KJGXhfQiLm06E+7IVEXhrZeYr95rdHWhTFog=; b=QQOOAXR4dQP7vurAImslaMQ/0hEyFqnLt5Ub3ZHpoythnfaBqTbTMgGhS+J4QQu1o8 IpVPCf7UlwOuwBpBmX4Gm/dfhtpgLW9vlG4uTs+1QpMX2uo2mTJMXWP7aSRC9LCZn4A8 nVAKmnrYto/im9mS45Q/asuWK1LMigwQfB/Fffg4sF5BFLIf/EcQncvIkwMPJW89D+E7 PLG5UuLTx40U7IeKgqyxyJbsnRglX7tO2J9/9smvA2IdlfmVrIddR2k0cJymKi2W9T04 tx0hVmI9+3aWfr+lYiJC+4Q/umnAfj9NA1h8NVxqWv7dTVA53n2HqkrOaoIQ4Vm7TDXX jsZQ== X-Forwarded-Encrypted: i=1; AJvYcCXOg/DLtUaxU85dc90x4r0XQow1blZQSKCNAsf2gOXP2gea+pZasa7dXaP66qswUt2742kyWONgLDxPMJc=@vger.kernel.org X-Gm-Message-State: AOJu0Yw9g7Cn4VE8KFK91BnX3z61hBkRuKPU47BFEuM+n+KtfIQQcsYO lvJjNMMFn3IYLaD7pIk/4I7ZFEKgi2ophTCa0OaPvDGeQSccgfqNQOucQNUtK9mhMLvWrKNQHB+ Aem5Tg80fY84OT7fm45ed3vm/k+tH+sfCxiFOb71VjSo2XuOuVj+kBFXpSROTnIRBlrE= X-Gm-Gg: ASbGncuhXJbtyoxoafmmzYgu7zCxLDny4fxxG4R5gwJBIFNIQVoMA8FSCvKgQSo2WWA 3OSUj3/vWZEx56q65mctdzp3MItiQLHopUCsiEJERsGKBvFk5aFEmdoTxjeDPVYXtKrwSiYrnsb 3ADIExc+/Yd8bfLPXM+QzalrMTs5dKSTpv0aJshJUdq8m9kUfF1QHJtDnNKPH1fopsEM8jj7gBH cS/tdLpSWqGqGjKTrAu1T/5Vtr22LOLpRc5QdjCg3ZLnd9FK5q4O1I+gW29Lf0schL4Qu39a/d0 h8/r3hFbp7zRFwbBJ5VWEgcJ2VJhPRtoM3t8zGje9GqyIfhoCezb8e6dekiwb9yyHkM++I8rnSj xnT5ozFY9eoveK7MGWRZwDErXBW0TqxCGWQ== X-Received: by 2002:a05:6a20:42a3:b0:334:a82b:97d0 with SMTP id adf61e73a8af0-334a84cf411mr4798304637.22.1760710666479; Fri, 17 Oct 2025 07:17:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH1K0BwIFhCxW9E7gPpQWafSheAdYCei9+vs2ra04WnLUz4ftpn6En0/NIln+gDf3YNJ5bVgA== X-Received: by 2002:a05:6a20:42a3:b0:334:a82b:97d0 with SMTP id adf61e73a8af0-334a84cf411mr4798226637.22.1760710665576; Fri, 17 Oct 2025 07:17:45 -0700 (PDT) Received: from hu-vgarodia-hyd.qualcomm.com ([202.46.23.25]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7992d0966d7sm25895826b3a.40.2025.10.17.07.17.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Oct 2025 07:17:44 -0700 (PDT) From: Vikash Garodia Date: Fri, 17 Oct 2025 19:46:29 +0530 Subject: [PATCH v2 8/8] media: iris: Add platform data for kaanapali 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: <20251017-knp_video-v2-8-f568ce1a4be3@oss.qualcomm.com> References: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> In-Reply-To: <20251017-knp_video-v2-0-f568ce1a4be3@oss.qualcomm.com> To: Dikshita Agarwal , Abhinav Kumar , Bryan O'Donoghue , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Philipp Zabel , Dmitry Baryshkov , Konrad Dybcio Cc: linux-arm-msm@vger.kernel.org, linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vishnu Reddy , Vikash Garodia X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1760710621; l=8413; i=vikash.garodia@oss.qualcomm.com; s=20241104; h=from:subject:message-id; bh=94zn2oaEs2/tPLmKQcuLmcTARdo0LUWMIIHm7rC4jyI=; b=as7o9C9nsEeN8DXB+6qFiEG1BQUd8dRFgYVoGup0byiSf1Y5WMnzktmgq1vC6Ibo6keD2RdjV kBSqAIzGCNoATIZQwDSQpS7hcdqjj89jngTXlEAqBRnWOMlu+31ZbBi X-Developer-Key: i=vikash.garodia@oss.qualcomm.com; a=ed25519; pk=LY9Eqp4KiHWxzGNKGHbwRFEJOfRCSzG/rxQNmvZvaKE= X-Proofpoint-ORIG-GUID: 0doQIDPOgrGdhgHvFWdqB4rYdFWhYg7k X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUxMDEzMDAyMiBTYWx0ZWRfXyshl21PNv+jF dJqIPX1txh/6cqmiqrBS4VTHuWuPbM+O1RXrOkDpO1sA3FGySd0s0dxKM68KIcs70mOF1P5QU2/ d+2z6ycK5Zwy/9uDhbL5wS7IenLJzFifgrzj1gkCsYXrBmh6Ha7TbIdm/IOq5upCAR4w1Ynxy+d izRFTpS5sqOAzkLBZnProtH7nyzAtGI7/jK8R2lOrfAPSCdEXGHGUtwI5RwLsZQX7l2cTn/ljHy ZK4D/+TiSmE3PV1r/lu3YKdczAHCTXCwksfTeFBN0Xgc/KtO/ubnaczSdtOtGM16cNdbQ5p25f2 PTXzC0k5wKRbH2eBQzIKFNO7pS7HAq1iOME6bb8CtkJ1o9VGkMD/q0JHteK/NSh9K8OskvQz2fl FBV5BjInY17ZA5ZMI7IGYM7AQUccRw== X-Authority-Analysis: v=2.4 cv=SfD6t/Ru c=1 sm=1 tr=0 ts=68f2500c cx=c_pps a=WW5sKcV1LcKqjgzy2JUPuA==:117 a=ZePRamnt/+rB5gQjfz0u9A==:17 a=IkcTkHD0fZMA:10 a=x6icFKpwvdMA:10 a=VkNPw1HP01LnGYTKEx00:22 a=COk6AnOGAAAA:8 a=EUspDBNiAAAA:8 a=253cHNSug-08pUEeBzYA:9 a=QEXdDO2ut3YA:10 a=OpyuDcXvxspvyRM73sMx:22 a=TjNXssC_j7lpFel5tvFf:22 X-Proofpoint-GUID: 0doQIDPOgrGdhgHvFWdqB4rYdFWhYg7k X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-10-17_05,2025-10-13_01,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 clxscore=1015 adultscore=0 phishscore=0 lowpriorityscore=0 bulkscore=0 impostorscore=0 priorityscore=1501 spamscore=0 suspectscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2510020000 definitions=main-2510130022 Add support for the kaanapali platform by re-using the SM8550 definitions and using the vpu4 ops. Move the configurations that differs in a per-SoC platform header, that will contain SoC specific data. Co-developed-by: Vishnu Reddy Signed-off-by: Vishnu Reddy Signed-off-by: Vikash Garodia Reviewed-by: Bryan O'Donoghue --- .../platform/qcom/iris/iris_platform_common.h | 1 + .../media/platform/qcom/iris/iris_platform_gen2.c | 86 ++++++++++++++++++= ++++ .../platform/qcom/iris/iris_platform_kaanapali.h | 63 ++++++++++++++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 4 files changed, 154 insertions(+) diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/driv= ers/media/platform/qcom/iris/iris_platform_common.h index d6d4a9fdfc189797f903dfeb56d931741b405ee2..f77bad531f067f59b48c3e4caa4= 0a463d454c47e 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -41,6 +41,7 @@ enum pipe_type { PIPE_4 =3D 4, }; =20 +extern struct iris_platform_data kaanapali_data; extern struct iris_platform_data qcs8300_data; extern struct iris_platform_data sm8250_data; extern struct iris_platform_data sm8550_data; diff --git a/drivers/media/platform/qcom/iris/iris_platform_gen2.c b/driver= s/media/platform/qcom/iris/iris_platform_gen2.c index 00c6b9021b98aac80612b1bb9734c8dac8146bd9..104c24fd47770dff770a5230cf9= 57d78c89b01f7 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_gen2.c +++ b/drivers/media/platform/qcom/iris/iris_platform_gen2.c @@ -12,6 +12,7 @@ #include "iris_vpu_buffer.h" #include "iris_vpu_common.h" =20 +#include "iris_platform_kaanapali.h" #include "iris_platform_qcs8300.h" #include "iris_platform_sm8650.h" #include "iris_platform_sm8750.h" @@ -744,6 +745,91 @@ static const u32 sm8550_enc_op_int_buf_tbl[] =3D { BUF_SCRATCH_2, }; =20 +struct iris_platform_data kaanapali_data =3D { + .get_instance =3D iris_hfi_gen2_get_instance, + .init_hfi_command_ops =3D iris_hfi_gen2_command_ops_init, + .init_hfi_response_ops =3D iris_hfi_gen2_response_ops_init, + .get_vpu_buffer_size =3D iris_vpu4x_buf_size, + .vpu_ops =3D &iris_vpu4x_ops, + .set_preset_registers =3D iris_set_sm8550_preset_registers, + .icc_tbl =3D sm8550_icc_table, + .icc_tbl_size =3D ARRAY_SIZE(sm8550_icc_table), + .clk_rst_tbl =3D kaanapali_clk_reset_table, + .clk_rst_tbl_size =3D ARRAY_SIZE(kaanapali_clk_reset_table), + .bw_tbl_dec =3D sm8550_bw_table_dec, + .bw_tbl_dec_size =3D ARRAY_SIZE(sm8550_bw_table_dec), + .pmdomain_tbl =3D kaanapali_pmdomain_table, + .pmdomain_tbl_size =3D ARRAY_SIZE(kaanapali_pmdomain_table), + .opp_pd_tbl =3D sm8550_opp_pd_table, + .opp_pd_tbl_size =3D ARRAY_SIZE(sm8550_opp_pd_table), + .clk_tbl =3D kaanapali_clk_table, + .clk_tbl_size =3D ARRAY_SIZE(kaanapali_clk_table), + .opp_clk_tbl =3D kaanapali_opp_clk_table, + /* Upper bound of DMA address range */ + .dma_mask =3D 0xe0000000 - 1, + .fwname =3D "qcom/vpu/vpu40_p2_s7.mbn", + .pas_id =3D IRIS_PAS_ID, + .inst_caps =3D &platform_inst_cap_sm8550, + .inst_fw_caps_dec =3D inst_fw_cap_sm8550_dec, + .inst_fw_caps_dec_size =3D ARRAY_SIZE(inst_fw_cap_sm8550_dec), + .inst_fw_caps_enc =3D inst_fw_cap_sm8550_enc, + .inst_fw_caps_enc_size =3D ARRAY_SIZE(inst_fw_cap_sm8550_enc), + .tz_cp_config_data =3D tz_cp_config_kaanapali, + .tz_cp_config_data_size =3D ARRAY_SIZE(tz_cp_config_kaanapali), + .core_arch =3D VIDEO_ARCH_LX, + .hw_response_timeout =3D HW_RESPONSE_TIMEOUT_VALUE, + .ubwc_config =3D &ubwc_config_sm8550, + .num_vpp_pipe =3D 2, + .max_session_count =3D 16, + .max_core_mbpf =3D NUM_MBS_8K * 2, + .max_core_mbps =3D ((8192 * 4352) / 256) * 60, + .dec_input_config_params_default =3D + sm8550_vdec_input_config_params_default, + .dec_input_config_params_default_size =3D + ARRAY_SIZE(sm8550_vdec_input_config_params_default), + .dec_input_config_params_hevc =3D + sm8550_vdec_input_config_param_hevc, + .dec_input_config_params_hevc_size =3D + ARRAY_SIZE(sm8550_vdec_input_config_param_hevc), + .dec_input_config_params_vp9 =3D + sm8550_vdec_input_config_param_vp9, + .dec_input_config_params_vp9_size =3D + ARRAY_SIZE(sm8550_vdec_input_config_param_vp9), + .dec_output_config_params =3D + sm8550_vdec_output_config_params, + .dec_output_config_params_size =3D + ARRAY_SIZE(sm8550_vdec_output_config_params), + + .enc_input_config_params =3D + sm8550_venc_input_config_params, + .enc_input_config_params_size =3D + ARRAY_SIZE(sm8550_venc_input_config_params), + .enc_output_config_params =3D + sm8550_venc_output_config_params, + .enc_output_config_params_size =3D + ARRAY_SIZE(sm8550_venc_output_config_params), + + .dec_input_prop =3D sm8550_vdec_subscribe_input_properties, + .dec_input_prop_size =3D ARRAY_SIZE(sm8550_vdec_subscribe_input_propertie= s), + .dec_output_prop_avc =3D sm8550_vdec_subscribe_output_properties_avc, + .dec_output_prop_avc_size =3D + ARRAY_SIZE(sm8550_vdec_subscribe_output_properties_avc), + .dec_output_prop_hevc =3D sm8550_vdec_subscribe_output_properties_hevc, + .dec_output_prop_hevc_size =3D + ARRAY_SIZE(sm8550_vdec_subscribe_output_properties_hevc), + .dec_output_prop_vp9 =3D sm8550_vdec_subscribe_output_properties_vp9, + .dec_output_prop_vp9_size =3D + ARRAY_SIZE(sm8550_vdec_subscribe_output_properties_vp9), + + .dec_ip_int_buf_tbl =3D sm8550_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size =3D ARRAY_SIZE(sm8550_dec_ip_int_buf_tbl), + .dec_op_int_buf_tbl =3D sm8550_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size =3D ARRAY_SIZE(sm8550_dec_op_int_buf_tbl), + + .enc_op_int_buf_tbl =3D sm8550_enc_op_int_buf_tbl, + .enc_op_int_buf_tbl_size =3D ARRAY_SIZE(sm8550_enc_op_int_buf_tbl), +}; + struct iris_platform_data sm8550_data =3D { .get_instance =3D iris_hfi_gen2_get_instance, .init_hfi_command_ops =3D iris_hfi_gen2_command_ops_init, diff --git a/drivers/media/platform/qcom/iris/iris_platform_kaanapali.h b/d= rivers/media/platform/qcom/iris/iris_platform_kaanapali.h new file mode 100644 index 0000000000000000000000000000000000000000..247fb9d7cb632d2e9a1e9832d08= 7cb03ac9b7cf3 --- /dev/null +++ b/drivers/media/platform/qcom/iris/iris_platform_kaanapali.h @@ -0,0 +1,63 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#ifndef __IRIS_PLATFORM_KAANAPALI_H__ +#define __IRIS_PLATFORM_KAANAPALI_H__ + +#define VIDEO_REGION_VM0_SECURE_NP_ID 1 +#define VIDEO_REGION_VM0_NONSECURE_NP_ID 5 + +static const char *const kaanapali_clk_reset_table[] =3D { + "bus0", + "bus1", + "core_freerun_reset", + "vcodec0_core_freerun_reset", +}; + +static const char *const kaanapali_pmdomain_table[] =3D { + "venus", + "vcodec0", + "vpp0", + "vpp1", + "apv", +}; + +static const struct platform_clk_data kaanapali_clk_table[] =3D { + { IRIS_AXI_CLK, "iface" }, + { IRIS_CTRL_CLK, "core" }, + { IRIS_HW_CLK, "vcodec0_core" }, + { IRIS_AXI1_CLK, "iface1" }, + { IRIS_CTRL_FREERUN_CLK, "core_freerun" }, + { IRIS_HW_FREERUN_CLK, "vcodec0_core_freerun" }, + { IRIS_BSE_HW_CLK, "vcodec_bse" }, + { IRIS_VPP0_HW_CLK, "vcodec_vpp0" }, + { IRIS_VPP1_HW_CLK, "vcodec_vpp1" }, + { IRIS_APV_HW_CLK, "vcodec_apv" }, +}; + +static const char *const kaanapali_opp_clk_table[] =3D { + "vcodec0_core", + "vcodec_apv", + "vcodec_bse", + "core", + NULL, +}; + +static struct tz_cp_config tz_cp_config_kaanapali[] =3D { + { + .cp_start =3D VIDEO_REGION_VM0_SECURE_NP_ID, + .cp_size =3D 0, + .cp_nonpixel_start =3D 0x01000000, + .cp_nonpixel_size =3D 0x24800000, + }, + { + .cp_start =3D VIDEO_REGION_VM0_NONSECURE_NP_ID, + .cp_size =3D 0, + .cp_nonpixel_start =3D 0x25800000, + .cp_nonpixel_size =3D 0xda400000, + }, +}; + +#endif /* __IRIS_PLATFORM_KAANAPALI_H__ */ diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/= platform/qcom/iris/iris_probe.c index ad82a62f8b923d818ffe77c131d7eb6da8c34002..a0902f3aaa1ca6021cfd414787d= a747a6dda1010 100644 --- a/drivers/media/platform/qcom/iris/iris_probe.c +++ b/drivers/media/platform/qcom/iris/iris_probe.c @@ -348,6 +348,10 @@ static const struct dev_pm_ops iris_pm_ops =3D { }; =20 static const struct of_device_id iris_dt_match[] =3D { + { + .compatible =3D "qcom,kaanapali-iris", + .data =3D &kaanapali_data, + }, { .compatible =3D "qcom,qcs8300-iris", .data =3D &qcs8300_data, --=20 2.34.1