From patchwork Tue Aug 4 00:05:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 11699301 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 BFA9713B1 for ; Tue, 4 Aug 2020 00:06:37 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 229AD2076E for ; Tue, 4 Aug 2020 00:06:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="kSFVzJ6L"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="m7JUSxo2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 229AD2076E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E2D05950; Tue, 4 Aug 2020 02:05:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E2D05950 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596499595; bh=c0xPEnpHIjKK5s/FvMEYVEq36KsICI2mh/oHHME9pDw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=kSFVzJ6LjQXSRbZg6xD8VPwkPE+vV46RV5a55dX4FnSO+Yo99jfUILN7U5hlLIgRI nd2M8+Ap3CBeCqCAWBH5fwAIiIl6dMp9mzm05JGXW4pFQDPrFe5KS1RbVU1Pvy4uho gi7imNr4QM8e4JPUSGJhpNmqwwBaQ0sC9JtH2s2E= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3FF1BF80234; Tue, 4 Aug 2020 02:05:46 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4A8E7F80249; Tue, 4 Aug 2020 02:05:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 16968F801F7 for ; Tue, 4 Aug 2020 02:05:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 16968F801F7 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="m7JUSxo2" Received: by mail-pl1-x643.google.com with SMTP id p1so21878365pls.4 for ; Mon, 03 Aug 2020 17:05:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=y16Y9VzNG9qM+J0oXaRKcTXEkcxRSQyUjMcg0sQqDX0=; b=m7JUSxo2z9T38XvDBBSMBw1xudjbDt7oA4PQIt4hL6CSScE3oqLtdvilgE1ZxTrkxw 47CMo04qMxEQHssTIVp688HGv2GZX5XgmSD6ZB+R6CAEqc7TduZ8x9ijI5otvWJ24avG 4G/H/VJFnoAQ9grSOdfJ49KklJyLN0NzKZgrY= 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=y16Y9VzNG9qM+J0oXaRKcTXEkcxRSQyUjMcg0sQqDX0=; b=ZLLAOUDIonZRAt9sQ0AVKvxN3xLCkMS2LnMhTh03qcULVQvtwLOvxLl3Y2yJTXm6At FfTyUKMgBLTc8Y3jtwcz3Aw9tV5g6ubqeKDhlGl4OPfF94UspWs9e8dwQiAUwVqZgTaw ddFUhbYem+JqPzEyH+H4SkhjbRvXWxqORk09U7uhjRKKwDdZzMw32eqTber88Gn1ZlJ0 7GcQ/CYixF/i8crkjZu2ImBxWnx8jvX2OetvMoJGoMylfCX/iwl2FHZCm5GfVN/0mRh8 LVIGkHEVcjw3doY+N+paLOO7QoKCO1gEpihcqbwlM3wpJdPV6h2P4VGXRARkAAc7raS+ Rzug== X-Gm-Message-State: AOAM5300McxSA2Obdr7ft6YPrnTN2ZoonKrMTJD/2JKTUl8sHTWkr8P2 kwFCQ479IgCwBvNlFvbFz0Xyyw== X-Google-Smtp-Source: ABdhPJxx5w0TAv0orspB1pOK9CJb492TY2RPzdXrRojGdVXlfSbiBzq9AcCqxuS4HsoSMxslIgTPxw== X-Received: by 2002:a17:90a:4e89:: with SMTP id o9mr1813122pjh.178.1596499533330; Mon, 03 Aug 2020 17:05:33 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id e28sm12332756pfl.124.2020.08.03.17.05.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 17:05:32 -0700 (PDT) From: Stephen Boyd To: Mark Brown , Oder Chiou Subject: [PATCH 1/3] ASoC: rt5682: Use dev_dbg() in rt5682_clk_check() Date: Mon, 3 Aug 2020 17:05:29 -0700 Message-Id: <20200804000531.920688-2-swboyd@chromium.org> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6-goog In-Reply-To: <20200804000531.920688-1-swboyd@chromium.org> References: <20200804000531.920688-1-swboyd@chromium.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Takashi Iwai , linux-kernel@vger.kernel.org, Shuming Fan , Cheng-Yi Chiang X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" I see a spew of "sysclk/dai not set correctly" whenever I cat /sys/kernel/debug/clk/clk_summary on my device. This is because the master pointer isn't set yet in this driver. A user isn't going to be able to do much if this check is failing so this error message isn't really an error, it's more of a kernel debug message. Lower the priority to dev_dbg() so that it isn't so noisy. Cc: Cheng-Yi Chiang Cc: Shuming Fan Signed-off-by: Stephen Boyd --- sound/soc/codecs/rt5682.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index fab066a75ce0..ed9475f24aec 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -2482,7 +2482,7 @@ static int rt5682_set_bias_level(struct snd_soc_component *component, static bool rt5682_clk_check(struct rt5682_priv *rt5682) { if (!rt5682->master[RT5682_AIF1]) { - dev_err(rt5682->component->dev, "sysclk/dai not set correctly\n"); + dev_dbg(rt5682->component->dev, "sysclk/dai not set correctly\n"); return false; } return true; From patchwork Tue Aug 4 00:05:30 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 11699305 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 4B41713B6 for ; Tue, 4 Aug 2020 00:08:20 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 20B4920792 for ; Tue, 4 Aug 2020 00:08:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="CJAU5juh"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="LPyRsBf8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 20B4920792 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 76E2D167E; Tue, 4 Aug 2020 02:07:30 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 76E2D167E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596499698; bh=i7RqaK+9Q+KK6nbWpbbk9g589RBn4mqsq5K4Pm80vjc=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=CJAU5juhISou3AF2L5BsaeAxpw47lgM7I5K8JE8EmfZjqefU0qs+XVvjZiyvUAKQU rwSdo3KoCJmOCJ7GvYqGYmi1ffmNtezgah03++42E2DFTTjyMKH56LR+GRoeLneMBn 4vGbPfBxqfjspU+0uszrw2nPmiusBEQUiaal6YcQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 905E8F802DB; Tue, 4 Aug 2020 02:05:50 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 724CCF802C3; Tue, 4 Aug 2020 02:05:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1431AF80218 for ; Tue, 4 Aug 2020 02:05:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1431AF80218 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="LPyRsBf8" Received: by mail-pf1-x444.google.com with SMTP id r11so11306609pfl.11 for ; Mon, 03 Aug 2020 17:05:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=l3OiBOjafm3plPEFte4M6SO56RI7TS2vgkQEyD6y8A0=; b=LPyRsBf8uatoR8gWHlPsC/BOs6J+g3iymamTa9IWYe2OXk+e9O1U+kElZtxQYeyY/C Eyb660XqBkPshzkYARXpu1veuTlEWBLctTGaZ2TX8ZFi03Mq+fDjaLt9pW05nKWefJuq XvNZhcNKkmbYBMGzbXq3C4j6YB6NKPoCc5c7E= 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=l3OiBOjafm3plPEFte4M6SO56RI7TS2vgkQEyD6y8A0=; b=Nwp93aWAgJmYvKtn9Z7AAC3Q+YQ5KHZpaFic0mSZkC672mqTZYTfC1UT3EA7oAJwnj 2RrYVoh5N6CGSU4ij1GtlfZwEOd1hbLKpU/Hn/FXdCYIehr6MuCeTdvyZL0eaR1MUsNW zDGrziTXqZ6WFwMHxXRh1inXBZq76lYmOGlUQGSiLXXCSvR1CY9eA2teK5h8etiI4850 TreLaO7BFMq8YmdpGkW69wlMHop0D/iOrq1igkZXEeEu+WFIlsDYs8iQLEFbnMZYGHah JJ9TOU+tffujD0xhk+s6+BQxCM4tU4QPikkR3mDEALrL1mCFk6kiuTncCy2I0RYxwif1 R0Cg== X-Gm-Message-State: AOAM5302vqTwZchUI1uWc6Qd+B6kf1vx3SQJXKRuQhcZ29GZXMUIP7WF wqPeZuy+jnK1IjbfBYlDwDYwsA== X-Google-Smtp-Source: ABdhPJyFldD5Jk+BXD0T+4t0RZBnjvyZfqehuzQXAggkI49L/50t4c4PrODhjN5fDmoDfwya8bFnWA== X-Received: by 2002:a63:8ec8:: with SMTP id k191mr17016302pge.154.1596499534145; Mon, 03 Aug 2020 17:05:34 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id e28sm12332756pfl.124.2020.08.03.17.05.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 17:05:33 -0700 (PDT) From: Stephen Boyd To: Mark Brown , Oder Chiou Subject: [PATCH 2/3] ASoC: rt5682: Drop usage of __clk_get_name() Date: Mon, 3 Aug 2020 17:05:30 -0700 Message-Id: <20200804000531.920688-3-swboyd@chromium.org> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6-goog In-Reply-To: <20200804000531.920688-1-swboyd@chromium.org> References: <20200804000531.920688-1-swboyd@chromium.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Takashi Iwai , linux-kernel@vger.kernel.org, Shuming Fan , Cheng-Yi Chiang X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The __clk_get_name() API is deprecated. Use clk_hw_get_name() or proper registration techniques to avoid it. Cc: Cheng-Yi Chiang Cc: Shuming Fan Signed-off-by: Stephen Boyd --- sound/soc/codecs/rt5682.c | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index ed9475f24aec..d8a1973a4624 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -2548,7 +2548,7 @@ static unsigned long rt5682_wclk_recalc_rate(struct clk_hw *hw, container_of(hw, struct rt5682_priv, dai_clks_hw[RT5682_DAI_WCLK_IDX]); struct snd_soc_component *component = rt5682->component; - const char * const clk_name = __clk_get_name(hw->clk); + const char * const clk_name = clk_hw_get_name(hw); if (!rt5682_clk_check(rt5682)) return 0; @@ -2572,7 +2572,7 @@ static long rt5682_wclk_round_rate(struct clk_hw *hw, unsigned long rate, container_of(hw, struct rt5682_priv, dai_clks_hw[RT5682_DAI_WCLK_IDX]); struct snd_soc_component *component = rt5682->component; - const char * const clk_name = __clk_get_name(hw->clk); + const char * const clk_name = clk_hw_get_name(hw); if (!rt5682_clk_check(rt5682)) return -EINVAL; @@ -2597,7 +2597,7 @@ static int rt5682_wclk_set_rate(struct clk_hw *hw, unsigned long rate, dai_clks_hw[RT5682_DAI_WCLK_IDX]); struct snd_soc_component *component = rt5682->component; struct clk *parent_clk; - const char * const clk_name = __clk_get_name(hw->clk); + const char * const clk_name = clk_hw_get_name(hw); int pre_div; unsigned int clk_pll2_out; @@ -2755,33 +2755,31 @@ static int rt5682_register_dai_clks(struct snd_soc_component *component) struct device *dev = component->dev; struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); struct rt5682_platform_data *pdata = &rt5682->pdata; - struct clk_init_data init; struct clk *dai_clk; struct clk_lookup *dai_clk_lookup; struct clk_hw *dai_clk_hw; - const char *parent_name; int i, ret; for (i = 0; i < RT5682_DAI_NUM_CLKS; ++i) { + struct clk_init_data init = { }; + dai_clk_hw = &rt5682->dai_clks_hw[i]; switch (i) { case RT5682_DAI_WCLK_IDX: /* Make MCLK the parent of WCLK */ if (rt5682->mclk) { - parent_name = __clk_get_name(rt5682->mclk); - init.parent_names = &parent_name; + init.parent_data = &(struct clk_parent_data){ + .fw_name = "mclk", + }; init.num_parents = 1; - } else { - init.parent_names = NULL; - init.num_parents = 0; } break; case RT5682_DAI_BCLK_IDX: /* Make WCLK the parent of BCLK */ - parent_name = __clk_get_name( - rt5682->dai_clks[RT5682_DAI_WCLK_IDX]); - init.parent_names = &parent_name; + init.parent_hws = &(const struct clk_hw *){ + &rt5682->dai_clks_hw[RT5682_DAI_WCLK_IDX] + }; init.num_parents = 1; break; default: From patchwork Tue Aug 4 00:05:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Boyd X-Patchwork-Id: 11699307 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 2940D13B6 for ; Tue, 4 Aug 2020 00:09:06 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0102720792 for ; Tue, 4 Aug 2020 00:09:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Q0DJdL/k"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kSXUbVgM" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0102720792 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 539D51668; Tue, 4 Aug 2020 02:08:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 539D51668 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1596499744; bh=7v+C0Tq6jHojhPVXEd2eOjPd6q3hapJ/jP0S1mJ6RnI=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Q0DJdL/k8RAMocoIXq8O38jyRT4ql9UYNs83BOtSkqT9GSDCggvl3WeV6KmVnMGoi fBQXJRJJHcNNDo0ghxjUREkVBldriAEqBAPOdpdtb+Kz+ML7ssQQsoFGhnbuGkxgGp F5szCdlxwjz+Omm4siFSjK160kkjAPzrdEZbFr+k= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E5DBEF802E0; Tue, 4 Aug 2020 02:05:51 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id DA486F802D2; Tue, 4 Aug 2020 02:05:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BC813F800B7 for ; Tue, 4 Aug 2020 02:05:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BC813F800B7 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="kSXUbVgM" Received: by mail-pj1-x1044.google.com with SMTP id f9so1014326pju.4 for ; Mon, 03 Aug 2020 17:05:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=XYxlPxktLYpTU+ajRvocUmvWDtHWUPhy8uwzwzVSk3I=; b=kSXUbVgMYfHIPmXvbDKDf53m5ed9n1Gm6wnE6Vy5a4s1jaI4+9yrAkwN4xh9jxDUCj WQlzPLz+ANy+WsdXd6S24HWI0jcEtM+EQeiagJNqQZZIftIkdToSDqBWVkXMifVxXbvd gxYItY//3bUQS8cwCayYMupFA/eJoX86S2fbQ= 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=XYxlPxktLYpTU+ajRvocUmvWDtHWUPhy8uwzwzVSk3I=; b=ObaWtv1svs+PjMyAToxOnj+OB4Uzm7r2NIu2OMT4a8xOlpILYHs0vqT78pi0XKJdlK HYoE90cTQHEBvjyBZ4mhHAeDKTjrZyzUR4e9bEFGLUHlwpKPFHQYHGnN1ksOKb5uum8x mMOMfbbQYS9EqQFVwtsvOaq2ePpdIfedYH9huvfnm3kzUhJbL2180YpDFNpkE8YUgMdj 2YOdoxC42uyLZFjUROQxRyOnaBciuACHoXDzGEdR46zJLpRoVA0iiVOOAPP3PWrQM2Wf q4y3gjN7LH26VFFPPb03lupKZKFYz+BmcIvgFzHkIegv8OqXPB1uThSVgDkPTHG/Nh87 31Zg== X-Gm-Message-State: AOAM531FL2M3YixXU9JkocN6nscdHvqj7aR7Yhh1zg6LkqTOF2keunpe 5iCjyiM8VaXNFvVArYzDNKGbPg== X-Google-Smtp-Source: ABdhPJy0Kl39KCvp6CQkcZipctw4cxaao9j76i19pk33xNx5VtGJDatjpizlaD3AgEZ9rDJKr/SibQ== X-Received: by 2002:a17:90a:33e8:: with SMTP id n95mr1683693pjb.183.1596499535212; Mon, 03 Aug 2020 17:05:35 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:1:3e52:82ff:fe6c:83ab]) by smtp.gmail.com with ESMTPSA id e28sm12332756pfl.124.2020.08.03.17.05.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Aug 2020 17:05:34 -0700 (PDT) From: Stephen Boyd To: Mark Brown , Oder Chiou Subject: [PATCH 3/3] ASoC: rt5682: Use clk_hw based APIs for registration Date: Mon, 3 Aug 2020 17:05:31 -0700 Message-Id: <20200804000531.920688-4-swboyd@chromium.org> X-Mailer: git-send-email 2.28.0.163.g6104cc2f0b6-goog In-Reply-To: <20200804000531.920688-1-swboyd@chromium.org> References: <20200804000531.920688-1-swboyd@chromium.org> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, Takashi Iwai , linux-kernel@vger.kernel.org, Shuming Fan , Cheng-Yi Chiang X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" The (new?) style of clk registration uses clk_hw based APIs so that we can more easily see the difference between clk providers and clk consumers. Use the clk_hw based APIs to do this and migrate to devm for the clkdev creation so that we can reduce the amount of code. Cc: Cheng-Yi Chiang Cc: Shuming Fan Signed-off-by: Stephen Boyd --- sound/soc/codecs/rt5682.c | 47 +++++++++------------------------------ sound/soc/codecs/rt5682.h | 2 -- 2 files changed, 11 insertions(+), 38 deletions(-) diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c index d8a1973a4624..bfb26fec7137 100644 --- a/sound/soc/codecs/rt5682.c +++ b/sound/soc/codecs/rt5682.c @@ -2755,8 +2755,6 @@ static int rt5682_register_dai_clks(struct snd_soc_component *component) struct device *dev = component->dev; struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); struct rt5682_platform_data *pdata = &rt5682->pdata; - struct clk *dai_clk; - struct clk_lookup *dai_clk_lookup; struct clk_hw *dai_clk_hw; int i, ret; @@ -2784,8 +2782,7 @@ static int rt5682_register_dai_clks(struct snd_soc_component *component) break; default: dev_err(dev, "Invalid clock index\n"); - ret = -EINVAL; - goto err; + return -EINVAL; } init.name = pdata->dai_clk_names[i]; @@ -2793,39 +2790,26 @@ static int rt5682_register_dai_clks(struct snd_soc_component *component) init.flags = CLK_GET_RATE_NOCACHE | CLK_SET_RATE_GATE; dai_clk_hw->init = &init; - dai_clk = devm_clk_register(dev, dai_clk_hw); - if (IS_ERR(dai_clk)) { - dev_warn(dev, "Failed to register %s: %ld\n", - init.name, PTR_ERR(dai_clk)); - ret = PTR_ERR(dai_clk); - goto err; + ret = devm_clk_hw_register(dev, dai_clk_hw); + if (ret) { + dev_warn(dev, "Failed to register %s: %d\n", + init.name, ret); + return ret; } - rt5682->dai_clks[i] = dai_clk; if (dev->of_node) { devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, dai_clk_hw); } else { - dai_clk_lookup = clkdev_create(dai_clk, init.name, - "%s", dev_name(dev)); - if (!dai_clk_lookup) { - ret = -ENOMEM; - goto err; - } else { - rt5682->dai_clks_lookup[i] = dai_clk_lookup; - } + ret = devm_clk_hw_register_clkdev(dev, dai_clk_hw, + init.name, + dev_name(dev)); + if (ret) + return ret; } } return 0; - -err: - do { - if (rt5682->dai_clks_lookup[i]) - clkdev_drop(rt5682->dai_clks_lookup[i]); - } while (i-- > 0); - - return ret; } #endif /* CONFIG_COMMON_CLK */ @@ -2882,15 +2866,6 @@ static void rt5682_remove(struct snd_soc_component *component) { struct rt5682_priv *rt5682 = snd_soc_component_get_drvdata(component); -#ifdef CONFIG_COMMON_CLK - int i; - - for (i = RT5682_DAI_NUM_CLKS - 1; i >= 0; --i) { - if (rt5682->dai_clks_lookup[i]) - clkdev_drop(rt5682->dai_clks_lookup[i]); - } -#endif - rt5682_reset(rt5682); } diff --git a/sound/soc/codecs/rt5682.h b/sound/soc/codecs/rt5682.h index 6d94327beae5..354acd735ef4 100644 --- a/sound/soc/codecs/rt5682.h +++ b/sound/soc/codecs/rt5682.h @@ -1411,8 +1411,6 @@ struct rt5682_priv { #ifdef CONFIG_COMMON_CLK struct clk_hw dai_clks_hw[RT5682_DAI_NUM_CLKS]; - struct clk_lookup *dai_clks_lookup[RT5682_DAI_NUM_CLKS]; - struct clk *dai_clks[RT5682_DAI_NUM_CLKS]; struct clk *mclk; #endif