video: tegra: nvmap: Make NvMap load based on DT

Add MODULE_DEVICE_TABLE() for NvMap match table so that depmod
automatically loads the driver based upon the NvMap compatible
string.

Bug 3851361

Change-Id: I04fabae9787f5cc0f85239ae40f42cd5a5fec88e
Signed-off-by: Ashish Mhetre <amhetre@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2809441
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Jonathan Hunter <jonathanh@nvidia.com>
Reviewed-by: Sachin Nikam <snikam@nvidia.com>
Reviewed-by: Ketan Patil <ketanp@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc_kernel_abi <svc_kernel_abi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Ashish Mhetre
2022-11-15 15:42:58 +05:30
committed by Laxman Dewangan
parent d5be3dd31c
commit ac3205e61e
2 changed files with 5 additions and 37 deletions

View File

@@ -95,11 +95,13 @@ static struct dma_declare_info vpr_dma_info = {
};
#endif
__weak const struct of_device_id nvmap_of_ids[] = {
{ .compatible = "nvidia,carveouts" },
{ .compatible = "nvidia,carveouts-t18x" },
const struct of_device_id nvmap_of_ids[] = {
{ .compatible = "nvidia,carveouts" },
{ .compatible = "nvidia,carveouts-t18x" },
{ .compatible = "nvidia,carveouts-t19x" },
{ }
};
MODULE_DEVICE_TABLE(of, nvmap_of_ids);
static struct nvmap_platform_carveout nvmap_carveouts[] = {
[0] = {
@@ -910,10 +912,7 @@ static struct platform_driver __refdata nvmap_driver = {
.driver = {
.name = "tegra-carveouts",
.owner = THIS_MODULE,
#ifndef NVMAP_LOADABLE_MODULE
.of_match_table = nvmap_of_ids,
#endif /* !NVMAP_LOADABLE_MODULE */
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.suppress_bind_attrs = true,
},
};
@@ -926,34 +925,12 @@ static int __init nvmap_init_driver(void)
if (e)
goto fail;
#ifdef NVMAP_LOADABLE_MODULE
if (!(of_machine_is_compatible("nvidia,tegra186") ||
of_machine_is_compatible("nvidia,tegra194") ||
of_machine_is_compatible("nvidia,tegra234") ||
of_machine_is_compatible("nvidia,tegra239") ||
of_machine_is_compatible("nvidia,tegra23x") ||
of_machine_is_compatible("nvidia,tegra232"))) {
nvmap_heap_deinit();
return -ENODEV;
}
#endif /* NVMAP_LOADABLE_MODULE */
e = platform_driver_register(&nvmap_driver);
if (e) {
nvmap_heap_deinit();
goto fail;
}
#ifdef NVMAP_LOADABLE_MODULE
if (!nvmap_is_carveout_node_present()) {
pdev = platform_device_register_simple("tegra-carveouts", -1, NULL, 0);
if (IS_ERR(pdev)) {
platform_driver_unregister(&nvmap_driver);
nvmap_heap_deinit();
return PTR_ERR(pdev);
}
}
#endif /* NVMAP_LOADABLE_MODULE */
fail:
return e;
}

View File

@@ -27,15 +27,6 @@
#include "nvmap_priv.h"
bool nvmap_version_t19x;
const struct of_device_id nvmap_of_ids[] = {
{ .compatible = "nvidia,carveouts" },
{ .compatible = "nvidia,carveouts-t18x" },
{ .compatible = "nvidia,carveouts-t19x" },
{ }
};
int nvmap_register_cvsram_carveout(struct device *dma_dev,
phys_addr_t base, size_t size, int (*busy)(void),
int (*idle)(void))