#include "nouveau_platform.h"
#include <nvkm/subdev/clk/gk20a_devfreq.h>
static int nouveau_platform_probe(struct platform_device *pdev)
{
const struct nvkm_device_tegra_func *func;
struct nvkm_device *device = NULL;
struct drm_device *drm;
func = of_device_get_match_data(&pdev->dev);
drm = nouveau_platform_device_create(func, pdev, &device);
return PTR_ERR_OR_ZERO(drm);
}
static void nouveau_platform_remove(struct platform_device *pdev)
{
struct nouveau_drm *drm = platform_get_drvdata(pdev);
nouveau_drm_device_remove(drm);
}
#ifdef CONFIG_PM_SLEEP
static int nouveau_platform_suspend(struct device *dev)
{
return gk20a_devfreq_suspend(dev);
}
static int nouveau_platform_resume(struct device *dev)
{
return gk20a_devfreq_resume(dev);
}
static SIMPLE_DEV_PM_OPS(nouveau_pm_ops, nouveau_platform_suspend,
nouveau_platform_resume);
#endif
#if IS_ENABLED(CONFIG_OF)
static const struct nvkm_device_tegra_func gk20a_platform_data = {
.iommu_bit = 34,
.require_vdd = true,
};
static const struct nvkm_device_tegra_func gm20b_platform_data = {
.iommu_bit = 34,
.require_vdd = true,
.require_ref_clk = true,
};
static const struct nvkm_device_tegra_func gp10b_platform_data = {
.iommu_bit = 36,
.require_vdd = false,
};
static const struct of_device_id nouveau_platform_match[] = {
{
.compatible = "nvidia,gk20a",
.data = &gk20a_platform_data,
},
{
.compatible = "nvidia,gm20b",
.data = &gm20b_platform_data,
},
{
.compatible = "nvidia,gp10b",
.data = &gp10b_platform_data,
},
{ }
};
MODULE_DEVICE_TABLE(of, nouveau_platform_match);
#endif
struct platform_driver nouveau_platform_driver = {
.driver = {
.name = "nouveau",
.of_match_table = of_match_ptr(nouveau_platform_match),
#ifdef CONFIG_PM_SLEEP
.pm = &nouveau_pm_ops,
#endif
},
.probe = nouveau_platform_probe,
.remove = nouveau_platform_remove,
};