Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e4cb2772 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: msm_bus: Add proxy bus client driver"

parents 02ac5aa3 08735869
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
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>;
	};
+1 −1
Original line number Diff line number Diff line
@@ -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 \
+93 −0
Original line number Diff line number Diff line
/* 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);