blob: 4cdfec24e375192f798bbae3aedfe57a271923a9 [file] [log] [blame]
xjb04a4022021-11-25 15:01:52 +08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (c) 2019 MediaTek Inc.
4 */
5
6#include <linux/device.h>
7#include <linux/kernel.h>
8#include <linux/module.h>
9#include <linux/of.h>
10#include <linux/of_platform.h>
11#include <linux/pm_runtime.h>
12
13static const struct of_device_id bring_up_id_table[] = {
14 { .compatible = "mediatek,scpsys-bring-up",},
15 { .compatible = "mediatek,scpsys-bringup-mt6779",},
16 { },
17};
18MODULE_DEVICE_TABLE(of, bring_up_id_table);
19
20static int bring_up_probe(struct platform_device *pdev)
21{
22 if (!pdev->dev.pm_domain)
23 return -EPROBE_DEFER;
24
25 pm_runtime_enable(&pdev->dev);
26
27 /* always enabled in lifetime */
28 pm_runtime_get_sync(&pdev->dev);
29
30
31 return 0;
32}
33
34static int bring_up_remove(struct platform_device *pdev)
35{
36 pm_runtime_put_sync(&pdev->dev);
37 return 0;
38}
39
40static struct platform_driver scpsys_bring_up = {
41 .probe = bring_up_probe,
42 .remove = bring_up_remove,
43 .driver = {
44 .name = "scpsys_bring_up",
45 .owner = THIS_MODULE,
46 .of_match_table = bring_up_id_table,
47 },
48};
49//move to builtin so as to earlier than clk-bring up
50builtin_platform_driver(scpsys_bring_up);