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 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 98F1DC433F5 for ; Wed, 15 Dec 2021 08:21:38 +0000 (UTC) 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 DA88D1F19; Wed, 15 Dec 2021 09:20:45 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DA88D1F19 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1639556495; bh=yqoZCUTgjW9q/LKUilVYReXVgfi/LCgJLk5IVKXqdbw=; h=Date:From:To:Subject:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ksMSAjrE7JT3yuqTfqejl3GpBS7wlIhguw0Ouoje3B2zT3AmkNJUeX55E1k+9fFc1 VzOTIKS1/qGdOcphKLeVpcARDgFCJA40oAQxYw2tU3w0N5HoSftX+JzQrZ+mcLgN/9 WiPL50CaP6VD3AjkOBVRHGsrPHbjahFwtBtOVAt8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6DDC6F800FE; Wed, 15 Dec 2021 09:20:45 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 0ED58F800FE; Wed, 15 Dec 2021 09:20:43 +0100 (CET) Received: from mail-pf1-x42e.google.com (mail-pf1-x42e.google.com [IPv6:2607:f8b0:4864:20::42e]) (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 17979F800FE for ; Wed, 15 Dec 2021 09:20:39 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 17979F800FE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="G/3L4rDd" Received: by mail-pf1-x42e.google.com with SMTP id x5so20119249pfr.0 for ; Wed, 15 Dec 2021 00:20:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dVW69TmCJnTv5pUkbvRYzOl3hIL8o0Ev8E5MCNMu3v4=; b=G/3L4rDd1Goqt0d0b2dj/cMhsDvkaMD7Z1+8qFaNab+J/SE+VpMr8z5qIjIgg31BP3 6Rgv6T1J2UpaqpYj4Ko/HrsvNIinACGkY9Lq5IoHJmoAfHdOCZaVIS8KCXKSYD+RXgZa /tkVzDLzR++mtz40WJdnBEWAHCVJHeYyEp/qf6PSLI0VfhlzOWEmckna48+po0it3yNf LAXJXzd9ucGOc72u1drmRWGY/oxGZGNbXHlqHYO3Q1Mbr9iGZI5uUeGNv079dUH+i/uQ cRClz28G6WpGzT/Iu1lkboFSdf/KTwa+NTw7eq9XCNDI29f50wCdZFXoICXU1S0PMGXY mLOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dVW69TmCJnTv5pUkbvRYzOl3hIL8o0Ev8E5MCNMu3v4=; b=R58grPOVsb/eNN4isHw6FtmgMpIPojLc5FlXQaJ0suXOaAQZDjy+kkQve4t0g7U+42 PwbnTX8WfLBqcNE6X1m9uuJFHR1vpFWOStuX25nFjRITZeWqWd7GLIOPIPkRdagYYjKy wxiyhlKrAyWPUNZPyNHXxVGBm4h2lNk9SIe/j+8EOMxmJ01fQYgQzGVFr37w1ndYwfNx SUxpTR5yd+ZKJOFb72zF1Ry+s8GUcLKanHB42USbNAOp4oC7+GKVVxbjaxYeBIs1NS5Z FNBPoVyoD8geAgy9huWdrfx4/mzcwHc3D5yRIbg7d9cqIG2GBZGxCJjklXBYr5P45t3G uieg== X-Gm-Message-State: AOAM530FEeGemTJkTTb4Eyygw6u6enIfMDxC2URfwSYlAYQeanG6+1rv VdBPLjDvI7ezgnrFRU4ecEqwIg== X-Google-Smtp-Source: ABdhPJzqmCCROdTAh4mINIHDWtKReeWzZihdPEwTeamzuw2CuCOAX2lKwuAQZGGVSBG5s+y4UQgjig== X-Received: by 2002:a63:5350:: with SMTP id t16mr6987808pgl.321.1639556435096; Wed, 15 Dec 2021 00:20:35 -0800 (PST) Received: from google.com ([2401:fa00:1:10:754d:1c44:62a9:6d30]) by smtp.gmail.com with ESMTPSA id j127sm1679143pfg.14.2021.12.15.00.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 00:20:34 -0800 (PST) Date: Wed, 15 Dec 2021 16:20:31 +0800 From: Tzung-Bi Shih To: Trevor Wu Subject: Re: [PATCH 1/2] ASoC: mediatek: mt8195: update control for RT5682 series Message-ID: References: <20211215065835.3074-1-trevor.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211215065835.3074-1-trevor.wu@mediatek.com> Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, tiwai@suse.com, robh+dt@kernel.org, linux-kernel@vger.kernel.org, shumingf@realtek.com, broonie@kernel.org, linux-mediatek@lists.infradead.org, jiaxin.yu@mediatek.com, matthias.bgg@gmail.com, linux-arm-kernel@lists.infradead.org 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" On Wed, Dec 15, 2021 at 02:58:34PM +0800, Trevor Wu wrote: > --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c > +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c [...] > +static int mt8195_set_bias_level_post(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) > +{ > + struct snd_soc_component *component = dapm->component; > + struct mt8195_mt6359_rt1011_rt5682_priv *priv = > + snd_soc_card_get_drvdata(card); > + int ret = 0; ret doesn't need to be initialized. > + /* > + * It's required to control mclk directly in the set_bias_level_post > + * function for rt5682 and rt5682s codec, or the unexpected pop happens > + * at the end of playback. > + */ > + if (!component || > + (strcmp(component->name, RT5682_DEV0_NAME) && > + strcmp(component->name, RT5682S_DEV0_NAME))) > + return 0; > + > + if (IS_ERR(priv->i2so1_mclk)) > + return 0; I doubt if it needs to check priv->i2so1_mclk. In other words, if IS_ERR(priv->i2so1_mclk) is true in _probe, does mt8195_set_bias_level_post() get called? > + switch (level) { > + case SND_SOC_BIAS_OFF: > + if (!__clk_is_enabled(priv->i2so1_mclk)) > + return 0; > + > + dev_dbg(card->dev, "Disable i2so1"); > + clk_disable_unprepare(priv->i2so1_mclk); I would suggest move dev_dbg() later than clk_disable_unprepare() which means "Disable i2so1" is done. > + break; > + case SND_SOC_BIAS_ON: > + dev_dbg(card->dev, "Enable i2so1"); > + ret = clk_prepare_enable(priv->i2so1_mclk); > + if (ret) { > + dev_err(card->dev, "Can't enable mclk, err: %d\n", ret); The error message can be more specific. "Cannot enable i2so1" for example. > + return ret; > + } Also, I would suggest move dev_dbg() later than clk_prepare_enable(). Otherwise, it could fail to prepare or enable but still can see "Enable i2so1" message. > + break; > + default: > + break; > + } > + > + return ret; The function doesn't use any gotos. To be concise, "return 0;". > @@ -1072,6 +1119,19 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev) > return -EINVAL; > } > > + priv->i2so1_mclk = devm_clk_get(&pdev->dev, "i2so1_mclk"); > + if (IS_ERR(priv->i2so1_mclk)) { > + ret = PTR_ERR(priv->i2so1_mclk); > + if (ret == -ENOENT) { > + dev_dbg(&pdev->dev, > + "Failed to get i2so1_mclk, defer probe\n"); > + return -EPROBE_DEFER; > + } Does devm_clk_get_optional() could make the block more concise? > + > + dev_err(&pdev->dev, "Failed to get i2so1_mclk, err:%d\n", ret); If devm_clk_get() is possible to return -EPROBE_DEFER too, use dev_err_probe(). > --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c > +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c [...] > +static int mt8195_set_bias_level_post(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) > +{ > + struct snd_soc_component *component = dapm->component; > + struct mt8195_mt6359_rt1019_rt5682_priv *priv = > + snd_soc_card_get_drvdata(card); > + int ret = 0; Ditto, see comments above. > + > + /* > + * It's required to control mclk directly in the set_bias_level_post > + * function for rt5682 and rt5682s codec, or the unexpected pop happens > + * at the end of playback. > + */ > + if (!component || > + (strcmp(component->name, RT5682_DEV0_NAME) && > + strcmp(component->name, RT5682S_DEV0_NAME))) > + return 0; > + > + if (IS_ERR(priv->i2so1_mclk)) > + return 0; Ditto, see comments above. > + > + switch (level) { > + case SND_SOC_BIAS_OFF: > + if (!__clk_is_enabled(priv->i2so1_mclk)) > + return 0; > + > + dev_dbg(card->dev, "Disable i2so1"); > + clk_disable_unprepare(priv->i2so1_mclk); > + break; > + case SND_SOC_BIAS_ON: > + dev_dbg(card->dev, "Enable i2so1"); > + ret = clk_prepare_enable(priv->i2so1_mclk); > + if (ret) { > + dev_err(card->dev, "Can't enable mclk, err: %d\n", ret); > + return ret; > + } > + break; > + default: > + break; > + } Ditto, see comments above for the block. > + > + return ret; Ditto, see comments above. > @@ -1285,6 +1326,19 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) > return -EINVAL; > } > > + priv->i2so1_mclk = devm_clk_get(&pdev->dev, "i2so1_mclk"); > + if (IS_ERR(priv->i2so1_mclk)) { > + ret = PTR_ERR(priv->i2so1_mclk); > + if (ret == -ENOENT) { > + dev_dbg(&pdev->dev, > + "Failed to get i2so1_mclk, defer probe\n"); > + return -EPROBE_DEFER; > + } > + > + dev_err(&pdev->dev, "Failed to get i2so1_mclk, err:%d\n", ret); > + return ret; > + } Ditto, see comments above for the block. 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 1A8A6C433F5 for ; Wed, 15 Dec 2021 08:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ySZbXYKLTomtzvRZGavJNJcWfarsLW7iZL4Vj9OJayo=; b=YZ/6aNd9cSPyed rPu/SkPDiKCszng4AODVik6VFo+edrUs1M5MB0jguFdEN+jfOZtYL81WWBXBPvaW3g5wY65uHRYAb xAhOeAnglgpvRgykwwYmLLksWyViTbeIVPiX0crWTk91aHDn81OH5bFDu6L7fUNlYF2afKE1OGf86 5uLMHa2GG83dei1pJ4o9WDZX9niTcX80XJUJEhUlm2CbYvY3Uw3MvCoS59pwiqNcRW4L1S2CVy/bW /oEggLiUZKHgdLLAkrBisRKCrpdbipkp7il/baLzBDKkH9A9Zyz6kOwKc9+Xxo4hW4NHsQKqsoQcg D0N/YWBUatjXVtOIAOIQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxPWu-00HKuq-1v; Wed, 15 Dec 2021 08:20:52 +0000 Received: from mail-pg1-x535.google.com ([2607:f8b0:4864:20::535]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxPWh-00HKsg-6v for linux-mediatek@lists.infradead.org; Wed, 15 Dec 2021 08:20:40 +0000 Received: by mail-pg1-x535.google.com with SMTP id r138so19542487pgr.13 for ; Wed, 15 Dec 2021 00:20:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dVW69TmCJnTv5pUkbvRYzOl3hIL8o0Ev8E5MCNMu3v4=; b=G/3L4rDd1Goqt0d0b2dj/cMhsDvkaMD7Z1+8qFaNab+J/SE+VpMr8z5qIjIgg31BP3 6Rgv6T1J2UpaqpYj4Ko/HrsvNIinACGkY9Lq5IoHJmoAfHdOCZaVIS8KCXKSYD+RXgZa /tkVzDLzR++mtz40WJdnBEWAHCVJHeYyEp/qf6PSLI0VfhlzOWEmckna48+po0it3yNf LAXJXzd9ucGOc72u1drmRWGY/oxGZGNbXHlqHYO3Q1Mbr9iGZI5uUeGNv079dUH+i/uQ cRClz28G6WpGzT/Iu1lkboFSdf/KTwa+NTw7eq9XCNDI29f50wCdZFXoICXU1S0PMGXY mLOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dVW69TmCJnTv5pUkbvRYzOl3hIL8o0Ev8E5MCNMu3v4=; b=Dqg/0spNBp6B1JmvzI+eioHYMuBYsHw6yzMwzSNIRlxl3fV6aIUjGQWmdnwwcx38Pa tH+sSDNajYeHvuWedoNWSzckyST6H2AW+d3ppljXaYS+mk26uppr+DByi22GHs2GpNd9 MXbDSrDBCS7J6dcqJuJcLsFktl1LmU8opLKR4d+Ac0k/fa8BEqrcb2lsNRxfVZXSos8I hGODd/KZ8QMUrbrrEtFIWXTK796mYA0jj8dq2RX15UM3WN+p0AbUaK5qmnqX7yzeguzn MfDH9kKxEIjUZQ5mphk7oaR97ONWT+BdMitdeA57/oUat2Z6Stulrn1kzt5ICaBR+U+s ga3g== X-Gm-Message-State: AOAM533KJisSqN5hnSwoBT/PP9Il6gzj4WnpW5EI51Z/G5m2TDMFBBlJ eh9KpnugQWrvDZIt53+mWibyDTZYEaGSgg== X-Google-Smtp-Source: ABdhPJzqmCCROdTAh4mINIHDWtKReeWzZihdPEwTeamzuw2CuCOAX2lKwuAQZGGVSBG5s+y4UQgjig== X-Received: by 2002:a63:5350:: with SMTP id t16mr6987808pgl.321.1639556435096; Wed, 15 Dec 2021 00:20:35 -0800 (PST) Received: from google.com ([2401:fa00:1:10:754d:1c44:62a9:6d30]) by smtp.gmail.com with ESMTPSA id j127sm1679143pfg.14.2021.12.15.00.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 00:20:34 -0800 (PST) Date: Wed, 15 Dec 2021 16:20:31 +0800 From: Tzung-Bi Shih To: Trevor Wu Cc: broonie@kernel.org, tiwai@suse.com, robh+dt@kernel.org, matthias.bgg@gmail.com, alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, jiaxin.yu@mediatek.com, shumingf@realtek.com Subject: Re: [PATCH 1/2] ASoC: mediatek: mt8195: update control for RT5682 series Message-ID: References: <20211215065835.3074-1-trevor.wu@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211215065835.3074-1-trevor.wu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211215_002039_293528_6C76BB9E X-CRM114-Status: GOOD ( 23.81 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+linux-mediatek=archiver.kernel.org@lists.infradead.org On Wed, Dec 15, 2021 at 02:58:34PM +0800, Trevor Wu wrote: > --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c > +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c [...] > +static int mt8195_set_bias_level_post(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) > +{ > + struct snd_soc_component *component = dapm->component; > + struct mt8195_mt6359_rt1011_rt5682_priv *priv = > + snd_soc_card_get_drvdata(card); > + int ret = 0; ret doesn't need to be initialized. > + /* > + * It's required to control mclk directly in the set_bias_level_post > + * function for rt5682 and rt5682s codec, or the unexpected pop happens > + * at the end of playback. > + */ > + if (!component || > + (strcmp(component->name, RT5682_DEV0_NAME) && > + strcmp(component->name, RT5682S_DEV0_NAME))) > + return 0; > + > + if (IS_ERR(priv->i2so1_mclk)) > + return 0; I doubt if it needs to check priv->i2so1_mclk. In other words, if IS_ERR(priv->i2so1_mclk) is true in _probe, does mt8195_set_bias_level_post() get called? > + switch (level) { > + case SND_SOC_BIAS_OFF: > + if (!__clk_is_enabled(priv->i2so1_mclk)) > + return 0; > + > + dev_dbg(card->dev, "Disable i2so1"); > + clk_disable_unprepare(priv->i2so1_mclk); I would suggest move dev_dbg() later than clk_disable_unprepare() which means "Disable i2so1" is done. > + break; > + case SND_SOC_BIAS_ON: > + dev_dbg(card->dev, "Enable i2so1"); > + ret = clk_prepare_enable(priv->i2so1_mclk); > + if (ret) { > + dev_err(card->dev, "Can't enable mclk, err: %d\n", ret); The error message can be more specific. "Cannot enable i2so1" for example. > + return ret; > + } Also, I would suggest move dev_dbg() later than clk_prepare_enable(). Otherwise, it could fail to prepare or enable but still can see "Enable i2so1" message. > + break; > + default: > + break; > + } > + > + return ret; The function doesn't use any gotos. To be concise, "return 0;". > @@ -1072,6 +1119,19 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev) > return -EINVAL; > } > > + priv->i2so1_mclk = devm_clk_get(&pdev->dev, "i2so1_mclk"); > + if (IS_ERR(priv->i2so1_mclk)) { > + ret = PTR_ERR(priv->i2so1_mclk); > + if (ret == -ENOENT) { > + dev_dbg(&pdev->dev, > + "Failed to get i2so1_mclk, defer probe\n"); > + return -EPROBE_DEFER; > + } Does devm_clk_get_optional() could make the block more concise? > + > + dev_err(&pdev->dev, "Failed to get i2so1_mclk, err:%d\n", ret); If devm_clk_get() is possible to return -EPROBE_DEFER too, use dev_err_probe(). > --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c > +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c [...] > +static int mt8195_set_bias_level_post(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) > +{ > + struct snd_soc_component *component = dapm->component; > + struct mt8195_mt6359_rt1019_rt5682_priv *priv = > + snd_soc_card_get_drvdata(card); > + int ret = 0; Ditto, see comments above. > + > + /* > + * It's required to control mclk directly in the set_bias_level_post > + * function for rt5682 and rt5682s codec, or the unexpected pop happens > + * at the end of playback. > + */ > + if (!component || > + (strcmp(component->name, RT5682_DEV0_NAME) && > + strcmp(component->name, RT5682S_DEV0_NAME))) > + return 0; > + > + if (IS_ERR(priv->i2so1_mclk)) > + return 0; Ditto, see comments above. > + > + switch (level) { > + case SND_SOC_BIAS_OFF: > + if (!__clk_is_enabled(priv->i2so1_mclk)) > + return 0; > + > + dev_dbg(card->dev, "Disable i2so1"); > + clk_disable_unprepare(priv->i2so1_mclk); > + break; > + case SND_SOC_BIAS_ON: > + dev_dbg(card->dev, "Enable i2so1"); > + ret = clk_prepare_enable(priv->i2so1_mclk); > + if (ret) { > + dev_err(card->dev, "Can't enable mclk, err: %d\n", ret); > + return ret; > + } > + break; > + default: > + break; > + } Ditto, see comments above for the block. > + > + return ret; Ditto, see comments above. > @@ -1285,6 +1326,19 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) > return -EINVAL; > } > > + priv->i2so1_mclk = devm_clk_get(&pdev->dev, "i2so1_mclk"); > + if (IS_ERR(priv->i2so1_mclk)) { > + ret = PTR_ERR(priv->i2so1_mclk); > + if (ret == -ENOENT) { > + dev_dbg(&pdev->dev, > + "Failed to get i2so1_mclk, defer probe\n"); > + return -EPROBE_DEFER; > + } > + > + dev_err(&pdev->dev, "Failed to get i2so1_mclk, err:%d\n", ret); > + return ret; > + } Ditto, see comments above for the block. _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 660BFC433EF for ; Wed, 15 Dec 2021 08:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=C6rSvFMkpqR5n5K4Y6vef8xNglUAeLYpfcpWDBFv27Y=; b=Mf1ZSe0WwG3Wma wi06f0aLX1ztuKWOG78HPvvewxDVDSLwqVpr8QqpyChpYVuPCSA6HIVhmsBTwt9UHEQBu48l8bAK1 aRjLW/QkA9W9atKfnRzY6JvOVcv5l2YffyUjnYw7KJCr5CjI/zxGNbJMKmIE4FAg9QEo/arHgcGV2 iBGcAx5I5q6moPJbWhBMOkkVg9rUIJ+d8yj/ET71/fLbbfiCR9cNhNdbBnzYzdlVJsnksyS+F1BCC CkLXIymwjx87LkeXUgi80tYpfx4SiOiabJC2xztKRiCJfkxv1kIbWoj2N8tsoAr60rEFlsGiIAyHp 4zr7mMff5kq1AswjoBNw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxPWl-00HKtw-1u; Wed, 15 Dec 2021 08:20:43 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxPWh-00HKsh-6o for linux-arm-kernel@lists.infradead.org; Wed, 15 Dec 2021 08:20:40 +0000 Received: by mail-pf1-x42b.google.com with SMTP id o4so20002728pfp.13 for ; Wed, 15 Dec 2021 00:20:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dVW69TmCJnTv5pUkbvRYzOl3hIL8o0Ev8E5MCNMu3v4=; b=G/3L4rDd1Goqt0d0b2dj/cMhsDvkaMD7Z1+8qFaNab+J/SE+VpMr8z5qIjIgg31BP3 6Rgv6T1J2UpaqpYj4Ko/HrsvNIinACGkY9Lq5IoHJmoAfHdOCZaVIS8KCXKSYD+RXgZa /tkVzDLzR++mtz40WJdnBEWAHCVJHeYyEp/qf6PSLI0VfhlzOWEmckna48+po0it3yNf LAXJXzd9ucGOc72u1drmRWGY/oxGZGNbXHlqHYO3Q1Mbr9iGZI5uUeGNv079dUH+i/uQ cRClz28G6WpGzT/Iu1lkboFSdf/KTwa+NTw7eq9XCNDI29f50wCdZFXoICXU1S0PMGXY mLOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dVW69TmCJnTv5pUkbvRYzOl3hIL8o0Ev8E5MCNMu3v4=; b=y0vkuneqQx8nbcD95nRUXNdR4BTSCyI3r/EZpWIwV1etd6dw23krQend5U9XpcHBTS mdtAAWB1A+S0ssNc0Tk6Awvu+nmIyx9UlUuazUwL1gpC2jOt4Ot6I4l+TIjf56SMALaK axMHhwDBdfT6BzHlcrsFbt5/n6yASYHuHfbNAI6/OrwZGYoeoCd+f+F+kxksuVd55Y55 SQdQKl1Ou2GBlUrUtlxh+bts+XA3aASa4oDM5DEYweOJ1KZiP4p7uVdoK6sOKUXvTQQX LePTaXGYSWXOyzcB28/fn2r8sXCLiykhzXhB0VFdx6Qsao0O+Smae8od951F0ccxN74n oQWw== X-Gm-Message-State: AOAM5308OSJs6ox/OeKMp/uOqJp+j5iwtvnYDmOXhIenPpSuyhB2iWe3 +he9ejkz5lIO1wQffHNP525nuw== X-Google-Smtp-Source: ABdhPJzqmCCROdTAh4mINIHDWtKReeWzZihdPEwTeamzuw2CuCOAX2lKwuAQZGGVSBG5s+y4UQgjig== X-Received: by 2002:a63:5350:: with SMTP id t16mr6987808pgl.321.1639556435096; Wed, 15 Dec 2021 00:20:35 -0800 (PST) Received: from google.com ([2401:fa00:1:10:754d:1c44:62a9:6d30]) by smtp.gmail.com with ESMTPSA id j127sm1679143pfg.14.2021.12.15.00.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 00:20:34 -0800 (PST) Date: Wed, 15 Dec 2021 16:20:31 +0800 From: Tzung-Bi Shih To: Trevor Wu Cc: broonie@kernel.org, tiwai@suse.com, robh+dt@kernel.org, matthias.bgg@gmail.com, alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, jiaxin.yu@mediatek.com, shumingf@realtek.com Subject: Re: [PATCH 1/2] ASoC: mediatek: mt8195: update control for RT5682 series Message-ID: References: <20211215065835.3074-1-trevor.wu@mediatek.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211215065835.3074-1-trevor.wu@mediatek.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211215_002039_292841_F85DADB9 X-CRM114-Status: GOOD ( 25.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Dec 15, 2021 at 02:58:34PM +0800, Trevor Wu wrote: > --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c > +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c [...] > +static int mt8195_set_bias_level_post(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) > +{ > + struct snd_soc_component *component = dapm->component; > + struct mt8195_mt6359_rt1011_rt5682_priv *priv = > + snd_soc_card_get_drvdata(card); > + int ret = 0; ret doesn't need to be initialized. > + /* > + * It's required to control mclk directly in the set_bias_level_post > + * function for rt5682 and rt5682s codec, or the unexpected pop happens > + * at the end of playback. > + */ > + if (!component || > + (strcmp(component->name, RT5682_DEV0_NAME) && > + strcmp(component->name, RT5682S_DEV0_NAME))) > + return 0; > + > + if (IS_ERR(priv->i2so1_mclk)) > + return 0; I doubt if it needs to check priv->i2so1_mclk. In other words, if IS_ERR(priv->i2so1_mclk) is true in _probe, does mt8195_set_bias_level_post() get called? > + switch (level) { > + case SND_SOC_BIAS_OFF: > + if (!__clk_is_enabled(priv->i2so1_mclk)) > + return 0; > + > + dev_dbg(card->dev, "Disable i2so1"); > + clk_disable_unprepare(priv->i2so1_mclk); I would suggest move dev_dbg() later than clk_disable_unprepare() which means "Disable i2so1" is done. > + break; > + case SND_SOC_BIAS_ON: > + dev_dbg(card->dev, "Enable i2so1"); > + ret = clk_prepare_enable(priv->i2so1_mclk); > + if (ret) { > + dev_err(card->dev, "Can't enable mclk, err: %d\n", ret); The error message can be more specific. "Cannot enable i2so1" for example. > + return ret; > + } Also, I would suggest move dev_dbg() later than clk_prepare_enable(). Otherwise, it could fail to prepare or enable but still can see "Enable i2so1" message. > + break; > + default: > + break; > + } > + > + return ret; The function doesn't use any gotos. To be concise, "return 0;". > @@ -1072,6 +1119,19 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev) > return -EINVAL; > } > > + priv->i2so1_mclk = devm_clk_get(&pdev->dev, "i2so1_mclk"); > + if (IS_ERR(priv->i2so1_mclk)) { > + ret = PTR_ERR(priv->i2so1_mclk); > + if (ret == -ENOENT) { > + dev_dbg(&pdev->dev, > + "Failed to get i2so1_mclk, defer probe\n"); > + return -EPROBE_DEFER; > + } Does devm_clk_get_optional() could make the block more concise? > + > + dev_err(&pdev->dev, "Failed to get i2so1_mclk, err:%d\n", ret); If devm_clk_get() is possible to return -EPROBE_DEFER too, use dev_err_probe(). > --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c > +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c [...] > +static int mt8195_set_bias_level_post(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) > +{ > + struct snd_soc_component *component = dapm->component; > + struct mt8195_mt6359_rt1019_rt5682_priv *priv = > + snd_soc_card_get_drvdata(card); > + int ret = 0; Ditto, see comments above. > + > + /* > + * It's required to control mclk directly in the set_bias_level_post > + * function for rt5682 and rt5682s codec, or the unexpected pop happens > + * at the end of playback. > + */ > + if (!component || > + (strcmp(component->name, RT5682_DEV0_NAME) && > + strcmp(component->name, RT5682S_DEV0_NAME))) > + return 0; > + > + if (IS_ERR(priv->i2so1_mclk)) > + return 0; Ditto, see comments above. > + > + switch (level) { > + case SND_SOC_BIAS_OFF: > + if (!__clk_is_enabled(priv->i2so1_mclk)) > + return 0; > + > + dev_dbg(card->dev, "Disable i2so1"); > + clk_disable_unprepare(priv->i2so1_mclk); > + break; > + case SND_SOC_BIAS_ON: > + dev_dbg(card->dev, "Enable i2so1"); > + ret = clk_prepare_enable(priv->i2so1_mclk); > + if (ret) { > + dev_err(card->dev, "Can't enable mclk, err: %d\n", ret); > + return ret; > + } > + break; > + default: > + break; > + } Ditto, see comments above for the block. > + > + return ret; Ditto, see comments above. > @@ -1285,6 +1326,19 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) > return -EINVAL; > } > > + priv->i2so1_mclk = devm_clk_get(&pdev->dev, "i2so1_mclk"); > + if (IS_ERR(priv->i2so1_mclk)) { > + ret = PTR_ERR(priv->i2so1_mclk); > + if (ret == -ENOENT) { > + dev_dbg(&pdev->dev, > + "Failed to get i2so1_mclk, defer probe\n"); > + return -EPROBE_DEFER; > + } > + > + dev_err(&pdev->dev, "Failed to get i2so1_mclk, err:%d\n", ret); > + return ret; > + } Ditto, see comments above for the block. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C57AEC433EF for ; Wed, 15 Dec 2021 08:20:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240776AbhLOIUg (ORCPT ); Wed, 15 Dec 2021 03:20:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235661AbhLOIUg (ORCPT ); Wed, 15 Dec 2021 03:20:36 -0500 Received: from mail-pg1-x52c.google.com (mail-pg1-x52c.google.com [IPv6:2607:f8b0:4864:20::52c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E9178C061574 for ; Wed, 15 Dec 2021 00:20:35 -0800 (PST) Received: by mail-pg1-x52c.google.com with SMTP id 133so19555603pgc.12 for ; Wed, 15 Dec 2021 00:20:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=dVW69TmCJnTv5pUkbvRYzOl3hIL8o0Ev8E5MCNMu3v4=; b=G/3L4rDd1Goqt0d0b2dj/cMhsDvkaMD7Z1+8qFaNab+J/SE+VpMr8z5qIjIgg31BP3 6Rgv6T1J2UpaqpYj4Ko/HrsvNIinACGkY9Lq5IoHJmoAfHdOCZaVIS8KCXKSYD+RXgZa /tkVzDLzR++mtz40WJdnBEWAHCVJHeYyEp/qf6PSLI0VfhlzOWEmckna48+po0it3yNf LAXJXzd9ucGOc72u1drmRWGY/oxGZGNbXHlqHYO3Q1Mbr9iGZI5uUeGNv079dUH+i/uQ cRClz28G6WpGzT/Iu1lkboFSdf/KTwa+NTw7eq9XCNDI29f50wCdZFXoICXU1S0PMGXY mLOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=dVW69TmCJnTv5pUkbvRYzOl3hIL8o0Ev8E5MCNMu3v4=; b=naVXBb2RPCToGKIBmXSOvH6YmpHKdORzTyjqnJrACC/Er0J2LGFlkKcJWwwUCfXTkL STXexVlKIDuovpg0EtNzANgU5q28NOTNhrEVIxJHrgHC6xEOZmzPA6gOoNzUe0x3TitF xv+vlx0syupbQyNIU2J7SZPUcZpvo970tAXEHUzBNwaF1QA9Y6Wzpx4uLggGtEFh6ArI EIeBJEQCH1aUccH4wFUpNXQq6SM8CHcILKFEgmh6RP5bpV0QbKidvaDN8O59QUxz+jZP VRiQfIjHPcIgNfNoaij0vRRM+3MwloBOBqxNi7ZLX4cC341s20VEfgpbt9IL3zMGNuW7 p15Q== X-Gm-Message-State: AOAM532faH2BUmaiorxyXPtcvjnjmvmFqWLndLYhoDxCeN3DPObQBi31 MBRYxBSiRXCeq4B2UzdlY4ysqw== X-Google-Smtp-Source: ABdhPJzqmCCROdTAh4mINIHDWtKReeWzZihdPEwTeamzuw2CuCOAX2lKwuAQZGGVSBG5s+y4UQgjig== X-Received: by 2002:a63:5350:: with SMTP id t16mr6987808pgl.321.1639556435096; Wed, 15 Dec 2021 00:20:35 -0800 (PST) Received: from google.com ([2401:fa00:1:10:754d:1c44:62a9:6d30]) by smtp.gmail.com with ESMTPSA id j127sm1679143pfg.14.2021.12.15.00.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 00:20:34 -0800 (PST) Date: Wed, 15 Dec 2021 16:20:31 +0800 From: Tzung-Bi Shih To: Trevor Wu Cc: broonie@kernel.org, tiwai@suse.com, robh+dt@kernel.org, matthias.bgg@gmail.com, alsa-devel@alsa-project.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, jiaxin.yu@mediatek.com, shumingf@realtek.com Subject: Re: [PATCH 1/2] ASoC: mediatek: mt8195: update control for RT5682 series Message-ID: References: <20211215065835.3074-1-trevor.wu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211215065835.3074-1-trevor.wu@mediatek.com> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Wed, Dec 15, 2021 at 02:58:34PM +0800, Trevor Wu wrote: > --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c > +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1011-rt5682.c [...] > +static int mt8195_set_bias_level_post(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) > +{ > + struct snd_soc_component *component = dapm->component; > + struct mt8195_mt6359_rt1011_rt5682_priv *priv = > + snd_soc_card_get_drvdata(card); > + int ret = 0; ret doesn't need to be initialized. > + /* > + * It's required to control mclk directly in the set_bias_level_post > + * function for rt5682 and rt5682s codec, or the unexpected pop happens > + * at the end of playback. > + */ > + if (!component || > + (strcmp(component->name, RT5682_DEV0_NAME) && > + strcmp(component->name, RT5682S_DEV0_NAME))) > + return 0; > + > + if (IS_ERR(priv->i2so1_mclk)) > + return 0; I doubt if it needs to check priv->i2so1_mclk. In other words, if IS_ERR(priv->i2so1_mclk) is true in _probe, does mt8195_set_bias_level_post() get called? > + switch (level) { > + case SND_SOC_BIAS_OFF: > + if (!__clk_is_enabled(priv->i2so1_mclk)) > + return 0; > + > + dev_dbg(card->dev, "Disable i2so1"); > + clk_disable_unprepare(priv->i2so1_mclk); I would suggest move dev_dbg() later than clk_disable_unprepare() which means "Disable i2so1" is done. > + break; > + case SND_SOC_BIAS_ON: > + dev_dbg(card->dev, "Enable i2so1"); > + ret = clk_prepare_enable(priv->i2so1_mclk); > + if (ret) { > + dev_err(card->dev, "Can't enable mclk, err: %d\n", ret); The error message can be more specific. "Cannot enable i2so1" for example. > + return ret; > + } Also, I would suggest move dev_dbg() later than clk_prepare_enable(). Otherwise, it could fail to prepare or enable but still can see "Enable i2so1" message. > + break; > + default: > + break; > + } > + > + return ret; The function doesn't use any gotos. To be concise, "return 0;". > @@ -1072,6 +1119,19 @@ static int mt8195_mt6359_rt1011_rt5682_dev_probe(struct platform_device *pdev) > return -EINVAL; > } > > + priv->i2so1_mclk = devm_clk_get(&pdev->dev, "i2so1_mclk"); > + if (IS_ERR(priv->i2so1_mclk)) { > + ret = PTR_ERR(priv->i2so1_mclk); > + if (ret == -ENOENT) { > + dev_dbg(&pdev->dev, > + "Failed to get i2so1_mclk, defer probe\n"); > + return -EPROBE_DEFER; > + } Does devm_clk_get_optional() could make the block more concise? > + > + dev_err(&pdev->dev, "Failed to get i2so1_mclk, err:%d\n", ret); If devm_clk_get() is possible to return -EPROBE_DEFER too, use dev_err_probe(). > --- a/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c > +++ b/sound/soc/mediatek/mt8195/mt8195-mt6359-rt1019-rt5682.c [...] > +static int mt8195_set_bias_level_post(struct snd_soc_card *card, > + struct snd_soc_dapm_context *dapm, enum snd_soc_bias_level level) > +{ > + struct snd_soc_component *component = dapm->component; > + struct mt8195_mt6359_rt1019_rt5682_priv *priv = > + snd_soc_card_get_drvdata(card); > + int ret = 0; Ditto, see comments above. > + > + /* > + * It's required to control mclk directly in the set_bias_level_post > + * function for rt5682 and rt5682s codec, or the unexpected pop happens > + * at the end of playback. > + */ > + if (!component || > + (strcmp(component->name, RT5682_DEV0_NAME) && > + strcmp(component->name, RT5682S_DEV0_NAME))) > + return 0; > + > + if (IS_ERR(priv->i2so1_mclk)) > + return 0; Ditto, see comments above. > + > + switch (level) { > + case SND_SOC_BIAS_OFF: > + if (!__clk_is_enabled(priv->i2so1_mclk)) > + return 0; > + > + dev_dbg(card->dev, "Disable i2so1"); > + clk_disable_unprepare(priv->i2so1_mclk); > + break; > + case SND_SOC_BIAS_ON: > + dev_dbg(card->dev, "Enable i2so1"); > + ret = clk_prepare_enable(priv->i2so1_mclk); > + if (ret) { > + dev_err(card->dev, "Can't enable mclk, err: %d\n", ret); > + return ret; > + } > + break; > + default: > + break; > + } Ditto, see comments above for the block. > + > + return ret; Ditto, see comments above. > @@ -1285,6 +1326,19 @@ static int mt8195_mt6359_rt1019_rt5682_dev_probe(struct platform_device *pdev) > return -EINVAL; > } > > + priv->i2so1_mclk = devm_clk_get(&pdev->dev, "i2so1_mclk"); > + if (IS_ERR(priv->i2so1_mclk)) { > + ret = PTR_ERR(priv->i2so1_mclk); > + if (ret == -ENOENT) { > + dev_dbg(&pdev->dev, > + "Failed to get i2so1_mclk, defer probe\n"); > + return -EPROBE_DEFER; > + } > + > + dev_err(&pdev->dev, "Failed to get i2so1_mclk, err:%d\n", ret); > + return ret; > + } Ditto, see comments above for the block.