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

Commit 4877a522 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: msm_bus: Modify aggregation formula for adhoc driver"

parents bc287cc5 fd1c5e6a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -57,6 +57,11 @@ qcom,qos-off: Parameter that represents the delta between QoS register address
			space for different devices.
			Typically these optional properties are used for
			devices that represent fabric devices.
qcom,util-fact:		Parameter that represents the DDR utilization factor. It is
			represented as actual util-factor * 100.
qcom,vrail-comp:	Parameter that represents the voltage rail compensation to push
			the bus to the next level if needed. It is represented as actual
			vrail-comp * 100.
qcom,bus-type:		Parameter that represents the bus type such as BIMC or NOC.
			Typically these optional properties are used for
			devices that represent fabric devices.
+2 −0
Original line number Diff line number Diff line
@@ -51,6 +51,8 @@ struct msm_bus_fab_device_type {
	uint32_t base_offset;
	uint32_t qos_freq;
	uint32_t qos_off;
	uint32_t util_fact;
	uint32_t vrail_comp;
	struct msm_bus_noc_ops noc_ops;
	enum msm_bus_hw_sel bus_type;
	bool bypass_qos_prg;
+19 −0
Original line number Diff line number Diff line
@@ -325,6 +325,7 @@ static uint64_t arbitrate_bus_req(struct msm_bus_node_device_type *bus_dev,
	uint64_t max_ib = 0;
	uint64_t sum_ab = 0;
	uint64_t bw_max_hz;
	struct msm_bus_node_device_type *fab_dev = NULL;

	/* Find max ib */
	for (i = 0; i < bus_dev->num_lnodes; i++) {
@@ -332,6 +333,24 @@ static uint64_t arbitrate_bus_req(struct msm_bus_node_device_type *bus_dev,
		sum_ab += bus_dev->lnode_list[i].lnode_ab[ctx];
	}

	/*
	 *  Account for Util factor and vrail comp. The new aggregation
	 *  formula is:
	 *  Freq_hz = max((sum(ab) * util_fact)/num_chan, max(ib)/vrail_comp)
	 *				/ bus-width
	 *  util_fact and vrail comp are obtained from fabric's dts properties.
	 *  They default to 100 if absent.
	 */
	fab_dev = bus_dev->node_info->bus_device->platform_data;

	/* Don't do this for virtual fabrics */
	if (fab_dev && fab_dev->fabdev) {
		sum_ab *= fab_dev->fabdev->util_fact;
		sum_ab = msm_bus_div64(100, sum_ab);
		max_ib *= 100;
		max_ib = msm_bus_div64(fab_dev->fabdev->vrail_comp, max_ib);
	}

	/* Account for multiple channels if any */
	if (bus_dev->node_info->num_qports > 1)
		sum_ab = msm_bus_div64(bus_dev->node_info->num_qports,
+2 −0
Original line number Diff line number Diff line
@@ -680,6 +680,8 @@ static int msm_bus_fabric_init(struct device *dev,
	fabdev->qos_off = pdata->fabdev->qos_off;
	fabdev->bus_type = pdata->fabdev->bus_type;
	fabdev->bypass_qos_prg = pdata->fabdev->bypass_qos_prg;
	fabdev->util_fact = pdata->fabdev->util_fact;
	fabdev->vrail_comp = pdata->fabdev->vrail_comp;
	msm_bus_fab_init_noc_ops(node_dev);

	fabdev->qos_base = devm_ioremap(dev,
+18 −0
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@
#include "msm_bus_adhoc.h"

#define DEFAULT_QOS_FREQ	19200
#define DEFAULT_UTIL_FACT	100
#define DEFAULT_VRAIL_COMP	100

static int get_qos_mode(struct platform_device *pdev,
			struct device_node *node, const char *qos_mode)
@@ -145,6 +147,22 @@ static struct msm_bus_fab_device_type *get_fab_device_info(
		fab_dev->qos_freq = DEFAULT_QOS_FREQ;
	}

	ret = of_property_read_u32(dev_node, "qcom,util-fact",
						&fab_dev->util_fact);
	if (ret) {
		dev_info(&pdev->dev, "Util-fact is missing, default to %d\n",
				DEFAULT_UTIL_FACT);
		fab_dev->util_fact = DEFAULT_UTIL_FACT;
	}

	ret = of_property_read_u32(dev_node, "qcom,vrail-comp",
						&fab_dev->vrail_comp);
	if (ret) {
		dev_info(&pdev->dev, "Vrail-comp is missing, default to %d\n",
				DEFAULT_VRAIL_COMP);
		fab_dev->vrail_comp = DEFAULT_VRAIL_COMP;
	}

	return fab_dev;

fab_dev_err: