diff options
author | Vijayakumar <vsubbu@nvidia.com> | 2016-09-12 13:06:33 -0400 |
---|---|---|
committer | Deepak Nibade <dnibade@nvidia.com> | 2016-12-27 04:56:50 -0500 |
commit | 3c351f5bb2d04c1f70c72f3f2fd758bbb340877c (patch) | |
tree | cdaaf5547d6a2663111ba3dadb60d723f5833683 /drivers/gpu/nvgpu/clk/clk_domain.c | |
parent | 1b1090512020369df18dbe36336ac5a85d2cd693 (diff) |
gpu: nvgpu: add function to retrieve clk points
JIRA DNVGPU-123
Function will copy possible clock points for
a given master clock domain to pointer passed.
pointer with NULL value and count of zero can be passed
to query number of clock points for a given domain so that
memory can be allocated and function called again to
fill clock points
Change-Id: Iec6206f23789980036be99793599e934bd221035
Reviewed-on: http://git-master/r/1218912
(cherry picked from commit 9219697bff1e12deb605325055a02a7b387996e9)
Signed-off-by: Vijayakumar <vsubbu@nvidia.com>
Reviewed-on: http://git-master/r/1235055
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_domain.c')
-rw-r--r-- | drivers/gpu/nvgpu/clk/clk_domain.c | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_domain.c b/drivers/gpu/nvgpu/clk/clk_domain.c index c8da851a..f87530dc 100644 --- a/drivers/gpu/nvgpu/clk/clk_domain.c +++ b/drivers/gpu/nvgpu/clk/clk_domain.c | |||
@@ -435,6 +435,19 @@ static u32 clkdomainvfsearch_stub( | |||
435 | return -EINVAL; | 435 | return -EINVAL; |
436 | } | 436 | } |
437 | 437 | ||
438 | static u32 clkdomaingetfpoints_stub( | ||
439 | struct gk20a *g, | ||
440 | struct clk_pmupstate *pclk, | ||
441 | struct clk_domain *pdomain, | ||
442 | u32 *pfpointscount, | ||
443 | u16 *pfreqpointsinmhz, | ||
444 | u8 rail | ||
445 | ) | ||
446 | { | ||
447 | gk20a_dbg_info(""); | ||
448 | return -EINVAL; | ||
449 | } | ||
450 | |||
438 | 451 | ||
439 | static u32 clk_domain_construct_super(struct gk20a *g, | 452 | static u32 clk_domain_construct_super(struct gk20a *g, |
440 | struct boardobj **ppboardobj, | 453 | struct boardobj **ppboardobj, |
@@ -461,6 +474,9 @@ static u32 clk_domain_construct_super(struct gk20a *g, | |||
461 | pdomain->clkdomainclkvfsearch = | 474 | pdomain->clkdomainclkvfsearch = |
462 | clkdomainvfsearch_stub; | 475 | clkdomainvfsearch_stub; |
463 | 476 | ||
477 | pdomain->clkdomainclkgetfpoints = | ||
478 | clkdomaingetfpoints_stub; | ||
479 | |||
464 | pdomain->api_domain = ptmpdomain->api_domain; | 480 | pdomain->api_domain = ptmpdomain->api_domain; |
465 | pdomain->domain = ptmpdomain->domain; | 481 | pdomain->domain = ptmpdomain->domain; |
466 | pdomain->perf_domain_grp_idx = | 482 | pdomain->perf_domain_grp_idx = |
@@ -626,6 +642,70 @@ done: | |||
626 | return status; | 642 | return status; |
627 | } | 643 | } |
628 | 644 | ||
645 | static u32 clkdomaingetfpoints | ||
646 | ( | ||
647 | struct gk20a *g, | ||
648 | struct clk_pmupstate *pclk, | ||
649 | struct clk_domain *pdomain, | ||
650 | u32 *pfpointscount, | ||
651 | u16 *pfreqpointsinmhz, | ||
652 | u8 rail | ||
653 | ) | ||
654 | { | ||
655 | u32 status = 0; | ||
656 | struct clk_domain_3x_master *p3xmaster = | ||
657 | (struct clk_domain_3x_master *)pdomain; | ||
658 | struct clk_prog *pprog = NULL; | ||
659 | struct clk_prog_1x_master *pprog1xmaster = NULL; | ||
660 | u32 fpointscount = 0; | ||
661 | u32 remainingcount; | ||
662 | u32 totalcount; | ||
663 | u16 *freqpointsdata; | ||
664 | u8 i; | ||
665 | |||
666 | gk20a_dbg_info(""); | ||
667 | |||
668 | if (pfpointscount == NULL) | ||
669 | return -EINVAL; | ||
670 | |||
671 | if ((pfreqpointsinmhz == NULL) && (*pfpointscount != 0)) | ||
672 | return -EINVAL; | ||
673 | |||
674 | if (pdomain->super.implements(g, &pdomain->super, | ||
675 | CTRL_CLK_CLK_DOMAIN_TYPE_3X_SLAVE)) | ||
676 | return -EINVAL; | ||
677 | |||
678 | freqpointsdata = pfreqpointsinmhz; | ||
679 | totalcount = 0; | ||
680 | fpointscount = *pfpointscount; | ||
681 | remainingcount = fpointscount; | ||
682 | /* Iterate over the set of CLK_PROGs pointed at by this domain.*/ | ||
683 | for (i = p3xmaster->super.clk_prog_idx_first; | ||
684 | i <= p3xmaster->super.clk_prog_idx_last; | ||
685 | i++) { | ||
686 | pprog = CLK_CLK_PROG_GET(pclk, i); | ||
687 | pprog1xmaster = (struct clk_prog_1x_master *)pprog; | ||
688 | status = pprog1xmaster->getfpoints(g, pclk, pprog1xmaster, | ||
689 | &fpointscount, &freqpointsdata, rail); | ||
690 | if (status) { | ||
691 | *pfpointscount = 0; | ||
692 | goto done; | ||
693 | } | ||
694 | totalcount += fpointscount; | ||
695 | if (*pfpointscount) { | ||
696 | remainingcount -= fpointscount; | ||
697 | fpointscount = remainingcount; | ||
698 | } else | ||
699 | fpointscount = 0; | ||
700 | |||
701 | } | ||
702 | |||
703 | *pfpointscount = totalcount; | ||
704 | done: | ||
705 | gk20a_dbg_info("done status %x", status); | ||
706 | return status; | ||
707 | } | ||
708 | |||
629 | static u32 _clk_domain_pmudatainit_3x_prog(struct gk20a *g, | 709 | static u32 _clk_domain_pmudatainit_3x_prog(struct gk20a *g, |
630 | struct boardobj *board_obj_ptr, | 710 | struct boardobj *board_obj_ptr, |
631 | struct nv_pmu_boardobj *ppmudata) | 711 | struct nv_pmu_boardobj *ppmudata) |
@@ -689,6 +769,9 @@ static u32 clk_domain_construct_3x_prog(struct gk20a *g, | |||
689 | pdomain->super.super.clkdomainclkvfsearch = | 769 | pdomain->super.super.clkdomainclkvfsearch = |
690 | clkdomainvfsearch; | 770 | clkdomainvfsearch; |
691 | 771 | ||
772 | pdomain->super.super.clkdomainclkgetfpoints = | ||
773 | clkdomaingetfpoints; | ||
774 | |||
692 | pdomain->clk_prog_idx_first = ptmpdomain->clk_prog_idx_first; | 775 | pdomain->clk_prog_idx_first = ptmpdomain->clk_prog_idx_first; |
693 | pdomain->clk_prog_idx_last = ptmpdomain->clk_prog_idx_last; | 776 | pdomain->clk_prog_idx_last = ptmpdomain->clk_prog_idx_last; |
694 | pdomain->noise_unaware_ordering_index = | 777 | pdomain->noise_unaware_ordering_index = |