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_add_clock(struct device
*dev
, char *name
)
23 clk
= clk_get(dev
, name
);
25 dev_err(dev
, "%s clock not found\n", name
);
29 ret
= pm_clk_add_clk(dev
, clk
);
36 static int tegra_aconnect_probe(struct platform_device
*pdev
)
40 if (!pdev
->dev
.of_node
)
43 ret
= pm_clk_create(&pdev
->dev
);
47 ret
= tegra_aconnect_add_clock(&pdev
->dev
, "ape");
51 ret
= tegra_aconnect_add_clock(&pdev
->dev
, "apb2ape");
55 pm_runtime_enable(&pdev
->dev
);
57 of_platform_populate(pdev
->dev
.of_node
, NULL
, NULL
, &pdev
->dev
);
59 dev_info(&pdev
->dev
, "Tegra ACONNECT bus registered\n");
64 pm_clk_destroy(&pdev
->dev
);
69 static int tegra_aconnect_remove(struct platform_device
*pdev
)
71 pm_runtime_disable(&pdev
->dev
);
73 pm_clk_destroy(&pdev
->dev
);
78 static int tegra_aconnect_runtime_resume(struct device
*dev
)
80 return pm_clk_resume(dev
);
83 static int tegra_aconnect_runtime_suspend(struct device
*dev
)
85 return pm_clk_suspend(dev
);
88 static const struct dev_pm_ops tegra_aconnect_pm_ops
= {
89 SET_RUNTIME_PM_OPS(tegra_aconnect_runtime_suspend
,
90 tegra_aconnect_runtime_resume
, NULL
)
93 static const struct of_device_id tegra_aconnect_of_match
[] = {
94 { .compatible
= "nvidia,tegra210-aconnect", },
97 MODULE_DEVICE_TABLE(of
, tegra_aconnect_of_match
);
99 static struct platform_driver tegra_aconnect_driver
= {
100 .probe
= tegra_aconnect_probe
,
101 .remove
= tegra_aconnect_remove
,
103 .name
= "tegra-aconnect",
104 .of_match_table
= tegra_aconnect_of_match
,
105 .pm
= &tegra_aconnect_pm_ops
,
108 module_platform_driver(tegra_aconnect_driver
);
110 MODULE_DESCRIPTION("NVIDIA Tegra ACONNECT Bus Driver");
111 MODULE_AUTHOR("Jon Hunter <jonathanh@nvidia.com>");
112 MODULE_LICENSE("GPL v2");