From patchwork Tue Jan 28 08:04:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dikshita Agarwal X-Patchwork-Id: 13952164 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 A0DDD8462; Tue, 28 Jan 2025 08:05:33 +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=1738051535; cv=none; b=Ink6KOFEk7tE3sQuIeL78ejRAPKB42CuhHdZoEZW/U1ewVJHXLYEmITn7ogprWg7j1adNCIsSushzMObaLhG2HdBp3BdqBkgpJMARblAVK871WIOyndRRDEJZw9EpG7djoFupk763OFihUfNnNZ4BJX/EgsGiNtLQITS1hJ8zrA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738051535; c=relaxed/simple; bh=P2cCKmvjiVGyz3aZlVis7QWWtNl98gsucLHH68Ds1ZM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E70qGtxSNZDbWsmw8xfcnSXBL6REGPW7aGA6+Wg753W9A0M1uvVlsP7Np3T/evDJxE/cUnAlYn4nKqJQTS5wMe6XUVLJuVWMuJlDHm0kxaBgMcblCjke5K+5zR2LfxAonlCoFGyE7lEFBt1JcYDgRhoQwVBgR1cwgocSDFR8/v4= 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=nlCySCLI; arc=none smtp.client-ip=205.220.180.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="nlCySCLI" Received: from pps.filterd (m0279871.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50S1chcu017126; Tue, 28 Jan 2025 08:05:25 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= XuadnqemqlHlUFbQ8N2KzZulOJDtNacuwMdHlxS11S4=; b=nlCySCLI3L7T6jbK 9yaLx/bbfTJ6gi3ca5lP+FGVgBnBTRVVv5z8OBYiPTu0Bdjwk3Lt2RLt/OLTvq2w guP7c/urt7Yh6IJZUt5WDJlhnW8ak1tmjNBtZ6oDaGcBx/yK36g/g4byGI5UMeP4 PiqY46UUrIRHxMvwQivYLt3RBtCCg5rtksAVDAaZCGNkZEx6OZUN3LZ6rkfPIyY8 2Fp4G1QdNZXZ1utujiLJTA6QLoaKadRBiZRO3/MC8hBeyIvNDxuNiCHiGmVvvXuL eWq+fUqrDxjKZxPuTNRMC+MIPy0SxKs7Emnu7RRCNfDZT6NEoN4QCTo3jzPGFUHE vW+kBw== Received: from nalasppmta04.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44enrq8n5p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jan 2025 08:05:25 +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 50S85OCm013971 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jan 2025 08:05:24 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; Tue, 28 Jan 2025 00:05:17 -0800 From: Dikshita Agarwal To: , , , , , CC: , , , , , , , , , , , , , , , Subject: [RFC PATCH v10 1/2] media: iris: introduce helper module to select video driver Date: Tue, 28 Jan 2025 13:34:28 +0530 Message-ID: <20250128080429.3911091-2-quic_dikshita@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250128080429.3911091-1-quic_dikshita@quicinc.com> References: <20250128080429.3911091-1-quic_dikshita@quicinc.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: w6VKo6SZETstTKa6kiABSnTMmxRIFRix X-Proofpoint-ORIG-GUID: w6VKo6SZETstTKa6kiABSnTMmxRIFRix X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-28_02,2025-01-27_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 mlxscore=0 impostorscore=0 adultscore=0 mlxlogscore=999 lowpriorityscore=0 priorityscore=1501 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501280061 Introduce a helper module with a kernel param to select between venus and iris drivers for platforms supported by both drivers. Signed-off-by: Dikshita Agarwal --- drivers/media/platform/qcom/Makefile | 1 + drivers/media/platform/qcom/iris/iris_core.h | 1 + drivers/media/platform/qcom/iris/iris_probe.c | 3 + drivers/media/platform/qcom/venus/core.c | 5 ++ .../platform/qcom/video_drv_helper/Makefile | 4 ++ .../qcom/video_drv_helper/video_drv_helper.c | 70 +++++++++++++++++++ .../qcom/video_drv_helper/video_drv_helper.h | 11 +++ 7 files changed, 95 insertions(+) create mode 100644 drivers/media/platform/qcom/video_drv_helper/Makefile create mode 100644 drivers/media/platform/qcom/video_drv_helper/video_drv_helper.c create mode 100644 drivers/media/platform/qcom/video_drv_helper/video_drv_helper.h diff --git a/drivers/media/platform/qcom/Makefile b/drivers/media/platform/qcom/Makefile index ea2221a202c0..15accde3bd67 100644 --- a/drivers/media/platform/qcom/Makefile +++ b/drivers/media/platform/qcom/Makefile @@ -2,3 +2,4 @@ obj-y += camss/ obj-y += iris/ obj-y += venus/ +obj-y += video_drv_helper/ diff --git a/drivers/media/platform/qcom/iris/iris_core.h b/drivers/media/platform/qcom/iris/iris_core.h index 37fb4919fecc..7108e751ff88 100644 --- a/drivers/media/platform/qcom/iris/iris_core.h +++ b/drivers/media/platform/qcom/iris/iris_core.h @@ -107,5 +107,6 @@ struct iris_core { int iris_core_init(struct iris_core *core); void iris_core_deinit(struct iris_core *core); +extern bool video_drv_should_bind(struct device *dev, bool is_iris_driver); #endif diff --git a/drivers/media/platform/qcom/iris/iris_probe.c b/drivers/media/platform/qcom/iris/iris_probe.c index 954cc7c0cc97..276461ade811 100644 --- a/drivers/media/platform/qcom/iris/iris_probe.c +++ b/drivers/media/platform/qcom/iris/iris_probe.c @@ -196,6 +196,9 @@ static int iris_probe(struct platform_device *pdev) u64 dma_mask; int ret; + if (!video_drv_should_bind(&pdev->dev, true)) + return -ENODEV; + core = devm_kzalloc(&pdev->dev, sizeof(*core), GFP_KERNEL); if (!core) return -ENOMEM; diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 77d48578ecd2..b38be7812efe 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -369,12 +369,17 @@ static int venus_add_dynamic_nodes(struct venus_core *core) static void venus_remove_dynamic_nodes(struct venus_core *core) {} #endif +extern bool video_drv_should_bind(struct device *dev, bool is_iris_driver); + static int venus_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct venus_core *core; int ret; + if (!video_drv_should_bind(&pdev->dev, false)) + return -ENODEV; + core = devm_kzalloc(dev, sizeof(*core), GFP_KERNEL); if (!core) return -ENOMEM; diff --git a/drivers/media/platform/qcom/video_drv_helper/Makefile b/drivers/media/platform/qcom/video_drv_helper/Makefile new file mode 100644 index 000000000000..82567e0392fb --- /dev/null +++ b/drivers/media/platform/qcom/video_drv_helper/Makefile @@ -0,0 +1,4 @@ +# Makefile for Video driver helper + +obj-m := video_drv_helper.o + diff --git a/drivers/media/platform/qcom/video_drv_helper/video_drv_helper.c b/drivers/media/platform/qcom/video_drv_helper/video_drv_helper.c new file mode 100644 index 000000000000..9009c2906e54 --- /dev/null +++ b/drivers/media/platform/qcom/video_drv_helper/video_drv_helper.c @@ -0,0 +1,70 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#include +#include +#include + +#include "video_drv_helper.h" + +/* The venus driver supports only hfi gen1 to communicate with the firmware while + * the iris driver supports both hfi gen1 and hfi gen2. + * The support of hfi gen1 is added to the iris driver with the intention that + * it can support old gen1 interface based firmware, while enabling gen2 based future SOCs. + * With this, the plan is to migrate older SOCs from venus to iris. + * As of now, since the iris driver supports only entry level features and doesn't have + * feature parity with the venus driver, a runtime-selection is provided to user via + * module parameter 'prefer_venus' to select the driver. + * This selection is available only for the SoCs which are supported by both venus + * and iris eg: SM8250. + * When the feature parity is achieved, the plan is to switch the default to point to + * the iris driver, then gradually start removing platforms from venus. + * Hardware supported by only venus - 8916, 8996, SDM660, SDM845, SC7180, SC7280 + * Hardware supported by only iris - SM8550 + * Hardware supported by both venus and iris - SM8250 + */ + +#if !IS_REACHABLE(CONFIG_VIDEO_QCOM_VENUS) || !IS_REACHABLE(CONFIG_VIDEO_QCOM_IRIS) +bool video_drv_should_bind(struct device *dev, bool is_iris_driver) +{ + /* If just a single driver is enabled, use it no matter what */ + return true; +} + +#else +static bool prefer_venus = true; +MODULE_PARM_DESC(prefer_venus, "Select whether venus or iris driver should be preferred"); +module_param(prefer_venus, bool, 0444); + +/* list all platforms supported by both venus and iris drivers */ +static const char *const venus_to_iris_migration[] = { + "qcom,sm8250-venus", + NULL, +}; + +bool video_drv_should_bind(struct device *dev, bool is_iris_driver) +{ + if (of_device_compatible_match(dev->of_node, venus_to_iris_migration)) + return prefer_venus ? !is_iris_driver : is_iris_driver; + + return true; +} +EXPORT_SYMBOL_GPL(video_drv_should_bind); +#endif + +static int __init video_drv_helper_init(void) +{ + return 0; +} + +static void __exit video_drv_helper_exit(void) +{ +} + +module_init(video_drv_helper_init); +module_exit(video_drv_helper_exit); + +MODULE_DESCRIPTION("A video driver helper module"); +MODULE_LICENSE("GPL"); diff --git a/drivers/media/platform/qcom/video_drv_helper/video_drv_helper.h b/drivers/media/platform/qcom/video_drv_helper/video_drv_helper.h new file mode 100644 index 000000000000..6d835227fec2 --- /dev/null +++ b/drivers/media/platform/qcom/video_drv_helper/video_drv_helper.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +/* + * Copyright (c) 2025 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#ifndef __VIDEO_DRV_HELPER_H__ +#define __VIDEO_DRV_HELPER_H__ + +bool video_drv_should_bind(struct device *dev, bool is_iris_driver); + +#endif From patchwork Tue Jan 28 08:04:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dikshita Agarwal X-Patchwork-Id: 13952165 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 AE1DF1DE4D6; Tue, 28 Jan 2025 08:05:42 +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=1738051545; cv=none; b=ER01v/j1M4LE8ZaUbYfwGEq7jIuyAY94dkIlfGXhqOpF6LAWjn9NZmA202occy6lHcZlyxT9DTC++7GI1UnGEAAi6eeP34EAzZWCjDgQMZAv6MfyZvoqr+eG4V5faDI2JAyx8bj6dh3UmwBafj9Tpleqkc+Utb95QeeRMIMNyGk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738051545; c=relaxed/simple; bh=phBb+xCD0Gr4v1dNFFrAkdZBDl6tfRRfhhScqXofeXs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=E5bcVxEwNfFerR+Th6q30XT4/ZI9u/Gy4ib/p/NJZLNPx81q+G4/bmmDaKD6/ggYYisbxZGrd3/NV71tDhg+IDNkZNaECyPE/Y9oGuPHZJeFEYyq4tSKMmcc8Dx9utwbJbZnadxJ+++xPioFSaWxXY5jVM1snCE9PO1hZjNQUFk= 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=XphX1Nxn; arc=none smtp.client-ip=205.220.180.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="XphX1Nxn" Received: from pps.filterd (m0279872.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50S5r051029367; Tue, 28 Jan 2025 08:05:32 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= IwHuX2a87T5teGsysN9gAkeNrqxFRYpu7qvmAA8g3xc=; b=XphX1Nxn2Ge6mTGU ljVvtknAmdrbr54CicpvV3dyQ5A7AxX95qRKtrihau3qtgu4MLuc6HJFppDSMb5s 43gAxQPjjHGYil2dd8kZIvecPO48svAgtrqHqkfuz+XiBCdZIFghm56aJNLZ/h8l dDZR3RUzMvj21zUEaWnNICa7ZT4tt2vaP8MRYFgpFwbKc+3qwqsvepsLcECqY8PU 3YPZeACbFSEzk6pAifpD/nTUsqinDR3oTUdJ+V2o80ECwwQ3wCD6SdLSdegu8ckT hIuOqvHta1LPro4AIVQgER8e9luAn/Uz2BsqE2uC2WbQ+Q5Gd3L1z4PRiVGuTLLO lgNAcg== Received: from nalasppmta03.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 44esfq0a5a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jan 2025 08:05:32 +0000 (GMT) Received: from nalasex01a.na.qualcomm.com (nalasex01a.na.qualcomm.com [10.47.209.196]) by NALASPPMTA03.qualcomm.com (8.18.1.2/8.18.1.2) with ESMTPS id 50S85Vta003178 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Jan 2025 08:05:31 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; Tue, 28 Jan 2025 00:05:24 -0800 From: Dikshita Agarwal To: , , , , , CC: , , , , , , , , , , , , , , , Subject: [RFC PATCH v10 2/2] media: iris: enable video driver probe of SM8250 SoC Date: Tue, 28 Jan 2025 13:34:29 +0530 Message-ID: <20250128080429.3911091-3-quic_dikshita@quicinc.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250128080429.3911091-1-quic_dikshita@quicinc.com> References: <20250128080429.3911091-1-quic_dikshita@quicinc.com> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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: ywEsLvH9hedm0oemCZT_iKu1OamtuFF8 X-Proofpoint-ORIG-GUID: ywEsLvH9hedm0oemCZT_iKu1OamtuFF8 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-28_02,2025-01-27_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 spamscore=0 adultscore=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 suspectscore=0 bulkscore=0 priorityscore=1501 impostorscore=0 clxscore=1015 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2501280061 Initialize the platform data and enable video driver probe of SM8250 SoC. Signed-off-by: Dikshita Agarwal --- drivers/media/platform/qcom/iris/Makefile | 1 + .../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 + 4 files changed, 154 insertions(+) create mode 100644 drivers/media/platform/qcom/iris/iris_platform_sm8250.c diff --git a/drivers/media/platform/qcom/iris/Makefile b/drivers/media/platform/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 += 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_platform_common.h b/drivers/media/platform/qcom/iris/iris_platform_common.h index 189dd081ad0a..f6b15d2805fb 100644 --- a/drivers/media/platform/qcom/iris/iris_platform_common.h +++ b/drivers/media/platform/qcom/iris/iris_platform_common.h @@ -33,6 +33,7 @@ enum pipe_type { PIPE_4 = 4, }; +extern struct iris_platform_data sm8250_data; extern struct iris_platform_data sm8550_data; enum platform_clk_type { diff --git a/drivers/media/platform/qcom/iris/iris_platform_sm8250.c b/drivers/media/platform/qcom/iris/iris_platform_sm8250.c new file mode 100644 index 000000000000..360be452c1fa --- /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 reserved. + */ + +#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[] = { + { + .cap_id = PIPE, + .min = PIPE_1, + .max = PIPE_4, + .step_or_mask = 1, + .value = PIPE_4, + .hfi_id = HFI_PROPERTY_PARAM_WORK_ROUTE, + .set = iris_set_pipe, + }, + { + .cap_id = STAGE, + .min = STAGE_1, + .max = STAGE_2, + .step_or_mask = 1, + .value = STAGE_2, + .hfi_id = HFI_PROPERTY_PARAM_WORK_MODE, + .set = iris_set_stage, + }, + { + .cap_id = DEBLOCK, + .min = 0, + .max = 1, + .step_or_mask = 1, + .value = 0, + .hfi_id = HFI_PROPERTY_CONFIG_VDEC_POST_LOOP_DEBLOCKER, + .set = iris_set_u32, + }, +}; + +static struct platform_inst_caps platform_inst_cap_sm8250 = { + .min_frame_width = 128, + .max_frame_width = 8192, + .min_frame_height = 128, + .max_frame_height = 8192, + .max_mbpf = 138240, + .mb_cycles_vsp = 25, + .mb_cycles_vpp = 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[] = { + { "cpu-cfg", 1000, 1000 }, + { "video-mem", 1000, 15000000 }, +}; + +static const char * const sm8250_clk_reset_table[] = { "bus", "core" }; + +static const struct bw_info sm8250_bw_table_dec[] = { + { ((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[] = { "venus", "vcodec0" }; + +static const char * const sm8250_opp_pd_table[] = { "mx" }; + +static const struct platform_clk_data sm8250_clk_table[] = { + {IRIS_AXI_CLK, "iface" }, + {IRIS_CTRL_CLK, "core" }, + {IRIS_HW_CLK, "vcodec0_core" }, +}; + +static struct tz_cp_config tz_cp_config_sm8250 = { + .cp_start = 0, + .cp_size = 0x25800000, + .cp_nonpixel_start = 0x01000000, + .cp_nonpixel_size = 0x24800000, +}; + +static const u32 sm8250_vdec_input_config_param_default[] = { + 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_FRAME_SIZE, + HFI_PROPERTY_PARAM_BUFFER_SIZE_ACTUAL, + HFI_PROPERTY_PARAM_BUFFER_ALLOC_MODE, +}; + +static const u32 sm8250_dec_ip_int_buf_tbl[] = { + BUF_BIN, + BUF_SCRATCH_1, +}; + +static const u32 sm8250_dec_op_int_buf_tbl[] = { + BUF_DPB, +}; + +struct iris_platform_data sm8250_data = { + .get_instance = iris_hfi_gen1_get_instance, + .init_hfi_command_ops = &iris_hfi_gen1_command_ops_init, + .init_hfi_response_ops = iris_hfi_gen1_response_ops_init, + .vpu_ops = &iris_vpu2_ops, + .set_preset_registers = iris_set_sm8250_preset_registers, + .icc_tbl = sm8250_icc_table, + .icc_tbl_size = ARRAY_SIZE(sm8250_icc_table), + .clk_rst_tbl = sm8250_clk_reset_table, + .clk_rst_tbl_size = ARRAY_SIZE(sm8250_clk_reset_table), + .bw_tbl_dec = sm8250_bw_table_dec, + .bw_tbl_dec_size = ARRAY_SIZE(sm8250_bw_table_dec), + .pmdomain_tbl = sm8250_pmdomain_table, + .pmdomain_tbl_size = ARRAY_SIZE(sm8250_pmdomain_table), + .opp_pd_tbl = sm8250_opp_pd_table, + .opp_pd_tbl_size = ARRAY_SIZE(sm8250_opp_pd_table), + .clk_tbl = sm8250_clk_table, + .clk_tbl_size = ARRAY_SIZE(sm8250_clk_table), + .dma_mask = GENMASK(31, 29) - 1, + .fwname = "qcom/vpu-1.0/venus.mbn", + .pas_id = IRIS_PAS_ID, + .inst_caps = &platform_inst_cap_sm8250, + .inst_fw_caps = inst_fw_cap_sm8250, + .inst_fw_caps_size = ARRAY_SIZE(inst_fw_cap_sm8250), + .tz_cp_config_data = &tz_cp_config_sm8250, + .hw_response_timeout = HW_RESPONSE_TIMEOUT_VALUE, + .num_vpp_pipe = 4, + .max_session_count = 16, + .max_core_mbpf = (8192 * 4352) / 256, + .input_config_params_default = + sm8250_vdec_input_config_param_default, + .input_config_params_default_size = + ARRAY_SIZE(sm8250_vdec_input_config_param_default), + + .dec_ip_int_buf_tbl = sm8250_dec_ip_int_buf_tbl, + .dec_ip_int_buf_tbl_size = ARRAY_SIZE(sm8250_dec_ip_int_buf_tbl), + .dec_op_int_buf_tbl = sm8250_dec_op_int_buf_tbl, + .dec_op_int_buf_tbl_size = 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 276461ade811..1b7aec817331 100644 --- a/drivers/media/platform/qcom/iris/iris_probe.c +++ b/drivers/media/platform/qcom/iris/iris_probe.c @@ -327,6 +327,10 @@ static const struct of_device_id iris_dt_match[] = { .compatible = "qcom,sm8550-iris", .data = &sm8550_data, }, + { + .compatible = "qcom,sm8250-venus", + .data = &sm8250_data, + }, { }, }; MODULE_DEVICE_TABLE(of, iris_dt_match);