blob: 5e68db6794d9a630732e753a70772ede08bea4da [file] [log] [blame]
xjb04a4022021-11-25 15:01:52 +08001// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2020 MediaTek Inc.
4 */
5#include <linux/arm-smccc.h>
6#include <linux/module.h>
7#include <linux/of_device.h>
8#include <linux/platform_device.h>
9#include <linux/soc/mediatek/mtk_sip_svc.h>
10
11#define MTK_SIP_DVFSRC_START 0x01
12
13/* We let dvfsrc working on parent main driver and setup
14 * framework (interconnect, regulator, ..) for user register
15 * and request, so we will lock high opp in that stage.
16 * We will release this lock in this driver and let probe on
17 * late_initsync stage. It send smc cmd MTK_SIP_DVFSRC_RUN
18 * to release lock let dvfsrc free run.
19 */
20
21static int mtk_dvfsrc_start_probe(struct platform_device *pdev)
22{
23 struct arm_smccc_res ares;
24
25 arm_smccc_smc(MTK_SIP_VCOREFS_CONTROL, MTK_SIP_DVFSRC_START, 0, 0, 0,
26 0, 0, 0, &ares);
27
28 return 0;
29}
30
31static struct platform_driver mtk_dvfsrc_run_drv = {
32 .probe = mtk_dvfsrc_start_probe,
33 .driver = {
34 .name = "mtk-dvfsrc-start",
35 },
36};
37
38static int __init mtk_dvfsrc_run_init(void)
39{
40 return platform_driver_register(&mtk_dvfsrc_run_drv);
41}
42late_initcall_sync(mtk_dvfsrc_run_init);
43
44static void __exit mtk_dvfsrc_run_exit(void)
45{
46 platform_driver_unregister(&mtk_dvfsrc_run_drv);
47}
48module_exit(mtk_dvfsrc_run_exit);
49
50MODULE_LICENSE("GPL v2");
51MODULE_DESCRIPTION("MTK DVFSRC enable free run driver");