mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 02:24:24 +02:00
memory: tegra: Change macros to interpret parameter as integer
Convert the macros that manipulate the delay values to interpret their index parameter as an integer to allow the introduction of loops. Signed-off-by: Diogo Ivo <diogo.ivo@tecnico.ulisboa.pt> Link: https://lore.kernel.org/r/20240704-tegra210_emcfreq-v4-4-3e450503c555@tecnico.ulisboa.pt Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
This commit is contained in:
parent
c5f83622cc
commit
a238f62b36
|
|
@ -75,29 +75,29 @@ enum {
|
|||
* The division portion of the average operation.
|
||||
*/
|
||||
#define __AVERAGE_PTFV(dev) \
|
||||
({ next->ptfv_list[PTFV_DQSOSC_MOVAVG_ ## dev ## _INDEX] = \
|
||||
next->ptfv_list[PTFV_DQSOSC_MOVAVG_ ## dev ## _INDEX] / \
|
||||
({ next->ptfv_list[(dev)] = \
|
||||
next->ptfv_list[(dev)] / \
|
||||
next->ptfv_list[PTFV_DVFS_SAMPLES_INDEX]; })
|
||||
|
||||
/*
|
||||
* Convert val to fixed point and add it to the temporary average.
|
||||
*/
|
||||
#define __INCREMENT_PTFV(dev, val) \
|
||||
({ next->ptfv_list[PTFV_DQSOSC_MOVAVG_ ## dev ## _INDEX] += \
|
||||
({ next->ptfv_list[(dev)] += \
|
||||
((val) * MOVAVG_PRECISION_FACTOR); })
|
||||
|
||||
/*
|
||||
* Convert a moving average back to integral form and return the value.
|
||||
*/
|
||||
#define __MOVAVG_AC(timing, dev) \
|
||||
((timing)->ptfv_list[PTFV_DQSOSC_MOVAVG_ ## dev ## _INDEX] / \
|
||||
((timing)->ptfv_list[(dev)] / \
|
||||
MOVAVG_PRECISION_FACTOR)
|
||||
|
||||
/* Weighted update. */
|
||||
#define __WEIGHTED_UPDATE_PTFV(dev, nval) \
|
||||
do { \
|
||||
int w = PTFV_MOVAVG_WEIGHT_INDEX; \
|
||||
int dqs = PTFV_DQSOSC_MOVAVG_ ## dev ## _INDEX; \
|
||||
int dqs = (dev); \
|
||||
\
|
||||
next->ptfv_list[dqs] = \
|
||||
((nval * MOVAVG_PRECISION_FACTOR) + \
|
||||
|
|
@ -111,7 +111,7 @@ enum {
|
|||
|
||||
/* Access a particular average. */
|
||||
#define __MOVAVG(timing, dev) \
|
||||
((timing)->ptfv_list[PTFV_DQSOSC_MOVAVG_ ## dev ## _INDEX])
|
||||
((timing)->ptfv_list[(dev)])
|
||||
|
||||
static u32 update_clock_tree_delay(struct tegra210_emc *emc, int type)
|
||||
{
|
||||
|
|
@ -418,6 +418,7 @@ static u32 periodic_compensation_handler(struct tegra210_emc *emc, u32 type,
|
|||
(nt)->ptfv_list[PTFV_DVFS_SAMPLES_INDEX]; })
|
||||
|
||||
u32 i, adel = 0, samples = next->ptfv_list[PTFV_DVFS_SAMPLES_INDEX];
|
||||
u32 idx;
|
||||
|
||||
if (!next->periodic_training)
|
||||
return 0;
|
||||
|
|
@ -431,24 +432,12 @@ static u32 periodic_compensation_handler(struct tegra210_emc *emc, u32 type,
|
|||
* calibration then we can reuse the previous
|
||||
* frequencies EMA data.
|
||||
*/
|
||||
__COPY_EMA(next, last, C0D0U0);
|
||||
__COPY_EMA(next, last, C0D0U1);
|
||||
__COPY_EMA(next, last, C1D0U0);
|
||||
__COPY_EMA(next, last, C1D0U1);
|
||||
__COPY_EMA(next, last, C0D1U0);
|
||||
__COPY_EMA(next, last, C0D1U1);
|
||||
__COPY_EMA(next, last, C1D1U0);
|
||||
__COPY_EMA(next, last, C1D1U1);
|
||||
for (idx = 0; idx < DRAM_CLKTREE_NUM; idx++)
|
||||
__COPY_EMA(next, last, idx);
|
||||
} else {
|
||||
/* Reset the EMA.*/
|
||||
__MOVAVG(next, C0D0U0) = 0;
|
||||
__MOVAVG(next, C0D0U1) = 0;
|
||||
__MOVAVG(next, C1D0U0) = 0;
|
||||
__MOVAVG(next, C1D0U1) = 0;
|
||||
__MOVAVG(next, C0D1U0) = 0;
|
||||
__MOVAVG(next, C0D1U1) = 0;
|
||||
__MOVAVG(next, C1D1U0) = 0;
|
||||
__MOVAVG(next, C1D1U1) = 0;
|
||||
for (idx = 0; idx < DRAM_CLKTREE_NUM; idx++)
|
||||
__MOVAVG(next, idx) = 0;
|
||||
|
||||
for (i = 0; i < samples; i++) {
|
||||
/* Generate next sample of data. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user