summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/pmu_perf/vfe_equ.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/pmu_perf/vfe_equ.c')
-rw-r--r--drivers/gpu/nvgpu/pmu_perf/vfe_equ.c607
1 files changed, 607 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/pmu_perf/vfe_equ.c b/drivers/gpu/nvgpu/pmu_perf/vfe_equ.c
new file mode 100644
index 00000000..5b479d7d
--- /dev/null
+++ b/drivers/gpu/nvgpu/pmu_perf/vfe_equ.c
@@ -0,0 +1,607 @@
1/*
2 * Copyright (c) 2016-2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23#include <nvgpu/bios.h>
24#include <nvgpu/gk20a.h>
25
26#include "pmu_perf.h"
27#include "vfe_equ.h"
28#include "boardobj/boardobjgrp.h"
29#include "boardobj/boardobjgrp_e255.h"
30#include "ctrl/ctrlclk.h"
31#include "ctrl/ctrlvolt.h"
32
33static struct vfe_equ *construct_vfe_equ(struct gk20a *g, void *pargs);
34static int devinit_get_vfe_equ_table(struct gk20a *g,
35 struct vfe_equs *pequobjs);
36
37static int _vfe_equs_pmudatainit(struct gk20a *g,
38 struct boardobjgrp *pboardobjgrp,
39 struct nv_pmu_boardobjgrp_super *pboardobjgrppmu)
40{
41 int status = 0;
42
43 status = boardobjgrp_pmudatainit_e255(g, pboardobjgrp, pboardobjgrppmu);
44 if (status) {
45 nvgpu_err(g, "error updating pmu boardobjgrp for vfe equ 0x%x",
46 status);
47 goto done;
48 }
49
50done:
51 return status;
52}
53
54static int _vfe_equs_pmudata_instget(struct gk20a *g,
55 struct nv_pmu_boardobjgrp *pmuboardobjgrp,
56 struct nv_pmu_boardobj **ppboardobjpmudata,
57 u8 idx)
58{
59 struct nv_pmu_perf_vfe_equ_boardobj_grp_set *pgrp_set =
60 (struct nv_pmu_perf_vfe_equ_boardobj_grp_set *)pmuboardobjgrp;
61
62 nvgpu_log_info(g, " ");
63
64 /* check whether pmuboardobjgrp has a valid boardobj in index */
65 if (idx >= CTRL_BOARDOBJGRP_E255_MAX_OBJECTS) {
66 return -EINVAL;
67 }
68
69 *ppboardobjpmudata = (struct nv_pmu_boardobj *)
70 &pgrp_set->objects[idx].data.board_obj;
71 nvgpu_log_info(g, " Done");
72 return 0;
73}
74
75int vfe_equ_sw_setup(struct gk20a *g)
76{
77 int status;
78 struct boardobjgrp *pboardobjgrp = NULL;
79 struct vfe_equs *pvfeequobjs;
80
81 nvgpu_log_info(g, " ");
82
83 status = boardobjgrpconstruct_e255(g, &g->perf_pmu.vfe_equobjs.super);
84 if (status) {
85 nvgpu_err(g,
86 "error creating boardobjgrp for clk domain, status - 0x%x",
87 status);
88 goto done;
89 }
90
91 pboardobjgrp = &g->perf_pmu.vfe_equobjs.super.super;
92 pvfeequobjs = &(g->perf_pmu.vfe_equobjs);
93
94 BOARDOBJGRP_PMU_CONSTRUCT(pboardobjgrp, PERF, VFE_EQU);
95
96 status = BOARDOBJGRP_PMU_CMD_GRP_SET_CONSTRUCT(g, pboardobjgrp,
97 perf, PERF, vfe_equ, VFE_EQU);
98 if (status) {
99 nvgpu_err(g,
100 "error constructing PMU_BOARDOBJ_CMD_GRP_SET interface - 0x%x",
101 status);
102 goto done;
103 }
104
105 pboardobjgrp->pmudatainit = _vfe_equs_pmudatainit;
106 pboardobjgrp->pmudatainstget = _vfe_equs_pmudata_instget;
107
108 status = devinit_get_vfe_equ_table(g, pvfeequobjs);
109 if (status) {
110 goto done;
111 }
112
113done:
114 nvgpu_log_info(g, " done status %x", status);
115 return status;
116}
117
118int vfe_equ_pmu_setup(struct gk20a *g)
119{
120 int status;
121 struct boardobjgrp *pboardobjgrp = NULL;
122
123 nvgpu_log_info(g, " ");
124
125 pboardobjgrp = &g->perf_pmu.vfe_equobjs.super.super;
126
127 if (!pboardobjgrp->bconstructed) {
128 return -EINVAL;
129 }
130
131 status = pboardobjgrp->pmuinithandle(g, pboardobjgrp);
132
133 nvgpu_log_info(g, "Done");
134 return status;
135}
136
137static int devinit_get_vfe_equ_table(struct gk20a *g,
138 struct vfe_equs *pvfeequobjs)
139{
140 int status = 0;
141 u8 *vfeequs_tbl_ptr = NULL;
142 struct vbios_vfe_3x_header_struct vfeequs_tbl_header = { 0 };
143 struct vbios_vfe_3x_equ_entry_struct equ = { 0 };
144 u8 *vfeequs_tbl_entry_ptr = NULL;
145 u8 *rd_offset_ptr = NULL;
146 u32 index = 0;
147 struct vfe_equ *pequ;
148 u8 equ_type = 0;
149 u32 szfmt;
150 union {
151 struct boardobj board_obj;
152 struct vfe_equ super;
153 struct vfe_equ_compare compare;
154 struct vfe_equ_minmax minmax;
155 struct vfe_equ_quadratic quadratic;
156 } equ_data;
157
158 nvgpu_log_info(g, " ");
159
160 vfeequs_tbl_ptr = (u8 *)nvgpu_bios_get_perf_table_ptrs(g,
161 g->bios.perf_token,
162 CONTINUOUS_VIRTUAL_BINNING_TABLE);
163
164 if (vfeequs_tbl_ptr == NULL) {
165 status = -EINVAL;
166 goto done;
167 }
168
169 memcpy(&vfeequs_tbl_header, vfeequs_tbl_ptr,
170 VBIOS_CLOCKS_TABLE_1X_HEADER_SIZE_07);
171 if (vfeequs_tbl_header.header_size != VBIOS_CLOCKS_TABLE_1X_HEADER_SIZE_07) {
172 status = -EINVAL;
173 goto done;
174 }
175
176 if (vfeequs_tbl_header.vfe_equ_entry_size ==
177 VBIOS_VFE_3X_EQU_ENTRY_SIZE_17) {
178 szfmt = VBIOS_VFE_3X_EQU_ENTRY_SIZE_17;
179 } else if (vfeequs_tbl_header.vfe_equ_entry_size ==
180 VBIOS_VFE_3X_EQU_ENTRY_SIZE_18) {
181 szfmt = VBIOS_VFE_3X_EQU_ENTRY_SIZE_18;
182 } else {
183 status = -EINVAL;
184 goto done;
185 }
186
187 vfeequs_tbl_entry_ptr = vfeequs_tbl_ptr +
188 vfeequs_tbl_header.header_size +
189 (vfeequs_tbl_header.vfe_var_entry_count *
190 vfeequs_tbl_header.vfe_var_entry_size);
191
192 for (index = 0;
193 index < vfeequs_tbl_header.vfe_equ_entry_count;
194 index++) {
195 memset(&equ, 0, sizeof(struct vbios_vfe_3x_equ_entry_struct));
196
197 rd_offset_ptr = vfeequs_tbl_entry_ptr +
198 (index * vfeequs_tbl_header.vfe_equ_entry_size);
199
200 memcpy(&equ, rd_offset_ptr, szfmt);
201
202 equ_data.super.var_idx = (u8)equ.var_idx;
203 equ_data.super.equ_idx_next =
204 (equ.equ_idx_next == VBIOS_VFE_3X_EQU_ENTRY_IDX_INVALID) ?
205 CTRL_BOARDOBJ_IDX_INVALID : (u8)equ.equ_idx_next;
206 equ_data.super.out_range_min = equ.out_range_min;
207 equ_data.super.out_range_max = equ.out_range_max;
208
209 switch (BIOS_GET_FIELD(equ.param3, VBIOS_VFE_3X_EQU_ENTRY_PAR3_OUTPUT_TYPE)) {
210 case VBIOS_VFE_3X_EQU_ENTRY_PAR3_OUTPUT_TYPE_UNITLESS:
211 equ_data.super.output_type =
212 CTRL_PERF_VFE_EQU_OUTPUT_TYPE_UNITLESS;
213 break;
214
215 case VBIOS_VFE_3X_EQU_ENTRY_PAR3_OUTPUT_TYPE_FREQ_MHZ:
216 equ_data.super.output_type =
217 CTRL_PERF_VFE_EQU_OUTPUT_TYPE_FREQ_MHZ;
218 break;
219
220 case VBIOS_VFE_3X_EQU_ENTRY_PAR3_OUTPUT_TYPE_VOLT_UV:
221 equ_data.super.output_type =
222 CTRL_PERF_VFE_EQU_OUTPUT_TYPE_VOLT_UV;
223 break;
224
225 case VBIOS_VFE_3X_EQU_ENTRY_PAR3_OUTPUT_TYPE_VF_GAIN:
226 equ_data.super.output_type =
227 CTRL_PERF_VFE_EQU_OUTPUT_TYPE_VF_GAIN;
228 break;
229
230 case VBIOS_VFE_3X_EQU_ENTRY_PAR3_OUTPUT_TYPE_VOLT_DELTA_UV:
231 equ_data.super.output_type =
232 CTRL_PERF_VFE_EQU_OUTPUT_TYPE_VOLT_DELTA_UV;
233 break;
234
235 default:
236 nvgpu_err(g, "unrecognized output id @vfeequ index %d",
237 index);
238 goto done;
239 }
240
241 switch ((u8)equ.type) {
242 case VBIOS_VFE_3X_EQU_ENTRY_TYPE_DISABLED:
243 case VBIOS_VFE_3X_EQU_ENTRY_TYPE_QUADRATIC_FXP:
244 case VBIOS_VFE_3X_EQU_ENTRY_TYPE_MINMAX_FXP:
245 continue;
246 break;
247
248 case VBIOS_VFE_3X_EQU_ENTRY_TYPE_QUADRATIC:
249 equ_type = CTRL_PERF_VFE_EQU_TYPE_QUADRATIC;
250 equ_data.quadratic.coeffs[0] = equ.param0;
251 equ_data.quadratic.coeffs[1] = equ.param1;
252 equ_data.quadratic.coeffs[2] = equ.param2;
253 break;
254
255 case VBIOS_VFE_3X_EQU_ENTRY_TYPE_MINMAX:
256 equ_type = CTRL_PERF_VFE_EQU_TYPE_MINMAX;
257 equ_data.minmax.b_max = BIOS_GET_FIELD(equ.param0,
258 VBIOS_VFE_3X_EQU_ENTRY_PAR0_MINMAX_CRIT) &&
259 VBIOS_VFE_3X_EQU_ENTRY_PAR0_MINMAX_CRIT_MAX;
260 equ_data.minmax.equ_idx0 = (u8)BIOS_GET_FIELD(
261 equ.param0,
262 VBIOS_VFE_3X_EQU_ENTRY_PAR0_MINMAX_VFE_EQU_IDX_0);
263 equ_data.minmax.equ_idx1 = (u8)BIOS_GET_FIELD(
264 equ.param0,
265 VBIOS_VFE_3X_EQU_ENTRY_PAR0_MINMAX_VFE_EQU_IDX_1);
266 break;
267
268 case VBIOS_VFE_3X_EQU_ENTRY_TYPE_COMPARE:
269 {
270 u8 cmp_func = (u8)BIOS_GET_FIELD(
271 equ.param1,
272 VBIOS_VFE_3X_EQU_ENTRY_PAR1_COMPARE_FUNCTION);
273 equ_type = CTRL_PERF_VFE_EQU_TYPE_COMPARE;
274
275 switch (cmp_func) {
276 case VBIOS_VFE_3X_EQU_ENTRY_PAR1_COMPARE_FUNCTION_EQUAL:
277 equ_data.compare.func_id =
278 CTRL_PERF_VFE_EQU_COMPARE_FUNCTION_EQUAL;
279 break;
280
281 case VBIOS_VFE_3X_EQU_ENTRY_PAR1_COMPARE_FUNCTION_GREATER_EQ:
282 equ_data.compare.func_id =
283 CTRL_PERF_VFE_EQU_COMPARE_FUNCTION_GREATER_EQ;
284 break;
285 case VBIOS_VFE_3X_EQU_ENTRY_PAR1_COMPARE_FUNCTION_GREATER:
286 equ_data.compare.func_id =
287 CTRL_PERF_VFE_EQU_COMPARE_FUNCTION_GREATER;
288 break;
289 default:
290 nvgpu_err(g,
291 "invalid vfe compare index %x type %x ",
292 index, cmp_func);
293 status = -EINVAL;
294 goto done;
295 }
296 equ_data.compare.equ_idx_true = (u8)BIOS_GET_FIELD(
297 equ.param1,
298 VBIOS_VFE_3X_EQU_ENTRY_PAR1_COMPARE_VFE_EQU_IDX_TRUE);
299 equ_data.compare.equ_idx_false = (u8)BIOS_GET_FIELD(
300 equ.param1,
301 VBIOS_VFE_3X_EQU_ENTRY_PAR1_COMPARE_VFE_EQU_IDX_FALSE);
302 equ_data.compare.criteria = equ.param0;
303 break;
304 }
305 default:
306 status = -EINVAL;
307 nvgpu_err(g, "Invalid equ[%d].type = 0x%x.",
308 index, (u8)equ.type);
309 goto done;
310 }
311
312 equ_data.board_obj.type = equ_type;
313 pequ = construct_vfe_equ(g, (void *)&equ_data);
314
315 if (pequ == NULL) {
316 nvgpu_err(g,
317 "error constructing vfe_equ boardobj %d", index);
318 status = -EINVAL;
319 goto done;
320 }
321
322 status = boardobjgrp_objinsert(&pvfeequobjs->super.super,
323 (struct boardobj *)pequ, index);
324 if (status) {
325 nvgpu_err(g, "error adding vfe_equ boardobj %d", index);
326 status = -EINVAL;
327 goto done;
328 }
329 }
330done:
331 nvgpu_log_info(g, " done status %x", status);
332 return status;
333}
334
335static int _vfe_equ_pmudatainit_super(struct gk20a *g,
336 struct boardobj *board_obj_ptr,
337 struct nv_pmu_boardobj *ppmudata)
338{
339 u32 status = 0;
340 struct vfe_equ *pvfe_equ;
341 struct nv_pmu_vfe_equ *pset;
342
343 nvgpu_log_info(g, " ");
344
345 status = boardobj_pmudatainit_super(g, board_obj_ptr, ppmudata);
346 if (status != 0) {
347 return status;
348 }
349
350 pvfe_equ = (struct vfe_equ *)board_obj_ptr;
351
352 pset = (struct nv_pmu_vfe_equ *)
353 ppmudata;
354
355 pset->var_idx = pvfe_equ->var_idx;
356 pset->equ_idx_next = pvfe_equ->equ_idx_next;
357 pset->output_type = pvfe_equ->output_type;
358 pset->out_range_min = pvfe_equ->out_range_min;
359 pset->out_range_max = pvfe_equ->out_range_max;
360
361 return status;
362}
363
364static int vfe_equ_construct_super(struct gk20a *g,
365 struct boardobj **ppboardobj,
366 u16 size, void *pargs)
367{
368 struct vfe_equ *pvfeequ;
369 struct vfe_equ *ptmpequ = (struct vfe_equ *)pargs;
370 int status = 0;
371
372 status = boardobj_construct_super(g, ppboardobj,
373 size, pargs);
374 if (status) {
375 return -EINVAL;
376 }
377
378 pvfeequ = (struct vfe_equ *)*ppboardobj;
379
380 pvfeequ->super.pmudatainit =
381 _vfe_equ_pmudatainit_super;
382
383 pvfeequ->var_idx = ptmpequ->var_idx;
384 pvfeequ->equ_idx_next = ptmpequ->equ_idx_next;
385 pvfeequ->output_type = ptmpequ->output_type;
386 pvfeequ->out_range_min = ptmpequ->out_range_min;
387 pvfeequ->out_range_max = ptmpequ->out_range_max;
388
389 return status;
390}
391
392static int _vfe_equ_pmudatainit_compare(struct gk20a *g,
393 struct boardobj *board_obj_ptr,
394 struct nv_pmu_boardobj *ppmudata)
395{
396 int status = 0;
397 struct vfe_equ_compare *pvfe_equ_compare;
398 struct nv_pmu_vfe_equ_compare *pset;
399
400 nvgpu_log_info(g, " ");
401
402 status = _vfe_equ_pmudatainit_super(g, board_obj_ptr, ppmudata);
403 if (status != 0) {
404 return status;
405 }
406
407 pvfe_equ_compare = (struct vfe_equ_compare *)board_obj_ptr;
408
409 pset = (struct nv_pmu_vfe_equ_compare *) ppmudata;
410
411 pset->func_id = pvfe_equ_compare->func_id;
412 pset->equ_idx_true = pvfe_equ_compare->equ_idx_true;
413 pset->equ_idx_false = pvfe_equ_compare->equ_idx_false;
414 pset->criteria = pvfe_equ_compare->criteria;
415
416 return status;
417}
418
419
420static int vfe_equ_construct_compare(struct gk20a *g,
421 struct boardobj **ppboardobj,
422 u16 size, void *pargs)
423{
424 struct boardobj *ptmpobj = (struct boardobj *)pargs;
425 struct vfe_equ_compare *pvfeequ;
426 struct vfe_equ_compare *ptmpequ =
427 (struct vfe_equ_compare *)pargs;
428 int status = 0;
429
430 if (BOARDOBJ_GET_TYPE(pargs) != CTRL_PERF_VFE_EQU_TYPE_COMPARE) {
431 return -EINVAL;
432 }
433
434 ptmpobj->type_mask |= BIT(CTRL_PERF_VFE_EQU_TYPE_COMPARE);
435 status = vfe_equ_construct_super(g, ppboardobj, size, pargs);
436 if (status) {
437 return -EINVAL;
438 }
439
440 pvfeequ = (struct vfe_equ_compare *)*ppboardobj;
441
442 pvfeequ->super.super.pmudatainit =
443 _vfe_equ_pmudatainit_compare;
444
445 pvfeequ->func_id = ptmpequ->func_id;
446 pvfeequ->equ_idx_true = ptmpequ->equ_idx_true;
447 pvfeequ->equ_idx_false = ptmpequ->equ_idx_false;
448 pvfeequ->criteria = ptmpequ->criteria;
449
450
451 return status;
452}
453
454static int _vfe_equ_pmudatainit_minmax(struct gk20a *g,
455 struct boardobj *board_obj_ptr,
456 struct nv_pmu_boardobj *ppmudata)
457{
458 int status = 0;
459 struct vfe_equ_minmax *pvfe_equ_minmax;
460 struct nv_pmu_vfe_equ_minmax *pset;
461
462 nvgpu_log_info(g, " ");
463
464 status = _vfe_equ_pmudatainit_super(g, board_obj_ptr, ppmudata);
465 if (status != 0) {
466 return status;
467 }
468
469 pvfe_equ_minmax = (struct vfe_equ_minmax *)board_obj_ptr;
470
471 pset = (struct nv_pmu_vfe_equ_minmax *)
472 ppmudata;
473
474 pset->b_max = pvfe_equ_minmax->b_max;
475 pset->equ_idx0 = pvfe_equ_minmax->equ_idx0;
476 pset->equ_idx1 = pvfe_equ_minmax->equ_idx1;
477
478 return status;
479}
480
481static int vfe_equ_construct_minmax(struct gk20a *g,
482 struct boardobj **ppboardobj,
483 u16 size, void *pargs)
484{
485 struct boardobj *ptmpobj = (struct boardobj *)pargs;
486 struct vfe_equ_minmax *pvfeequ;
487 struct vfe_equ_minmax *ptmpequ =
488 (struct vfe_equ_minmax *)pargs;
489 int status = 0;
490
491 if (BOARDOBJ_GET_TYPE(pargs) != CTRL_PERF_VFE_EQU_TYPE_MINMAX) {
492 return -EINVAL;
493 }
494
495 ptmpobj->type_mask |= BIT(CTRL_PERF_VFE_EQU_TYPE_MINMAX);
496 status = vfe_equ_construct_super(g, ppboardobj, size, pargs);
497 if (status) {
498 return -EINVAL;
499 }
500
501 pvfeequ = (struct vfe_equ_minmax *)*ppboardobj;
502
503 pvfeequ->super.super.pmudatainit =
504 _vfe_equ_pmudatainit_minmax;
505 pvfeequ->b_max = ptmpequ->b_max;
506 pvfeequ->equ_idx0 = ptmpequ->equ_idx0;
507 pvfeequ->equ_idx1 = ptmpequ->equ_idx1;
508
509 return status;
510}
511
512static int _vfe_equ_pmudatainit_quadratic(struct gk20a *g,
513 struct boardobj *board_obj_ptr,
514 struct nv_pmu_boardobj *ppmudata)
515{
516 int status = 0;
517 struct vfe_equ_quadratic *pvfe_equ_quadratic;
518 struct nv_pmu_vfe_equ_quadratic *pset;
519 u32 i;
520
521 nvgpu_log_info(g, " ");
522
523 status = _vfe_equ_pmudatainit_super(g, board_obj_ptr, ppmudata);
524 if (status != 0) {
525 return status;
526 }
527
528 pvfe_equ_quadratic = (struct vfe_equ_quadratic *)board_obj_ptr;
529
530 pset = (struct nv_pmu_vfe_equ_quadratic *) ppmudata;
531
532 for (i = 0; i < CTRL_PERF_VFE_EQU_QUADRATIC_COEFF_COUNT; i++) {
533 pset->coeffs[i] = pvfe_equ_quadratic->coeffs[i];
534 }
535
536 return status;
537}
538
539static int vfe_equ_construct_quadratic(struct gk20a *g,
540 struct boardobj **ppboardobj,
541 u16 size, void *pargs)
542{
543 struct boardobj *ptmpobj = (struct boardobj *)pargs;
544 struct vfe_equ_quadratic *pvfeequ;
545 struct vfe_equ_quadratic *ptmpequ =
546 (struct vfe_equ_quadratic *)pargs;
547 int status = 0;
548 u32 i;
549
550 if (BOARDOBJ_GET_TYPE(pargs) != CTRL_PERF_VFE_EQU_TYPE_QUADRATIC) {
551 return -EINVAL;
552 }
553
554 ptmpobj->type_mask |= BIT(CTRL_PERF_VFE_EQU_TYPE_QUADRATIC);
555 status = vfe_equ_construct_super(g, ppboardobj, size, pargs);
556 if (status) {
557 return -EINVAL;
558 }
559
560 pvfeequ = (struct vfe_equ_quadratic *)*ppboardobj;
561
562 pvfeequ->super.super.pmudatainit =
563 _vfe_equ_pmudatainit_quadratic;
564
565 for (i = 0; i < CTRL_PERF_VFE_EQU_QUADRATIC_COEFF_COUNT; i++) {
566 pvfeequ->coeffs[i] = ptmpequ->coeffs[i];
567 }
568
569 return status;
570}
571
572static struct vfe_equ *construct_vfe_equ(struct gk20a *g, void *pargs)
573{
574 struct boardobj *board_obj_ptr = NULL;
575 int status;
576
577 nvgpu_log_info(g, " ");
578
579 switch (BOARDOBJ_GET_TYPE(pargs)) {
580 case CTRL_PERF_VFE_EQU_TYPE_COMPARE:
581 status = vfe_equ_construct_compare(g, &board_obj_ptr,
582 sizeof(struct vfe_equ_compare), pargs);
583 break;
584
585 case CTRL_PERF_VFE_EQU_TYPE_MINMAX:
586 status = vfe_equ_construct_minmax(g, &board_obj_ptr,
587 sizeof(struct vfe_equ_minmax), pargs);
588 break;
589
590 case CTRL_PERF_VFE_EQU_TYPE_QUADRATIC:
591 status = vfe_equ_construct_quadratic(g, &board_obj_ptr,
592 sizeof(struct vfe_equ_quadratic), pargs);
593 break;
594
595 default:
596 return NULL;
597
598 }
599
600 if (status) {
601 return NULL;
602 }
603
604 nvgpu_log_info(g, " Done");
605
606 return (struct vfe_equ *)board_obj_ptr;
607}