Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp259101ybi; Wed, 29 May 2019 20:50:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxcHaB+xaUk1uqiO6Vvseo61X3gaFZHZKbi+Wk4tDweBs8Yqt0RBr/MLDplg3oI492tUczX X-Received: by 2002:a63:ed09:: with SMTP id d9mr1775198pgi.419.1559188235263; Wed, 29 May 2019 20:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559188235; cv=none; d=google.com; s=arc-20160816; b=byeMRQeJLPc5CVWCgua/hrndqYDeSKkuVb7LQfbi+MpQZPZTqGgb3ZN87m7vQxJff1 64kFccr7g5s8ZeeKMM2gzTgFqQ0tkBSH0jCSD9E4jdQz3uQd5hZ8+U3SFQY9MQrH9r0X rbgb70Vu3LWjKqxMN6KhSmUE2F0gh+T05BJxenfpyENjIV5uzHKZZWikXemM4TJJ53mT BP9FSu6DRh2sq3nf+YaYOOHgjYChkLoeUSr1Lr5iZd9Pi9dnq5a6IgCAGitVKpXJFcRi gd8BQrWNqWbzahLfwcTpuo8VFxTFgf7myz70rE+GwfF47Sd1jLRgxm/HQvlylER9BwBt MJcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WUjlL/Phg2ShR/iETk8Snptwc864o8I0gQMIOHr5CEM=; b=XQy1diSE4Y6tyzlEJ0KcMKpz9Gw4RPOae+myMwvgVgtpUju68u8Sv4YGU7EjQmtew5 2sAlclj1fE4KmcJLDmyQAkREuBwlywCWAjppTwd9MNNzHCMUiDzTVbNxmzLU1QDl/7Yj R8MvyGw1M/SqRoCb09Uce2SIzOz7qMG5uric0O+hSznL5WNswuA079KWSJko0R3IoTJ5 wq9AnCeKf63zJEU9FJ0HQCXmmJEsiIO3N1wi02sNvOuPTz5HSMJjIYHMh6G7YpAWt+kB EmkdiWpYMwbEKxxwVW3wLQxQcfzR08g6SRiXdEVhVl3z+VAZTQubvrBE8egjOP3eqqBA 07hA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f9ajOved; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q10si1759540pjp.98.2019.05.29.20.50.18; Wed, 29 May 2019 20:50:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=f9ajOved; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387480AbfE3DsT (ORCPT + 99 others); Wed, 29 May 2019 23:48:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:58322 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732170AbfE3DUW (ORCPT ); Wed, 29 May 2019 23:20:22 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 25C3824923; Thu, 30 May 2019 03:20:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186421; bh=NNX8TfOE1eoiQ0tEo8mNTq/l4fQjj0DGRchKEYf1pdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f9ajOved0frRC7oFvdcY0yR0122aoevVTGDYo3ch4KH4dMTFxEyYGxXowzbUIFtDu K5nbjkdzMd57ucNlCxNCdZYuAfbbxaUOyrHFvL3uMYVkSugDPFyHEja0+bcD8kot1z kRERkEsOJqUdyK5iHUDLY+O6IxJFSzqbOOehr2iE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Mohan Kumar D , Jonathan Hunter , Sameer Pujar , Vinod Koul , Sasha Levin Subject: [PATCH 4.14 175/193] dmaengine: tegra210-adma: use devm_clk_*() helpers Date: Wed, 29 May 2019 20:07:09 -0700 Message-Id: <20190530030512.141001893@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030446.953835040@linuxfoundation.org> References: <20190530030446.953835040@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ Upstream commit f6ed6491d565c336a360471e0c29228e34f4380e ] adma driver is using pm_clk_*() interface for managing clock resources. With this it is observed that clocks remain ON always. This happens on Tegra devices which use BPMP co-processor to manage clock resources, where clocks are enabled during prepare phase. This is necessary because clocks to BPMP are always blocking. When pm_clk_*() interface is used on such Tegra devices, clock prepare count is not balanced till remove call happens for the driver and hence clocks are seen ON always. Thus this patch replaces pm_clk_*() with devm_clk_*() framework. Suggested-by: Mohan Kumar D Reviewed-by: Jonathan Hunter Signed-off-by: Sameer Pujar Signed-off-by: Vinod Koul Signed-off-by: Sasha Levin --- drivers/dma/tegra210-adma.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/dma/tegra210-adma.c b/drivers/dma/tegra210-adma.c index 08b10274284a8..09b6756366c30 100644 --- a/drivers/dma/tegra210-adma.c +++ b/drivers/dma/tegra210-adma.c @@ -22,7 +22,6 @@ #include #include #include -#include #include #include @@ -141,6 +140,7 @@ struct tegra_adma { struct dma_device dma_dev; struct device *dev; void __iomem *base_addr; + struct clk *ahub_clk; unsigned int nr_channels; unsigned long rx_requests_reserved; unsigned long tx_requests_reserved; @@ -637,8 +637,9 @@ static int tegra_adma_runtime_suspend(struct device *dev) struct tegra_adma *tdma = dev_get_drvdata(dev); tdma->global_cmd = tdma_read(tdma, ADMA_GLOBAL_CMD); + clk_disable_unprepare(tdma->ahub_clk); - return pm_clk_suspend(dev); + return 0; } static int tegra_adma_runtime_resume(struct device *dev) @@ -646,10 +647,11 @@ static int tegra_adma_runtime_resume(struct device *dev) struct tegra_adma *tdma = dev_get_drvdata(dev); int ret; - ret = pm_clk_resume(dev); - if (ret) + ret = clk_prepare_enable(tdma->ahub_clk); + if (ret) { + dev_err(dev, "ahub clk_enable failed: %d\n", ret); return ret; - + } tdma_write(tdma, ADMA_GLOBAL_CMD, tdma->global_cmd); return 0; @@ -692,13 +694,11 @@ static int tegra_adma_probe(struct platform_device *pdev) if (IS_ERR(tdma->base_addr)) return PTR_ERR(tdma->base_addr); - ret = pm_clk_create(&pdev->dev); - if (ret) - return ret; - - ret = of_pm_clk_add_clk(&pdev->dev, "d_audio"); - if (ret) - goto clk_destroy; + tdma->ahub_clk = devm_clk_get(&pdev->dev, "d_audio"); + if (IS_ERR(tdma->ahub_clk)) { + dev_err(&pdev->dev, "Error: Missing ahub controller clock\n"); + return PTR_ERR(tdma->ahub_clk); + } pm_runtime_enable(&pdev->dev); @@ -775,8 +775,6 @@ static int tegra_adma_probe(struct platform_device *pdev) pm_runtime_put_sync(&pdev->dev); rpm_disable: pm_runtime_disable(&pdev->dev); -clk_destroy: - pm_clk_destroy(&pdev->dev); return ret; } @@ -794,7 +792,6 @@ static int tegra_adma_remove(struct platform_device *pdev) pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev); - pm_clk_destroy(&pdev->dev); return 0; } -- 2.20.1