diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2019-03-28 02:11:02 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2019-03-28 02:11:05 -0700 |
commit | 09abd60d6bee2706ea2378ce67a29384f5a1f74a (patch) | |
tree | 0d64d6f251667b8624f9afe169550ec54a9dbf67 | |
parent | 070b932a3d53a7966ca502d7d2e7809583328acd (diff) | |
parent | 961dc330d02c2805bcdfc9270cbed6ea71c1cf0e (diff) |
Merge "msm: msm_bus: Add proxy bus client driver" into kernel.lnx.4.9.r21-relLA.UM.6.3.r7-01500-sdm845.0
-rw-r--r-- | Documentation/devicetree/bindings/arm/msm/proxy-client.txt | 34 | ||||
-rw-r--r-- | drivers/soc/qcom/msm_bus/Makefile | 2 | ||||
-rw-r--r-- | drivers/soc/qcom/msm_bus/msm_bus_proxy_client.c | 93 |
3 files changed, 128 insertions, 1 deletions
diff --git a/Documentation/devicetree/bindings/arm/msm/proxy-client.txt b/Documentation/devicetree/bindings/arm/msm/proxy-client.txt new file mode 100644 index 000000000000..29cfaf90016c --- /dev/null +++ b/Documentation/devicetree/bindings/arm/msm/proxy-client.txt @@ -0,0 +1,34 @@ +Bus Proxy Client Bindings + +Bus proxy client provides means to cast proxy bandwidth votes during bootup +which is removed at the end of boot. This feature can be used in situations +where a shared resource can be scaled between several possible perfomance +levels and hardware requires that it be at a high level at the beginning of +boot before the client has probed and voted for required bandwidth. + +Required properties: +- compatible: Must be "qcom,bus-proxy-client". + +Optional properties: +- qcom,msm-bus,name: String representing the client-name. +- qcom,msm-bus,num-cases: Total number of usecases. +- qcom,msm-bus,active-only: Boolean context flag for requests in active or + dual (active & sleep) contex. +- qcom,msm-bus,num-paths: Total number of master-slave pairs. +- qcom,msm-bus,vectors-KBps: Arrays of unsigned integers representing: + master-id, slave-id, arbitrated bandwidth + in KBps, instantaneous bandwidth in KBps. + +Example: + + qcom,proxy-client { + compatible = "qcom,bus-proxy-client"; + qcom,msm-bus,name = "proxy_client"; + qcom,msm-bus,num-cases = <3>; + qcom,msm-bus,num-paths = <2>; + qcom,msm-bus,active-only; + qcom,msm-bus,vectors-KBps = + <22 512 0 0>, <23 512 0 0>, + <22 512 0 6400000>, <23 512 0 6400000>, + <22 512 0 6400000>, <23 512 0 6400000>; + }; diff --git a/drivers/soc/qcom/msm_bus/Makefile b/drivers/soc/qcom/msm_bus/Makefile index 15569b1300fd..c2ef70c8162c 100644 --- a/drivers/soc/qcom/msm_bus/Makefile +++ b/drivers/soc/qcom/msm_bus/Makefile @@ -7,7 +7,7 @@ obj-$(CONFIG_MSM_RPM_SMD) += msm_bus_rpm_smd.o ifdef CONFIG_QCOM_BUS_CONFIG_RPMH obj-y += msm_bus_fabric_rpmh.o msm_bus_arb_rpmh.o msm_bus_rules.o \ - msm_bus_bimc_rpmh.o msm_bus_noc_rpmh.o + msm_bus_bimc_rpmh.o msm_bus_noc_rpmh.o msm_bus_proxy_client.o obj-$(CONFIG_OF) += msm_bus_of_rpmh.o else obj-y += msm_bus_fabric_adhoc.o msm_bus_arb_adhoc.o msm_bus_rules.o \ diff --git a/drivers/soc/qcom/msm_bus/msm_bus_proxy_client.c b/drivers/soc/qcom/msm_bus/msm_bus_proxy_client.c new file mode 100644 index 000000000000..cdf61f6c8644 --- /dev/null +++ b/drivers/soc/qcom/msm_bus/msm_bus_proxy_client.c @@ -0,0 +1,93 @@ +/* Copyright (c) 2018, The Linux Foundation. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 and + * only version 2 as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <linux/msm-bus.h> + +struct proxy_client { + struct msm_bus_scale_pdata *pdata; + unsigned int client_handle; +}; + +static struct proxy_client proxy_client_info; + +static int msm_bus_device_proxy_client_probe(struct platform_device *pdev) +{ + int ret; + + proxy_client_info.pdata = msm_bus_cl_get_pdata(pdev); + + if (!proxy_client_info.pdata) + return 0; + + proxy_client_info.client_handle = + msm_bus_scale_register_client(proxy_client_info.pdata); + + if (!proxy_client_info.client_handle) { + dev_err(&pdev->dev, "Unable to register bus client\n"); + return -ENODEV; + } + + ret = msm_bus_scale_client_update_request( + proxy_client_info.client_handle, 1); + if (ret) + dev_err(&pdev->dev, "Bandwidth update failed (%d)\n", ret); + + return ret; +} + +static const struct of_device_id proxy_client_match[] = { + {.compatible = "qcom,bus-proxy-client"}, + {} +}; + +static struct platform_driver msm_bus_proxy_client_driver = { + .probe = msm_bus_device_proxy_client_probe, + .driver = { + .name = "msm_bus_proxy_client_device", + .owner = THIS_MODULE, + .of_match_table = proxy_client_match, + }, +}; + +static int __init msm_bus_proxy_client_init_driver(void) +{ + int rc; + + rc = platform_driver_register(&msm_bus_proxy_client_driver); + if (rc) { + pr_err("Failed to register proxy client device driver"); + return rc; + } + + return rc; +} + +static int __init msm_bus_proxy_client_unvote(void) +{ + int ret; + + if (!proxy_client_info.pdata || !proxy_client_info.client_handle) + return 0; + + ret = msm_bus_scale_client_update_request( + proxy_client_info.client_handle, 0); + if (ret) + pr_err("%s: bandwidth update request failed (%d)\n", + __func__, ret); + + msm_bus_scale_unregister_client(proxy_client_info.client_handle); + + return 0; +} + +subsys_initcall_sync(msm_bus_proxy_client_init_driver); +late_initcall_sync(msm_bus_proxy_client_unvote); |