|
46 | 46 | #define DDRMON_CH1_COUNT_NUM 0x3c
|
47 | 47 | #define DDRMON_CH1_DFI_ACCESS_NUM 0x40
|
48 | 48 |
|
| 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 | + */ |
49 | 54 | struct dmc_count_channel {
|
50 | 55 | u32 access;
|
51 |
| - u32 total; |
| 56 | + u32 clock_cycles; |
52 | 57 | };
|
53 | 58 |
|
54 | 59 | struct dmc_count {
|
@@ -151,7 +156,7 @@ static void rockchip_dfi_read_counters(struct rockchip_dfi *dfi, struct dmc_coun
|
151 | 156 | continue;
|
152 | 157 | count->c[i].access = readl_relaxed(dfi_regs +
|
153 | 158 | 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 + |
155 | 160 | DDRMON_CH0_COUNT_NUM + i * 20);
|
156 | 161 | }
|
157 | 162 | }
|
@@ -183,29 +188,29 @@ static int rockchip_dfi_get_event(struct devfreq_event_dev *edev,
|
183 | 188 | struct rockchip_dfi *dfi = devfreq_event_get_drvdata(edev);
|
184 | 189 | struct dmc_count count;
|
185 | 190 | struct dmc_count *last = &dfi->last_event_count;
|
186 |
| - u32 access = 0, total = 0; |
| 191 | + u32 access = 0, clock_cycles = 0; |
187 | 192 | int i;
|
188 | 193 |
|
189 | 194 | rockchip_dfi_read_counters(dfi, &count);
|
190 | 195 |
|
191 | 196 | /* We can only report one channel, so find the busiest one */
|
192 | 197 | for (i = 0; i < dfi->max_channels; i++) {
|
193 |
| - u32 a, t; |
| 198 | + u32 a, c; |
194 | 199 |
|
195 | 200 | if (!(dfi->channel_mask & BIT(i)))
|
196 | 201 | continue;
|
197 | 202 |
|
198 | 203 | 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; |
200 | 205 |
|
201 | 206 | if (a > access) {
|
202 | 207 | access = a;
|
203 |
| - total = t; |
| 208 | + clock_cycles = c; |
204 | 209 | }
|
205 | 210 | }
|
206 | 211 |
|
207 | 212 | edata->load_count = access * 4;
|
208 |
| - edata->total_count = total; |
| 213 | + edata->total_count = clock_cycles; |
209 | 214 |
|
210 | 215 | dfi->last_event_count = count;
|
211 | 216 |
|
|
0 commit comments