Commit fc12262b authored by Thierry Reding's avatar Thierry Reding Committed by Ben Skeggs

drm/nouveau/tegra: Set clock rate if not set

If the GPU clock has not had a rate set, initialize it to the maximum
clock rate to make sure it does run.
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent b0b651ae
...@@ -279,6 +279,7 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func, ...@@ -279,6 +279,7 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
struct nvkm_device **pdevice) struct nvkm_device **pdevice)
{ {
struct nvkm_device_tegra *tdev; struct nvkm_device_tegra *tdev;
unsigned long rate;
int ret; int ret;
if (!(tdev = kzalloc(sizeof(*tdev), GFP_KERNEL))) if (!(tdev = kzalloc(sizeof(*tdev), GFP_KERNEL)))
...@@ -307,6 +308,17 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func, ...@@ -307,6 +308,17 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func,
goto free; goto free;
} }
rate = clk_get_rate(tdev->clk);
if (rate == 0) {
ret = clk_set_rate(tdev->clk, ULONG_MAX);
if (ret < 0)
goto free;
rate = clk_get_rate(tdev->clk);
dev_dbg(&pdev->dev, "GPU clock set to %lu\n", rate);
}
if (func->require_ref_clk) if (func->require_ref_clk)
tdev->clk_ref = devm_clk_get(&pdev->dev, "ref"); tdev->clk_ref = devm_clk_get(&pdev->dev, "ref");
if (IS_ERR(tdev->clk_ref)) { if (IS_ERR(tdev->clk_ref)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment