bus/tegra: Changes for v5.2-rc1
This pair of patches adds support for system sleep to the ACONNECT bus found on Tegra SoCs. -----BEGIN PGP SIGNATURE----- iQJHBAABCAAxFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAly4jAITHHRyZWRpbmdA bnZpZGlhLmNvbQAKCRDdI6zXfz6zoUTlEACelMwGb5AhB1vFKJuT3a/D0uHx6pN0 P2CxZgSBtIjbU+rYw+qd7sgoUh9ZXm8Q7gLxr1F/xG01cVYBfJRojF8HHobXg0qB CS6DNB5OFxpgYY+fuP4PCSgXplA9ud8Sk4LNlWTmh3jW7AT0gDJoChtAzYxB7zq+ TFZhw5fmhWRpXOUkUVuGKZh5WVuFIg5I3j5ZF9TMgRMQG5WJW1aK4lYqd+q8egH8 6IRZymt38FdHK9IaFB0PdmOffxUhnbEeLHIDu/5z896ohE8J7lTbVSR7vpp5gG0/ NBwGxrHtFh+xNZJF9MrGVI3eFyWhLhaEUDBtztM1hytgvvhGPLFdC9gyFGCrAzh5 l8agL/SBx8oOMOqsbI1vea8GwYLtAUJRuJPvIT1hkpGiiCOBA173PtKhWmRmjwZY nx+rcrQ5SWlDAkNAHfh6KXt+nANfYFYmzmBZeUA8nTgtqvMjjDjybZMbqZgjbHvk OaZABRtl5YFMLHMcOLmGSfxK2bi8+H/21EPP5VJNepmFVsq1779TsU0HYlzVfkZ6 /kqQBci6IlJBnYHgbKzsxZMml8eQjkdVeeBOw6tRr7W8QKOj01EXpQ7KNtZ/T2jv ooVX1IxVO1YExMoGvNWc76PizhCHERlyawJkx1+6Ccavf/wyn+ngh8jDDH4yktwE Q4G7GGJHRx27mA== =l61h -----END PGP SIGNATURE----- Merge tag 'tegra-for-5.2-bus' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into arm/drivers bus/tegra: Changes for v5.2-rc1 This pair of patches adds support for system sleep to the ACONNECT bus found on Tegra SoCs. * tag 'tegra-for-5.2-bus' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux: bus: tegra-aconnect: add system sleep callbacks bus: tegra-aconnect: use devm_clk_*() helpers Signed-off-by: Olof Johansson <olof@lixom.net>
This commit is contained in:
commit
fea188820b
|
@ -12,28 +12,38 @@
|
|||
#include <linux/module.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/pm_clock.h>
|
||||
#include <linux/pm_runtime.h>
|
||||
|
||||
struct tegra_aconnect {
|
||||
struct clk *ape_clk;
|
||||
struct clk *apb2ape_clk;
|
||||
};
|
||||
|
||||
static int tegra_aconnect_probe(struct platform_device *pdev)
|
||||
{
|
||||
int ret;
|
||||
struct tegra_aconnect *aconnect;
|
||||
|
||||
if (!pdev->dev.of_node)
|
||||
return -EINVAL;
|
||||
|
||||
ret = pm_clk_create(&pdev->dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
aconnect = devm_kzalloc(&pdev->dev, sizeof(struct tegra_aconnect),
|
||||
GFP_KERNEL);
|
||||
if (!aconnect)
|
||||
return -ENOMEM;
|
||||
|
||||
ret = of_pm_clk_add_clk(&pdev->dev, "ape");
|
||||
if (ret)
|
||||
goto clk_destroy;
|
||||
aconnect->ape_clk = devm_clk_get(&pdev->dev, "ape");
|
||||
if (IS_ERR(aconnect->ape_clk)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve ape clock\n");
|
||||
return PTR_ERR(aconnect->ape_clk);
|
||||
}
|
||||
|
||||
ret = of_pm_clk_add_clk(&pdev->dev, "apb2ape");
|
||||
if (ret)
|
||||
goto clk_destroy;
|
||||
aconnect->apb2ape_clk = devm_clk_get(&pdev->dev, "apb2ape");
|
||||
if (IS_ERR(aconnect->apb2ape_clk)) {
|
||||
dev_err(&pdev->dev, "Can't retrieve apb2ape clock\n");
|
||||
return PTR_ERR(aconnect->apb2ape_clk);
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, aconnect);
|
||||
pm_runtime_enable(&pdev->dev);
|
||||
|
||||
of_platform_populate(pdev->dev.of_node, NULL, NULL, &pdev->dev);
|
||||
|
@ -41,35 +51,51 @@ static int tegra_aconnect_probe(struct platform_device *pdev)
|
|||
dev_info(&pdev->dev, "Tegra ACONNECT bus registered\n");
|
||||
|
||||
return 0;
|
||||
|
||||
clk_destroy:
|
||||
pm_clk_destroy(&pdev->dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int tegra_aconnect_remove(struct platform_device *pdev)
|
||||
{
|
||||
pm_runtime_disable(&pdev->dev);
|
||||
|
||||
pm_clk_destroy(&pdev->dev);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra_aconnect_runtime_resume(struct device *dev)
|
||||
{
|
||||
return pm_clk_resume(dev);
|
||||
struct tegra_aconnect *aconnect = dev_get_drvdata(dev);
|
||||
int ret;
|
||||
|
||||
ret = clk_prepare_enable(aconnect->ape_clk);
|
||||
if (ret) {
|
||||
dev_err(dev, "ape clk_enable failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = clk_prepare_enable(aconnect->apb2ape_clk);
|
||||
if (ret) {
|
||||
clk_disable_unprepare(aconnect->ape_clk);
|
||||
dev_err(dev, "apb2ape clk_enable failed: %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tegra_aconnect_runtime_suspend(struct device *dev)
|
||||
{
|
||||
return pm_clk_suspend(dev);
|
||||
struct tegra_aconnect *aconnect = dev_get_drvdata(dev);
|
||||
|
||||
clk_disable_unprepare(aconnect->ape_clk);
|
||||
clk_disable_unprepare(aconnect->apb2ape_clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops tegra_aconnect_pm_ops = {
|
||||
SET_RUNTIME_PM_OPS(tegra_aconnect_runtime_suspend,
|
||||
tegra_aconnect_runtime_resume, NULL)
|
||||
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
|
||||
pm_runtime_force_resume)
|
||||
};
|
||||
|
||||
static const struct of_device_id tegra_aconnect_of_match[] = {
|
||||
|
|
Loading…
Reference in New Issue