2 * Tegra ACONNECT Bus Driver
4 * Copyright (C) 2016, NVIDIA CORPORATION. All rights reserved.
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
11 #include <linux/clk.h>
12 #include <linux/module.h>
13 #include <linux/of_platform.h>
14 #include <linux/platform_device.h>
15 #include <linux/pm_clock.h>
16 #include <linux/pm_runtime.h>
18 static int tegra_aconnect_probe(struct platform_device
*pdev
)
22 if (!pdev
->dev
.of_node
)
25 ret
= pm_clk_create(&pdev
->dev
);
29 ret
= of_pm_clk_add_clk(&pdev
->dev
, "ape");
33 ret
= of_pm_clk_add_clk(&pdev
->dev
, "apb2ape");
37 pm_runtime_enable(&pdev
->dev
);
39 of_platform_populate(pdev
->dev
.of_node
, NULL
, NULL
, &pdev
->dev
);
41 dev_info(&pdev
->dev
, "Tegra ACONNECT bus registered\n");
46 pm_clk_destroy(&pdev
->dev
);
51 static int tegra_aconnect_remove(struct platform_device
*pdev
)
53 pm_runtime_disable(&pdev
->dev
);
55 pm_clk_destroy(&pdev
->dev
);
60 static int tegra_aconnect_runtime_resume(struct device
*dev
)
62 return pm_clk_resume(dev
);
65 static int tegra_aconnect_runtime_suspend(struct device
*dev
)
67 return pm_clk_suspend(dev
);
70 static const struct dev_pm_ops tegra_aconnect_pm_ops
= {
71 SET_RUNTIME_PM_OPS(tegra_aconnect_runtime_suspend
,
72 tegra_aconnect_runtime_resume
, NULL
)
75 static const struct of_device_id tegra_aconnect_of_match
[] = {
76 { .compatible
= "nvidia,tegra210-aconnect", },
79 MODULE_DEVICE_TABLE(of
, tegra_aconnect_of_match
);
81 static struct platform_driver tegra_aconnect_driver
= {
82 .probe
= tegra_aconnect_probe
,
83 .remove
= tegra_aconnect_remove
,
85 .name
= "tegra-aconnect",
86 .of_match_table
= tegra_aconnect_of_match
,
87 .pm
= &tegra_aconnect_pm_ops
,
90 module_platform_driver(tegra_aconnect_driver
);
92 MODULE_DESCRIPTION("NVIDIA Tegra ACONNECT Bus Driver");
93 MODULE_AUTHOR("Jon Hunter <jonathanh@nvidia.com>");
94 MODULE_LICENSE("GPL v2");