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

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

Merge "ARM: dts: msm: add proxy bandwidth vote for kona"

parents 7d62fb2d 6982325e
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -945,6 +945,18 @@
		};
	};

	bus_proxy_client: qcom,bus_proxy_client {
		compatible = "qcom,bus-proxy-client";
		qcom,msm-bus,name = "bus-proxy-client";
		qcom,msm-bus,num-cases = <2>;
		qcom,msm-bus,num-paths = <2>;
		qcom,msm-bus,vectors-KBps =
			<22 512 0 0>, <23 512 0 0>,
			<22 512 1500000 1500000>, <23 512 1500000 1500000>;
		qcom,msm-bus,active-only;
		status = "ok";
	};

	keepalive_opp_table: keepalive-opp-table {
		compatible = "operating-points-v2";
		opp-1 {
+1 −1
Original line number Diff line number Diff line
@@ -8,7 +8,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 \
+85 −0
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
 */

#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",
		.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\n");
		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);