From nobody Tue Oct 7 03:41:30 2025 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 A434F2BE645 for ; Tue, 15 Jul 2025 20:48:03 +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=1752612486; cv=none; b=oD4IHKB14WF7p21PcKfz7PEUh4nzGBlOGNLPGmKfXGDTsW8rgi+rq94xDS+yV/x01dNzCll3fTcYEyi2mnSRv5Mpns0CKiq/rcT4isdrTBao1OZUPDIvfLy1Jp6rlJ5M5ErfWp/jhoRAj8620W2iaAnO0tFtDMwJsPPU3e5LcFk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752612486; c=relaxed/simple; bh=FTM+53bRRVOHtoe28id393M3/rMRlzMvNdgdygu1FsM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JzF437wr0m34cs07qfUstJAQ2AZeEQ52TQvg9tCNsFSqqI2KEPrZmcMZwOv6oEMEBBUiVAylXBkpjrj4TGs9uVuAduOTpCdcYlfGEGprUQrX82x2RIeynWQN7kCJg6wAb3emJs2Lvwo57Xz50v7a9BlJI5ii4m9cS7lkQkGDk3M= 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=CLKlHh+E; 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="CLKlHh+E" 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 56FGDJLF026146 for ; Tue, 15 Jul 2025 20:48:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:date:from:in-reply-to:message-id :mime-version:references:subject:to; s=qcppdkim1; bh=OaMMPHPi/zp Bc19zLi9ig6YpA2t1zrIdsPiqN861Zlw=; b=CLKlHh+EB6rwfnPZWIDBoiMaQzR yncmSl6ZBGrAzTHhG809eVE6ITimjoJxh0vLu6QMtWEK+ldWfJJ3N0e5mkvcvhD6 qLWX1rBS+Jo2J1yYl0cygik0lS/aVA2UxnKkBxPWW3MPm+nigUrUokaos1DV0Kam 2r3jTEEDzn0PeX0diawFh0V7w+zP4a7ueOGCzzc0NUVHkuwt9WD6QTVyslG3mMpM XFYmAhMNkcxxm6dweFgcoc+kZu/BpyU3/CTNpcbF6J54RwzwAMhRJ+jVFskQUpRF gzH6BdZScCSuLdWGkwjtXQXTbwx7qM/LfcSrLQh6PbUxycQA8MLCUrOjCtw== Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 47wfca2ugj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 15 Jul 2025 20:48:02 +0000 (GMT) Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7e333fae758so400524785a.2 for ; Tue, 15 Jul 2025 13:48:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1752612481; x=1753217281; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OaMMPHPi/zpBc19zLi9ig6YpA2t1zrIdsPiqN861Zlw=; b=K9yCbktaiMPvlfXdmgci6CIt71gFyn2sWRY3+w0iaPsf4fKhQVtqvOVUUt6/LJY+Bh pq1l5jmLRbNEon5TfMjVbWL4eF027ETLzA72+AswzfKpwSy8cNeLjvaIrjUDkCA8szzR TPzAa1p4xpzOQD0yofcW095qKMR4AZ5IgNPCEhgmJb25naunT0tFUsYkX4rA94UaWIma 8KjjOA4pa9AF20jFkDxpW+PIG2IVyI5GeKZovnyVIgsjagsWt2UCYt0+b+n6HbMoRh2g 3c7fKPb73bUaQLkXOyzDnMUjccEpNkDmMI88FH7GD/O5OkDYYbkYq+Hyokkk+DbxLDMW MNCA== X-Forwarded-Encrypted: i=1; AJvYcCXV80iK/xxPj0H00TwOOCbgskP3yiwjY2B4aXjQV+BFEHYdN4+3zhc8SNKm5+LlFlDX0PK89FtSH3uCUG4=@vger.kernel.org X-Gm-Message-State: AOJu0YzuDv9hyZA8VCqJuzNt7XBjjzRk3z3M59sjFDJjKaSgQejbBNbn uNZOV/dTh5APytJ7J0ZeOJWS6pTCXEKhp4/7gdIyb9cgl2upaZEDKDlGdn5cht8Ig8o+f59DREv BlOsxhqRKC3jb1KVnyo2GUAUHNzX8Vq4L5521qQ8h+fQl5gBFytfWg4K+DFSnNAHWGSM= X-Gm-Gg: ASbGncszfska8TFIWLAjkV1mj1OYT5o1R6go7PPsQVHuc7Vgpu9v4V2Qx8qlAxuLLOR /XORyBE0SFikbj41BWxuWchSfjVFmIMcEMBXAihxju27LwtfQ70gw1KLLV9WD81UPsXVpd4M26R iyh19TpZtZbo+++uiXALYDsJWaxH/5QU4We7/gMMlC+H+WAkp+VLH+qmPqZIxKi2iarBexXN/m6 yzjoSDlA0uV8Owbi/r+nqMFf6YZxSL+fFegSbnbrwGd+x9UQN24Se3VYfJ1wtZw+roTLMd+2TcZ kNGysUfRBFjWS60iQS2BdrZDuKn0hSjNWw3hKO9DhyFtwDqk6ObXmjw0MTJfvUIA1pURHai0yTT ya2R+algXD4QZ4jUIoA== X-Received: by 2002:a05:620a:8390:b0:7e3:28f3:893 with SMTP id af79cd13be357-7e3435ea1ffmr45799285a.35.1752612481010; Tue, 15 Jul 2025 13:48:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGBLFxJa9jSwaBUo5QAp9PxCrGHJ6gmYYTz22qRCxD7RWkcjeXREbTUK+MG7ac/OvQT1814mQ== X-Received: by 2002:a05:620a:8390:b0:7e3:28f3:893 with SMTP id af79cd13be357-7e3435ea1ffmr45795785a.35.1752612480472; Tue, 15 Jul 2025 13:48:00 -0700 (PDT) Received: from trex.. (153.red-79-144-197.dynamicip.rima-tde.net. [79.144.197.153]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3b5e8dc2464sm16331877f8f.38.2025.07.15.13.47.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Jul 2025 13:47:59 -0700 (PDT) From: Jorge Ramirez-Ortiz To: jorge.ramirez@oss.qualcomm.com, quic_vgarodia@quicinc.com, quic_dikshita@quicinc.com, bryan.odonoghue@linaro.org, krzk+dt@kernel.org, konradybcio@kernel.org, mchehab@kernel.org, andersson@kernel.org, conor+dt@kernel.org, amit.kucheria@oss.qualcomm.com Cc: linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v7 3/7] media: venus: Add support for AR50_LITE video core Date: Tue, 15 Jul 2025 22:47:45 +0200 Message-Id: <20250715204749.2189875-4-jorge.ramirez@oss.qualcomm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250715204749.2189875-1-jorge.ramirez@oss.qualcomm.com> References: <20250715204749.2189875-1-jorge.ramirez@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Proofpoint-Spam-Details-Enc: AW1haW4tMjUwNzE1MDE5MSBTYWx0ZWRfXyPCLt87CLJhL e1By/nL4K1Lpe41W/RLr4+qrhlVbth9I1iWv2OncZNI7Mt6Qsb+LsCZM8/FbBpL4s5ORncukIRE wOMXTwMxjpGs0Cghmki9ERLguNQ8VQhV7mvoZ/RurBZsc6FkOukqDeJnaB03bQTYCHr2Rix9Ke6 1tjiy8CpKk4jO1hh1tYsvUWHM8R3bAheU8UPnM+mAgkjfHIaVSvbrJDHjm6CYPr9AAHrifVcue1 chr90653n7vQ3IuEQCRxbkDXku22j6ZtB3uFstclmSdjgIbjGKfLkRKZy2kIFeseRhp9ZIruOcF JqIVA6HmHXrKXhC0IuNx58YnyQGat74qG5qgKR2sdYuoIUPzEk7f7cB+9OtaIFUPJsyXu0lY9QM h56Hzstr35XcftyVRIn2tkrsGZawTgwf6r8KJsToQjWmQP2/AoN3G1kiILtjS0A/g9uRerUT X-Proofpoint-GUID: _WULiEQ3NxrwzkFH5Z7VVSO_c86TBSpo X-Authority-Analysis: v=2.4 cv=SeX3duRu c=1 sm=1 tr=0 ts=6876be82 cx=c_pps a=hnmNkyzTK/kJ09Xio7VxxA==:117 a=Ki5fnJvzvo7yLsyA0quaxQ==:17 a=Wb1JkmetP80A:10 a=EUspDBNiAAAA:8 a=bko80PZImhyAhWnkyZcA:9 a=PEH46H7Ffwr30OY-TuGO:22 X-Proofpoint-ORIG-GUID: _WULiEQ3NxrwzkFH5Z7VVSO_c86TBSpo X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1099,Hydra:6.1.9,FMLib:17.12.80.40 definitions=2025-07-15_05,2025-07-15_02,2025-03-28_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 mlxscore=0 priorityscore=1501 bulkscore=0 phishscore=0 lowpriorityscore=0 mlxlogscore=999 impostorscore=0 clxscore=1015 adultscore=0 suspectscore=0 malwarescore=0 classifier=spam authscore=0 authtc=n/a authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.19.0-2505280000 definitions=main-2507150191 Content-Type: text/plain; charset="utf-8" The AR50_LITE is a simplified variant of the AR50 video core, designed for power and cost-efficient platforms. It supports hardware-accelerated decoding of H.264, HEVC, and VP9 formats, and provides encoding support for H.264 and HEVC. Signed-off-by: Jorge Ramirez-Ortiz --- drivers/media/platform/qcom/venus/core.c | 15 +++++++-- drivers/media/platform/qcom/venus/core.h | 5 +++ drivers/media/platform/qcom/venus/firmware.c | 10 ++++++ drivers/media/platform/qcom/venus/firmware.h | 1 + drivers/media/platform/qcom/venus/helpers.c | 30 +++++++++++++++-- drivers/media/platform/qcom/venus/helpers.h | 2 ++ .../media/platform/qcom/venus/hfi_parser.c | 5 +-- .../media/platform/qcom/venus/hfi_platform.c | 20 +++++++----- .../media/platform/qcom/venus/hfi_platform.h | 25 ++++++++------- .../platform/qcom/venus/hfi_platform_v4.c | 31 ++++++++++++------ .../platform/qcom/venus/hfi_platform_v6.c | 32 +++++++++++++------ drivers/media/platform/qcom/venus/hfi_venus.c | 25 +++++++++++---- .../media/platform/qcom/venus/hfi_venus_io.h | 4 +++ .../media/platform/qcom/venus/pm_helpers.c | 2 +- drivers/media/platform/qcom/venus/vdec.c | 7 +--- 15 files changed, 154 insertions(+), 60 deletions(-) diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platf= orm/qcom/venus/core.c index b7d6745b6124..bad49f0b4a77 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -269,14 +269,19 @@ static int venus_enumerate_codecs(struct venus_core *= core, u32 type, =20 static void venus_assign_register_offsets(struct venus_core *core) { - if (IS_IRIS2(core) || IS_IRIS2_1(core)) { - core->vbif_base =3D core->base + VBIF_BASE; + if (IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core)) { core->cpu_base =3D core->base + CPU_BASE_V6; core->cpu_cs_base =3D core->base + CPU_CS_BASE_V6; core->cpu_ic_base =3D core->base + CPU_IC_BASE_V6; core->wrapper_base =3D core->base + WRAPPER_BASE_V6; core->wrapper_tz_base =3D core->base + WRAPPER_TZ_BASE_V6; - core->aon_base =3D core->base + AON_BASE_V6; + if (IS_AR50_LITE(core)) { + core->vbif_base =3D NULL; + core->aon_base =3D NULL; + } else { + core->vbif_base =3D core->base + VBIF_BASE; + core->aon_base =3D core->base + AON_BASE_V6; + } } else { core->vbif_base =3D core->base + VBIF_BASE; core->cpu_base =3D core->base + CPU_BASE; @@ -476,6 +481,10 @@ static int venus_probe(struct platform_device *pdev) if (ret) goto err_firmware_deinit; =20 + ret =3D venus_firmware_cfg(core); + if (ret) + goto err_venus_shutdown; + ret =3D hfi_core_resume(core, true); if (ret) goto err_venus_shutdown; diff --git a/drivers/media/platform/qcom/venus/core.h b/drivers/media/platf= orm/qcom/venus/core.h index 3af8386b78be..f5b59e81e3c2 100644 --- a/drivers/media/platform/qcom/venus/core.h +++ b/drivers/media/platform/qcom/venus/core.h @@ -538,6 +538,11 @@ struct venus_inst { #define IS_IRIS2(core) ((core)->res->vpu_version =3D=3D VPU_VERSION_IRIS2) #define IS_IRIS2_1(core) ((core)->res->vpu_version =3D=3D VPU_VERSION_IRIS= 2_1) =20 +static inline bool is_lite(struct venus_core *core) +{ + return IS_AR50_LITE(core); +} + #define ctrl_to_inst(ctrl) \ container_of((ctrl)->handler, struct venus_inst, ctrl_handler) =20 diff --git a/drivers/media/platform/qcom/venus/firmware.c b/drivers/media/p= latform/qcom/venus/firmware.c index 66a18830e66d..c74988fd5ce2 100644 --- a/drivers/media/platform/qcom/venus/firmware.c +++ b/drivers/media/platform/qcom/venus/firmware.c @@ -207,6 +207,16 @@ static int venus_shutdown_no_tz(struct venus_core *cor= e) return 0; } =20 +int venus_firmware_cfg(struct venus_core *core) +{ + void __iomem *cpu_cs_base =3D core->cpu_cs_base; + + if (IS_AR50_LITE(core)) + writel(CPU_CS_VCICMD_ARP_OFF, cpu_cs_base + CPU_CS_VCICMD); + + return 0; +} + int venus_boot(struct venus_core *core) { struct device *dev =3D core->dev; diff --git a/drivers/media/platform/qcom/venus/firmware.h b/drivers/media/p= latform/qcom/venus/firmware.h index aaccd847fa30..3fea4ab63bf7 100644 --- a/drivers/media/platform/qcom/venus/firmware.h +++ b/drivers/media/platform/qcom/venus/firmware.h @@ -9,6 +9,7 @@ struct device; =20 int venus_firmware_init(struct venus_core *core); void venus_firmware_deinit(struct venus_core *core); +int venus_firmware_cfg(struct venus_core *core); int venus_boot(struct venus_core *core); int venus_shutdown(struct venus_core *core); int venus_set_hw_state(struct venus_core *core, bool suspend); diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/pl= atform/qcom/venus/helpers.c index 8295542e1a7c..438ed1abd8e8 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -230,6 +230,24 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *ins= t) } EXPORT_SYMBOL_GPL(venus_helper_alloc_dpb_bufs); =20 +void venus_helper_prepare_eos_data(struct venus_inst *inst, + struct hfi_frame_data *data) +{ + struct venus_core *core =3D inst->core; + + data->buffer_type =3D HFI_BUFFER_INPUT; + data->flags =3D HFI_BUFFERFLAG_EOS; + + if (IS_V6(core) && is_fw_rev_or_older(core, 1, 0, 87)) + return; + + if (IS_V4(core) && is_lite(core) && is_fw_rev_or_older(core, 6, 0, 53)) + data->alloc_len =3D 1; + + data->device_addr =3D 0xdeadb000; +} +EXPORT_SYMBOL_GPL(venus_helper_prepare_eos_data); + static int intbufs_set_buffer(struct venus_inst *inst, u32 type) { struct venus_core *core =3D inst->core; @@ -1715,11 +1733,17 @@ int venus_helper_session_init(struct venus_inst *in= st) if (ret) return ret; =20 - inst->clk_data.vpp_freq =3D hfi_platform_get_codec_vpp_freq(version, code= c, + inst->clk_data.vpp_freq =3D hfi_platform_get_codec_vpp_freq(version, + is_lite(inst->core), + codec, session_type); - inst->clk_data.vsp_freq =3D hfi_platform_get_codec_vsp_freq(version, code= c, + inst->clk_data.vsp_freq =3D hfi_platform_get_codec_vsp_freq(version, + is_lite(inst->core), + codec, session_type); - inst->clk_data.low_power_freq =3D hfi_platform_get_codec_lp_freq(version,= codec, + inst->clk_data.low_power_freq =3D hfi_platform_get_codec_lp_freq(version, + is_lite(inst->core), + codec, session_type); =20 return 0; diff --git a/drivers/media/platform/qcom/venus/helpers.h b/drivers/media/pl= atform/qcom/venus/helpers.h index 358e4f39c9c0..62a734c1da1d 100644 --- a/drivers/media/platform/qcom/venus/helpers.h +++ b/drivers/media/platform/qcom/venus/helpers.h @@ -58,6 +58,8 @@ int venus_helper_get_out_fmts(struct venus_inst *inst, u3= 2 fmt, u32 *out_fmt, bool venus_helper_check_format(struct venus_inst *inst, u32 v4l2_pixfmt); int venus_helper_alloc_dpb_bufs(struct venus_inst *inst); int venus_helper_free_dpb_bufs(struct venus_inst *inst); +void venus_helper_prepare_eos_data(struct venus_inst *inst, + struct hfi_frame_data *data); int venus_helper_intbufs_alloc(struct venus_inst *inst); int venus_helper_intbufs_free(struct venus_inst *inst); int venus_helper_intbufs_realloc(struct venus_inst *inst); diff --git a/drivers/media/platform/qcom/venus/hfi_parser.c b/drivers/media= /platform/qcom/venus/hfi_parser.c index 1b3db2caa99f..55cee1c786a0 100644 --- a/drivers/media/platform/qcom/venus/hfi_parser.c +++ b/drivers/media/platform/qcom/venus/hfi_parser.c @@ -277,12 +277,13 @@ static int hfi_platform_parser(struct venus_core *cor= e, struct venus_inst *inst) if (inst) return 0; =20 - ret =3D hfi_platform_get_codecs(core, &enc_codecs, &dec_codecs, &count); + ret =3D hfi_platform_get_codecs(core, &enc_codecs, &dec_codecs, &count, + is_lite(core)); if (ret) return ret; =20 if (plat->capabilities) - caps =3D plat->capabilities(&entries); + caps =3D plat->capabilities(&entries, is_lite(core)); =20 if (!caps || !entries || !count) return -EINVAL; diff --git a/drivers/media/platform/qcom/venus/hfi_platform.c b/drivers/med= ia/platform/qcom/venus/hfi_platform.c index 643e5aa138f5..c6c248561793 100644 --- a/drivers/media/platform/qcom/venus/hfi_platform.c +++ b/drivers/media/platform/qcom/venus/hfi_platform.c @@ -21,7 +21,8 @@ const struct hfi_platform *hfi_platform_get(enum hfi_vers= ion version) } =20 unsigned long -hfi_platform_get_codec_vpp_freq(enum hfi_version version, u32 codec, u32 s= ession_type) +hfi_platform_get_codec_vpp_freq(enum hfi_version version, bool lite, u32 c= odec, + u32 session_type) { const struct hfi_platform *plat; unsigned long freq =3D 0; @@ -31,13 +32,14 @@ hfi_platform_get_codec_vpp_freq(enum hfi_version versio= n, u32 codec, u32 session return 0; =20 if (plat->codec_vpp_freq) - freq =3D plat->codec_vpp_freq(session_type, codec); + freq =3D plat->codec_vpp_freq(session_type, codec, lite); =20 return freq; } =20 unsigned long -hfi_platform_get_codec_vsp_freq(enum hfi_version version, u32 codec, u32 s= ession_type) +hfi_platform_get_codec_vsp_freq(enum hfi_version version, bool lite, u32 c= odec, + u32 session_type) { const struct hfi_platform *plat; unsigned long freq =3D 0; @@ -47,13 +49,14 @@ hfi_platform_get_codec_vsp_freq(enum hfi_version versio= n, u32 codec, u32 session return 0; =20 if (plat->codec_vpp_freq) - freq =3D plat->codec_vsp_freq(session_type, codec); + freq =3D plat->codec_vsp_freq(session_type, codec, lite); =20 return freq; } =20 unsigned long -hfi_platform_get_codec_lp_freq(enum hfi_version version, u32 codec, u32 se= ssion_type) +hfi_platform_get_codec_lp_freq(enum hfi_version version, bool lite, u32 co= dec, + u32 session_type) { const struct hfi_platform *plat; unsigned long freq =3D 0; @@ -63,13 +66,14 @@ hfi_platform_get_codec_lp_freq(enum hfi_version version= , u32 codec, u32 session_ return 0; =20 if (plat->codec_lp_freq) - freq =3D plat->codec_lp_freq(session_type, codec); + freq =3D plat->codec_lp_freq(session_type, codec, lite); =20 return freq; } =20 int -hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec= _codecs, u32 *count) +hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 *dec= _codecs, u32 *count, + bool lite) { const struct hfi_platform *plat; =20 @@ -78,7 +82,7 @@ hfi_platform_get_codecs(struct venus_core *core, u32 *enc= _codecs, u32 *dec_codec return -EINVAL; =20 if (plat->codecs) - plat->codecs(enc_codecs, dec_codecs, count); + plat->codecs(enc_codecs, dec_codecs, count, lite); =20 if (IS_IRIS2_1(core)) { *enc_codecs &=3D ~HFI_VIDEO_CODEC_VP8; diff --git a/drivers/media/platform/qcom/venus/hfi_platform.h b/drivers/med= ia/platform/qcom/venus/hfi_platform.h index ec89a90a8129..a9f1ead18084 100644 --- a/drivers/media/platform/qcom/venus/hfi_platform.h +++ b/drivers/media/platform/qcom/venus/hfi_platform.h @@ -47,11 +47,12 @@ struct hfi_platform_codec_freq_data { }; =20 struct hfi_platform { - unsigned long (*codec_vpp_freq)(u32 session_type, u32 codec); - unsigned long (*codec_vsp_freq)(u32 session_type, u32 codec); - unsigned long (*codec_lp_freq)(u32 session_type, u32 codec); - void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count); - const struct hfi_plat_caps *(*capabilities)(unsigned int *entries); + unsigned long (*codec_vpp_freq)(u32 session_type, u32 codec, bool lite); + unsigned long (*codec_vsp_freq)(u32 session_type, u32 codec, bool lite); + unsigned long (*codec_lp_freq)(u32 session_type, u32 codec, bool lite); + void (*codecs)(u32 *enc_codecs, u32 *dec_codecs, u32 *count, bool lite); + const struct hfi_plat_caps *(*capabilities)(unsigned int *entries, + bool lite); int (*bufreq)(struct hfi_plat_buffers_params *params, u32 session_type, u32 buftype, struct hfi_buffer_requirements *bufreq); }; @@ -60,12 +61,12 @@ extern const struct hfi_platform hfi_plat_v4; extern const struct hfi_platform hfi_plat_v6; =20 const struct hfi_platform *hfi_platform_get(enum hfi_version version); -unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, u3= 2 codec, - u32 session_type); -unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, u3= 2 codec, - u32 session_type); -unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, u32= codec, - u32 session_type); +unsigned long hfi_platform_get_codec_vpp_freq(enum hfi_version version, bo= ol lite, + u32 codec, u32 session_type); +unsigned long hfi_platform_get_codec_vsp_freq(enum hfi_version version, bo= ol lite, + u32 codec, u32 session_type); +unsigned long hfi_platform_get_codec_lp_freq(enum hfi_version version, boo= l lite, + u32 codec, u32 session_type); int hfi_platform_get_codecs(struct venus_core *core, u32 *enc_codecs, u32 = *dec_codecs, - u32 *count); + u32 *count, bool lite); #endif diff --git a/drivers/media/platform/qcom/venus/hfi_platform_v4.c b/drivers/= media/platform/qcom/venus/hfi_platform_v4.c index e3f0a90a567b..4ae7ed476c48 100644 --- a/drivers/media/platform/qcom/venus/hfi_platform_v4.c +++ b/drivers/media/platform/qcom/venus/hfi_platform_v4.c @@ -245,14 +245,19 @@ static const struct hfi_plat_caps caps[] =3D { .num_fmts =3D 4, } }; =20 -static const struct hfi_plat_caps *get_capabilities(unsigned int *entries) +static const struct hfi_plat_caps *get_capabilities(unsigned int *entries, + bool lite) { + WARN_ON(lite); + *entries =3D ARRAY_SIZE(caps); return caps; } =20 -static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count) +static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count, bool = lite) { + WARN_ON(lite); + *enc_codecs =3D HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC | HFI_VIDEO_CODEC_VP8; *dec_codecs =3D HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC | @@ -273,12 +278,14 @@ static const struct hfi_platform_codec_freq_data code= c_freq_data[] =3D { }; =20 static const struct hfi_platform_codec_freq_data * -get_codec_freq_data(u32 session_type, u32 pixfmt) +get_codec_freq_data(u32 session_type, u32 pixfmt, bool lite) { const struct hfi_platform_codec_freq_data *data =3D codec_freq_data; unsigned int i, data_size =3D ARRAY_SIZE(codec_freq_data); const struct hfi_platform_codec_freq_data *found =3D NULL; =20 + WARN_ON(lite); + for (i =3D 0; i < data_size; i++) { if (data[i].pixfmt =3D=3D pixfmt && data[i].session_type =3D=3D session_= type) { found =3D &data[i]; @@ -289,33 +296,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt) return found; } =20 -static unsigned long codec_vpp_freq(u32 session_type, u32 codec) +static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite) { const struct hfi_platform_codec_freq_data *data; =20 - data =3D get_codec_freq_data(session_type, codec); + WARN_ON(lite); + + data =3D get_codec_freq_data(session_type, codec, lite); if (data) return data->vpp_freq; =20 return 0; } =20 -static unsigned long codec_vsp_freq(u32 session_type, u32 codec) +static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite) { const struct hfi_platform_codec_freq_data *data; =20 - data =3D get_codec_freq_data(session_type, codec); + WARN_ON(lite); + + data =3D get_codec_freq_data(session_type, codec, lite); if (data) return data->vsp_freq; =20 return 0; } =20 -static unsigned long codec_lp_freq(u32 session_type, u32 codec) +static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite) { const struct hfi_platform_codec_freq_data *data; =20 - data =3D get_codec_freq_data(session_type, codec); + WARN_ON(lite); + + data =3D get_codec_freq_data(session_type, codec, lite); if (data) return data->low_power_freq; =20 diff --git a/drivers/media/platform/qcom/venus/hfi_platform_v6.c b/drivers/= media/platform/qcom/venus/hfi_platform_v6.c index 4e8af645f8b9..ad08d26cd7ba 100644 --- a/drivers/media/platform/qcom/venus/hfi_platform_v6.c +++ b/drivers/media/platform/qcom/venus/hfi_platform_v6.c @@ -245,14 +245,20 @@ static const struct hfi_plat_caps caps[] =3D { .num_fmts =3D 4, } }; =20 -static const struct hfi_plat_caps *get_capabilities(unsigned int *entries) +static const struct hfi_plat_caps *get_capabilities(unsigned int *entries, + bool lite) { + WARN_ON(lite); + *entries =3D ARRAY_SIZE(caps); return caps; } =20 -static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count) +static void get_codecs(u32 *enc_codecs, u32 *dec_codecs, u32 *count, + bool lite) { + WARN_ON(lite); + *enc_codecs =3D HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC | HFI_VIDEO_CODEC_VP8; *dec_codecs =3D HFI_VIDEO_CODEC_H264 | HFI_VIDEO_CODEC_HEVC | @@ -273,12 +279,14 @@ static const struct hfi_platform_codec_freq_data code= c_freq_data[] =3D { }; =20 static const struct hfi_platform_codec_freq_data * -get_codec_freq_data(u32 session_type, u32 pixfmt) +get_codec_freq_data(u32 session_type, u32 pixfmt, bool lite) { const struct hfi_platform_codec_freq_data *data =3D codec_freq_data; unsigned int i, data_size =3D ARRAY_SIZE(codec_freq_data); const struct hfi_platform_codec_freq_data *found =3D NULL; =20 + WARN_ON(lite); + for (i =3D 0; i < data_size; i++) { if (data[i].pixfmt =3D=3D pixfmt && data[i].session_type =3D=3D session_= type) { found =3D &data[i]; @@ -289,33 +297,39 @@ get_codec_freq_data(u32 session_type, u32 pixfmt) return found; } =20 -static unsigned long codec_vpp_freq(u32 session_type, u32 codec) +static unsigned long codec_vpp_freq(u32 session_type, u32 codec, bool lite) { const struct hfi_platform_codec_freq_data *data; =20 - data =3D get_codec_freq_data(session_type, codec); + WARN_ON(lite); + + data =3D get_codec_freq_data(session_type, codec, lite); if (data) return data->vpp_freq; =20 return 0; } =20 -static unsigned long codec_vsp_freq(u32 session_type, u32 codec) +static unsigned long codec_vsp_freq(u32 session_type, u32 codec, bool lite) { const struct hfi_platform_codec_freq_data *data; =20 - data =3D get_codec_freq_data(session_type, codec); + WARN_ON(lite); + + data =3D get_codec_freq_data(session_type, codec, lite); if (data) return data->vsp_freq; =20 return 0; } =20 -static unsigned long codec_lp_freq(u32 session_type, u32 codec) +static unsigned long codec_lp_freq(u32 session_type, u32 codec, bool lite) { const struct hfi_platform_codec_freq_data *data; =20 - data =3D get_codec_freq_data(session_type, codec); + WARN_ON(lite); + + data =3D get_codec_freq_data(session_type, codec, lite); if (data) return data->low_power_freq; =20 diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/= platform/qcom/venus/hfi_venus.c index cec7f5964d3d..d3da35f67fd5 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -380,7 +380,7 @@ static void venus_soft_int(struct venus_hfi_device *hde= v) void __iomem *cpu_ic_base =3D hdev->core->cpu_ic_base; u32 clear_bit; =20 - if (IS_V6(hdev->core)) + if (IS_V6(hdev->core) || (IS_V4(hdev->core) && is_lite(hdev->core))) clear_bit =3D BIT(CPU_IC_SOFTINT_H2A_SHIFT_V6); else clear_bit =3D BIT(CPU_IC_SOFTINT_H2A_SHIFT); @@ -501,9 +501,11 @@ static int venus_boot_core(struct venus_hfi_device *hd= ev) if (count >=3D max_tries) ret =3D -ETIMEDOUT; =20 - if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) { + if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->= core)) { writel(0x1, cpu_cs_base + CPU_CS_H2XSOFTINTEN_V6); - writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6); + + if (!IS_AR50_LITE(hdev->core)) + writel(0x0, cpu_cs_base + CPU_CS_X2RPMH_V6); } =20 return ret; @@ -569,6 +571,9 @@ static int venus_halt_axi(struct venus_hfi_device *hdev) u32 mask_val; int ret; =20 + if (IS_AR50_LITE(hdev->core)) + return 0; + if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) { writel(0x3, cpu_cs_base + CPU_CS_X2RPMH_V6); =20 @@ -1138,7 +1143,13 @@ static irqreturn_t venus_isr(struct venus_core *core) wrapper_base =3D hdev->core->wrapper_base; =20 status =3D readl(wrapper_base + WRAPPER_INTR_STATUS); - if (IS_IRIS2(core) || IS_IRIS2_1(core)) { + + if (IS_AR50_LITE(core)) { + if (status & WRAPPER_INTR_STATUS_A2H_MASK || + status & WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE || + status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK) + hdev->irq_status =3D status; + } else if (IS_IRIS2(core) || IS_IRIS2_1(core)) { if (status & WRAPPER_INTR_STATUS_A2H_MASK || status & WRAPPER_INTR_STATUS_A2HWD_MASK_V6 || status & CPU_CS_SCIACMDARG0_INIT_IDLE_MSG_MASK) @@ -1150,7 +1161,7 @@ static irqreturn_t venus_isr(struct venus_core *core) hdev->irq_status =3D status; } writel(1, cpu_cs_base + CPU_CS_A2HSOFTINTCLR); - if (!(IS_IRIS2(core) || IS_IRIS2_1(core))) + if (!(IS_IRIS2(core) || IS_IRIS2_1(core) || IS_AR50_LITE(core))) writel(status, wrapper_base + WRAPPER_INTR_CLEAR); =20 return IRQ_WAKE_THREAD; @@ -1535,7 +1546,7 @@ static bool venus_cpu_and_video_core_idle(struct venu= s_hfi_device *hdev) void __iomem *cpu_cs_base =3D hdev->core->cpu_cs_base; u32 ctrl_status, cpu_status; =20 - if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) + if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->= core)) cpu_status =3D readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6); else cpu_status =3D readl(wrapper_base + WRAPPER_CPU_STATUS); @@ -1555,7 +1566,7 @@ static bool venus_cpu_idle_and_pc_ready(struct venus_= hfi_device *hdev) void __iomem *cpu_cs_base =3D hdev->core->cpu_cs_base; u32 ctrl_status, cpu_status; =20 - if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core)) + if (IS_IRIS2(hdev->core) || IS_IRIS2_1(hdev->core) || IS_AR50_LITE(hdev->= core)) cpu_status =3D readl(wrapper_tz_base + WRAPPER_TZ_CPU_STATUS_V6); else cpu_status =3D readl(wrapper_base + WRAPPER_CPU_STATUS); diff --git a/drivers/media/platform/qcom/venus/hfi_venus_io.h b/drivers/med= ia/platform/qcom/venus/hfi_venus_io.h index 9735a246ce36..f2c3064c44ae 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus_io.h +++ b/drivers/media/platform/qcom/venus/hfi_venus_io.h @@ -51,6 +51,9 @@ /* Venus cpu */ #define CPU_CS_SCIACMDARG3 0x58 =20 +#define CPU_CS_VCICMD 0x20 +#define CPU_CS_VCICMD_ARP_OFF BIT(0) + #define SFR_ADDR 0x5c #define MMAP_ADDR 0x60 #define UC_REGION_ADDR 0x64 @@ -100,6 +103,7 @@ #define WRAPPER_INTR_MASK_A2HCPU_MASK 0x4 #define WRAPPER_INTR_MASK_A2HCPU_SHIFT 0x2 =20 +#define WRAPPER_INTR_STATUS_A2HWD_MASK_V4_LITE 0x10 #define WRAPPER_INTR_STATUS_A2HWD_MASK_V6 0x8 #define WRAPPER_INTR_MASK_A2HWD_BASK_V6 0x8 =20 diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media= /platform/qcom/venus/pm_helpers.c index 8dd5a9b0d060..e09b0d9ae610 100644 --- a/drivers/media/platform/qcom/venus/pm_helpers.c +++ b/drivers/media/platform/qcom/venus/pm_helpers.c @@ -51,7 +51,7 @@ static int core_clks_enable(struct venus_core *core) dev_pm_opp_put(opp); =20 for (i =3D 0; i < res->clks_num; i++) { - if (IS_V6(core)) { + if (IS_V6(core) || (IS_V4(core) && is_lite(core))) { ret =3D clk_set_rate(core->clks[i], freq); if (ret) goto err; diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platf= orm/qcom/venus/vdec.c index 29b0d6a5303d..ac3d2760b2e0 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -565,12 +565,7 @@ vdec_decoder_cmd(struct file *file, void *fh, struct v= 4l2_decoder_cmd *cmd) if (!(inst->streamon_out && inst->streamon_cap)) goto unlock; =20 - fdata.buffer_type =3D HFI_BUFFER_INPUT; - fdata.flags |=3D HFI_BUFFERFLAG_EOS; - if (IS_V6(inst->core) && is_fw_rev_or_older(inst->core, 1, 0, 87)) - fdata.device_addr =3D 0; - else - fdata.device_addr =3D 0xdeadb000; + venus_helper_prepare_eos_data(inst, &fdata); =20 ret =3D hfi_session_process_buf(inst, &fdata); =20 --=20 2.34.1