Skip to content

Commit 2785cc0

Browse files
saschahauerchanwoochoi
authored andcommitted
PM / devfreq: rockchip-dfi: give variable a better name
struct dmc_count_channel::total counts the clock cycles of the DDR controller. Rename it accordingly to give the reader a better idea what this is about. While at it, at some documentation to struct dmc_count_channel. Link: https://lore.kernel.org/all/[email protected]/ Reviewed-by: Sebastian Reichel <[email protected]> Acked-by: Chanwoo Choi <[email protected]> Signed-off-by: Sascha Hauer <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]>
1 parent d724f4a commit 2785cc0

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

drivers/devfreq/event/rockchip-dfi.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,14 @@
4646
#define DDRMON_CH1_COUNT_NUM 0x3c
4747
#define DDRMON_CH1_DFI_ACCESS_NUM 0x40
4848

49+
/**
50+
* struct dmc_count_channel - structure to hold counter values from the DDR controller
51+
* @access: Number of read and write accesses
52+
* @clock_cycles: DDR clock cycles
53+
*/
4954
struct dmc_count_channel {
5055
u32 access;
51-
u32 total;
56+
u32 clock_cycles;
5257
};
5358

5459
struct dmc_count {
@@ -151,7 +156,7 @@ static void rockchip_dfi_read_counters(struct rockchip_dfi *dfi, struct dmc_coun
151156
continue;
152157
count->c[i].access = readl_relaxed(dfi_regs +
153158
DDRMON_CH0_DFI_ACCESS_NUM + i * 20);
154-
count->c[i].total = readl_relaxed(dfi_regs +
159+
count->c[i].clock_cycles = readl_relaxed(dfi_regs +
155160
DDRMON_CH0_COUNT_NUM + i * 20);
156161
}
157162
}
@@ -183,29 +188,29 @@ static int rockchip_dfi_get_event(struct devfreq_event_dev *edev,
183188
struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev);
184189
struct dmc_count count;
185190
struct dmc_count *last = &dfi->last_event_count;
186-
u32 access = 0, total = 0;
191+
u32 access = 0, clock_cycles = 0;
187192
int i;
188193

189194
rockchip_dfi_read_counters(dfi, &count);
190195

191196
/* We can only report one channel, so find the busiest one */
192197
for (i = 0; i < dfi->max_channels; i++) {
193-
u32 a, t;
198+
u32 a, c;
194199

195200
if (!(dfi->channel_mask & BIT(i)))
196201
continue;
197202

198203
a = count.c[i].access - last->c[i].access;
199-
t = count.c[i].total - last->c[i].total;
204+
c = count.c[i].clock_cycles - last->c[i].clock_cycles;
200205

201206
if (a > access) {
202207
access = a;
203-
total = t;
208+
clock_cycles = c;
204209
}
205210
}
206211

207212
edata->load_count = access * 4;
208-
edata->total_count = total;
213+
edata->total_count = clock_cycles;
209214

210215
dfi->last_event_count = count;
211216

0 commit comments

Comments
 (0)