From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7507C43331 for ; Tue, 12 Jan 2021 13:00:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 644502311B for ; Tue, 12 Jan 2021 13:00:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729259AbhALNAH (ORCPT ); Tue, 12 Jan 2021 08:00:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45822 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390718AbhALNAH (ORCPT ); Tue, 12 Jan 2021 08:00:07 -0500 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73300C06179F; Tue, 12 Jan 2021 04:59:26 -0800 (PST) Received: by mail-lf1-x12e.google.com with SMTP id a12so3218775lfl.6; Tue, 12 Jan 2021 04:59:26 -0800 (PST) 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=/HJcNkl5nY2t78OqKeve4KEQLTFTI0WusBFcveQbI3Y=; b=SZvxWZU5jtXaZBiFOiUZMu98ooM1VwI1kj9mG6vlqmCv4ys2GnpwNHVRUpfvNScNRb ntv2kKjpGNxmtbBZ2NeJjOU3GzN4oTjCay44Hnvpd2tn96K2eS8nzcsjRmdo2G/loc3h K4EjWnB7Izgt3mwocLD8tdpedPAjDu0naVleeToWGgN33QEwERj52bpIY0V2Uvl8P7Pv Ny3rB8Ss9XjokprFxbYF/ZEsvTwDZcUcbIDDMxUW0Qz4mpJ4oWhNhhXGF/YH7v4KdDRC Y+ViCHaS6+ScdFpzWR/MKrFmPtFZF7w+7fw0yvOvpc8oJ9nv48oC8SxxLsDvxhRyIuoO 44aA== 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=/HJcNkl5nY2t78OqKeve4KEQLTFTI0WusBFcveQbI3Y=; b=kjYFktE9BWFYCUgQ1wLJrjAqTln2Q/ezGwfmlaZ1PWd7R+DBTsAEIhGDiqnQoaROWv wdjLN1ocne/CPR+U8xtjFE988MDy+t2x1p0Kx4rRYt2agdX8YJaVc4YonaNxVwqyTCK5 HWafwTtQpbfGcH082mSx5DMbC+HxJcBS1Tb6NT5q0wndlnLTckxZPGsk7vwA1vXcDDQ2 VpycCnLv84iedd2X/HN1W2q1bQTU+sOSd+6Xm8z8QK+JfnxIiG9iQkaDirJofXigj05V yWlimAg0HzY7zZvcCMKpwwydPFb9+cCbHCJURgjSW6s1/j/OVB9+qz9IArXpUPRccvbd XiLw== X-Gm-Message-State: AOAM533ZOQm/1lCdBoXwUi/TqlXSH3uBMKbxgGIE3DoiaJPQ92DSzq2i +S8Rg/UlpfLUh3sN6s4WkBk= X-Google-Smtp-Source: ABdhPJzddiXeMJzKEZTcHQxQ5aGewHJJB9sTdUVVkIaXRul9O3svaRqJU1kH5fYbL3uBqHhYx/Ah7A== X-Received: by 2002:a05:6512:504:: with SMTP id o4mr2352275lfb.398.1610456365037; Tue, 12 Jan 2021 04:59:25 -0800 (PST) Received: from localhost.localdomain (109-252-192-57.dynamic.spd-mgts.ru. [109.252.192.57]) by smtp.gmail.com with ESMTPSA id 192sm384211lfa.219.2021.01.12.04.59.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jan 2021 04:59:24 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Sameer Pujar , Peter Geis , Nicolas Chauvet , Takashi Iwai , Jaroslav Kysela Cc: alsa-devel@alsa-project.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 4/5] ASoC: tegra: ahub: Use clk_bulk helpers Date: Tue, 12 Jan 2021 15:58:33 +0300 Message-Id: <20210112125834.21545-5-digetx@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210112125834.21545-1-digetx@gmail.com> References: <20210112125834.21545-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org Use clk_bulk helpers to make code cleaner. Tested-by: Peter Geis Tested-by: Nicolas Chauvet Signed-off-by: Dmitry Osipenko --- sound/soc/tegra/tegra30_ahub.c | 30 +++++++----------------------- sound/soc/tegra/tegra30_ahub.h | 4 ++-- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 1e9767c75b11..4dbb58f7ea36 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -45,8 +45,7 @@ static int tegra30_ahub_runtime_suspend(struct device *dev) regcache_cache_only(ahub->regmap_apbif, true); regcache_cache_only(ahub->regmap_ahub, true); - clk_disable_unprepare(ahub->clk_apbif); - clk_disable_unprepare(ahub->clk_d_audio); + clk_bulk_disable_unprepare(ahub->nclocks, ahub->clocks); return 0; } @@ -66,17 +65,9 @@ static int tegra30_ahub_runtime_resume(struct device *dev) { int ret; - ret = clk_prepare_enable(ahub->clk_d_audio); - if (ret) { - dev_err(dev, "clk_enable d_audio failed: %d\n", ret); - return ret; - } - ret = clk_prepare_enable(ahub->clk_apbif); - if (ret) { - dev_err(dev, "clk_enable apbif failed: %d\n", ret); - clk_disable(ahub->clk_d_audio); + ret = clk_bulk_prepare_enable(ahub->nclocks, ahub->clocks); + if (ret) return ret; - } regcache_cache_only(ahub->regmap_apbif, false); regcache_cache_only(ahub->regmap_ahub, false); @@ -509,19 +500,12 @@ static int tegra30_ahub_probe(struct platform_device *pdev) ahub->soc_data = soc_data; ahub->dev = &pdev->dev; - ahub->clk_d_audio = devm_clk_get(&pdev->dev, "d_audio"); - if (IS_ERR(ahub->clk_d_audio)) { - dev_err(&pdev->dev, "Can't retrieve ahub d_audio clock\n"); - ret = PTR_ERR(ahub->clk_d_audio); - return ret; - } + ahub->clocks[ahub->nclocks++].id = "apbif"; + ahub->clocks[ahub->nclocks++].id = "d_audio"; - ahub->clk_apbif = devm_clk_get(&pdev->dev, "apbif"); - if (IS_ERR(ahub->clk_apbif)) { - dev_err(&pdev->dev, "Can't retrieve ahub apbif clock\n"); - ret = PTR_ERR(ahub->clk_apbif); + ret = devm_clk_bulk_get(&pdev->dev, ahub->nclocks, ahub->clocks); + if (ret) return ret; - } res0 = platform_get_resource(pdev, IORESOURCE_MEM, 0); regs_apbif = devm_ioremap_resource(&pdev->dev, res0); diff --git a/sound/soc/tegra/tegra30_ahub.h b/sound/soc/tegra/tegra30_ahub.h index 5a2500b4ea06..063aed5037d7 100644 --- a/sound/soc/tegra/tegra30_ahub.h +++ b/sound/soc/tegra/tegra30_ahub.h @@ -510,8 +510,8 @@ struct tegra30_ahub_soc_data { struct tegra30_ahub { const struct tegra30_ahub_soc_data *soc_data; struct device *dev; - struct clk *clk_d_audio; - struct clk *clk_apbif; + struct clk_bulk_data clocks[2]; + unsigned int nclocks; resource_size_t apbif_addr; struct regmap *regmap_apbif; struct regmap *regmap_ahub; -- 2.29.2