summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk/clk_domain.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_domain.c')
-rw-r--r--drivers/gpu/nvgpu/clk/clk_domain.c69
1 files changed, 52 insertions, 17 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_domain.c b/drivers/gpu/nvgpu/clk/clk_domain.c
index f87530dc..fe3db5d6 100644
--- a/drivers/gpu/nvgpu/clk/clk_domain.c
+++ b/drivers/gpu/nvgpu/clk/clk_domain.c
@@ -422,14 +422,14 @@ static u32 clkdomainclkproglink_not_supported(struct gk20a *g,
422 return -EINVAL; 422 return -EINVAL;
423} 423}
424 424
425static u32 clkdomainvfsearch_stub( 425static int clkdomainvfsearch_stub(
426 struct gk20a *g, 426 struct gk20a *g,
427 struct clk_pmupstate *pclk, 427 struct clk_pmupstate *pclk,
428 struct clk_domain *pdomain, 428 struct clk_domain *pdomain,
429 u16 *clkmhz, 429 u16 *clkmhz,
430 u32 *voltuv, 430 u32 *voltuv,
431 u8 rail 431 u8 rail)
432) 432
433{ 433{
434 gk20a_dbg_info(""); 434 gk20a_dbg_info("");
435 return -EINVAL; 435 return -EINVAL;
@@ -441,8 +441,7 @@ static u32 clkdomaingetfpoints_stub(
441 struct clk_domain *pdomain, 441 struct clk_domain *pdomain,
442 u32 *pfpointscount, 442 u32 *pfpointscount,
443 u16 *pfreqpointsinmhz, 443 u16 *pfreqpointsinmhz,
444 u8 rail 444 u8 rail)
445)
446{ 445{
447 gk20a_dbg_info(""); 446 gk20a_dbg_info("");
448 return -EINVAL; 447 return -EINVAL;
@@ -556,17 +555,47 @@ static u32 clkdomainclkproglink_3x_prog(struct gk20a *g,
556 return status; 555 return status;
557} 556}
558 557
559static u32 clkdomainvfsearch 558static int clkdomaingetslaveclk(struct gk20a *g,
560( 559 struct clk_pmupstate *pclk,
561 struct gk20a *g, 560 struct clk_domain *pdomain,
562 struct clk_pmupstate *pclk, 561 u16 *pclkmhz,
563 struct clk_domain *pdomain, 562 u16 masterclkmhz)
564 u16 *pclkmhz,
565 u32 *pvoltuv,
566 u8 rail
567)
568{ 563{
569 u32 status = 0; 564 int status = 0;
565 struct clk_prog *pprog = NULL;
566 struct clk_prog_1x_master *pprog1xmaster = NULL;
567 u8 slaveidx;
568 struct clk_domain_3x_master *p3xmaster;
569
570 gk20a_dbg_info("");
571
572 if (pclkmhz == NULL)
573 return -EINVAL;
574
575 if (masterclkmhz == 0)
576 return -EINVAL;
577
578 slaveidx = BOARDOBJ_GET_IDX(pdomain);
579 p3xmaster = (struct clk_domain_3x_master *)
580 CLK_CLK_DOMAIN_GET(pclk,
581 ((struct clk_domain_3x_slave *)
582 pdomain)->master_idx);
583 pprog = CLK_CLK_PROG_GET(pclk, p3xmaster->super.clk_prog_idx_first);
584 pprog1xmaster = (struct clk_prog_1x_master *)pprog;
585
586 status = pprog1xmaster->getslaveclk(g, pclk, pprog1xmaster,
587 slaveidx, pclkmhz, masterclkmhz);
588 return status;
589}
590
591static int clkdomainvfsearch(struct gk20a *g,
592 struct clk_pmupstate *pclk,
593 struct clk_domain *pdomain,
594 u16 *pclkmhz,
595 u32 *pvoltuv,
596 u8 rail)
597{
598 int status = 0;
570 struct clk_domain_3x_master *p3xmaster = 599 struct clk_domain_3x_master *p3xmaster =
571 (struct clk_domain_3x_master *)pdomain; 600 (struct clk_domain_3x_master *)pdomain;
572 struct clk_prog *pprog = NULL; 601 struct clk_prog *pprog = NULL;
@@ -580,6 +609,10 @@ static u32 clkdomainvfsearch
580 u32 bestvoltuv; 609 u32 bestvoltuv;
581 610
582 gk20a_dbg_info(""); 611 gk20a_dbg_info("");
612
613 if ((pclkmhz == NULL) || (pvoltuv == NULL))
614 return -EINVAL;
615
583 if ((*pclkmhz != 0) && (*pvoltuv != 0)) 616 if ((*pclkmhz != 0) && (*pvoltuv != 0))
584 return -EINVAL; 617 return -EINVAL;
585 618
@@ -595,7 +628,6 @@ static u32 clkdomainvfsearch
595 ((struct clk_domain_3x_slave *) 628 ((struct clk_domain_3x_slave *)
596 pdomain)->master_idx); 629 pdomain)->master_idx);
597 } 630 }
598
599 /* Iterate over the set of CLK_PROGs pointed at by this domain.*/ 631 /* Iterate over the set of CLK_PROGs pointed at by this domain.*/
600 for (i = p3xmaster->super.clk_prog_idx_first; 632 for (i = p3xmaster->super.clk_prog_idx_first;
601 i <= p3xmaster->super.clk_prog_idx_last; 633 i <= p3xmaster->super.clk_prog_idx_last;
@@ -625,7 +657,7 @@ static u32 clkdomainvfsearch
625 } 657 }
626 } 658 }
627 } 659 }
628 /* clk and volt sent as zero to pring vf table */ 660 /* clk and volt sent as zero to print vf table */
629 if ((*pclkmhz == 0) && (*pvoltuv == 0)) { 661 if ((*pclkmhz == 0) && (*pvoltuv == 0)) {
630 status = 0; 662 status = 0;
631 goto done; 663 goto done;
@@ -836,6 +868,9 @@ static u32 clk_domain_construct_3x_slave(struct gk20a *g,
836 868
837 pdomain->master_idx = ptmpdomain->master_idx; 869 pdomain->master_idx = ptmpdomain->master_idx;
838 870
871 pdomain->clkdomainclkgetslaveclk =
872 clkdomaingetslaveclk;
873
839 return status; 874 return status;
840} 875}
841 876