All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: ak4458: Remove component probe() and remove()
@ 2022-09-08  7:31 Shengjiu Wang
  2022-09-08  8:57   ` Daniel Baluta
  2022-09-08 12:42 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Shengjiu Wang @ 2022-09-08  7:31 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel

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 <shengjiu.wang@nxp.com>
---
 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);
 
+	if (ak4458->drvdata->type == AK4497) {
+		ret = snd_soc_component_update_bits(component, AK4458_09_DSD2,
+						    0x4, (ak4458->dsd_path << 2));
+		if (ret < 0)
+			return ret;
+	}
+
 	ret = ak4458_rstn_control(component, 0);
 	if (ret)
 		return ret;
@@ -629,48 +636,6 @@ static void ak4458_reset(struct ak4458_priv *ak4458, bool active)
 	}
 }
 
-static int ak4458_init(struct snd_soc_component *component)
-{
-	struct ak4458_priv *ak4458 = 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 = snd_soc_component_update_bits(component, AK4458_00_CONTROL1,
-			    0x80, 0x80);   /* ACKS bit = 1; 10000000 */
-	if (ret < 0)
-		return ret;
-
-	if (ak4458->drvdata->type == AK4497) {
-		ret = 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 = snd_soc_component_get_drvdata(component);
-
-	ak4458->fs = 48000;
-
-	return ak4458_init(component);
-}
-
-static void ak4458_remove(struct snd_soc_component *component)
-{
-	struct ak4458_priv *ak4458 = 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 */
 
 static const struct snd_soc_component_driver soc_codec_dev_ak4458 = {
-	.probe			= ak4458_probe,
-	.remove			= ak4458_remove,
 	.controls		= ak4458_snd_controls,
 	.num_controls		= ARRAY_SIZE(ak4458_snd_controls),
 	.dapm_widgets		= ak4458_dapm_widgets,
@@ -728,8 +691,6 @@ static const struct snd_soc_component_driver soc_codec_dev_ak4458 = {
 };
 
 static const struct snd_soc_component_driver soc_codec_dev_ak4497 = {
-	.probe			= ak4458_probe,
-	.remove			= ak4458_remove,
 	.controls		= ak4497_snd_controls,
 	.num_controls		= ARRAY_SIZE(ak4497_snd_controls),
 	.dapm_widgets		= ak4497_dapm_widgets,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: ak4458: Remove component probe() and remove()
  2022-09-08  7:31 [PATCH] ASoC: ak4458: Remove component probe() and remove() Shengjiu Wang
@ 2022-09-08  8:57   ` Daniel Baluta
  2022-09-08 12:42 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Baluta @ 2022-09-08  8:57 UTC (permalink / raw)
  To: Shengjiu Wang; +Cc: lgirdwood, broonie, perex, tiwai, alsa-devel, linux-kernel

On Thu, Sep 8, 2022 at 11:03 AM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> 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 <shengjiu.wang@nxp.com>

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

> ---
>  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);
>
> +       if (ak4458->drvdata->type == AK4497) {
> +               ret = snd_soc_component_update_bits(component, AK4458_09_DSD2,
> +                                                   0x4, (ak4458->dsd_path << 2));
> +               if (ret < 0)
> +                       return ret;
> +       }
> +
>         ret = ak4458_rstn_control(component, 0);
>         if (ret)
>                 return ret;
> @@ -629,48 +636,6 @@ static void ak4458_reset(struct ak4458_priv *ak4458, bool active)
>         }
>  }
>
> -static int ak4458_init(struct snd_soc_component *component)
> -{
> -       struct ak4458_priv *ak4458 = 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 = snd_soc_component_update_bits(component, AK4458_00_CONTROL1,
> -                           0x80, 0x80);   /* ACKS bit = 1; 10000000 */
> -       if (ret < 0)
> -               return ret;
> -
> -       if (ak4458->drvdata->type == AK4497) {
> -               ret = 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 = snd_soc_component_get_drvdata(component);
> -
> -       ak4458->fs = 48000;
> -
> -       return ak4458_init(component);
> -}
> -
> -static void ak4458_remove(struct snd_soc_component *component)
> -{
> -       struct ak4458_priv *ak4458 = 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 */
>
>  static const struct snd_soc_component_driver soc_codec_dev_ak4458 = {
> -       .probe                  = ak4458_probe,
> -       .remove                 = ak4458_remove,
>         .controls               = ak4458_snd_controls,
>         .num_controls           = ARRAY_SIZE(ak4458_snd_controls),
>         .dapm_widgets           = ak4458_dapm_widgets,
> @@ -728,8 +691,6 @@ static const struct snd_soc_component_driver soc_codec_dev_ak4458 = {
>  };
>
>  static const struct snd_soc_component_driver soc_codec_dev_ak4497 = {
> -       .probe                  = ak4458_probe,
> -       .remove                 = ak4458_remove,
>         .controls               = ak4497_snd_controls,
>         .num_controls           = ARRAY_SIZE(ak4497_snd_controls),
>         .dapm_widgets           = ak4497_dapm_widgets,
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: ak4458: Remove component probe() and remove()
@ 2022-09-08  8:57   ` Daniel Baluta
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Baluta @ 2022-09-08  8:57 UTC (permalink / raw)
  To: Shengjiu Wang; +Cc: alsa-devel, lgirdwood, linux-kernel, tiwai, broonie

On Thu, Sep 8, 2022 at 11:03 AM Shengjiu Wang <shengjiu.wang@nxp.com> wrote:
>
> 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 <shengjiu.wang@nxp.com>

Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>

> ---
>  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);
>
> +       if (ak4458->drvdata->type == AK4497) {
> +               ret = snd_soc_component_update_bits(component, AK4458_09_DSD2,
> +                                                   0x4, (ak4458->dsd_path << 2));
> +               if (ret < 0)
> +                       return ret;
> +       }
> +
>         ret = ak4458_rstn_control(component, 0);
>         if (ret)
>                 return ret;
> @@ -629,48 +636,6 @@ static void ak4458_reset(struct ak4458_priv *ak4458, bool active)
>         }
>  }
>
> -static int ak4458_init(struct snd_soc_component *component)
> -{
> -       struct ak4458_priv *ak4458 = 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 = snd_soc_component_update_bits(component, AK4458_00_CONTROL1,
> -                           0x80, 0x80);   /* ACKS bit = 1; 10000000 */
> -       if (ret < 0)
> -               return ret;
> -
> -       if (ak4458->drvdata->type == AK4497) {
> -               ret = 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 = snd_soc_component_get_drvdata(component);
> -
> -       ak4458->fs = 48000;
> -
> -       return ak4458_init(component);
> -}
> -
> -static void ak4458_remove(struct snd_soc_component *component)
> -{
> -       struct ak4458_priv *ak4458 = 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 */
>
>  static const struct snd_soc_component_driver soc_codec_dev_ak4458 = {
> -       .probe                  = ak4458_probe,
> -       .remove                 = ak4458_remove,
>         .controls               = ak4458_snd_controls,
>         .num_controls           = ARRAY_SIZE(ak4458_snd_controls),
>         .dapm_widgets           = ak4458_dapm_widgets,
> @@ -728,8 +691,6 @@ static const struct snd_soc_component_driver soc_codec_dev_ak4458 = {
>  };
>
>  static const struct snd_soc_component_driver soc_codec_dev_ak4497 = {
> -       .probe                  = ak4458_probe,
> -       .remove                 = ak4458_remove,
>         .controls               = ak4497_snd_controls,
>         .num_controls           = ARRAY_SIZE(ak4497_snd_controls),
>         .dapm_widgets           = ak4497_dapm_widgets,
> --
> 2.34.1
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ASoC: ak4458: Remove component probe() and remove()
  2022-09-08  7:31 [PATCH] ASoC: ak4458: Remove component probe() and remove() Shengjiu Wang
  2022-09-08  8:57   ` Daniel Baluta
@ 2022-09-08 12:42 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2022-09-08 12:42 UTC (permalink / raw)
  To: perex, linux-kernel, lgirdwood, tiwai, alsa-devel, Shengjiu Wang

On Thu, 8 Sep 2022 15:31:56 +0800, Shengjiu Wang wrote:
> Most function in ak4458_probe() and ak4458_remove() are
> duplicate with dai ops, so remove them and move dsd_path
> setting to dai ops.
> 
> 

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: ak4458: Remove component probe() and remove()
      commit: e9e7df88996d64544178f48b0299dfe736c6aa22

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-09-08 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-08  7:31 [PATCH] ASoC: ak4458: Remove component probe() and remove() Shengjiu Wang
2022-09-08  8:57 ` Daniel Baluta
2022-09-08  8:57   ` Daniel Baluta
2022-09-08 12:42 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.