Lloyd Atkinson | 8772e20 | 2016-09-26 17:52:16 -0400 | [diff] [blame] | 1 | /* Copyright (c) 2015-2017, The Linux Foundation. All rights reserved. |
| 2 | * |
| 3 | * This program is free software; you can redistribute it and/or modify |
| 4 | * it under the terms of the GNU General Public License version 2 and |
| 5 | * only version 2 as published by the Free Software Foundation. |
| 6 | * |
| 7 | * This program is distributed in the hope that it will be useful, |
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 | * GNU General Public License for more details. |
| 11 | */ |
| 12 | |
| 13 | #define pr_fmt(fmt) "[drm:%s:%d] " fmt, __func__, __LINE__ |
| 14 | |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 15 | #include <linux/debugfs.h> |
| 16 | |
Lloyd Atkinson | 8772e20 | 2016-09-26 17:52:16 -0400 | [diff] [blame] | 17 | #include "sde_vbif.h" |
| 18 | #include "sde_hw_vbif.h" |
| 19 | #include "sde_trace.h" |
| 20 | |
| 21 | /** |
| 22 | * _sde_vbif_wait_for_xin_halt - wait for the xin to halt |
| 23 | * @vbif: Pointer to hardware vbif driver |
| 24 | * @xin_id: Client interface identifier |
| 25 | * @return: 0 if success; error code otherwise |
| 26 | */ |
| 27 | static int _sde_vbif_wait_for_xin_halt(struct sde_hw_vbif *vbif, u32 xin_id) |
| 28 | { |
| 29 | ktime_t timeout; |
| 30 | bool status; |
| 31 | int rc; |
| 32 | |
| 33 | if (!vbif || !vbif->cap || !vbif->ops.get_halt_ctrl) { |
| 34 | SDE_ERROR("invalid arguments vbif %d\n", vbif != 0); |
| 35 | return -EINVAL; |
| 36 | } |
| 37 | |
| 38 | timeout = ktime_add_us(ktime_get(), vbif->cap->xin_halt_timeout); |
| 39 | for (;;) { |
| 40 | status = vbif->ops.get_halt_ctrl(vbif, xin_id); |
| 41 | if (status) |
| 42 | break; |
| 43 | if (ktime_compare_safe(ktime_get(), timeout) > 0) { |
| 44 | status = vbif->ops.get_halt_ctrl(vbif, xin_id); |
| 45 | break; |
| 46 | } |
| 47 | usleep_range(501, 1000); |
| 48 | } |
| 49 | |
| 50 | if (!status) { |
| 51 | rc = -ETIMEDOUT; |
| 52 | SDE_ERROR("VBIF %d client %d not halting. TIMEDOUT.\n", |
| 53 | vbif->idx - VBIF_0, xin_id); |
| 54 | } else { |
| 55 | rc = 0; |
| 56 | SDE_DEBUG("VBIF %d client %d is halted\n", |
| 57 | vbif->idx - VBIF_0, xin_id); |
| 58 | } |
| 59 | |
| 60 | return rc; |
| 61 | } |
| 62 | |
Harsh Sahu | ea80837 | 2017-09-12 22:41:01 -0700 | [diff] [blame] | 63 | int sde_vbif_halt_plane_xin(struct sde_kms *sde_kms, u32 xin_id, u32 clk_ctrl) |
| 64 | { |
| 65 | struct sde_hw_vbif *vbif = NULL; |
| 66 | struct sde_hw_mdp *mdp; |
| 67 | bool forced_on = false; |
| 68 | bool status; |
| 69 | int rc = 0; |
| 70 | |
| 71 | if (!sde_kms) { |
| 72 | SDE_ERROR("invalid argument\n"); |
| 73 | return -EINVAL; |
| 74 | } |
| 75 | |
| 76 | vbif = sde_kms->hw_vbif[VBIF_RT]; |
| 77 | mdp = sde_kms->hw_mdp; |
| 78 | if (!vbif || !mdp || !vbif->ops.get_halt_ctrl || |
| 79 | !vbif->ops.set_halt_ctrl || |
| 80 | !mdp->ops.setup_clk_force_ctrl) { |
| 81 | SDE_ERROR("invalid vbif or mdp arguments\n"); |
| 82 | return -EINVAL; |
| 83 | } |
| 84 | |
| 85 | /* |
| 86 | * If status is 0, then make sure client clock is not gated |
| 87 | * while halting by forcing it ON only if it was not previously |
| 88 | * forced on. If status is 1 then its already halted. |
| 89 | */ |
| 90 | status = vbif->ops.get_halt_ctrl(vbif, xin_id); |
| 91 | if (status == 0) |
| 92 | forced_on = mdp->ops.setup_clk_force_ctrl(mdp, clk_ctrl, true); |
| 93 | else |
| 94 | return 0; |
| 95 | |
| 96 | /* send halt request for unused plane's xin client */ |
| 97 | vbif->ops.set_halt_ctrl(vbif, xin_id, true); |
| 98 | |
| 99 | rc = _sde_vbif_wait_for_xin_halt(vbif, xin_id); |
| 100 | if (rc) { |
| 101 | SDE_ERROR( |
| 102 | "wait failed for pipe halt:xin_id %u, clk_ctrl %u, rc %u\n", |
| 103 | xin_id, clk_ctrl, rc); |
| 104 | SDE_EVT32(xin_id, clk_ctrl, rc, SDE_EVTLOG_ERROR); |
Harsh Sahu | ea80837 | 2017-09-12 22:41:01 -0700 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | /* open xin client to enable transactions */ |
| 108 | vbif->ops.set_halt_ctrl(vbif, xin_id, false); |
| 109 | if (forced_on) |
| 110 | mdp->ops.setup_clk_force_ctrl(mdp, clk_ctrl, false); |
| 111 | |
Lloyd Atkinson | 89e6f2f | 2017-11-10 18:37:43 -0500 | [diff] [blame] | 112 | return rc; |
Harsh Sahu | ea80837 | 2017-09-12 22:41:01 -0700 | [diff] [blame] | 113 | } |
| 114 | |
Lloyd Atkinson | 8772e20 | 2016-09-26 17:52:16 -0400 | [diff] [blame] | 115 | /** |
| 116 | * _sde_vbif_apply_dynamic_ot_limit - determine OT based on usecase parameters |
| 117 | * @vbif: Pointer to hardware vbif driver |
| 118 | * @ot_lim: Pointer to OT limit to be modified |
| 119 | * @params: Pointer to usecase parameters |
| 120 | */ |
| 121 | static void _sde_vbif_apply_dynamic_ot_limit(struct sde_hw_vbif *vbif, |
| 122 | u32 *ot_lim, struct sde_vbif_set_ot_params *params) |
| 123 | { |
| 124 | u64 pps; |
| 125 | const struct sde_vbif_dynamic_ot_tbl *tbl; |
| 126 | u32 i; |
| 127 | |
| 128 | if (!vbif || !(vbif->cap->features & BIT(SDE_VBIF_QOS_OTLIM))) |
| 129 | return; |
| 130 | |
| 131 | /* Dynamic OT setting done only for WFD */ |
| 132 | if (!params->is_wfd) |
| 133 | return; |
| 134 | |
| 135 | pps = params->frame_rate; |
| 136 | pps *= params->width; |
| 137 | pps *= params->height; |
| 138 | |
| 139 | tbl = params->rd ? &vbif->cap->dynamic_ot_rd_tbl : |
| 140 | &vbif->cap->dynamic_ot_wr_tbl; |
| 141 | |
| 142 | for (i = 0; i < tbl->count; i++) { |
| 143 | if (pps <= tbl->cfg[i].pps) { |
| 144 | *ot_lim = tbl->cfg[i].ot_limit; |
| 145 | break; |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | SDE_DEBUG("vbif:%d xin:%d w:%d h:%d fps:%d pps:%llu ot:%u\n", |
| 150 | vbif->idx - VBIF_0, params->xin_id, |
| 151 | params->width, params->height, params->frame_rate, |
| 152 | pps, *ot_lim); |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * _sde_vbif_get_ot_limit - get OT based on usecase & configuration parameters |
| 157 | * @vbif: Pointer to hardware vbif driver |
| 158 | * @params: Pointer to usecase parameters |
| 159 | * @return: OT limit |
| 160 | */ |
| 161 | static u32 _sde_vbif_get_ot_limit(struct sde_hw_vbif *vbif, |
| 162 | struct sde_vbif_set_ot_params *params) |
| 163 | { |
| 164 | u32 ot_lim = 0; |
| 165 | u32 val; |
| 166 | |
| 167 | if (!vbif || !vbif->cap) { |
| 168 | SDE_ERROR("invalid arguments vbif %d\n", vbif != 0); |
| 169 | return -EINVAL; |
| 170 | } |
| 171 | |
| 172 | if (vbif->cap->default_ot_wr_limit && !params->rd) |
| 173 | ot_lim = vbif->cap->default_ot_wr_limit; |
| 174 | else if (vbif->cap->default_ot_rd_limit && params->rd) |
| 175 | ot_lim = vbif->cap->default_ot_rd_limit; |
| 176 | |
| 177 | /* |
| 178 | * If default ot is not set from dt/catalog, |
| 179 | * then do not configure it. |
| 180 | */ |
| 181 | if (ot_lim == 0) |
| 182 | goto exit; |
| 183 | |
| 184 | /* Modify the limits if the target and the use case requires it */ |
| 185 | _sde_vbif_apply_dynamic_ot_limit(vbif, &ot_lim, params); |
| 186 | |
| 187 | if (vbif && vbif->ops.get_limit_conf) { |
| 188 | val = vbif->ops.get_limit_conf(vbif, |
| 189 | params->xin_id, params->rd); |
| 190 | if (val == ot_lim) |
| 191 | ot_lim = 0; |
| 192 | } |
| 193 | |
| 194 | exit: |
| 195 | SDE_DEBUG("vbif:%d xin:%d ot_lim:%d\n", |
| 196 | vbif->idx - VBIF_0, params->xin_id, ot_lim); |
| 197 | return ot_lim; |
| 198 | } |
| 199 | |
| 200 | /** |
| 201 | * sde_vbif_set_ot_limit - set OT based on usecase & configuration parameters |
| 202 | * @vbif: Pointer to hardware vbif driver |
| 203 | * @params: Pointer to usecase parameters |
| 204 | * |
| 205 | * Note this function would block waiting for bus halt. |
| 206 | */ |
| 207 | void sde_vbif_set_ot_limit(struct sde_kms *sde_kms, |
| 208 | struct sde_vbif_set_ot_params *params) |
| 209 | { |
| 210 | struct sde_hw_vbif *vbif = NULL; |
| 211 | struct sde_hw_mdp *mdp; |
| 212 | bool forced_on = false; |
| 213 | u32 ot_lim; |
| 214 | int ret, i; |
| 215 | |
| 216 | if (!sde_kms) { |
| 217 | SDE_ERROR("invalid arguments\n"); |
| 218 | return; |
| 219 | } |
| 220 | mdp = sde_kms->hw_mdp; |
| 221 | |
| 222 | for (i = 0; i < ARRAY_SIZE(sde_kms->hw_vbif); i++) { |
| 223 | if (sde_kms->hw_vbif[i] && |
Clarence Ip | ff4609e | 2017-10-06 13:36:24 -0400 | [diff] [blame] | 224 | sde_kms->hw_vbif[i]->idx == params->vbif_idx) { |
Lloyd Atkinson | 8772e20 | 2016-09-26 17:52:16 -0400 | [diff] [blame] | 225 | vbif = sde_kms->hw_vbif[i]; |
Clarence Ip | ff4609e | 2017-10-06 13:36:24 -0400 | [diff] [blame] | 226 | break; |
| 227 | } |
Lloyd Atkinson | 8772e20 | 2016-09-26 17:52:16 -0400 | [diff] [blame] | 228 | } |
| 229 | |
| 230 | if (!vbif || !mdp) { |
| 231 | SDE_DEBUG("invalid arguments vbif %d mdp %d\n", |
Clarence Ip | ff4609e | 2017-10-06 13:36:24 -0400 | [diff] [blame] | 232 | vbif != NULL, mdp != NULL); |
Lloyd Atkinson | 8772e20 | 2016-09-26 17:52:16 -0400 | [diff] [blame] | 233 | return; |
| 234 | } |
| 235 | |
| 236 | if (!mdp->ops.setup_clk_force_ctrl || |
| 237 | !vbif->ops.set_limit_conf || |
| 238 | !vbif->ops.set_halt_ctrl) |
| 239 | return; |
| 240 | |
Veera Sundaram Sankaran | 7952540 | 2017-07-31 14:17:23 -0700 | [diff] [blame] | 241 | /* set write_gather_en for all write clients */ |
| 242 | if (vbif->ops.set_write_gather_en && !params->rd) |
| 243 | vbif->ops.set_write_gather_en(vbif, params->xin_id); |
| 244 | |
Lloyd Atkinson | 8772e20 | 2016-09-26 17:52:16 -0400 | [diff] [blame] | 245 | ot_lim = _sde_vbif_get_ot_limit(vbif, params) & 0xFF; |
| 246 | |
| 247 | if (ot_lim == 0) |
| 248 | goto exit; |
| 249 | |
| 250 | trace_sde_perf_set_ot(params->num, params->xin_id, ot_lim, |
| 251 | params->vbif_idx); |
| 252 | |
| 253 | forced_on = mdp->ops.setup_clk_force_ctrl(mdp, params->clk_ctrl, true); |
| 254 | |
| 255 | vbif->ops.set_limit_conf(vbif, params->xin_id, params->rd, ot_lim); |
| 256 | |
| 257 | vbif->ops.set_halt_ctrl(vbif, params->xin_id, true); |
| 258 | |
| 259 | ret = _sde_vbif_wait_for_xin_halt(vbif, params->xin_id); |
| 260 | if (ret) |
Lloyd Atkinson | 5d40d31 | 2016-09-06 08:34:13 -0400 | [diff] [blame] | 261 | SDE_EVT32(vbif->idx, params->xin_id); |
Lloyd Atkinson | 8772e20 | 2016-09-26 17:52:16 -0400 | [diff] [blame] | 262 | |
| 263 | vbif->ops.set_halt_ctrl(vbif, params->xin_id, false); |
| 264 | |
| 265 | if (forced_on) |
| 266 | mdp->ops.setup_clk_force_ctrl(mdp, params->clk_ctrl, false); |
| 267 | exit: |
| 268 | return; |
| 269 | } |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 270 | |
Clarence Ip | ff4609e | 2017-10-06 13:36:24 -0400 | [diff] [blame] | 271 | bool sde_vbif_set_xin_halt(struct sde_kms *sde_kms, |
| 272 | struct sde_vbif_set_xin_halt_params *params) |
| 273 | { |
| 274 | struct sde_hw_vbif *vbif = NULL; |
| 275 | struct sde_hw_mdp *mdp; |
| 276 | bool forced_on = false; |
| 277 | int ret, i; |
| 278 | |
| 279 | if (!sde_kms || !params) { |
| 280 | SDE_ERROR("invalid arguments\n"); |
| 281 | return false; |
| 282 | } |
| 283 | mdp = sde_kms->hw_mdp; |
| 284 | |
| 285 | for (i = 0; i < ARRAY_SIZE(sde_kms->hw_vbif); i++) { |
| 286 | if (sde_kms->hw_vbif[i] && |
| 287 | sde_kms->hw_vbif[i]->idx == params->vbif_idx) { |
| 288 | vbif = sde_kms->hw_vbif[i]; |
| 289 | break; |
| 290 | } |
| 291 | } |
| 292 | |
| 293 | if (!vbif || !mdp) { |
| 294 | SDE_DEBUG("invalid arguments vbif %d mdp %d\n", |
| 295 | vbif != NULL, mdp != NULL); |
| 296 | return false; |
| 297 | } |
| 298 | |
| 299 | if (!mdp->ops.setup_clk_force_ctrl || |
| 300 | !vbif->ops.set_halt_ctrl) |
| 301 | return false; |
| 302 | |
| 303 | if (params->enable) { |
| 304 | forced_on = mdp->ops.setup_clk_force_ctrl(mdp, |
| 305 | params->clk_ctrl, true); |
| 306 | |
| 307 | vbif->ops.set_halt_ctrl(vbif, params->xin_id, true); |
| 308 | |
| 309 | ret = _sde_vbif_wait_for_xin_halt(vbif, params->xin_id); |
| 310 | if (ret) |
| 311 | SDE_EVT32(vbif->idx, params->xin_id, SDE_EVTLOG_ERROR); |
| 312 | } else { |
| 313 | vbif->ops.set_halt_ctrl(vbif, params->xin_id, false); |
| 314 | |
| 315 | if (params->forced_on) |
| 316 | mdp->ops.setup_clk_force_ctrl(mdp, |
| 317 | params->clk_ctrl, false); |
| 318 | } |
| 319 | |
| 320 | return forced_on; |
| 321 | } |
| 322 | |
Alan Kwong | a62eeb8 | 2017-04-19 08:57:55 -0700 | [diff] [blame] | 323 | void sde_vbif_set_qos_remap(struct sde_kms *sde_kms, |
| 324 | struct sde_vbif_set_qos_params *params) |
| 325 | { |
| 326 | struct sde_hw_vbif *vbif = NULL; |
| 327 | struct sde_hw_mdp *mdp; |
| 328 | bool forced_on = false; |
| 329 | const struct sde_vbif_qos_tbl *qos_tbl; |
| 330 | int i; |
| 331 | |
| 332 | if (!sde_kms || !params || !sde_kms->hw_mdp) { |
| 333 | SDE_ERROR("invalid arguments\n"); |
| 334 | return; |
| 335 | } |
| 336 | mdp = sde_kms->hw_mdp; |
| 337 | |
| 338 | for (i = 0; i < ARRAY_SIZE(sde_kms->hw_vbif); i++) { |
| 339 | if (sde_kms->hw_vbif[i] && |
| 340 | sde_kms->hw_vbif[i]->idx == params->vbif_idx) { |
| 341 | vbif = sde_kms->hw_vbif[i]; |
| 342 | break; |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | if (!vbif || !vbif->cap) { |
| 347 | SDE_ERROR("invalid vbif %d\n", params->vbif_idx); |
| 348 | return; |
| 349 | } |
| 350 | |
| 351 | if (!vbif->ops.set_qos_remap || !mdp->ops.setup_clk_force_ctrl) { |
| 352 | SDE_DEBUG("qos remap not supported\n"); |
| 353 | return; |
| 354 | } |
| 355 | |
| 356 | qos_tbl = params->is_rt ? &vbif->cap->qos_rt_tbl : |
| 357 | &vbif->cap->qos_nrt_tbl; |
| 358 | |
| 359 | if (!qos_tbl->npriority_lvl || !qos_tbl->priority_lvl) { |
| 360 | SDE_DEBUG("qos tbl not defined\n"); |
| 361 | return; |
| 362 | } |
| 363 | |
| 364 | forced_on = mdp->ops.setup_clk_force_ctrl(mdp, params->clk_ctrl, true); |
| 365 | |
| 366 | for (i = 0; i < qos_tbl->npriority_lvl; i++) { |
| 367 | SDE_DEBUG("vbif:%d xin:%d lvl:%d/%d\n", |
| 368 | params->vbif_idx, params->xin_id, i, |
| 369 | qos_tbl->priority_lvl[i]); |
| 370 | vbif->ops.set_qos_remap(vbif, params->xin_id, i, |
| 371 | qos_tbl->priority_lvl[i]); |
| 372 | } |
| 373 | |
| 374 | if (forced_on) |
| 375 | mdp->ops.setup_clk_force_ctrl(mdp, params->clk_ctrl, false); |
| 376 | } |
| 377 | |
Clarence Ip | 980405d | 2017-08-08 18:33:44 -0400 | [diff] [blame] | 378 | void sde_vbif_clear_errors(struct sde_kms *sde_kms) |
| 379 | { |
| 380 | struct sde_hw_vbif *vbif; |
| 381 | u32 i, pnd, src; |
| 382 | |
| 383 | if (!sde_kms) { |
| 384 | SDE_ERROR("invalid argument\n"); |
| 385 | return; |
| 386 | } |
| 387 | |
| 388 | for (i = 0; i < ARRAY_SIZE(sde_kms->hw_vbif); i++) { |
| 389 | vbif = sde_kms->hw_vbif[i]; |
| 390 | if (vbif && vbif->ops.clear_errors) { |
| 391 | vbif->ops.clear_errors(vbif, &pnd, &src); |
| 392 | if (pnd || src) { |
| 393 | SDE_EVT32(i, pnd, src); |
| 394 | SDE_DEBUG("VBIF %d: pnd 0x%X, src 0x%X\n", |
| 395 | vbif->idx - VBIF_0, pnd, src); |
| 396 | } |
| 397 | } |
| 398 | } |
| 399 | } |
| 400 | |
Clarence Ip | 7f0de63 | 2017-05-31 14:59:14 -0400 | [diff] [blame] | 401 | void sde_vbif_init_memtypes(struct sde_kms *sde_kms) |
| 402 | { |
| 403 | struct sde_hw_vbif *vbif; |
| 404 | int i, j; |
| 405 | |
| 406 | if (!sde_kms) { |
| 407 | SDE_ERROR("invalid argument\n"); |
| 408 | return; |
| 409 | } |
| 410 | |
| 411 | for (i = 0; i < ARRAY_SIZE(sde_kms->hw_vbif); i++) { |
| 412 | vbif = sde_kms->hw_vbif[i]; |
| 413 | if (vbif && vbif->cap && vbif->ops.set_mem_type) { |
| 414 | for (j = 0; j < vbif->cap->memtype_count; j++) |
| 415 | vbif->ops.set_mem_type( |
| 416 | vbif, j, vbif->cap->memtype[j]); |
| 417 | } |
| 418 | } |
| 419 | } |
| 420 | |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 421 | #ifdef CONFIG_DEBUG_FS |
| 422 | void sde_debugfs_vbif_destroy(struct sde_kms *sde_kms) |
| 423 | { |
| 424 | debugfs_remove_recursive(sde_kms->debugfs_vbif); |
| 425 | sde_kms->debugfs_vbif = NULL; |
| 426 | } |
| 427 | |
| 428 | int sde_debugfs_vbif_init(struct sde_kms *sde_kms, struct dentry *debugfs_root) |
| 429 | { |
| 430 | char vbif_name[32]; |
| 431 | struct dentry *debugfs_vbif; |
| 432 | int i, j; |
| 433 | |
Lloyd Atkinson | b020e0f | 2017-03-14 08:05:18 -0700 | [diff] [blame] | 434 | sde_kms->debugfs_vbif = debugfs_create_dir("vbif", debugfs_root); |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 435 | if (!sde_kms->debugfs_vbif) { |
| 436 | SDE_ERROR("failed to create vbif debugfs\n"); |
| 437 | return -EINVAL; |
| 438 | } |
| 439 | |
| 440 | for (i = 0; i < sde_kms->catalog->vbif_count; i++) { |
| 441 | struct sde_vbif_cfg *vbif = &sde_kms->catalog->vbif[i]; |
| 442 | |
| 443 | snprintf(vbif_name, sizeof(vbif_name), "%d", vbif->id); |
| 444 | |
| 445 | debugfs_vbif = debugfs_create_dir(vbif_name, |
| 446 | sde_kms->debugfs_vbif); |
| 447 | |
Lloyd Atkinson | 8de415a | 2017-05-23 11:31:16 -0400 | [diff] [blame] | 448 | debugfs_create_u32("features", 0600, debugfs_vbif, |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 449 | (u32 *)&vbif->features); |
| 450 | |
Lloyd Atkinson | 8de415a | 2017-05-23 11:31:16 -0400 | [diff] [blame] | 451 | debugfs_create_u32("xin_halt_timeout", 0400, debugfs_vbif, |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 452 | (u32 *)&vbif->xin_halt_timeout); |
| 453 | |
Lloyd Atkinson | 8de415a | 2017-05-23 11:31:16 -0400 | [diff] [blame] | 454 | debugfs_create_u32("default_rd_ot_limit", 0400, debugfs_vbif, |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 455 | (u32 *)&vbif->default_ot_rd_limit); |
| 456 | |
Lloyd Atkinson | 8de415a | 2017-05-23 11:31:16 -0400 | [diff] [blame] | 457 | debugfs_create_u32("default_wr_ot_limit", 0400, debugfs_vbif, |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 458 | (u32 *)&vbif->default_ot_wr_limit); |
| 459 | |
| 460 | for (j = 0; j < vbif->dynamic_ot_rd_tbl.count; j++) { |
| 461 | struct sde_vbif_dynamic_ot_cfg *cfg = |
| 462 | &vbif->dynamic_ot_rd_tbl.cfg[j]; |
| 463 | |
| 464 | snprintf(vbif_name, sizeof(vbif_name), |
| 465 | "dynamic_ot_rd_%d_pps", j); |
Lloyd Atkinson | 8de415a | 2017-05-23 11:31:16 -0400 | [diff] [blame] | 466 | debugfs_create_u64(vbif_name, 0400, debugfs_vbif, |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 467 | (u64 *)&cfg->pps); |
| 468 | snprintf(vbif_name, sizeof(vbif_name), |
| 469 | "dynamic_ot_rd_%d_ot_limit", j); |
Lloyd Atkinson | 8de415a | 2017-05-23 11:31:16 -0400 | [diff] [blame] | 470 | debugfs_create_u32(vbif_name, 0400, debugfs_vbif, |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 471 | (u32 *)&cfg->ot_limit); |
| 472 | } |
| 473 | |
| 474 | for (j = 0; j < vbif->dynamic_ot_wr_tbl.count; j++) { |
| 475 | struct sde_vbif_dynamic_ot_cfg *cfg = |
| 476 | &vbif->dynamic_ot_wr_tbl.cfg[j]; |
| 477 | |
| 478 | snprintf(vbif_name, sizeof(vbif_name), |
| 479 | "dynamic_ot_wr_%d_pps", j); |
Lloyd Atkinson | 8de415a | 2017-05-23 11:31:16 -0400 | [diff] [blame] | 480 | debugfs_create_u64(vbif_name, 0400, debugfs_vbif, |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 481 | (u64 *)&cfg->pps); |
| 482 | snprintf(vbif_name, sizeof(vbif_name), |
| 483 | "dynamic_ot_wr_%d_ot_limit", j); |
Lloyd Atkinson | 8de415a | 2017-05-23 11:31:16 -0400 | [diff] [blame] | 484 | debugfs_create_u32(vbif_name, 0400, debugfs_vbif, |
Alan Kwong | 748e833d | 2016-10-26 12:34:48 -0400 | [diff] [blame] | 485 | (u32 *)&cfg->ot_limit); |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | return 0; |
| 490 | } |
| 491 | #endif |