Commit ba3f8266 authored by Konrad Dybcio's avatar Konrad Dybcio Committed by Georgi Djakov
Browse files

interconnect: qcom: icc-rpm: Check for node-specific rate coefficients

parent 919791d8
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -300,14 +300,14 @@ static u64 qcom_icc_calc_rate(struct qcom_icc_provider *qp, struct qcom_icc_node
	else
		agg_avg_rate = qn->sum_avg[ctx];

	if (qp->ab_coeff) {
		agg_avg_rate = agg_avg_rate * qp->ab_coeff;
	if (qn->ab_coeff) {
		agg_avg_rate = agg_avg_rate * qn->ab_coeff;
		agg_avg_rate = div_u64(agg_avg_rate, 100);
	}

	if (qp->ib_coeff) {
	if (qn->ib_coeff) {
		agg_peak_rate = qn->max_peak[ctx] * 100;
		agg_peak_rate = div_u64(qn->max_peak[ctx], qp->ib_coeff);
		agg_peak_rate = div_u64(qn->max_peak[ctx], qn->ib_coeff);
	} else {
		agg_peak_rate = qn->max_peak[ctx];
	}
@@ -563,6 +563,12 @@ int qnoc_probe(struct platform_device *pdev)
	for (i = 0; i < num_nodes; i++) {
		size_t j;

		if (!qnodes[i]->ab_coeff)
			qnodes[i]->ab_coeff = qp->ab_coeff;

		if (!qnodes[i]->ib_coeff)
			qnodes[i]->ib_coeff = qp->ib_coeff;

		node = icc_node_create(qnodes[i]->id);
		if (IS_ERR(node)) {
			ret = PTR_ERR(node);
+4 −0
Original line number Diff line number Diff line
@@ -103,6 +103,8 @@ struct qcom_icc_qos {
 * @mas_rpm_id:	RPM id for devices that are bus masters
 * @slv_rpm_id:	RPM id for devices that are bus slaves
 * @qos: NoC QoS setting parameters
 * @ab_coeff: a percentage-based coefficient for compensating the AB calculations
 * @ib_coeff: an inverse-percentage-based coefficient for compensating the IB calculations
 * @bus_clk_rate: a pointer to an array containing bus clock rates in Hz
 */
struct qcom_icc_node {
@@ -118,6 +120,8 @@ struct qcom_icc_node {
	int mas_rpm_id;
	int slv_rpm_id;
	struct qcom_icc_qos qos;
	u16 ab_coeff;
	u16 ib_coeff;
	u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM];
};