diff options
author | Tushar Khandelwal <tushar.khandelwal@arm.com> | 2017-07-14 12:41:01 +0100 |
---|---|---|
committer | Arvind Chauhan <arvind.chauhan@arm.com> | 2017-10-31 13:10:41 +0530 |
commit | afafc7ebb2e74e4035b1ed309c1a8702b46bb097 (patch) | |
tree | 08711e974e084fcd93432f272c42145516c3b024 | |
parent | 0aecb74c2c5cb22f4add6e1003180c3c8cbe05d6 (diff) |
drivers: gpu: arm: add scmi compatible gpu dvfs driver
Change-Id: I507204bd7f0bb1e1738348ab5a3f47d541e61291
Signed-off-by: Tushar Khandelwal <tushar.khandelwal@arm.com>
[Resolved merge conficts]
Signed-off-by: Arvind Chauhan <arvind.chauhan@arm.com>
-rw-r--r-- | drivers/gpu/arm/midgard/platform/devicetree/scmi_mali_opp.c | 76 | ||||
-rw-r--r-- | linaro/configs/vexpress64.conf | 1 |
2 files changed, 73 insertions, 4 deletions
diff --git a/drivers/gpu/arm/midgard/platform/devicetree/scmi_mali_opp.c b/drivers/gpu/arm/midgard/platform/devicetree/scmi_mali_opp.c index 2564416ecef3..70e785b03f94 100644 --- a/drivers/gpu/arm/midgard/platform/devicetree/scmi_mali_opp.c +++ b/drivers/gpu/arm/midgard/platform/devicetree/scmi_mali_opp.c @@ -20,30 +20,57 @@ #include <linux/scmi_protocol.h> #include <linux/version.h> +static const struct scmi_handle *handle; +static int gpu_domain_id; +static struct platform_device *scmi_device; +struct platform_device *scmi_pdev; + static int scmi_gpu_opps_probe(struct platform_device *pdev) { - struct device_node *np; + struct device_node *np ; struct platform_device *gpu_pdev; + struct device *dev = &pdev->dev; int err; + handle = devm_scmi_handle_get(dev); + if (IS_ERR_OR_NULL(handle) || !handle->perf_ops){ + return -EPROBE_DEFER; + } + np = of_find_node_by_name(NULL, "gpu"); if (!np) { - dev_err(&pdev->dev, "Failed to find DT entry for Mali\n"); + dev_err(dev, "Failed to find DT entry for Mali\n"); return -EFAULT; } gpu_pdev = of_find_device_by_node(np); if (!gpu_pdev) { - dev_err(&pdev->dev, "Failed to find device for Mali\n"); + dev_err(dev, "Failed to find device for Mali\n"); of_node_put(np); return -EFAULT; } + gpu_domain_id = handle->perf_ops->device_domain_id(&gpu_pdev->dev); + + err = handle->perf_ops->add_opps_to_device(&gpu_pdev->dev); + of_node_put(np); return err; + } +int scmi_gpu_domain_id_get(void) +{ + return gpu_domain_id; +} + +const struct scmi_handle *scmi_gpu_handle_get(void) +{ + if (IS_ERR_OR_NULL(handle) || !handle->perf_ops) + return ERR_PTR(-EPROBE_DEFER); + return handle; +} static struct platform_driver scmi_gpu_opp_driver = { .driver = { @@ -51,7 +78,48 @@ static struct platform_driver scmi_gpu_opp_driver = { }, .probe = scmi_gpu_opps_probe, }; -module_platform_driver(scmi_gpu_opp_driver); + +static int __init scmi_gpu_opp_init (void) +{ + int ret; + struct device_node *np_scmi; + np_scmi = of_find_node_by_name(NULL, "scmi"); + if (!np_scmi) { + printk("Failed to find DT entry for scmi\n"); + return -EPROBE_DEFER; + } + + scmi_pdev = of_find_device_by_node(np_scmi); + if (!scmi_pdev) { + printk( "Failed to find device for scmi\n"); + of_node_put(np_scmi); + return -EFAULT; + } + + ret = platform_driver_register(&scmi_gpu_opp_driver); + if (ret) + goto exit; + + scmi_device = platform_device_register_resndata(&scmi_pdev->dev, + "scmi_gpu_opp", + -1, NULL, 0, NULL, 0); + if (IS_ERR(scmi_device)) { + platform_driver_unregister(&scmi_gpu_opp_driver); + return -ENODEV; + } + +exit: + return ret; +} + +static void __exit scmi_gpu_opp_exit (void) +{ + platform_device_unregister(scmi_device); + platform_driver_unregister(&scmi_gpu_opp_driver); +} + +module_init(scmi_gpu_opp_init); +module_exit(scmi_gpu_opp_exit); MODULE_AUTHOR("Amit Kachhap <amit.kachhap@arm.com>"); MODULE_DESCRIPTION("ARM SCMI GPU opp driver"); diff --git a/linaro/configs/vexpress64.conf b/linaro/configs/vexpress64.conf index 53af347027b2..75eae39b97e8 100644 --- a/linaro/configs/vexpress64.conf +++ b/linaro/configs/vexpress64.conf @@ -127,4 +127,5 @@ CONFIG_MALI_PLATFORM_FAKE=y CONFIG_MALI_PLATFORM_THIRDPARTY=y CONFIG_MALI_PLATFORM_THIRDPARTY_NAME="juno_soc" CONFIG_MALI_PLATFORM_DEVICETREE=y +CONFIG_MALI_DEVFREQ=y CONFIG_ION_DUMMY=y |