From patchwork Sat Nov 2 17:56:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11224203 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25E46112B for ; Sat, 2 Nov 2019 17:57:08 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0ED8B21726 for ; Sat, 2 Nov 2019 17:57:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0ED8B21726 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC73E6E50C; Sat, 2 Nov 2019 17:56:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7ECE66E4F4; Sat, 2 Nov 2019 17:56:55 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id o28so12718461wro.7; Sat, 02 Nov 2019 10:56:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=n1tTzvYM5w9+u5hVDlIZGuSZUZEgZbCTm+ltdJcT/B4=; b=HCZqsNT4y4kwYnUGR1VhbSiWM/i1SCs0sqsKv2+6CpUIBn6PHJIBk8SVroBVmo2E62 hRzAmsTOmlYzq8UCgPuaANd5m81txcqgAoebxfX9Q7YrR+1PPQY8z0CAjU1CFiMiga/9 wJpnvOp0f/XqWx8UfoAgb3fykaO/s9EKWWfBTxzMhDWKJ6e2fKvB1fvb92NJdHDRUy5r 6YVgywzmiBrxrOF6XHZhrchGAwluIYrzPhJvr4q5IE1eAdF6KgO2Hgto1Wjz8SVSX6LJ ukbI3Ef9FP0Wdu7k7ggE4GWR5INjaJjUu3a4tpZbRILno3ALFBM50ACf+l2qmQHeHrLs VsNg== X-Gm-Message-State: APjAAAXpoSaPJG5PsvUyq0kODyYV0YlXhahfbFXmwipGFX777uAJECjN TpyWy5lrNjUmRfCeSIaRRqkXHkVe X-Google-Smtp-Source: APXvYqwbnnYZXrTkrBOfrjQ8/OumIiqq2aGuleKDeqHVq/H+Li2Ivc5XBEpeNlbKG3RfHNpeD83iPA== X-Received: by 2002:a5d:4612:: with SMTP id t18mr15317254wrq.255.1572717414013; Sat, 02 Nov 2019 10:56:54 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id f13sm10800339wrq.96.2019.11.02.10.56.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Nov 2019 10:56:52 -0700 (PDT) From: Thierry Reding To: Ben Skeggs , Joerg Roedel Subject: [PATCH v2 6/9] drm/nouveau: tegra: Set clock rate if not set Date: Sat, 2 Nov 2019 18:56:34 +0100 Message-Id: <20191102175637.3065-7-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191102175637.3065-1-thierry.reding@gmail.com> References: <20191102175637.3065-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n1tTzvYM5w9+u5hVDlIZGuSZUZEgZbCTm+ltdJcT/B4=; b=Ez9eNqz/Ef4W+g9pbhwhmvBdXpT7gFPFmbgzwdZhMJ7WrkBziKZDOmzPtdKCI9Rewx j9zCBqE17D73D3xYZtyK9viD4VvW06H6nyqCEvDOM02OdtjuADd8Hr8Vn2mdamZwUkVK XmMej0sSChRRHMjAlTIjGXhHyuK3WiCvOyIbjrJB8j93m6r0ikiISpd1MrWAgytgaBMQ BmRt0oDiRbXYhi08tyPE+glhQRK+TyoRSCqyCpm8WC5utejvQYk+OTtla69byetV3Vkb KSkQ7jZRGNWPTFdH6cyCs/CAQV38NLV0E0lYd7CIAyAF0q9ZPUVNlkFRjSsGJz6apEfl lCzA== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, nouveau@lists.freedesktop.org, Ben Dooks , dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding 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: Thierry Reding --- drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c index 747a775121cf..d0d52c1d4aee 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c @@ -279,6 +279,7 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func, struct nvkm_device **pdevice) { struct nvkm_device_tegra *tdev; + unsigned long rate; int ret; if (!(tdev = kzalloc(sizeof(*tdev), GFP_KERNEL))) @@ -307,6 +308,17 @@ nvkm_device_tegra_new(const struct nvkm_device_tegra_func *func, 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) tdev->clk_ref = devm_clk_get(&pdev->dev, "ref"); if (IS_ERR(tdev->clk_ref)) {