mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
nvdla: kmd: add support for ACPI
Bug 4988970 Jira DLA-7673 Change-Id: I8d611932cf7b7af107f135e9ae44caad9032a6c0 Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3272418 Signed-off-by: Amit Sharma <amisharma@nvidia.com> (cherry picked from commit e01c86ebdf123d6e9a40986c16f7f3ccbb989cc1) Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3270720 Reviewed-by: Ayush Kumar <ayushk@nvidia.com> Reviewed-by: Arvind M <am@nvidia.com> Reviewed-by: Vishal Thoke <vthoke@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com> Reviewed-by: Mitch Harwell <mharwell@nvidia.com> Reviewed-by: svcacv <svcacv@nvidia.com>
This commit is contained in:
@@ -29,6 +29,7 @@ ccflags-y += -DNVDLA_HAVE_CONFIG_HSIERRINJ=0
|
||||
ccflags-y += -DBUG_4942853=1
|
||||
ccflags-y += -DBUG_4960393=1
|
||||
ccflags-y += -DBUG_4972382=1
|
||||
ccflags-y += -DBUG_5054810=1
|
||||
|
||||
NVDLA_OBJS := \
|
||||
$(NVDLA_COMMON_OBJS) \
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <nvidia/conftest.h>
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/arm64-barrier.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/fs.h>
|
||||
@@ -928,6 +929,20 @@ static struct of_device_id tegra_nvdla_of_match[] = {
|
||||
.data = (struct nvhost_device_data *)&t264_sim_nvdla0_info },
|
||||
{ },
|
||||
};
|
||||
|
||||
static struct acpi_device_id tegra_nvdla_acpi_match[] = {
|
||||
{
|
||||
.id = "NVDA200A",
|
||||
.driver_data = 0x0,
|
||||
},
|
||||
{ },
|
||||
};
|
||||
|
||||
static void *acpi_data[] = {
|
||||
/*0x0*/ &t25x_nvdla0_info,
|
||||
NULL,
|
||||
};
|
||||
|
||||
#else
|
||||
static struct of_device_id tegra_nvdla_of_match[] = {
|
||||
{
|
||||
@@ -948,8 +963,18 @@ static struct of_device_id tegra_nvdla_of_match[] = {
|
||||
.data = (struct nvhost_device_data *)&t23x_nvdla1_info },
|
||||
{ },
|
||||
};
|
||||
|
||||
static struct acpi_device_id tegra_nvdla_acpi_match[] = {
|
||||
{ },
|
||||
};
|
||||
|
||||
static void *acpi_data[] = {
|
||||
NULL,
|
||||
};
|
||||
|
||||
#endif /* NVDLA_HAVE_CONFIG_AXI */
|
||||
MODULE_DEVICE_TABLE(of, tegra_nvdla_of_match);
|
||||
MODULE_DEVICE_TABLE(acpi, tegra_nvdla_acpi_match);
|
||||
|
||||
static uint32_t num_enabled_dla_instances(uint32_t soft_fuse_ret,
|
||||
int hw_reg_fuse_ret)
|
||||
@@ -999,6 +1024,13 @@ static int nvdla_probe(struct platform_device *pdev)
|
||||
match = of_match_device(tegra_nvdla_of_match, dev);
|
||||
if (match)
|
||||
pdata = (struct nvhost_device_data *)match->data;
|
||||
} else if (ACPI_HANDLE(&pdev->dev)) {
|
||||
const struct acpi_device_id *match;
|
||||
|
||||
match = acpi_match_device(tegra_nvdla_acpi_match, dev);
|
||||
if (match)
|
||||
pdata = (struct nvhost_device_data *)
|
||||
acpi_data[match->driver_data];
|
||||
} else {
|
||||
pdata = (struct nvhost_device_data *)pdev->dev.platform_data;
|
||||
}
|
||||
@@ -1074,10 +1106,12 @@ static int nvdla_probe(struct platform_device *pdev)
|
||||
goto err_alloc_nvdla;
|
||||
}
|
||||
|
||||
if (pdev->dev.of_node) {
|
||||
nvdla_dev->icc_write = devm_of_icc_get(dev, "write");
|
||||
if (IS_ERR(nvdla_dev->icc_write))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(nvdla_dev->icc_write),
|
||||
"failed to get icc write handle\n");
|
||||
}
|
||||
|
||||
nvdla_dev->dev = dev;
|
||||
nvdla_dev->pdev = pdev;
|
||||
@@ -1098,7 +1132,10 @@ static int nvdla_probe(struct platform_device *pdev)
|
||||
|
||||
if (pdata->version == FIRMWARE_ENCODE_VERSION(T23X)) {
|
||||
if (num_enabled_dla_instances(soft_fuse_ret, fuse_register_ret) == 1) {
|
||||
if (pdev->dev.of_node)
|
||||
pdev->dev.of_node->name = "nvdla0";
|
||||
else
|
||||
pdata->devfs_name = "nvdla0";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1349,6 +1386,9 @@ static struct platform_driver nvdla_driver = {
|
||||
#ifdef CONFIG_OF
|
||||
.of_match_table = tegra_nvdla_of_match,
|
||||
#endif
|
||||
#ifdef CONFIG_ACPI
|
||||
.acpi_match_table = ACPI_PTR(tegra_nvdla_acpi_match),
|
||||
#endif
|
||||
#ifdef CONFIG_PM
|
||||
.pm = &nvdla_module_pm_ops,
|
||||
#endif
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "dla_t19x_fw_version.h"
|
||||
|
||||
static struct nvhost_device_data t19_nvdla0_info = {
|
||||
.devfs_name = "nvdla0",
|
||||
.devfs_name_family = "nvdla",
|
||||
.class = NV_DLA0_CLASS_ID,
|
||||
.clocks = {
|
||||
@@ -55,6 +56,7 @@ static struct nvhost_device_data t19_nvdla0_info = {
|
||||
};
|
||||
|
||||
static struct nvhost_device_data t19_nvdla1_info = {
|
||||
.devfs_name = "nvdla1",
|
||||
.devfs_name_family = "nvdla",
|
||||
.class = NV_DLA1_CLASS_ID,
|
||||
.clocks = {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "dla_t23x_fw_version.h"
|
||||
|
||||
static struct nvhost_device_data t23x_nvdla0_info = {
|
||||
.devfs_name = "nvdla0",
|
||||
.devfs_name_family = "nvdla",
|
||||
.class = NV_DLA0_CLASS_ID,
|
||||
.clocks = {
|
||||
@@ -50,6 +51,7 @@ static struct nvhost_device_data t23x_nvdla0_info = {
|
||||
};
|
||||
|
||||
static struct nvhost_device_data t23x_nvdla1_info = {
|
||||
.devfs_name = "nvdla1",
|
||||
.devfs_name_family = "nvdla",
|
||||
.class = NV_DLA1_CLASS_ID,
|
||||
.clocks = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* Device data for T25X simulator
|
||||
*/
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "dla_t25x_fw_version.h"
|
||||
|
||||
static struct nvhost_device_data t25x_nvdla0_info = {
|
||||
.devfs_name = "nvdla0",
|
||||
.devfs_name_family = "nvdla",
|
||||
#if defined(BUG_4972382) && (BUG_4972382 == 1)
|
||||
.class = NV_DLA0_SIM_CLASS_ID,
|
||||
@@ -48,6 +49,7 @@ static struct nvhost_device_data t25x_nvdla0_info = {
|
||||
};
|
||||
|
||||
static struct nvhost_device_data t25x_nvdla1_info = {
|
||||
.devfs_name = "nvdla1",
|
||||
.devfs_name_family = "nvdla",
|
||||
#if defined(BUG_4972382) && (BUG_4972382 == 1)
|
||||
.class = NV_DLA1_SIM_CLASS_ID,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* Device data for T264 simulator
|
||||
* Device data for t264 simulator
|
||||
*/
|
||||
|
||||
#ifndef __NVHOST_NVDLA_T264_SIM_H__
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "dla_t25x_fw_version.h"
|
||||
|
||||
static struct nvhost_device_data t264_sim_nvdla0_info = {
|
||||
.devfs_name = "nvdla0",
|
||||
.devfs_name_family = "nvdla",
|
||||
.class = NV_DLA0_SIM_CLASS_ID,
|
||||
.clocks = {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
/* SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
*
|
||||
* NVDLA device implementation as AXI client.
|
||||
*/
|
||||
@@ -70,7 +70,12 @@ static int32_t s_nvdla_module_get_platform_resources(
|
||||
regs = devm_ioremap_resource(&pdev->dev, r);
|
||||
if (IS_ERR(regs)) {
|
||||
err = PTR_ERR(regs);
|
||||
#if defined(BUG_5054810) && (BUG_5054810 == 1)
|
||||
nvdla_dbg_err(pdev, "Failed to map the resources. Continuing as WAR.\n");
|
||||
continue;
|
||||
#else
|
||||
goto fail;
|
||||
#endif
|
||||
}
|
||||
|
||||
pdata->aperture[i] = regs;
|
||||
@@ -181,16 +186,16 @@ static int32_t s_nvdla_module_device_create(struct platform_device *pdev)
|
||||
struct class *dla_class;
|
||||
dev_t devno;
|
||||
|
||||
err = alloc_chrdev_region(&devno, 0, NVDLA_NUM_CDEV, "nvhost");
|
||||
err = alloc_chrdev_region(&devno, 0, NVDLA_NUM_CDEV, "nvdla");
|
||||
if (err < 0) {
|
||||
nvdla_dbg_err(pdev, "failed to reserve chrdev region\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
#if defined(NV_CLASS_CREATE_HAS_NO_OWNER_ARG) /* Linux v6.4 */
|
||||
dla_class = class_create(pdev->dev.of_node->name);
|
||||
dla_class = class_create(pdata->devfs_name);
|
||||
#else
|
||||
dla_class = class_create(THIS_MODULE, pdev->dev.of_node->name);
|
||||
dla_class = class_create(THIS_MODULE, pdata->devfs_name);
|
||||
#endif
|
||||
if (IS_ERR(dla_class)) {
|
||||
nvdla_dbg_err(pdev, "failed to create class\n");
|
||||
@@ -212,10 +217,10 @@ static int32_t s_nvdla_module_device_create(struct platform_device *pdev)
|
||||
devno,
|
||||
NULL,
|
||||
"nvhost-ctrl-%s",
|
||||
pdev->dev.of_node->name);
|
||||
pdata->devfs_name);
|
||||
if (IS_ERR(dev)) {
|
||||
nvdla_dbg_err(pdev, "failed to create nvhost-ctrl-%s device\n",
|
||||
pdev->dev.of_node->name);
|
||||
pdata->devfs_name);
|
||||
err = PTR_ERR(dev);
|
||||
goto delete_cdev;
|
||||
}
|
||||
@@ -272,7 +277,7 @@ int32_t nvdla_module_init(struct platform_device *pdev)
|
||||
goto disable_pm;
|
||||
}
|
||||
|
||||
pdata->debugfs = debugfs_create_dir(pdev->dev.of_node->name, NULL);
|
||||
pdata->debugfs = debugfs_create_dir(pdata->devfs_name, NULL);
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user