From nobody Mon Apr 6 09:42:45 2026 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 A46F5C38145 for ; Thu, 8 Sep 2022 07:50:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231232AbiIHHuJ (ORCPT ); Thu, 8 Sep 2022 03:50:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231231AbiIHHuG (ORCPT ); Thu, 8 Sep 2022 03:50:06 -0400 Received: from inva020.nxp.com (inva020.nxp.com [92.121.34.13]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE50E5465E for ; Thu, 8 Sep 2022 00:50:03 -0700 (PDT) Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 94F331A0EDB; Thu, 8 Sep 2022 09:50:01 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 686241A0ED8; Thu, 8 Sep 2022 09:50:01 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 465B0180031F; Thu, 8 Sep 2022 15:50:00 +0800 (+08) From: Shengjiu Wang To: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: ak4458: Remove component probe() and remove() Date: Thu, 8 Sep 2022 15:31:56 +0800 Message-Id: <1662622316-23426-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Most function in ak4458_probe() and ak4458_remove() are duplicate with dai ops, so remove them and move dsd_path setting to dai ops. Signed-off-by: Shengjiu Wang Reviewed-by: Daniel Baluta --- sound/soc/codecs/ak4458.c | 53 ++++++--------------------------------- 1 file changed, 7 insertions(+), 46 deletions(-) diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c index ea33cc83c86c..b534212096ee 100644 --- a/sound/soc/codecs/ak4458.c +++ b/sound/soc/codecs/ak4458.c @@ -447,6 +447,13 @@ static int ak4458_hw_params(struct snd_pcm_substream *= substream, snd_soc_component_update_bits(component, AK4458_0B_CONTROL7, AK4458_DCHAIN_MASK, dchn); =20 + if (ak4458->drvdata->type =3D=3D AK4497) { + ret =3D snd_soc_component_update_bits(component, AK4458_09_DSD2, + 0x4, (ak4458->dsd_path << 2)); + if (ret < 0) + return ret; + } + ret =3D ak4458_rstn_control(component, 0); if (ret) return ret; @@ -629,48 +636,6 @@ static void ak4458_reset(struct ak4458_priv *ak4458, b= ool active) } } =20 -static int ak4458_init(struct snd_soc_component *component) -{ - struct ak4458_priv *ak4458 =3D snd_soc_component_get_drvdata(component); - int ret; - - /* External Mute ON */ - if (ak4458->mute_gpiod) - gpiod_set_value_cansleep(ak4458->mute_gpiod, 1); - - ak4458_reset(ak4458, false); - - ret =3D snd_soc_component_update_bits(component, AK4458_00_CONTROL1, - 0x80, 0x80); /* ACKS bit =3D 1; 10000000 */ - if (ret < 0) - return ret; - - if (ak4458->drvdata->type =3D=3D AK4497) { - ret =3D snd_soc_component_update_bits(component, AK4458_09_DSD2, - 0x4, (ak4458->dsd_path << 2)); - if (ret < 0) - return ret; - } - - return ak4458_rstn_control(component, 1); -} - -static int ak4458_probe(struct snd_soc_component *component) -{ - struct ak4458_priv *ak4458 =3D snd_soc_component_get_drvdata(component); - - ak4458->fs =3D 48000; - - return ak4458_init(component); -} - -static void ak4458_remove(struct snd_soc_component *component) -{ - struct ak4458_priv *ak4458 =3D snd_soc_component_get_drvdata(component); - - ak4458_reset(ak4458, true); -} - #ifdef CONFIG_PM static int __maybe_unused ak4458_runtime_suspend(struct device *dev) { @@ -714,8 +679,6 @@ static int __maybe_unused ak4458_runtime_resume(struct = device *dev) #endif /* CONFIG_PM */ =20 static const struct snd_soc_component_driver soc_codec_dev_ak4458 =3D { - .probe =3D ak4458_probe, - .remove =3D ak4458_remove, .controls =3D ak4458_snd_controls, .num_controls =3D ARRAY_SIZE(ak4458_snd_controls), .dapm_widgets =3D ak4458_dapm_widgets, @@ -728,8 +691,6 @@ static const struct snd_soc_component_driver soc_codec_= dev_ak4458 =3D { }; =20 static const struct snd_soc_component_driver soc_codec_dev_ak4497 =3D { - .probe =3D ak4458_probe, - .remove =3D ak4458_remove, .controls =3D ak4497_snd_controls, .num_controls =3D ARRAY_SIZE(ak4497_snd_controls), .dapm_widgets =3D ak4497_dapm_widgets, --=20 2.34.1