From patchwork Tue Aug 20 10:22:09 2024
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Huan Yang
X-Patchwork-Id: 13770228
Return-Path:
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by smtp.lore.kernel.org (Postfix) with ESMTPS id E72DEC531DC
for ; Tue, 20 Aug 2024 14:31:22 +0000 (UTC)
Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201])
(using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by alsa0.perex.cz (Postfix) with ESMTPS id 20AEFD8;
Tue, 20 Aug 2024 16:31:11 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 20AEFD8
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org;
s=default; t=1724164281;
bh=+LigA+kHGSOA6AomnYIpDvE9P03BnWt59TTUoVPEG/Q=;
h=From:To:Cc:Subject:Date:List-Id:List-Archive:List-Help:List-Owner:
List-Post:List-Subscribe:List-Unsubscribe:From;
b=VydngoAHig1kJ8naeL8qNKIIIeW+B+4BoSGC/WP0tabWmGa6uj2PNkamca13G6GnU
Ga/MvxDftA+JOC6/k2l/sWOcfKO+KQ3BDzn1CndbmvD4MiDXn2VLxwp6kyljfYJ1mz
zrsto+pqrNITUKdeOKzmPe6iJL8YDOKLsZ73OwXg=
Received: by alsa1.perex.cz (Postfix, from userid 50401)
id 6B00DF8060D; Tue, 20 Aug 2024 16:29:52 +0200 (CEST)
Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org
[10.254.200.10])
by alsa1.perex.cz (Postfix) with ESMTP id 32DB0F80632;
Tue, 20 Aug 2024 16:29:52 +0200 (CEST)
Received: by alsa1.perex.cz (Postfix, from userid 50401)
id 110FEF80494; Tue, 20 Aug 2024 12:22:40 +0200 (CEST)
Received: from APC01-TYZ-obe.outbound.protection.outlook.com
(mail-tyzapc01on20608.outbound.protection.outlook.com
[IPv6:2a01:111:f403:2011::608])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(No client certificate requested)
by alsa1.perex.cz (Postfix) with ESMTPS id ECE39F80107
for ; Tue, 20 Aug 2024 12:22:26 +0200 (CEST)
DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz ECE39F80107
Authentication-Results: alsa1.perex.cz;
dkim=pass (2048-bit key,
unprotected) header.d=vivo.com header.i=@vivo.com header.a=rsa-sha256
header.s=selector2 header.b=btIQLVN0
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
b=IpwLgatJI9kwbYe9rMzN7C+HKMcSqwSVd7zWO0c5WTa0a7y+TAKbh212uSOiKTzlz5Uyh4WFOwPVl10jKQ70547YAKC3Bpy7oNUbXRq2/lPb+M3e3TaXbO+TgNTkaRpOoD1r+eMbMpIE/2H/0M+5miXJi/IZHbF0lt+73f15YiLLXAGpej3eN4rKsngVlQjiby8PwcayFo+7YETvuYWuptG6K9SMTrYk+vLy+XmAVlLfveRTqco7wsztF6vepEYL1V9hNASpQ+FVNGWIE64yHeS1PmSFR39KAbRkqL47B8JxIQEc0rEnEGbEJaZMWXKxhgTCUzmVGh8LC62HumN/HQ==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com;
s=arcselector10001;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1;
bh=sj3YHZ2HuFxMk0d+PQ52HeNC+n7cX6y0k5xtuMV/2Y4=;
b=OvqgOAkSYZBpnqMzPbFHo2iL1WVwBvIV+8ZQWOaH9/7FWFwQPUZpEh+qGc33cTzS0AIvB6dv5NPhyVpxCJHrsmDX7kGg9Kl54yp3jzz8YO08u+z4hBO2m9hHt8nFtul7t+V1Xwc8CnovTprFvy7PXXRdFkEPmvlg+IloFxTd3As8RmF0K9uDRoVYr5lh7CIJD5tjACLC56c5UBfmHnBGThj7OaPuHxoAuh49I6FDm2wufxn+U7RW1KXiknHe7fcVng6b8MHHj3Qd2HOpinoXLLHOcecsavXX8SzKDUBNC5azApDQ14kZ768GGaKgGNptoQ7byS3Jo4pW9Ja89JVYlQ==
ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass
smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com;
dkim=pass header.d=vivo.com; arc=none
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2;
h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck;
bh=sj3YHZ2HuFxMk0d+PQ52HeNC+n7cX6y0k5xtuMV/2Y4=;
b=btIQLVN0tYnv/TZpkz7kDEvh1+72DpR4jO0+kbY32GPOrICReXS05GHMjDSldXjJoYLMBc6ABn9SpPEXFRA38xKQWeMwcpkLc+utZP2UUapSzpynGS/WDYXC6FXflI1X/f9ealL3SISLDt0j26VBvelefRkIBaDeKQg1EmDKEoyhrF+3oeLu0Haw7prHuk1+WZ48n4XG+Fchcuv5N1L/Noc5arb/Dz+MRaAp0EX9VNCavWh4KeXGU5PxxYSRq0GvSyWm9jKaY21ten1yXwMy4hysJ+TDaNgRmeyzvU77x5WmWto0Lg+AtR/h9PDk7sgBfEgebR7lD2rSgy8XxgIR+A==
Authentication-Results: dkim=none (message not signed)
header.d=none;dmarc=none action=none header.from=vivo.com;
Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10)
by SEZPR06MB6486.apcprd06.prod.outlook.com (2603:1096:101:179::12) with
Microsoft SMTP Server (version=TLS1_2,
cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Tue, 20 Aug
2024 10:22:20 +0000
Received: from PUZPR06MB5676.apcprd06.prod.outlook.com
([fe80::a00b:f422:ac44:636f]) by PUZPR06MB5676.apcprd06.prod.outlook.com
([fe80::a00b:f422:ac44:636f%5]) with mapi id 15.20.7875.019; Tue, 20 Aug 2024
10:22:20 +0000
From: Huan Yang
To: Vinod Koul ,
Bard Liao ,
Pierre-Louis Bossart ,
Sanyog Kale ,
linux-arm-msm@vger.kernel.org,
alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org
Cc: opensource.kernel@vivo.com,
Huan Yang
Subject: [PATCH] soundwire: qcom: Use devm_clk_get_enabled() helpers
Date: Tue, 20 Aug 2024 18:22:09 +0800
Message-ID: <20240820102209.131512-1-link@vivo.com>
X-Mailer: git-send-email 2.45.2
X-ClientProxiedBy: SI2P153CA0027.APCP153.PROD.OUTLOOK.COM
(2603:1096:4:190::22) To PUZPR06MB5676.apcprd06.prod.outlook.com
(2603:1096:301:f8::10)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|SEZPR06MB6486:EE_
X-MS-Office365-Filtering-Correlation-Id: 075a3bdd-edec-4deb-368b-08dcc101f92b
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam:
BCL:0;ARA:13230040|1800799024|376014|366016|52116014|38350700014;
X-Microsoft-Antispam-Message-Info:
ZyMdqVU/ttXtoePfe+54TWrfB2m+fv6GbmRPN1FjD9tw2Qau64L2KYfCm7D3My+4d6MKMqFSar8a4kOlkYCTDzAPEGIb+6Am8rVkap6Zk8z+Dtv1aOPvZA5fukQLGF+JqpBSQwLE8HqKjnZ82uqmJLAqi70QchPh7mjyFyqB4etbwRrOQgk5O3BU8P9h4xyyrtCqvWgieIHSwa7RfKcyrcCk/SRaHOlMkeqTDwX+ma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B7ccW/cZ8/zQLNgjoTYNrre7+qsoQMGrc8RPNS1DmXMz83z3nc5wUjIEnwv/4kCkQMvI7f7Cr33HqEZQ7tlffRG2L32gNPc4VRYpmKRuzSD/uNXHa2X31hkJUXbrNy7w==
X-Forefront-Antispam-Report:
CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PUZPR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(366016)(52116014)(38350700014);DIR:OUT;SFP:1101;
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0:
/hq1w1rH8Ezlu/cIpZEcRCqoRYXElGUQEC3gwh+q44/I+cLPGPgvTFI6g9cvwe9LKEf/R3XNz2TGwIrpbkGfrC8vcAXJHmNJRNJr4QRn07QGuM9tojl79zjNrxXaWPF2p6jPaVvHNJy3Q/DcGL0lXb/diK7R2ZjVJQXuVGXYSnLV3YBVYF/sd3hP4kU5piBeRE02vtRylWmUoTAQW8Qwgy6I+ltaU2UWZtjiZl2yA9IN5Tt2WWRv16ueipP54KCFFqYcHi9hICMcGUPwrfi5oH60jXV7cgLiFxdNllUhrYl3XQSxNI9Hdzy8d3IOk/x0Pvh3lAiqjNCtEhMC2ujekyG7xxo+2wc5skH3tUOxao8aXoNOk+aM6D1j1iWlxrVslLvDI5d8O4bVnaO3JufsAO4kxsM3l1vPGzBLvJ+JPL3OYZFHfa8mQJUsWr+4b2rQa/Iz/YrFIBKygPrLJiu5D3f9iiUCWTWMf1cQmqj56pAIASupZNsYEo5mUbEI7XQEeKOG9/r1y5EWQt8yYip1EsKX/uxpZk3Fz4GjRRdmV56GicPfcWz8jX7ADRsR93SUfzeiUuvqdbWzM7nwx7Kw9IkK9oPfCFYQ4vXJ8rV48krqaUHCZ/Zqx5+FiRZT5l3KL04rHoG7Xubmv63vrXA7vGdxH7Y04JXrIgHdCdFiTVH3c6wuOdashc6P6LWrrEt4ad1iB8y3p+h/wSUw9VHRNwAxPpcdFrJJi5XRc199FVQJayiiZkpVV6anFXhrbDLQUoQZBU5EYmndbIL4G6j8DOs5zTe+ZyWugNz0kT4z9rL9Ych+70ZaTRKvnwzKWcZ2BspT9E0oSI3ji73fOnXYoq139InNLilSZ7AOtVxP1EqvM4/Gys8i/MvlZt0roVWdkIZyqeeMDGtk+H8nTOftbCl7hAxgXrrgOu90g+RHQil6dMvPefMyyYwVSSQ88yC+JgaBjCRUjqw0BlBTdmNqsXDgdBoSJliWNX3OBL7uE2/tWk87WV91CaKLRmRecwhXvshneEm1Sy+0vLa41q+1ocqIgi26yml5xPDAX/MexjTpQj9NXSXHOmgG3Hu5wQXOpEm4MUciiXQGnlJZcHC0cTvaZxjBA5hsR1oEWQvoIqR6BnAM45z6Aml6njBU4uGwad9TxR10d7yhCwyYdHoUk5eLUcjN/lZvDdE3JKGv4C7vVMyOdajJy7YU+p9Ma4yDi0Xjcel+5AONKOCQZdf2oGos2fHiBd4RD3lh0HbxhftGCwqIhuSwndxOrZUdvbnZc20zGf67inJ6/SRXSgszK2Q8EuiCr0+HOmOsQgB/p7FgzEmJDMMaF7ASv1vZOwEmOsNbZytaBdXIgrxDdO7bwNKDlyETB1+eh/dVabjXWtsKUuEthVQAZkKrnBVn+wZKfMkDfAMm5HkasNovW7/pkh+t2n8vNgK93ZgAO8DAdIkAifP2vvER0HmGUtb/2QA4xqdq8tTqH7wppCE7raelrodi95fTfTe7vgFDub6vvmQK3HayKrVFHMFArWUZ5F5k7QTphZWzorwIccwVwWwFWpRuIXbGOV1HtUPZ9Y5Bu1wBWR8mWTcDXzltyHF+kEAm
X-OriginatorOrg: vivo.com
X-MS-Exchange-CrossTenant-Network-Message-Id:
075a3bdd-edec-4deb-368b-08dcc101f92b
X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Aug 2024 10:22:20.0567
(UTC)
X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted
X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed
X-MS-Exchange-CrossTenant-MailboxType: HOSTED
X-MS-Exchange-CrossTenant-UserPrincipalName:
ir/+L8hDRJ9wCBph6zlk35xWgldhC/JwtaziuZZQVdds1ldYHZpNLN2Bb2JYkEUl/DeTJiupx31bAdiuMnfMQw==
X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEZPR06MB6486
X-MailFrom: link@vivo.com
X-Mailman-Rule-Hits: nonmember-moderation
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency;
loop; banned-address; member-moderation;
header-match-alsa-devel.alsa-project.org-0;
header-match-alsa-devel.alsa-project.org-1
Message-ID-Hash: IQQCOBK3JPXH5EITOFJFB7AREDBRLSMX
X-Message-ID-Hash: IQQCOBK3JPXH5EITOFJFB7AREDBRLSMX
X-Mailman-Approved-At: Tue, 20 Aug 2024 14:26:51 +0000
X-Mailman-Version: 3.3.9
Precedence: list
List-Id: "Alsa-devel mailing list for ALSA developers -
http://www.alsa-project.org"
Archived-At:
List-Archive:
List-Help:
List-Owner:
List-Post:
List-Subscribe:
List-Unsubscribe:
The devm_clk_get_enabled() helpers:
- call devm_clk_get()
- call clk_prepare_enable() and register what is needed in order to
call clk_disable_unprepare() when needed, as a managed resource.
This simplifies the code and avoids the calls to clk_disable_unprepare().
Signed-off-by: Huan Yang
---
drivers/soundwire/qcom.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/drivers/soundwire/qcom.c b/drivers/soundwire/qcom.c
index aed57002fd0e..2a57ed9464b4 100644
--- a/drivers/soundwire/qcom.c
+++ b/drivers/soundwire/qcom.c
@@ -1527,24 +1527,22 @@ static int qcom_swrm_probe(struct platform_device *pdev)
if (IS_ERR(ctrl->audio_cgcr)) {
dev_err(dev, "Failed to get cgcr reset ctrl required for SW gating\n");
ret = PTR_ERR(ctrl->audio_cgcr);
- goto err_init;
+ return ret;
}
}
ctrl->irq = of_irq_get(dev->of_node, 0);
if (ctrl->irq < 0) {
ret = ctrl->irq;
- goto err_init;
+ return ret;
}
- ctrl->hclk = devm_clk_get(dev, "iface");
+ ctrl->hclk = devm_clk_get_enabled(dev, "iface");
if (IS_ERR(ctrl->hclk)) {
ret = dev_err_probe(dev, PTR_ERR(ctrl->hclk), "unable to get iface clock\n");
- goto err_init;
+ return ret;
}
- clk_prepare_enable(ctrl->hclk);
-
ctrl->dev = dev;
dev_set_drvdata(&pdev->dev, ctrl);
mutex_init(&ctrl->port_lock);
@@ -1558,7 +1556,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
ret = qcom_swrm_get_port_config(ctrl);
if (ret)
- goto err_clk;
+ return ret;
params = &ctrl->bus.params;
params->max_dr_freq = DEFAULT_CLK_FREQ;
@@ -1586,7 +1584,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
"soundwire", ctrl);
if (ret) {
dev_err(dev, "Failed to request soundwire irq\n");
- goto err_clk;
+ return ret;
}
ctrl->wake_irq = of_irq_get(dev->of_node, 1);
@@ -1597,7 +1595,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
"swr_wake_irq", ctrl);
if (ret) {
dev_err(dev, "Failed to request soundwire wake irq\n");
- goto err_init;
+ return ret;
}
}
@@ -1612,7 +1610,7 @@ static int qcom_swrm_probe(struct platform_device *pdev)
if (ret) {
dev_err(dev, "Failed to register Soundwire controller (%d)\n",
ret);
- goto err_clk;
+ return ret;
}
qcom_swrm_init(ctrl);
@@ -1642,9 +1640,6 @@ static int qcom_swrm_probe(struct platform_device *pdev)
err_master_add:
sdw_bus_master_delete(&ctrl->bus);
-err_clk:
- clk_disable_unprepare(ctrl->hclk);
-err_init:
return ret;
}
@@ -1653,7 +1648,6 @@ static void qcom_swrm_remove(struct platform_device *pdev)
struct qcom_swrm_ctrl *ctrl = dev_get_drvdata(&pdev->dev);
sdw_bus_master_delete(&ctrl->bus);
- clk_disable_unprepare(ctrl->hclk);
}
static int __maybe_unused swrm_runtime_resume(struct device *dev)