mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
gpu: nvhost-host1x: Move nvhost_get_* APIs to header file
deprecate definition of below APIs from host1x-nvhost.ko - nvhost_get_default_device nvhost_get_host1x_device nvhost_get_host1x Bug 5176225 Change-Id: I72c3aae62fbc8c297a3871a9337562fe3998621b Signed-off-by: Mainak Sen <msen@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3342019 Reviewed-by: Mikko Perttunen <mperttunen@nvidia.com> GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
@@ -91,77 +91,6 @@ void host1x_writel(struct platform_device *pdev, u32 r, u32 v)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL(host1x_writel);
|
EXPORT_SYMBOL(host1x_writel);
|
||||||
|
|
||||||
static const struct of_device_id host1x_match[] = {
|
|
||||||
{ .compatible = "nvidia,tegra234-host1x", },
|
|
||||||
{ .compatible = "nvidia,tegra264-host1x", },
|
|
||||||
{},
|
|
||||||
};
|
|
||||||
|
|
||||||
struct platform_device *nvhost_get_default_device(void)
|
|
||||||
{
|
|
||||||
struct platform_device *host1x_pdev;
|
|
||||||
struct device_node *np;
|
|
||||||
|
|
||||||
np = of_find_matching_node(NULL, host1x_match);
|
|
||||||
if (!np)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
host1x_pdev = of_find_device_by_node(np);
|
|
||||||
if (!host1x_pdev)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return host1x_pdev;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(nvhost_get_default_device);
|
|
||||||
|
|
||||||
struct platform_device *nvhost_get_host1x_device(int instance)
|
|
||||||
{
|
|
||||||
struct platform_device *host1x_pdev;
|
|
||||||
struct device_node *np;
|
|
||||||
int numa_node;
|
|
||||||
|
|
||||||
for_each_matching_node(np, host1x_match) {
|
|
||||||
host1x_pdev = of_find_device_by_node(np);
|
|
||||||
if (host1x_pdev) {
|
|
||||||
numa_node = dev_to_node(&host1x_pdev->dev);
|
|
||||||
if (numa_node == NUMA_NO_NODE || numa_node == instance)
|
|
||||||
return host1x_pdev;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(nvhost_get_host1x_device);
|
|
||||||
|
|
||||||
struct host1x *nvhost_get_host1x(struct platform_device *client_pdev)
|
|
||||||
{
|
|
||||||
struct platform_device *host1x_pdev;
|
|
||||||
struct host1x *host1x;
|
|
||||||
int numa_node = NUMA_NO_NODE;
|
|
||||||
|
|
||||||
if (client_pdev)
|
|
||||||
numa_node = dev_to_node(&client_pdev->dev);
|
|
||||||
|
|
||||||
if (numa_node == NUMA_NO_NODE)
|
|
||||||
host1x_pdev = nvhost_get_default_device();
|
|
||||||
else
|
|
||||||
host1x_pdev = nvhost_get_host1x_device(numa_node);
|
|
||||||
|
|
||||||
if (!host1x_pdev) {
|
|
||||||
dev_dbg(&client_pdev->dev, "host1x device not available\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
host1x = platform_get_drvdata(host1x_pdev);
|
|
||||||
if (!host1x) {
|
|
||||||
dev_warn(&client_pdev->dev, "No platform data for host1x!\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return host1x;
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(nvhost_get_host1x);
|
|
||||||
|
|
||||||
static struct device *nvhost_client_device_create(struct platform_device *pdev,
|
static struct device *nvhost_client_device_create(struct platform_device *pdev,
|
||||||
struct cdev *cdev,
|
struct cdev *cdev,
|
||||||
const char *cdev_name,
|
const char *cdev_name,
|
||||||
@@ -869,7 +798,5 @@ static struct platform_driver nvhost_driver = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
MODULE_DEVICE_TABLE(of, host1x_match);
|
|
||||||
|
|
||||||
module_platform_driver(nvhost_driver);
|
module_platform_driver(nvhost_driver);
|
||||||
MODULE_LICENSE("GPL v2");
|
MODULE_LICENSE("GPL v2");
|
||||||
|
|||||||
@@ -9,6 +9,8 @@
|
|||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/host1x.h>
|
#include <linux/host1x.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
|
#include <linux/of.h>
|
||||||
|
#include <linux/of_platform.h>
|
||||||
|
|
||||||
struct nvhost_ctrl_sync_fence_info;
|
struct nvhost_ctrl_sync_fence_info;
|
||||||
struct nvhost_fence;
|
struct nvhost_fence;
|
||||||
@@ -178,10 +180,6 @@ struct nvhost_device_data *nvhost_get_devdata(struct platform_device *pdev)
|
|||||||
return (struct nvhost_device_data *)platform_get_drvdata(pdev);
|
return (struct nvhost_device_data *)platform_get_drvdata(pdev);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* public api to return platform_device ptr to the default host1x instance */
|
|
||||||
struct platform_device *nvhost_get_default_device(void);
|
|
||||||
struct platform_device *nvhost_get_host1x_device(int instance);
|
|
||||||
|
|
||||||
/* common runtime pm and power domain APIs */
|
/* common runtime pm and power domain APIs */
|
||||||
int nvhost_module_init(struct platform_device *ndev);
|
int nvhost_module_init(struct platform_device *ndev);
|
||||||
void nvhost_module_deinit(struct platform_device *dev);
|
void nvhost_module_deinit(struct platform_device *dev);
|
||||||
@@ -232,8 +230,80 @@ int nvhost_intr_register_notifier(struct platform_device *pdev,
|
|||||||
void (*callback)(void *),
|
void (*callback)(void *),
|
||||||
void *private_data);
|
void *private_data);
|
||||||
|
|
||||||
/* public host1x sync-point management APIs */
|
/* host1x sync-point management APIs */
|
||||||
struct host1x *nvhost_get_host1x(struct platform_device *pdev);
|
|
||||||
|
/* Return platform_device ptr to the default host1x instance */
|
||||||
|
static inline struct platform_device *nvhost_get_default_device(void)
|
||||||
|
{
|
||||||
|
struct platform_device *host1x_pdev;
|
||||||
|
struct device_node *np;
|
||||||
|
static const struct of_device_id host1x_match[] = {
|
||||||
|
{ .compatible = "nvidia,tegra234-host1x", },
|
||||||
|
{ .compatible = "nvidia,tegra264-host1x", },
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
|
||||||
|
np = of_find_matching_node(NULL, host1x_match);
|
||||||
|
if (!np)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
host1x_pdev = of_find_device_by_node(np);
|
||||||
|
if (!host1x_pdev)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return host1x_pdev;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct platform_device *nvhost_get_host1x_device(int instance)
|
||||||
|
{
|
||||||
|
struct platform_device *host1x_pdev;
|
||||||
|
struct device_node *np;
|
||||||
|
int numa_node;
|
||||||
|
static const struct of_device_id host1x_match[] = {
|
||||||
|
{ .compatible = "nvidia,tegra234-host1x", },
|
||||||
|
{ .compatible = "nvidia,tegra264-host1x", },
|
||||||
|
{},
|
||||||
|
};
|
||||||
|
|
||||||
|
for_each_matching_node(np, host1x_match) {
|
||||||
|
host1x_pdev = of_find_device_by_node(np);
|
||||||
|
if (host1x_pdev) {
|
||||||
|
numa_node = dev_to_node(&host1x_pdev->dev);
|
||||||
|
if (numa_node == NUMA_NO_NODE || numa_node == instance)
|
||||||
|
return host1x_pdev;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct host1x *nvhost_get_host1x(struct platform_device *client_pdev)
|
||||||
|
{
|
||||||
|
struct platform_device *host1x_pdev;
|
||||||
|
struct host1x *host1x;
|
||||||
|
int numa_node = NUMA_NO_NODE;
|
||||||
|
|
||||||
|
if (client_pdev)
|
||||||
|
numa_node = dev_to_node(&client_pdev->dev);
|
||||||
|
|
||||||
|
if (numa_node == NUMA_NO_NODE)
|
||||||
|
host1x_pdev = nvhost_get_default_device();
|
||||||
|
else
|
||||||
|
host1x_pdev = nvhost_get_host1x_device(numa_node);
|
||||||
|
|
||||||
|
if (!host1x_pdev) {
|
||||||
|
dev_dbg(&client_pdev->dev, "host1x device not available\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
host1x = platform_get_drvdata(host1x_pdev);
|
||||||
|
if (!host1x) {
|
||||||
|
dev_warn(&client_pdev->dev, "No platform data for host1x!\n");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return host1x;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int nvhost_module_set_rate(struct platform_device *dev, void *priv,
|
static inline int nvhost_module_set_rate(struct platform_device *dev, void *priv,
|
||||||
unsigned long constraint, int index,
|
unsigned long constraint, int index,
|
||||||
|
|||||||
Reference in New Issue
Block a user