From patchwork Wed May 3 11:34:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AngeloGioacchino Del Regno X-Patchwork-Id: 13230079 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 8FB3FC7EE22 for ; Wed, 3 May 2023 11:35:23 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I+V2P0bbvh6oV8A/xPIGqCEc8GKPPt6jctPHV0BxOts=; b=EsqvPa9thVlL5v a0snQ70out6xanwR6LIt/s609BGXtrRAh1NJboEIWMeMa8Ai+D2GzXPArbv47++5ixZJflWBW5Mvk nFpe6GfYIqHBGp9u75okyYrMCXBmmPhvNNHL/2IYob8QT3NeJP8qNc3ifrWN4r2BQ5aipBNwXKsHU 4jzBFDPoLgzG4tlE6LpTz1mRfCxcRwBXMpfBlBJTT0BZP+zCcVH4P+T9/rZynYXQFZD5v/T6OfQI9 j/cC8q1sTnuHExnyMNXVpKlfErWRpgpDZdy/zWUT8Budm0h0PUsMD5T6bLbU/1IucsXy9Ted8J8K9 lz1JEogDTYHYXOLW2cuA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1puAkp-004OHz-05; Wed, 03 May 2023 11:34:39 +0000 Received: from madras.collabora.co.uk ([46.235.227.172]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1puAkg-004OB4-08; Wed, 03 May 2023 11:34:31 +0000 Received: from IcarusMOD.eternityproject.eu (unknown [IPv6:2001:b07:2ed:14ed:c5f8:7372:f042:90a2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 743AE66056D4; Wed, 3 May 2023 12:34:27 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1683113668; bh=oygimjOCk8FTKzESWYFnGtWGKI3xuJTfmDm18J1tugE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nnSLnjd9bpSYeCY/2/NZVqduUmxCHwexohgvPshz2JTllUkmyRo/njwEw9d4MwMJT 7WEzj0+RlugeL+084Qu1byhLz321QBuV8Sp92WcW9OzgyfZhtdh9RnF9AP4e5g/EHW wZvTDMxTRy+WptLhVtHFLPGx8Ifv3Vg6GQiytY7PaF4r5l1Qti/S0P4uF6QHP4VZ0S uYa3FmhoPtjBPdT4YwwzCHzPe8XQAyhTpqzOo4CW4+mImzfQm5qUEWB1WEordvvWqk Onn4CAvpadjEBcP9u3b3WgmRzKWsJ3zxVdgaTHuF3A+t+/U+XHxKLbGXCt2O6Cov0N i+M3I5tgi8W/A== From: AngeloGioacchino Del Regno To: lgirdwood@gmail.com Subject: [PATCH 5/5] ASoC: mediatek: mt8195-afe-pcm: Clean up unnecessary functions Date: Wed, 3 May 2023 13:34:13 +0200 Message-Id: <20230503113413.149235-6-angelogioacchino.delregno@collabora.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230503113413.149235-1-angelogioacchino.delregno@collabora.com> References: <20230503113413.149235-1-angelogioacchino.delregno@collabora.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230503_043430_229447_28103903 X-CRM114-Status: GOOD ( 13.21 ) 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: , Cc: alsa-devel@alsa-project.org, chunxu.li@mediatek.com, Allen-KH.Cheng@mediatek.com, tiwai@suse.com, kernel@collabora.com, yung-chuan.liao@linux.intel.com, error27@gmail.com, peter.ujfalusi@linux.intel.com, tinghan.shen@mediatek.com, pierre-louis.bossart@linux.intel.com, ranjani.sridharan@linux.intel.com, u.kleine-koenig@pengutronix.de, sound-open-firmware@alsa-project.org, ribalda@chromium.org, broonie@kernel.org, linux-mediatek@lists.infradead.org, matthias.bgg@gmail.com, perex@perex.cz, daniel.baluta@nxp.com, linux-arm-kernel@lists.infradead.org, angelogioacchino.delregno@collabora.com, kai.vehmanen@linux.intel.com, linux-kernel@vger.kernel.org, yc.hung@mediatek.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Function mt8195_afe_init_registers() performs just a single call to regmap_multi_reg_write(), it returns int and it's not error checked; move that call to the probe function and also add some error check. While at it, also move the contents of mt8195_afe_parse_of() to the probe function as well: since this is getting a handle to topckgen and since that's optional, the ifdef for CONFIG_SND_SOC_MT6359 can also be removed. Signed-off-by: AngeloGioacchino Del Regno --- sound/soc/mediatek/mt8195/mt8195-afe-pcm.c | 32 ++++++---------------- 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c index 105db11eecec..d22cf1664d8a 100644 --- a/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c +++ b/sound/soc/mediatek/mt8195/mt8195-afe-pcm.c @@ -3030,28 +3030,6 @@ static const struct reg_sequence mt8195_cg_patch[] = { { AUDIO_TOP_CON1, 0xfffffff8 }, }; -static int mt8195_afe_init_registers(struct mtk_base_afe *afe) -{ - return regmap_multi_reg_write(afe->regmap, - mt8195_afe_reg_defaults, - ARRAY_SIZE(mt8195_afe_reg_defaults)); -} - -static void mt8195_afe_parse_of(struct mtk_base_afe *afe, - struct device_node *np) -{ -#if IS_ENABLED(CONFIG_SND_SOC_MT6359) - struct mt8195_afe_private *afe_priv = afe->platform_priv; - - afe_priv->topckgen = syscon_regmap_lookup_by_phandle(afe->dev->of_node, - "mediatek,topckgen"); - if (IS_ERR(afe_priv->topckgen)) { - dev_info(afe->dev, "%s() Cannot find topckgen controller: %ld\n", - __func__, PTR_ERR(afe_priv->topckgen)); - } -#endif -} - static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) { struct mtk_base_afe *afe; @@ -3160,7 +3138,10 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) platform_set_drvdata(pdev, afe); - mt8195_afe_parse_of(afe, pdev->dev.of_node); + afe_priv->topckgen = syscon_regmap_lookup_by_phandle(dev->of_node, "mediatek,topckgen"); + if (IS_ERR(afe_priv->topckgen)) + dev_dbg(afe->dev, "Cannot find topckgen controller: %ld\n", + PTR_ERR(afe_priv->topckgen)); /* enable clock for regcache get default value from hw */ afe_priv->pm_runtime_bypass_reg_ctl = true; @@ -3219,7 +3200,10 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev) goto err_pm_put; } - mt8195_afe_init_registers(afe); + ret = regmap_multi_reg_write(afe->regmap, mt8195_afe_reg_defaults, + ARRAY_SIZE(mt8195_afe_reg_defaults)); + if (ret) + goto err_pm_put; ret = pm_runtime_put_sync(dev); if (ret)