[alsa-devel] [PATCH 0/4] ASoC: missing replace codec to component
Hi Mark
These are new added driver on mark/for-next branch, but based on old "codec" framework. We want to convert it to component. These patches are do it
Kuninori Morimoto (4): ASoC: intel: kbl_da7219_max98357: replace codec to component ASoC: amd: acp-da7219-max98357: replace codec to component ASoC: ak4458: replace codec to component ASoC: ak5558: replace codec to component
sound/soc/amd/acp-da7219-max98357a.c | 4 +- sound/soc/codecs/ak4458.c | 105 +++++++++++++------------- sound/soc/codecs/ak5558.c | 65 ++++++++-------- sound/soc/intel/boards/kbl_da7219_max98357a.c | 12 +-- 4 files changed, 94 insertions(+), 92 deletions(-)
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Now we can replace Codec to Component. Let's do it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/intel/boards/kbl_da7219_max98357a.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c index d689124..e84baaf 100644 --- a/sound/soc/intel/boards/kbl_da7219_max98357a.c +++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c @@ -168,7 +168,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) { struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card); - struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_component *component = rtd->codec_dai->component; struct snd_soc_jack *jack; int ret;
@@ -191,7 +191,7 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP); snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); - da7219_aad_jack_det(codec, &ctx->kabylake_headset); + da7219_aad_jack_det(component, &ctx->kabylake_headset);
ret = snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC"); if (ret) @@ -522,12 +522,12 @@ static int kabylake_card_late_probe(struct snd_soc_card *card) { struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(card); struct kbl_hdmi_pcm *pcm; - struct snd_soc_codec *codec = NULL; + struct snd_soc_component *component = NULL; int err, i = 0; char jack_name[NAME_SIZE];
list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { - codec = pcm->codec_dai->codec; + component = pcm->codec_dai->component; snprintf(jack_name, sizeof(jack_name), "HDMI/DP, pcm=%d Jack", pcm->device); err = snd_soc_card_jack_new(card, jack_name, @@ -546,10 +546,10 @@ static int kabylake_card_late_probe(struct snd_soc_card *card)
}
- if (!codec) + if (!component) return -EINVAL;
- return hdac_hdmi_jack_port_init(codec, &card->dapm); + return hdac_hdmi_jack_port_init(component, &card->dapm); }
/* kabylake audio machine driver for SPT + DA7219 */
The patch
ASoC: intel: kbl_da7219_max98357: replace codec to component
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
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
From 257aaceb63eb2337e50cd9f9008d11df2cb86207 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 19 Feb 2018 04:15:38 +0000 Subject: [PATCH] ASoC: intel: kbl_da7219_max98357: replace codec to component
Now we can replace Codec to Component. Let's do it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/intel/boards/kbl_da7219_max98357a.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/soc/intel/boards/kbl_da7219_max98357a.c b/sound/soc/intel/boards/kbl_da7219_max98357a.c index d689124f6687..e84baafd5f63 100644 --- a/sound/soc/intel/boards/kbl_da7219_max98357a.c +++ b/sound/soc/intel/boards/kbl_da7219_max98357a.c @@ -168,7 +168,7 @@ static int kabylake_ssp_fixup(struct snd_soc_pcm_runtime *rtd, static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) { struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(rtd->card); - struct snd_soc_codec *codec = rtd->codec; + struct snd_soc_component *component = rtd->codec_dai->component; struct snd_soc_jack *jack; int ret;
@@ -191,7 +191,7 @@ static int kabylake_da7219_codec_init(struct snd_soc_pcm_runtime *rtd) snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOLUMEUP); snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEDOWN); snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOICECOMMAND); - da7219_aad_jack_det(codec, &ctx->kabylake_headset); + da7219_aad_jack_det(component, &ctx->kabylake_headset);
ret = snd_soc_dapm_ignore_suspend(&rtd->card->dapm, "SoC DMIC"); if (ret) @@ -522,12 +522,12 @@ static int kabylake_card_late_probe(struct snd_soc_card *card) { struct kbl_codec_private *ctx = snd_soc_card_get_drvdata(card); struct kbl_hdmi_pcm *pcm; - struct snd_soc_codec *codec = NULL; + struct snd_soc_component *component = NULL; int err, i = 0; char jack_name[NAME_SIZE];
list_for_each_entry(pcm, &ctx->hdmi_pcm_list, head) { - codec = pcm->codec_dai->codec; + component = pcm->codec_dai->component; snprintf(jack_name, sizeof(jack_name), "HDMI/DP, pcm=%d Jack", pcm->device); err = snd_soc_card_jack_new(card, jack_name, @@ -546,10 +546,10 @@ static int kabylake_card_late_probe(struct snd_soc_card *card)
}
- if (!codec) + if (!component) return -EINVAL;
- return hdac_hdmi_jack_port_init(codec, &card->dapm); + return hdac_hdmi_jack_port_init(component, &card->dapm); }
/* kabylake audio machine driver for SPT + DA7219 */
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Now we can replace Codec to Component. Let's do it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/amd/acp-da7219-max98357a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index e51a878..bbe0f10 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -47,8 +47,8 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) { int ret; struct snd_soc_card *card = rtd->card; - struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_component *component = codec_dai->component;
dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
@@ -76,7 +76,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) return ret; }
- da7219_aad_jack_det(codec, &cz_jack); + da7219_aad_jack_det(component, &cz_jack);
return 0; }
The patch
ASoC: amd: acp-da7219-max98357: replace codec to component
has been applied to the asoc tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git
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
From 9a60cde2dd63e10b421e87e1397641304dd1ef13 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Date: Mon, 19 Feb 2018 04:16:06 +0000 Subject: [PATCH] ASoC: amd: acp-da7219-max98357: replace codec to component
Now we can replace Codec to Component. Let's do it.
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com Signed-off-by: Mark Brown broonie@kernel.org --- sound/soc/amd/acp-da7219-max98357a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/amd/acp-da7219-max98357a.c b/sound/soc/amd/acp-da7219-max98357a.c index e51a878890ce..bbe0f103e6a8 100644 --- a/sound/soc/amd/acp-da7219-max98357a.c +++ b/sound/soc/amd/acp-da7219-max98357a.c @@ -47,8 +47,8 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) { int ret; struct snd_soc_card *card = rtd->card; - struct snd_soc_codec *codec = rtd->codec; struct snd_soc_dai *codec_dai = rtd->codec_dai; + struct snd_soc_component *component = codec_dai->component;
dev_info(rtd->dev, "codec dai name = %s\n", codec_dai->name);
@@ -76,7 +76,7 @@ static int cz_da7219_init(struct snd_soc_pcm_runtime *rtd) return ret; }
- da7219_aad_jack_det(codec, &cz_jack); + da7219_aad_jack_det(component, &cz_jack);
return 0; }
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Now we can replace Codec to Component. Let's do it.
Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/codecs/ak4458.c | 105 +++++++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 52 deletions(-)
diff --git a/sound/soc/codecs/ak4458.c b/sound/soc/codecs/ak4458.c index c976216..ba85c52 100644 --- a/sound/soc/codecs/ak4458.c +++ b/sound/soc/codecs/ak4458.c @@ -167,8 +167,8 @@ struct ak4458_priv { static int get_digfil(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct ak4458_priv *ak4458 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
ucontrol->value.enumerated.item[0] = ak4458->digfil;
@@ -178,8 +178,8 @@ static int get_digfil(struct snd_kcontrol *kcontrol, static int set_digfil(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); - struct ak4458_priv *ak4458 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); + struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); int num;
num = ucontrol->value.enumerated.item[0]; @@ -189,17 +189,17 @@ static int set_digfil(struct snd_kcontrol *kcontrol, ak4458->digfil = num;
/* write SD bit */ - snd_soc_update_bits(codec, AK4458_01_CONTROL2, + snd_soc_component_update_bits(component, AK4458_01_CONTROL2, AK4458_SD_MASK, ((ak4458->digfil & 0x02) << 4));
/* write SLOW bit */ - snd_soc_update_bits(codec, AK4458_02_CONTROL3, + snd_soc_component_update_bits(component, AK4458_02_CONTROL3, AK4458_SLOW_MASK, (ak4458->digfil & 0x01));
/* write SSLOW bit */ - snd_soc_update_bits(codec, AK4458_05_CONTROL4, + snd_soc_component_update_bits(component, AK4458_05_CONTROL4, AK4458_SSLOW_MASK, ((ak4458->digfil & 0x04) >> 2));
@@ -259,17 +259,17 @@ static int set_digfil(struct snd_kcontrol *kcontrol, {"AK4458 AOUTD", NULL, "AK4458 DAC4"}, };
-static int ak4458_rstn_control(struct snd_soc_codec *codec, int bit) +static int ak4458_rstn_control(struct snd_soc_component *component, int bit) { int ret;
if (bit) - ret = snd_soc_update_bits(codec, + ret = snd_soc_component_update_bits(component, AK4458_00_CONTROL1, AK4458_RSTN_MASK, 0x1); else - ret = snd_soc_update_bits(codec, + ret = snd_soc_component_update_bits(component, AK4458_00_CONTROL1, AK4458_RSTN_MASK, 0x0); @@ -280,8 +280,8 @@ static int ak4458_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct ak4458_priv *ak4458 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); int pcm_width = max(params_physical_width(params), ak4458->slot_width); int nfs1; u8 format; @@ -290,7 +290,7 @@ static int ak4458_hw_params(struct snd_pcm_substream *substream, ak4458->fs = nfs1;
/* Master Clock Frequency Auto Setting Mode Enable */ - snd_soc_update_bits(codec, AK4458_00_CONTROL1, 0x80, 0x80); + snd_soc_component_update_bits(component, AK4458_00_CONTROL1, 0x80, 0x80);
switch (pcm_width) { case 16: @@ -321,19 +321,19 @@ static int ak4458_hw_params(struct snd_pcm_substream *substream, return -EINVAL; }
- snd_soc_update_bits(codec, AK4458_00_CONTROL1, + snd_soc_component_update_bits(component, AK4458_00_CONTROL1, AK4458_DIF_MASK, format);
- ak4458_rstn_control(codec, 0); - ak4458_rstn_control(codec, 1); + ak4458_rstn_control(component, 0); + ak4458_rstn_control(component, 1);
return 0; }
static int ak4458_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec = dai->codec; - struct ak4458_priv *ak4458 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS: /* Slave Mode */ @@ -342,7 +342,7 @@ static int ak4458_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) case SND_SOC_DAIFMT_CBS_CFM: case SND_SOC_DAIFMT_CBM_CFS: default: - dev_err(codec->dev, "Master mode unsupported\n"); + dev_err(component->dev, "Master mode unsupported\n"); return -EINVAL; }
@@ -354,13 +354,13 @@ static int ak4458_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) ak4458->fmt = fmt & SND_SOC_DAIFMT_FORMAT_MASK; break; default: - dev_err(codec->dev, "Audio format 0x%02X unsupported\n", + dev_err(component->dev, "Audio format 0x%02X unsupported\n", fmt & SND_SOC_DAIFMT_FORMAT_MASK); return -EINVAL; }
- ak4458_rstn_control(codec, 0); - ak4458_rstn_control(codec, 1); + ak4458_rstn_control(component, 0); + ak4458_rstn_control(component, 1);
return 0; } @@ -369,27 +369,27 @@ static int ak4458_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
static int ak4458_set_dai_mute(struct snd_soc_dai *dai, int mute) { - struct snd_soc_codec *codec = dai->codec; - struct ak4458_priv *ak4458 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); int nfs, ndt, ret, reg; int ats;
nfs = ak4458->fs;
- reg = snd_soc_read(codec, AK4458_0B_CONTROL7); + reg = snd_soc_component_read32(component, AK4458_0B_CONTROL7); ats = (reg & AK4458_ATS_MASK) >> AK4458_ATS_SHIFT;
ndt = att_speed[ats] / (nfs / 1000);
if (mute) { - ret = snd_soc_update_bits(codec, AK4458_01_CONTROL2, 0x01, 1); + ret = snd_soc_component_update_bits(component, AK4458_01_CONTROL2, 0x01, 1); mdelay(ndt); if (ak4458->mute_gpiod) gpiod_set_value_cansleep(ak4458->mute_gpiod, 1); } else { if (ak4458->mute_gpiod) gpiod_set_value_cansleep(ak4458->mute_gpiod, 0); - ret = snd_soc_update_bits(codec, AK4458_01_CONTROL2, 0x01, 0); + ret = snd_soc_component_update_bits(component, AK4458_01_CONTROL2, 0x01, 0); mdelay(ndt); }
@@ -399,8 +399,8 @@ static int ak4458_set_dai_mute(struct snd_soc_dai *dai, int mute) static int ak4458_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) { - struct snd_soc_codec *codec = dai->codec; - struct ak4458_priv *ak4458 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component); int mode;
ak4458->slots = slots; @@ -421,7 +421,7 @@ static int ak4458_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, break; }
- snd_soc_update_bits(codec, AK4458_0A_CONTROL6, + snd_soc_component_update_bits(component, AK4458_0A_CONTROL6, AK4458_MODE_MASK, mode);
@@ -493,9 +493,9 @@ static void ak4458_power_on(struct ak4458_priv *ak4458) } }
-static void ak4458_init(struct snd_soc_codec *codec) +static void ak4458_init(struct snd_soc_component *component) { - struct ak4458_priv *ak4458 = snd_soc_codec_get_drvdata(codec); + struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
/* External Mute ON */ if (ak4458->mute_gpiod) @@ -503,26 +503,26 @@ static void ak4458_init(struct snd_soc_codec *codec)
ak4458_power_on(ak4458);
- snd_soc_update_bits(codec, AK4458_00_CONTROL1, + snd_soc_component_update_bits(component, AK4458_00_CONTROL1, 0x80, 0x80); /* ACKS bit = 1; 10000000 */
- ak4458_rstn_control(codec, 1); + ak4458_rstn_control(component, 1); }
-static int ak4458_probe(struct snd_soc_codec *codec) +static int ak4458_probe(struct snd_soc_component *component) { - struct ak4458_priv *ak4458 = snd_soc_codec_get_drvdata(codec); + struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
- ak4458_init(codec); + ak4458_init(component);
ak4458->fs = 48000;
return 0; }
-static int ak4458_remove(struct snd_soc_codec *codec) +static int ak4458_remove(struct snd_soc_component *component) { - struct ak4458_priv *ak4458 = snd_soc_codec_get_drvdata(codec); + struct ak4458_priv *ak4458 = snd_soc_component_get_drvdata(component);
ak4458_power_off(ak4458);
@@ -561,17 +561,19 @@ static int __maybe_unused ak4458_runtime_resume(struct device *dev) } #endif /* CONFIG_PM */
-struct snd_soc_codec_driver soc_codec_dev_ak4458 = { - .probe = ak4458_probe, - .remove = ak4458_remove, - .component_driver = { - .controls = ak4458_snd_controls, - .num_controls = ARRAY_SIZE(ak4458_snd_controls), - .dapm_widgets = ak4458_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(ak4458_dapm_widgets), - .dapm_routes = ak4458_intercon, - .num_dapm_routes = ARRAY_SIZE(ak4458_intercon), - }, +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, + .num_dapm_widgets = ARRAY_SIZE(ak4458_dapm_widgets), + .dapm_routes = ak4458_intercon, + .num_dapm_routes = ARRAY_SIZE(ak4458_intercon), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, };
static const struct regmap_config ak4458_regmap = { @@ -616,7 +618,7 @@ static int ak4458_i2c_probe(struct i2c_client *i2c) if (IS_ERR(ak4458->mute_gpiod)) return PTR_ERR(ak4458->mute_gpiod);
- ret = snd_soc_register_codec(ak4458->dev, &soc_codec_dev_ak4458, + ret = devm_snd_soc_register_component(ak4458->dev, &soc_codec_dev_ak4458, &ak4458_dai, 1); if (ret < 0) { dev_err(ak4458->dev, "Failed to register CODEC: %d\n", ret); @@ -630,7 +632,6 @@ static int ak4458_i2c_probe(struct i2c_client *i2c)
static int ak4458_i2c_remove(struct i2c_client *i2c) { - snd_soc_unregister_codec(&i2c->dev); pm_runtime_disable(&i2c->dev);
return 0;
From: Kuninori Morimoto kuninori.morimoto.gx@renesas.com
Now we can replace Codec to Component. Let's do it.
Note: xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 0 -> .idle_bias_on = 1 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/codecs/ak5558.c | 65 ++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 32 deletions(-)
diff --git a/sound/soc/codecs/ak5558.c b/sound/soc/codecs/ak5558.c index 225173f..83d2113 100644 --- a/sound/soc/codecs/ak5558.c +++ b/sound/soc/codecs/ak5558.c @@ -25,7 +25,7 @@
/* AK5558 Codec Private Data */ struct ak5558_priv { - struct snd_soc_codec codec; + struct snd_soc_component component; struct regmap *regmap; struct i2c_client *i2c; struct gpio_desc *reset_gpiod; /* Reset & Power down GPIO */ @@ -116,9 +116,9 @@ struct ak5558_priv { {"SDTO", NULL, "ADC Ch8"}, };
-static int ak5558_set_mcki(struct snd_soc_codec *codec) +static int ak5558_set_mcki(struct snd_soc_component *component) { - return snd_soc_update_bits(codec, AK5558_02_CONTROL1, AK5558_CKS, + return snd_soc_component_update_bits(component, AK5558_02_CONTROL1, AK5558_CKS, AK5558_CKS_AUTO); }
@@ -126,13 +126,13 @@ static int ak5558_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct snd_soc_codec *codec = dai->codec; - struct ak5558_priv *ak5558 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component); u8 bits; int pcm_width = max(params_physical_width(params), ak5558->slot_width);
/* set master/slave audio interface */ - bits = snd_soc_read(codec, AK5558_02_CONTROL1); + bits = snd_soc_component_read32(component, AK5558_02_CONTROL1); bits &= ~AK5558_BITS;
switch (pcm_width) { @@ -146,14 +146,14 @@ static int ak5558_hw_params(struct snd_pcm_substream *substream, return -EINVAL; }
- snd_soc_update_bits(codec, AK5558_02_CONTROL1, AK5558_BITS, bits); + snd_soc_component_update_bits(component, AK5558_02_CONTROL1, AK5558_BITS, bits);
return 0; }
static int ak5558_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - struct snd_soc_codec *codec = dai->codec; + struct snd_soc_component *component = dai->component; u8 format;
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { @@ -169,7 +169,7 @@ static int ak5558_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) }
/* set master/slave audio interface */ - format = snd_soc_read(codec, AK5558_02_CONTROL1); + format = snd_soc_component_read32(component, AK5558_02_CONTROL1); format &= ~AK5558_DIF;
switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { @@ -186,7 +186,7 @@ static int ak5558_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) return -EINVAL; }
- snd_soc_update_bits(codec, AK5558_02_CONTROL1, AK5558_DIF, format); + snd_soc_component_update_bits(component, AK5558_02_CONTROL1, AK5558_DIF, format);
return 0; } @@ -195,8 +195,8 @@ static int ak5558_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) { - struct snd_soc_codec *codec = dai->codec; - struct ak5558_priv *ak5558 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component); int tdm_mode;
ak5558->slots = slots; @@ -217,7 +217,7 @@ static int ak5558_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, break; }
- snd_soc_update_bits(codec, AK5558_03_CONTROL2, AK5558_MODE_BITS, + snd_soc_component_update_bits(component, AK5558_03_CONTROL2, AK5558_MODE_BITS, tdm_mode); return 0; } @@ -285,17 +285,17 @@ static void ak5558_power_on(struct ak5558_priv *ak5558) usleep_range(1000, 2000); }
-static int ak5558_probe(struct snd_soc_codec *codec) +static int ak5558_probe(struct snd_soc_component *component) { - struct ak5558_priv *ak5558 = snd_soc_codec_get_drvdata(codec); + struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component);
ak5558_power_on(ak5558); - return ak5558_set_mcki(codec); + return ak5558_set_mcki(component); }
-static int ak5558_remove(struct snd_soc_codec *codec) +static int ak5558_remove(struct snd_soc_component *component) { - struct ak5558_priv *ak5558 = snd_soc_codec_get_drvdata(codec); + struct ak5558_priv *ak5558 = snd_soc_component_get_drvdata(component);
ak5558_power_off(ak5558);
@@ -331,18 +331,19 @@ static int __maybe_unused ak5558_runtime_resume(struct device *dev) pm_runtime_force_resume) };
-struct snd_soc_codec_driver soc_codec_dev_ak5558 = { - .probe = ak5558_probe, - .remove = ak5558_remove, - - .component_driver = { - .controls = ak5558_snd_controls, - .num_controls = ARRAY_SIZE(ak5558_snd_controls), - .dapm_widgets = ak5558_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(ak5558_dapm_widgets), - .dapm_routes = ak5558_intercon, - .num_dapm_routes = ARRAY_SIZE(ak5558_intercon), - }, +struct snd_soc_component_driver soc_codec_dev_ak5558 = { + .probe = ak5558_probe, + .remove = ak5558_remove, + .controls = ak5558_snd_controls, + .num_controls = ARRAY_SIZE(ak5558_snd_controls), + .dapm_widgets = ak5558_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(ak5558_dapm_widgets), + .dapm_routes = ak5558_intercon, + .num_dapm_routes = ARRAY_SIZE(ak5558_intercon), + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, };
static const struct regmap_config ak5558_regmap = { @@ -376,7 +377,8 @@ static int ak5558_i2c_probe(struct i2c_client *i2c) if (IS_ERR(ak5558->reset_gpiod)) return PTR_ERR(ak5558->reset_gpiod);
- ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak5558, + ret = devm_snd_soc_register_component(&i2c->dev, + &soc_codec_dev_ak5558, &ak5558_dai, 1); if (ret) return ret; @@ -388,7 +390,6 @@ static int ak5558_i2c_probe(struct i2c_client *i2c)
static int ak5558_i2c_remove(struct i2c_client *i2c) { - snd_soc_unregister_codec(&i2c->dev); pm_runtime_disable(&i2c->dev);
return 0;
Hi Mark
My posted patches had compile issue. I will post v2 patch. Please drop these
These are new added driver on mark/for-next branch, but based on old "codec" framework. We want to convert it to component. These patches are do it
Kuninori Morimoto (4): ASoC: intel: kbl_da7219_max98357: replace codec to component ASoC: amd: acp-da7219-max98357: replace codec to component ASoC: ak4458: replace codec to component ASoC: ak5558: replace codec to component
sound/soc/amd/acp-da7219-max98357a.c | 4 +- sound/soc/codecs/ak4458.c | 105 +++++++++++++------------- sound/soc/codecs/ak5558.c | 65 ++++++++-------- sound/soc/intel/boards/kbl_da7219_max98357a.c | 12 +-- 4 files changed, 94 insertions(+), 92 deletions(-)
-- 1.9.1
Best regards
Kuninori Morimoto
participants (2)
-
Kuninori Morimoto
-
Mark Brown