diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-05-22 02:49:38 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-05-24 07:55:53 -0400 |
commit | c32aa0170d258f6db5252cc319a58b626bd8f7e0 (patch) | |
tree | 54a643057c5e87c492630af172b3cccb21e1116c /drivers/gpu/nvgpu/tegra | |
parent | ec964208c14e29ea46ea22f44a3ae718f36e17fa (diff) |
gpu: nvgpu: remove clk_common.c
clk/clk_common.c includes some linux specific clock
calls which can be easily replaced
Move linux specific call to platform file
Rest of the APIs are removed by directly substituting
API code into caller function
Jira NVGPU-49
Change-Id: Ia70e7a65c877649699b5d064683c34c0cb696d2e
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1483862
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/tegra')
-rw-r--r-- | drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c index d6e448d8..a3b73cdf 100644 --- a/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/tegra/linux/platform_gk20a_tegra.c | |||
@@ -754,6 +754,27 @@ void gk20a_tegra_init_secure_alloc(struct gk20a *g) | |||
754 | } | 754 | } |
755 | 755 | ||
756 | #ifdef CONFIG_COMMON_CLK | 756 | #ifdef CONFIG_COMMON_CLK |
757 | static struct clk *gk20a_clk_get(struct gk20a *g) | ||
758 | { | ||
759 | if (!g->clk.tegra_clk) { | ||
760 | struct clk *clk; | ||
761 | char clk_dev_id[32]; | ||
762 | struct device *dev = dev_from_gk20a(g); | ||
763 | |||
764 | snprintf(clk_dev_id, 32, "tegra_%s", dev_name(dev)); | ||
765 | |||
766 | clk = clk_get_sys(clk_dev_id, "gpu"); | ||
767 | if (IS_ERR(clk)) { | ||
768 | nvgpu_err(g, "fail to get tegra gpu clk %s/gpu\n", | ||
769 | clk_dev_id); | ||
770 | return NULL; | ||
771 | } | ||
772 | g->clk.tegra_clk = clk; | ||
773 | } | ||
774 | |||
775 | return g->clk.tegra_clk; | ||
776 | } | ||
777 | |||
757 | static int gm20b_clk_prepare_ops(struct clk_hw *hw) | 778 | static int gm20b_clk_prepare_ops(struct clk_hw *hw) |
758 | { | 779 | { |
759 | struct clk_gk20a *clk = to_clk_gk20a(hw); | 780 | struct clk_gk20a *clk = to_clk_gk20a(hw); |
@@ -809,6 +830,10 @@ static int gm20b_register_gpcclk(struct gk20a *g) | |||
809 | struct clk *c; | 830 | struct clk *c; |
810 | int err = 0; | 831 | int err = 0; |
811 | 832 | ||
833 | /* make sure the clock is available */ | ||
834 | if (!gk20a_clk_get(g)) | ||
835 | return -ENOSYS; | ||
836 | |||
812 | err = gm20b_init_clk_setup_sw(g); | 837 | err = gm20b_init_clk_setup_sw(g); |
813 | if (err) | 838 | if (err) |
814 | return err; | 839 | return err; |
@@ -958,7 +983,11 @@ static long gk20a_round_clk_rate(struct device *dev, unsigned long rate) | |||
958 | struct gk20a_platform *platform = gk20a_get_platform(dev); | 983 | struct gk20a_platform *platform = gk20a_get_platform(dev); |
959 | struct gk20a *g = platform->g; | 984 | struct gk20a *g = platform->g; |
960 | 985 | ||
961 | return gk20a_clk_round_rate(g, rate); | 986 | /* make sure the clock is available */ |
987 | if (!gk20a_clk_get(g)) | ||
988 | return rate; | ||
989 | |||
990 | return clk_round_rate(clk_get_parent(g->clk.tegra_clk), rate); | ||
962 | } | 991 | } |
963 | 992 | ||
964 | static int gk20a_clk_get_freqs(struct device *dev, | 993 | static int gk20a_clk_get_freqs(struct device *dev, |