Skip to content

Commit 919791d

Browse files
konradybcioGeorgi Djakov
authored andcommitted
interconnect: qcom: icc-rpm: Let nodes drive their own bus clock
If this hardware couldn't get messier, some nodes are supposed to drive their own bus clock.. Presumably to connect to some intermediate interface between the node itself and the bus it's (supposed to be) connected to. Expand the node struct with the necessary data and hook up the allocations & calculations. Note that the node-specific AB/IB coefficients contribute (by design) to both the node-level and the bus-level aggregation. Signed-off-by: Konrad Dybcio <konrad.dybcio@linaro.org> Link: https://lore.kernel.org/r/20230726-topic-icc_coeff-v4-3-c04b60caa467@linaro.org Signed-off-by: Georgi Djakov <djakov@kernel.org>
1 parent db8fc10 commit 919791d

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

drivers/interconnect/qcom/icc-rpm.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,6 +414,33 @@ static int qcom_icc_set(struct icc_node *src, struct icc_node *dst)
414414
qp->bus_clk_rate[QCOM_SMD_RPM_SLEEP_STATE] = sleep_rate;
415415
}
416416

417+
/* Handle the node-specific clock */
418+
if (!src_qn->bus_clk_desc)
419+
return 0;
420+
421+
active_rate = qcom_icc_calc_rate(qp, src_qn, QCOM_SMD_RPM_ACTIVE_STATE);
422+
sleep_rate = qcom_icc_calc_rate(qp, src_qn, QCOM_SMD_RPM_SLEEP_STATE);
423+
424+
if (active_rate != src_qn->bus_clk_rate[QCOM_SMD_RPM_ACTIVE_STATE]) {
425+
ret = qcom_icc_rpm_set_bus_rate(src_qn->bus_clk_desc, QCOM_SMD_RPM_ACTIVE_STATE,
426+
active_rate);
427+
if (ret)
428+
return ret;
429+
430+
/* Cache the rate after we've successfully committed it to RPM */
431+
src_qn->bus_clk_rate[QCOM_SMD_RPM_ACTIVE_STATE] = active_rate;
432+
}
433+
434+
if (sleep_rate != src_qn->bus_clk_rate[QCOM_SMD_RPM_SLEEP_STATE]) {
435+
ret = qcom_icc_rpm_set_bus_rate(src_qn->bus_clk_desc, QCOM_SMD_RPM_SLEEP_STATE,
436+
sleep_rate);
437+
if (ret)
438+
return ret;
439+
440+
/* Cache the rate after we've successfully committed it to RPM */
441+
src_qn->bus_clk_rate[QCOM_SMD_RPM_SLEEP_STATE] = sleep_rate;
442+
}
443+
417444
return 0;
418445
}
419446

drivers/interconnect/qcom/icc-rpm.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,13 @@ struct qcom_icc_qos {
9797
* @num_links: the total number of @links
9898
* @channels: number of channels at this node (e.g. DDR channels)
9999
* @buswidth: width of the interconnect between a node and the bus (bytes)
100+
* @bus_clk_desc: a pointer to a rpm_clk_resource description of bus clocks
100101
* @sum_avg: current sum aggregate value of all avg bw requests
101102
* @max_peak: current max aggregate value of all peak bw requests
102103
* @mas_rpm_id: RPM id for devices that are bus masters
103104
* @slv_rpm_id: RPM id for devices that are bus slaves
104105
* @qos: NoC QoS setting parameters
106+
* @bus_clk_rate: a pointer to an array containing bus clock rates in Hz
105107
*/
106108
struct qcom_icc_node {
107109
unsigned char *name;
@@ -110,11 +112,13 @@ struct qcom_icc_node {
110112
u16 num_links;
111113
u16 channels;
112114
u16 buswidth;
115+
const struct rpm_clk_resource *bus_clk_desc;
113116
u64 sum_avg[QCOM_SMD_RPM_STATE_NUM];
114117
u64 max_peak[QCOM_SMD_RPM_STATE_NUM];
115118
int mas_rpm_id;
116119
int slv_rpm_id;
117120
struct qcom_icc_qos qos;
121+
u32 bus_clk_rate[QCOM_SMD_RPM_STATE_NUM];
118122
};
119123

120124
struct qcom_icc_desc {

0 commit comments

Comments
 (0)