From nobody Wed Nov 27 04:29:04 2024 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 DE24F1BE86A; Mon, 14 Oct 2024 09:09:46 +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=1728896988; cv=none; b=Mm901WJD9wb1bn9oaEKyOctApTtGVusZUD20n8chZHPQyYPpi14AW+1DyzMwHPVEfIXd1kvS3RB6Z8901s3/FLxfbwV1INTxaz5hIAHFU4hI619Rj7aWcddcpNBrzELoj9mF1y1I57rK7ioI1etKRG/yF1MGe/u63TO9+/2AtLw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728896988; c=relaxed/simple; bh=sqYH8XshvvbhTbLylk/ve1TJ1nAJkBtnVpbnxS5f438=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=AhTIcsAPuLF2eJwoef/voh1dCECZWcMkJdNThnhfhjzgF7DFpCkR0jwfKyG7LE0vmDkikPRzIxIPzRn0ou9hjSpOAMoiiF+jCNcnQrvCxOtUOSehqiQqKHJYgLNzyGd8wuyPauRqvaVgNYGs5w/+GJnLVjky7YIe8A+Fu7EajKg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=mfbhp9Dk; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="mfbhp9Dk" Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49DNPQcl015828; Mon, 14 Oct 2024 09:09:41 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= lVPKK1q2lp4fT3jJgOHnQW1GaPQGC262559Q+5eZiPc=; b=mfbhp9Dk381GDbCP E1zVj2P6Yy2w93oKwVUV3bd0XHWFpkRyQfe9V85T/kfCYM5PsyllK5bkcUFUgZSe RxdebGawuDBJDDjPCbolS6gjAaTIhVZyKFDWpjcYZ99IozBOzesvsT8xXejAcaVL pi4xtk/LZHOs740IAF6DBbR/O3wEKVK2PldjXbIA4dfB9ZwmD2Sa/a86zamKf49A YDPgVxGKbs49BasME7RAfr7MnOFlaEpnO/6Lsun/vrOfv13PV8GbcXh5lHlmucPi eTBHQp9RHQ3dyfAMlW5lv+WH5ja/2Et47Dwtj68IdoCvr1gQWyDTwf3HIEoSgMqu GVvAhQ== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 427j9kutet-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Oct 2024 09:09:41 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA04.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 49E99eMF020400 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Oct 2024 09:09:40 GMT Received: from hu-dikshita-hyd.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Mon, 14 Oct 2024 02:09:36 -0700 From: Dikshita Agarwal Date: Mon, 14 Oct 2024 14:37:48 +0530 Subject: [PATCH v4 27/28] media: iris: enable video driver probe of SM8250 SoC 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: <20241014-qcom-video-iris-v4-v4-27-c5eaa4e9ab9e@quicinc.com> References: <20241014-qcom-video-iris-v4-v4-0-c5eaa4e9ab9e@quicinc.com> In-Reply-To: <20241014-qcom-video-iris-v4-v4-0-c5eaa4e9ab9e@quicinc.com> To: Vikash Garodia , Abhinav Kumar , Mauro Carvalho Chehab , "Rob Herring" , Krzysztof Kozlowski , "Conor Dooley" , Philipp Zabel CC: Hans Verkuil , Sebastian Fricke , , , , , Dikshita Agarwal X-Mailer: b4 0.14.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1728896854; l=7829; i=quic_dikshita@quicinc.com; s=20240917; h=from:subject:message-id; bh=sqYH8XshvvbhTbLylk/ve1TJ1nAJkBtnVpbnxS5f438=; b=QN/zoH1EKsi2RjxTRXCBYEAekt9oMH25QJn3tfYL3oKjnkpcTypEDhdC8ES0ifmceN5uTcMw3 LttQNouNWPYDpAR6Bhr4NxCmaVsFsTJeGXkH0nOboCGSBbMM+GkBtjG X-Developer-Key: i=quic_dikshita@quicinc.com; a=ed25519; pk=EEvKY6Ar1OI5SWf44FJ1Ebo1KuQEVbbf5UNPO+UHVhM= X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01a.na.qualcomm.com (10.47.209.196) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: bXfNrbClh0bI-o5_Lo71OrJQ1sWd3iPS X-Proofpoint-ORIG-GUID: bXfNrbClh0bI-o5_Lo71OrJQ1sWd3iPS X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 lowpriorityscore=0 clxscore=1015 malwarescore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 mlxlogscore=999 phishscore=0 impostorscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2409260000 definitions=main-2410140066 Initialize the platform data and enable video driver probe of SM8250 SoC. Signed-off-by: Dikshita Agarwal --- drivers/media/platform/qcom/iris/Makefile | 1 + drivers/media/platform/qcom/iris/iris_ctrls.c | 4 + .../platform/qcom/iris/iris_platform_common.h | 1 + .../platform/qcom/iris/iris_platform_sm8250.c | 148 +++++++++++++++++= ++++ drivers/media/platform/qcom/iris/iris_probe.c | 4 + 5 files changed, 158 insertions(+) diff --git a/drivers/media/platform/qcom/iris/Makefile b/drivers/media/plat= form/qcom/iris/Makefile index ca31db847273..a746681e03cd 100644 --- a/drivers/media/platform/qcom/iris/Makefile +++ b/drivers/media/platform/qcom/iris/Makefile @@ -9,6 +9,7 @@ iris-objs +=3D iris_buffer.o \ iris_hfi_gen2_packet.o \ iris_hfi_gen2_response.o \ iris_hfi_queue.o \ + iris_platform_sm8250.o \ iris_platform_sm8550.o \ iris_power.o \ iris_probe.o \ diff --git a/drivers/media/platform/qcom/iris/iris_ctrls.c b/drivers/media/= platform/qcom/iris/iris_ctrls.c index 65d10c97e004..e4c064cbacdd 100644 --- a/drivers/media/platform/qcom/iris/iris_ctrls.c +++ b/drivers/media/platform/qcom/iris/iris_ctrls.c @@ -17,6 +17,8 @@ static inline bool iris_valid_cap_id(enum platform_inst_f= w_cap_type cap_id) static enum platform_inst_fw_cap_type iris_get_cap_id(u32 id) { switch (id) { + case V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER: + return DEBLOCK; case V4L2_CID_MPEG_VIDEO_H264_PROFILE: return PROFILE; case V4L2_CID_MPEG_VIDEO_H264_LEVEL: @@ -32,6 +34,8 @@ static u32 iris_get_v4l2_id(enum platform_inst_fw_cap_typ= e cap_id) return 0; =20 switch (cap_id) { + case DEBLOCK: + return V4L2_CID_MPEG_VIDEO_DECODER_MPEG4_DEBLOCK_FILTER; case PROFILE: return V4L2_CID_MPEG_VIDEO_H264_PROFILE; case LEVEL: diff --git a/drivers/media/platform/qcom/iris/iris_platform_common.h b/driv= ers/media/platform/qcom/iris/iris_platform_common.h index c333a14f9c54..2a1b46b69efa 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -34,6 +34,7 @@ enum pipe_type { }; =20 extern struct iris_platform_data sm8550_data; +extern struct iris_platform_data sm8250_data; =20 enum platform_clk_type { IRIS_AXI_CLK, diff --git a/drivers/media/platform/qcom/iris/iris_platform_sm8250.c b/driv= ers/media/platform/qcom/iris/iris_platform_sm8250.c new file mode 100644 index 000000000000..9ef2fcc1a0fd --- /dev/null +++ b/drivers/media/platform/qcom/iris/iris_platform_sm8250.c @@ -0,0 +1,148 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights res= erved. + */ + +#include "iris_core.h" +#include "iris_ctrls.h" +#include "iris_platform_common.h" +#include "iris_resources.h" +#include "iris_hfi_gen1.h" +#include "iris_hfi_gen1_defines.h" +#include "iris_vpu_common.h" + +static struct platform_inst_fw_cap inst_fw_cap_sm8250[] =3D { + { + .cap_id =3D PIPE, + .min =3D PIPE_1, + .max =3D PIPE_4, + .step_or_mask =3D 1, + .value =3D PIPE_4, + .hfi_id =3D HFI_PROPERTY_PARAM_WORK_ROUTE, + .set =3D iris_set_pipe, + }, + { + .cap_id =3D STAGE, + .min =3D STAGE_1, + .max =3D STAGE_2, + .step_or_mask =3D 1, + .value =3D STAGE_2, + .hfi_id =3D HFI_PROPERTY_PARAM_WORK_MODE, + .set =3D iris_set_stage, + }, + { + .cap_id =3D DEBLOCK, + .min =3D 0, + .max =3D 1, + .step_or_mask =3D 1, + .value =3D 0, + .hfi_id =3D HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER, + .set =3D iris_set_u32, + }, +}; + +static struct platform_inst_caps platform_inst_cap_sm8250 =3D { + .min_frame_width =3D 128, + .max_frame_width =3D 8192, + .min_frame_height =3D 128, + .max_frame_height =3D 8192, + .max_mbpf =3D 138240, + .mb_cycles_vsp =3D 25, + .mb_cycles_vpp =3D 200, +}; + +static void iris_set_sm8250_preset_registers(struct iris_core *core) +{ + writel(0x0, core->reg_base + 0xB0088); +} + +static const struct icc_info sm8250_icc_table[] =3D { + { "cpu-cfg", 1000, 1000 }, + { "video-mem", 1000, 15000000 }, +}; + +static const char * const sm8250_clk_reset_table[] =3D { "bus", "core" }; + +static const struct bw_info sm8250_bw_table_dec[] =3D { + { ((4096 * 2160) / 256) * 60, 2403000 }, + { ((4096 * 2160) / 256) * 30, 1224000 }, + { ((1920 * 1080) / 256) * 60, 812000 }, + { ((1920 * 1080) / 256) * 30, 416000 }, +}; + +static const char * const sm8250_pmdomain_table[] =3D { "venus", "vcodec0"= }; + +static const char * const sm8250_opp_pd_table[] =3D { "mx" }; + +static const struct platform_clk_data sm8250_clk_table[] =3D { + {IRIS_AXI_CLK, "iface" }, + {IRIS_CTRL_CLK, "core" }, + {IRIS_HW_CLK, "vcodec0_core" }, +}; + +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 u32 sm8250_vdec_input_config_param[] =3D { + HFI_PROPERTY_PARAM_FRAME_SIZE, + HFI_PROPERTY_CONFIG_VIDEOCORES_USAGE, + HFI_PROPERTY_PARAM_UNCOMPRESSED_FORMAT_SELECT, + HFI_PROPERTY_PARAM_UNCOMPRESSED_PLANE_ACTUAL_CONSTRAINTS_INFO, + HFI_PROPERTY_PARAM_BUFFER_COUNT_ACTUAL, + HFI_PROPERTY_PARAM_VDEC_MULTI_STREAM, + HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL, + HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE, +}; + +static const u32 sm8250_dec_ip_int_buf_tbl[] =3D { + BUF_BIN, + BUF_SCRATCH_1, +}; + +static const u32 sm8250_dec_op_int_buf_tbl[] =3D { + BUF_DPB, +}; + +struct iris_platform_data sm8250_data =3D { + .get_instance =3D iris_hfi_gen1_get_instance, + .init_hfi_command_ops =3D &iris_hfi_gen1_command_ops_init, + .init_hfi_response_ops =3D iris_hfi_gen1_response_ops_init, + .vpu_ops =3D &iris_vpu2_ops, + .set_preset_registers =3D iris_set_sm8250_preset_registers, + .icc_tbl =3D sm8250_icc_table, + .icc_tbl_size =3D ARRAY_SIZE(sm8250_icc_table), + .clk_rst_tbl =3D sm8250_clk_reset_table, + .clk_rst_tbl_size =3D ARRAY_SIZE(sm8250_clk_reset_table), + .bw_tbl_dec =3D sm8250_bw_table_dec, + .bw_tbl_dec_size =3D ARRAY_SIZE(sm8250_bw_table_dec), + .pmdomain_tbl =3D sm8250_pmdomain_table, + .pmdomain_tbl_size =3D ARRAY_SIZE(sm8250_pmdomain_table), + .opp_pd_tbl =3D sm8250_opp_pd_table, + .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), + .dma_mask =3D GENMASK(31, 29) - 1, + .fwname =3D "qcom/vpu-1.0/venus.mbn", + .pas_id =3D IRIS_PAS_ID, + .inst_caps =3D &platform_inst_cap_sm8250, + .inst_fw_caps =3D inst_fw_cap_sm8250, + .inst_fw_caps_size =3D ARRAY_SIZE(inst_fw_cap_sm8250), + .tz_cp_config_data =3D &tz_cp_config_sm8250, + .hw_response_timeout =3D HW_RESPONSE_TIMEOUT_VALUE, + .num_vpp_pipe =3D 4, + .max_session_count =3D 16, + .max_core_mbpf =3D (8192 * 4352) / 256, + .input_config_params =3D + sm8250_vdec_input_config_param, + .input_config_params_size =3D + ARRAY_SIZE(sm8250_vdec_input_config_param), + + .dec_ip_int_buf_tbl =3D sm8250_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size =3D ARRAY_SIZE(sm8250_dec_ip_int_buf_tbl), + .dec_op_int_buf_tbl =3D sm8250_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size =3D ARRAY_SIZE(sm8250_dec_op_int_buf_tbl), +}; diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/= platform/qcom/iris/iris_probe.c index 86ef2e5c488e..a2aadd48926f 100644 --- a/drivers/media/platform/qcom/iris/iris_probe.c +++ b/drivers/media/platform/qcom/iris/iris_probe.c @@ -325,6 +325,10 @@ static const struct of_device_id iris_dt_match[] =3D { .compatible =3D "qcom,sm8550-iris", .data =3D &sm8550_data, }, + { + .compatible =3D "qcom,sm8250-venus", + .data =3D &sm8250_data, + }, { }, }; MODULE_DEVICE_TABLE(of, iris_dt_match); --=20 2.34.1