summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/boardobj/boardobjgrp.c
diff options
context:
space:
mode:
authorLakshmanan M <lm@nvidia.com>2016-09-08 13:20:59 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2016-10-27 05:50:54 -0400
commit315d8c6caa3a149b83c9894e94da852a50310c2d (patch)
treedac221b8c28e6eac255df34336c252d92c88a6a4 /drivers/gpu/nvgpu/boardobj/boardobjgrp.c
parentbc9df802feaeff0b1d7d1a2fc964267ebd10058d (diff)
gpu: nvgpu: Add pmgr support
This CL covers the following implementation, 1) Power Sensor Table parsing. 2) Power Topology Table parsing. 3) Add debugfs interface to get the current power(mW), current(mA) and voltage(uV) information from PMU. 4) Power Policy Table Parsing 5) Implement PMU boardobj interface for pmgr module. 6) Over current protection. JIRA DNVGPU-47 Change-Id: I620f4470aa704f1cc920e03947831440fbb0eb05 Signed-off-by: Lakshmanan M <lm@nvidia.com> Reviewed-on: http://git-master/r/1217176 (cherry picked from commit ed56743c2ac8dc325c75f85a82271d2d5ed8d96a) Reviewed-on: http://git-master/r/1241952 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/boardobj/boardobjgrp.c')
-rw-r--r--drivers/gpu/nvgpu/boardobj/boardobjgrp.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/boardobj/boardobjgrp.c b/drivers/gpu/nvgpu/boardobj/boardobjgrp.c
index 577acda3..43928ac1 100644
--- a/drivers/gpu/nvgpu/boardobj/boardobjgrp.c
+++ b/drivers/gpu/nvgpu/boardobj/boardobjgrp.c
@@ -254,6 +254,58 @@ static u32 boardobjgrp_pmustatusinstget_stub(struct gk20a *g,
254 return -EINVAL; 254 return -EINVAL;
255} 255}
256 256
257u32 boardobjgrp_pmudatainit_legacy(struct gk20a *g,
258 struct boardobjgrp *pboardobjgrp,
259 struct nv_pmu_boardobjgrp_super *pboardobjgrppmu)
260{
261 u32 status = 0;
262 struct boardobj *pboardobj = NULL;
263 struct nv_pmu_boardobj *ppmudata = NULL;
264 u8 index;
265
266 gk20a_dbg_info("");
267
268 if (pboardobjgrp == NULL)
269 return -EINVAL;
270 if (pboardobjgrppmu == NULL)
271 return -EINVAL;
272
273 boardobjgrpe32hdrset((struct nv_pmu_boardobjgrp *)pboardobjgrppmu,
274 pboardobjgrp->objmask);
275
276 BOARDOBJGRP_FOR_EACH_INDEX_IN_MASK(32, index, pboardobjgrp->objmask) {
277 /* Obtain pointer to the current instance of the Object from the Group */
278 pboardobj = pboardobjgrp->objgetbyidx(pboardobjgrp, index);
279 if (NULL == pboardobj) {
280 gk20a_err(dev_from_gk20a(g),
281 "could not get object instance");
282 status = -EINVAL;
283 goto boardobjgrppmudatainit_legacy_done;
284 }
285
286 status = pboardobjgrp->pmudatainstget(g,
287 (struct nv_pmu_boardobjgrp *)pboardobjgrppmu,
288 &ppmudata, index);
289 if (status) {
290 gk20a_err(dev_from_gk20a(g),
291 "could not get object instance");
292 goto boardobjgrppmudatainit_legacy_done;
293 }
294
295 /* Initialize the PMU Data */
296 status = pboardobj->pmudatainit(g, pboardobj, ppmudata);
297 if (status) {
298 gk20a_err(dev_from_gk20a(g),
299 "could not parse pmu for device %d", index);
300 goto boardobjgrppmudatainit_legacy_done;
301 }
302 }
303 BOARDOBJGRP_FOR_EACH_INDEX_IN_MASK_END
304
305boardobjgrppmudatainit_legacy_done:
306 gk20a_dbg_info(" Done");
307 return status;
308}
257 309
258u32 boardobjgrp_pmudatainit_super(struct gk20a *g, struct boardobjgrp 310u32 boardobjgrp_pmudatainit_super(struct gk20a *g, struct boardobjgrp
259 *pboardobjgrp, struct nv_pmu_boardobjgrp_super *pboardobjgrppmu) 311 *pboardobjgrp, struct nv_pmu_boardobjgrp_super *pboardobjgrppmu)