gpu: nvgpu: Use GPU device name in clock get operation

Used GPU device name in clock get operation (instead of fixed name),
to make operation is common for GK20A and GM20B. Updated clock ids
in tegra clock framework accordingly.

Bug 1450787

Change-Id: Ifd5b9c3a6fd8db5b06e6dcd989285e8410794803
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/441711
Reviewed-by: Bo Yan <byan@nvidia.com>
Tested-by: Bo Yan <byan@nvidia.com>
This commit is contained in:
Alex Frid
2014-07-24 00:04:05 -07:00
committed by Dan Willemsen
parent ea530792c4
commit 44b9d5fdb0
2 changed files with 8 additions and 6 deletions

View File

@@ -415,11 +415,15 @@ struct clk *gk20a_clk_get(struct gk20a *g)
{ {
if (!g->clk.tegra_clk) { if (!g->clk.tegra_clk) {
struct clk *clk; struct clk *clk;
char clk_dev_id[32];
struct device *dev = dev_from_gk20a(g);
clk = clk_get_sys("tegra_gk20a", "gpu"); snprintf(clk_dev_id, 32, "tegra_%s", dev_name(dev));
clk = clk_get_sys(clk_dev_id, "gpu");
if (IS_ERR(clk)) { if (IS_ERR(clk)) {
gk20a_err(dev_from_gk20a(g), gk20a_err(dev, "fail to get tegra gpu clk %s/gpu\n",
"fail to get tegra gpu clk tegra_gk20a/gpu"); clk_dev_id);
return NULL; return NULL;
} }
g->clk.tegra_clk = clk; g->clk.tegra_clk = clk;

View File

@@ -59,13 +59,11 @@ struct clk_gk20a {
bool debugfs_set; bool debugfs_set;
}; };
/* APIs used for separate HAL */
struct clk *gk20a_clk_get(struct gk20a *g);
/* APIs used for both GK20A and GM20B */ /* APIs used for both GK20A and GM20B */
unsigned long gk20a_clk_get_rate(struct gk20a *g); unsigned long gk20a_clk_get_rate(struct gk20a *g);
int gk20a_clk_set_rate(struct gk20a *g, unsigned long rate); int gk20a_clk_set_rate(struct gk20a *g, unsigned long rate);
long gk20a_clk_round_rate(struct gk20a *g, unsigned long rate); long gk20a_clk_round_rate(struct gk20a *g, unsigned long rate);
struct clk *gk20a_clk_get(struct gk20a *g);
#define KHZ 1000 #define KHZ 1000
#define MHZ 1000000 #define MHZ 1000000