Loading Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ See ../arm/mediatek/mediatek,audsys.txt for details about the parent node. Example: audsys: audio-subsystem@11220000 { compatible = "mediatek,mt2701-audsys", "syscon", "simple-mfd"; compatible = "mediatek,mt2701-audsys", "syscon"; ... afe: audio-controller { Loading sound/soc/codecs/max98927.c +39 −43 Original line number Diff line number Diff line Loading @@ -142,14 +142,14 @@ static struct reg_default max98927_reg[] = { static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { struct snd_soc_codec *codec = codec_dai->codec; struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = codec_dai->component; struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); unsigned int mode = 0; unsigned int format = 0; bool use_pdm = false; unsigned int invert = 0; dev_dbg(codec->dev, "%s: fmt 0x%08X\n", __func__, fmt); dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS: Loading @@ -160,7 +160,7 @@ static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) mode = MAX98927_PCM_MASTER_MODE_MASTER; break; default: dev_err(codec->dev, "DAI clock mode unsupported\n"); dev_err(component->dev, "DAI clock mode unsupported\n"); return -EINVAL; } Loading @@ -176,7 +176,7 @@ static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) invert = MAX98927_PCM_MODE_CFG_PCM_BCLKEDGE; break; default: dev_err(codec->dev, "DAI invert mode unsupported\n"); dev_err(component->dev, "DAI invert mode unsupported\n"); return -EINVAL; } Loading Loading @@ -268,7 +268,7 @@ static int max98927_get_bclk_sel(int bclk) static int max98927_set_clock(struct max98927_priv *max98927, struct snd_pcm_hw_params *params) { struct snd_soc_codec *codec = max98927->codec; struct snd_soc_component *component = max98927->component; /* BCLK/LRCLK ratio calculation */ int blr_clk_ratio = params_channels(params) * max98927->ch_size; int value; Loading @@ -281,7 +281,7 @@ static int max98927_set_clock(struct max98927_priv *max98927, break; } if (i == ARRAY_SIZE(rate_table)) { dev_err(codec->dev, "failed to find proper clock rate.\n"); dev_err(component->dev, "failed to find proper clock rate.\n"); return -EINVAL; } regmap_update_bits(max98927->regmap, Loading @@ -294,7 +294,7 @@ static int max98927_set_clock(struct max98927_priv *max98927, /* BCLK configuration */ value = max98927_get_bclk_sel(blr_clk_ratio); if (!value) { dev_err(codec->dev, "format unsupported %d\n", dev_err(component->dev, "format unsupported %d\n", params_format(params)); return -EINVAL; } Loading @@ -311,8 +311,8 @@ static int max98927_dai_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 max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); unsigned int sampling_rate = 0; unsigned int chan_sz = 0; Loading @@ -328,7 +328,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, chan_sz = MAX98927_PCM_MODE_CFG_CHANSZ_32; break; default: dev_err(codec->dev, "format unsupported %d\n", dev_err(component->dev, "format unsupported %d\n", params_format(params)); goto err; } Loading @@ -339,7 +339,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, MAX98927_R0020_PCM_MODE_CFG, MAX98927_PCM_MODE_CFG_CHANSZ_MASK, chan_sz); dev_dbg(codec->dev, "format supported %d", dev_dbg(component->dev, "format supported %d", params_format(params)); /* sampling rate configuration */ Loading Loading @@ -372,7 +372,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, sampling_rate = MAX98927_PCM_SR_SET1_SR_48000; break; default: dev_err(codec->dev, "rate %d not supported\n", dev_err(component->dev, "rate %d not supported\n", params_rate(params)); goto err; } Loading Loading @@ -407,8 +407,8 @@ static int max98927_dai_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 max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); int bsel = 0; unsigned int chan_sz = 0; Loading @@ -417,7 +417,7 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, /* BCLK configuration */ bsel = max98927_get_bclk_sel(slots * slot_width); if (bsel == 0) { dev_err(codec->dev, "BCLK %d not supported\n", dev_err(component->dev, "BCLK %d not supported\n", slots * slot_width); return -EINVAL; } Loading @@ -439,7 +439,7 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, chan_sz = MAX98927_PCM_MODE_CFG_CHANSZ_32; break; default: dev_err(codec->dev, "format unsupported %d\n", dev_err(component->dev, "format unsupported %d\n", slot_width); return -EINVAL; } Loading Loading @@ -483,8 +483,8 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, static int max98927_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_codec *codec = dai->codec; struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); max98927->sysclk = freq; return 0; Loading @@ -500,8 +500,8 @@ static const struct snd_soc_dai_ops max98927_dai_ops = { static int max98927_dac_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); switch (event) { case SND_SOC_DAPM_PRE_PMU: Loading Loading @@ -677,11 +677,11 @@ static struct snd_soc_dai_driver max98927_dai[] = { } }; static int max98927_probe(struct snd_soc_codec *codec) static int max98927_probe(struct snd_soc_component *component) { struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); max98927->codec = codec; max98927->component = component; /* Software Reset */ regmap_write(max98927->regmap, Loading Loading @@ -823,16 +823,18 @@ static const struct dev_pm_ops max98927_pm = { SET_SYSTEM_SLEEP_PM_OPS(max98927_suspend, max98927_resume) }; static const struct snd_soc_codec_driver soc_codec_dev_max98927 = { static const struct snd_soc_component_driver soc_component_dev_max98927 = { .probe = max98927_probe, .component_driver = { .controls = max98927_snd_controls, .num_controls = ARRAY_SIZE(max98927_snd_controls), .dapm_widgets = max98927_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(max98927_dapm_widgets), .dapm_routes = max98927_audio_map, .num_dapm_routes = ARRAY_SIZE(max98927_audio_map), }, .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, .non_legacy_dai_naming = 1, }; static const struct regmap_config max98927_regmap = { Loading Loading @@ -914,20 +916,15 @@ static int max98927_i2c_probe(struct i2c_client *i2c, max98927_slot_config(i2c, max98927); /* codec registeration */ ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98927, ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_max98927, max98927_dai, ARRAY_SIZE(max98927_dai)); if (ret < 0) dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); dev_err(&i2c->dev, "Failed to register component: %d\n", ret); return ret; } static int max98927_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); return 0; } static const struct i2c_device_id max98927_i2c_id[] = { { "max98927", 0}, { }, Loading Loading @@ -959,7 +956,6 @@ static struct i2c_driver max98927_i2c_driver = { .pm = &max98927_pm, }, .probe = max98927_i2c_probe, .remove = max98927_i2c_remove, .id_table = max98927_i2c_id, }; Loading sound/soc/codecs/max98927.h +1 −1 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ struct max98927_priv { struct regmap *regmap; struct snd_soc_codec *codec; struct snd_soc_component *component; struct max98927_pdata *pdata; unsigned int spk_gain; unsigned int sysclk; Loading sound/soc/codecs/mc13783.c +33 −35 Original line number Diff line number Diff line Loading @@ -107,13 +107,13 @@ static int mc13783_pcm_hw_params_dac(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component; unsigned int rate = params_rate(params); int i; for (i = 0; i < ARRAY_SIZE(mc13783_rates); i++) { if (rate == mc13783_rates[i]) { snd_soc_update_bits(codec, MC13783_AUDIO_DAC, snd_soc_component_update_bits(component, MC13783_AUDIO_DAC, 0xf << 17, i << 17); return 0; } Loading @@ -126,7 +126,7 @@ static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component; unsigned int rate = params_rate(params); unsigned int val; Loading @@ -141,7 +141,7 @@ static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream, return -EINVAL; } snd_soc_update_bits(codec, MC13783_AUDIO_CODEC, AUDIO_CODEC_CDCFS8K16K, snd_soc_component_update_bits(component, MC13783_AUDIO_CODEC, AUDIO_CODEC_CDCFS8K16K, val); return 0; Loading @@ -160,7 +160,7 @@ static int mc13783_pcm_hw_params_sync(struct snd_pcm_substream *substream, static int mc13783_set_fmt(struct snd_soc_dai *dai, unsigned int fmt, unsigned int reg) { struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component; unsigned int val = 0; unsigned int mask = AUDIO_CFS(3) | AUDIO_BCL_INV | AUDIO_CFS_INV | AUDIO_CSM | AUDIO_C_CLK_EN | AUDIO_C_RESET; Loading Loading @@ -208,7 +208,7 @@ static int mc13783_set_fmt(struct snd_soc_dai *dai, unsigned int fmt, val |= AUDIO_C_RESET; snd_soc_update_bits(codec, reg, mask, val); snd_soc_component_update_bits(component, reg, mask, val); return 0; } Loading Loading @@ -255,7 +255,7 @@ static int mc13783_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir, unsigned int reg) { struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component; int clk; unsigned int val = 0; unsigned int mask = AUDIO_CLK(0x7) | AUDIO_CLK_SEL; Loading @@ -275,7 +275,7 @@ static int mc13783_set_sysclk(struct snd_soc_dai *dai, val |= AUDIO_CLK(clk); snd_soc_update_bits(codec, reg, mask, val); snd_soc_component_update_bits(component, reg, mask, val); return 0; } Loading Loading @@ -308,7 +308,7 @@ static int mc13783_set_tdm_slot_dac(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 snd_soc_component *component = dai->component; unsigned int val = 0; unsigned int mask = SSI_NETWORK_DAC_SLOT_MASK | SSI_NETWORK_DAC_RXSLOT_MASK; Loading Loading @@ -344,7 +344,7 @@ static int mc13783_set_tdm_slot_dac(struct snd_soc_dai *dai, return -EINVAL; } snd_soc_update_bits(codec, MC13783_SSI_NETWORK, mask, val); snd_soc_component_update_bits(component, MC13783_SSI_NETWORK, mask, val); return 0; } Loading @@ -353,7 +353,7 @@ static int mc13783_set_tdm_slot_codec(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 snd_soc_component *component = dai->component; unsigned int val = 0; unsigned int mask = 0x3f; Loading @@ -366,7 +366,7 @@ static int mc13783_set_tdm_slot_codec(struct snd_soc_dai *dai, val |= (0x00 << 2); /* primary timeslot RX/TX(?) is 0 */ val |= (0x01 << 4); /* secondary timeslot TX is 1 */ snd_soc_update_bits(codec, MC13783_SSI_NETWORK, mask, val); snd_soc_component_update_bits(component, MC13783_SSI_NETWORK, mask, val); return 0; } Loading Loading @@ -606,12 +606,12 @@ static struct snd_kcontrol_new mc13783_control_list[] = { SOC_SINGLE("MC2 Capture Bias Switch", MC13783_AUDIO_TX, 1, 1, 0), }; static int mc13783_probe(struct snd_soc_codec *codec) static int mc13783_probe(struct snd_soc_component *component) { struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); struct mc13783_priv *priv = snd_soc_component_get_drvdata(component); snd_soc_codec_init_regmap(codec, dev_get_regmap(codec->dev->parent, NULL)); snd_soc_component_init_regmap(component, dev_get_regmap(component->dev->parent, NULL)); /* these are the reset values */ mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893); Loading @@ -638,14 +638,12 @@ static int mc13783_probe(struct snd_soc_codec *codec) return 0; } static int mc13783_remove(struct snd_soc_codec *codec) static void mc13783_remove(struct snd_soc_component *component) { struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); struct mc13783_priv *priv = snd_soc_component_get_drvdata(component); /* Make sure VAUDIOON is off */ mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_RX0, 0x3, 0); return 0; } #define MC13783_RATES_RECORD (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000) Loading Loading @@ -731,17 +729,19 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = { } }; static const struct snd_soc_codec_driver soc_codec_dev_mc13783 = { static const struct snd_soc_component_driver soc_component_dev_mc13783 = { .probe = mc13783_probe, .remove = mc13783_remove, .component_driver = { .controls = mc13783_control_list, .num_controls = ARRAY_SIZE(mc13783_control_list), .dapm_widgets = mc13783_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(mc13783_dapm_widgets), .dapm_routes = mc13783_routes, .num_dapm_routes = ARRAY_SIZE(mc13783_routes), }, .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, .non_legacy_dai_naming = 1, }; static int __init mc13783_codec_probe(struct platform_device *pdev) Loading Loading @@ -782,10 +782,10 @@ static int __init mc13783_codec_probe(struct platform_device *pdev) priv->mc13xxx = dev_get_drvdata(pdev->dev.parent); if (priv->adc_ssi_port == priv->dac_ssi_port) ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_mc13783, ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_mc13783, mc13783_dai_sync, ARRAY_SIZE(mc13783_dai_sync)); else ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_mc13783, ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_mc13783, mc13783_dai_async, ARRAY_SIZE(mc13783_dai_async)); return ret; Loading @@ -793,8 +793,6 @@ static int __init mc13783_codec_probe(struct platform_device *pdev) static int mc13783_codec_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); return 0; } Loading sound/soc/codecs/ml26124.c +49 −54 Original line number Diff line number Diff line Loading @@ -338,8 +338,8 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); int i = get_coeff(priv->mclk, params_rate(hw_params)); int srate; Loading @@ -351,23 +351,23 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, if (priv->clk_in) { switch (priv->mclk / params_rate(hw_params)) { case 256: snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 1); break; case 512: snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 2); break; case 1024: snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 3); break; default: dev_err(codec->dev, "Unsupported MCLKI\n"); dev_err(component->dev, "Unsupported MCLKI\n"); break; } } else { snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 0); } Loading @@ -375,35 +375,35 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, if (srate < 0) return srate; snd_soc_update_bits(codec, ML26124_SMPLING_RATE, 0xf, srate); snd_soc_update_bits(codec, ML26124_PLLNL, 0xff, coeff_div[i].pllnl); snd_soc_update_bits(codec, ML26124_PLLNH, 0x1, coeff_div[i].pllnh); snd_soc_update_bits(codec, ML26124_PLLML, 0xff, coeff_div[i].pllml); snd_soc_update_bits(codec, ML26124_PLLMH, 0x3f, coeff_div[i].pllmh); snd_soc_update_bits(codec, ML26124_PLLDIV, 0x1f, coeff_div[i].plldiv); snd_soc_component_update_bits(component, ML26124_SMPLING_RATE, 0xf, srate); snd_soc_component_update_bits(component, ML26124_PLLNL, 0xff, coeff_div[i].pllnl); snd_soc_component_update_bits(component, ML26124_PLLNH, 0x1, coeff_div[i].pllnh); snd_soc_component_update_bits(component, ML26124_PLLML, 0xff, coeff_div[i].pllml); snd_soc_component_update_bits(component, ML26124_PLLMH, 0x3f, coeff_div[i].pllmh); snd_soc_component_update_bits(component, ML26124_PLLDIV, 0x1f, coeff_div[i].plldiv); return 0; } static int ml26124_mute(struct snd_soc_dai *dai, int mute) { struct snd_soc_codec *codec = dai->codec; struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); switch (priv->substream->stream) { case SNDRV_PCM_STREAM_CAPTURE: snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, BIT(0), 1); snd_soc_component_update_bits(component, ML26124_REC_PLYBAK_RUN, BIT(0), 1); break; case SNDRV_PCM_STREAM_PLAYBACK: snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, BIT(1), 2); snd_soc_component_update_bits(component, ML26124_REC_PLYBAK_RUN, BIT(1), 2); break; } if (mute) snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4), snd_soc_component_update_bits(component, ML26124_DVOL_CTL, BIT(4), DVOL_CTL_DVMUTE_ON); else snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4), snd_soc_component_update_bits(component, ML26124_DVOL_CTL, BIT(4), DVOL_CTL_DVMUTE_OFF); return 0; Loading @@ -413,7 +413,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { unsigned char mode; struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component; /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { Loading @@ -426,7 +426,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, default: return -EINVAL; } snd_soc_update_bits(codec, ML26124_SAI_MODE_SEL, BIT(0), mode); snd_soc_component_update_bits(component, ML26124_SAI_MODE_SEL, BIT(0), mode); /* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { Loading @@ -450,8 +450,8 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, static int ml26124_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_codec *codec = codec_dai->codec; struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = codec_dai->component; struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); switch (clk_id) { case ML26124_USE_PLLOUT: Loading @@ -469,17 +469,17 @@ static int ml26124_set_dai_sysclk(struct snd_soc_dai *codec_dai, return 0; } static int ml26124_set_bias_level(struct snd_soc_codec *codec, static int ml26124_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); switch (level) { case SND_SOC_BIAS_ON: snd_soc_update_bits(codec, ML26124_PW_SPAMP_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_SPAMP_PW_MNG, ML26124_R26_MASK, ML26124_BLT_PREAMP_ON); msleep(100); snd_soc_update_bits(codec, ML26124_PW_SPAMP_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_SPAMP_PW_MNG, ML26124_R26_MASK, ML26124_MICBEN_ON | ML26124_BLT_ALL_ON); break; Loading @@ -487,8 +487,8 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: /* VMID ON */ if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG, ML26124_VMID, ML26124_VMID); msleep(500); regcache_sync(priv->regmap); Loading @@ -496,7 +496,7 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_OFF: /* VMID OFF */ snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG, ML26124_VMID, 0); break; } Loading Loading @@ -528,27 +528,29 @@ static struct snd_soc_dai_driver ml26124_dai = { .symmetric_rates = 1, }; static int ml26124_probe(struct snd_soc_codec *codec) static int ml26124_probe(struct snd_soc_component *component) { /* Software Reset */ snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 1); snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 0); snd_soc_component_update_bits(component, ML26124_SW_RST, 0x01, 1); snd_soc_component_update_bits(component, ML26124_SW_RST, 0x01, 0); return 0; } static const struct snd_soc_codec_driver soc_codec_dev_ml26124 = { static const struct snd_soc_component_driver soc_component_dev_ml26124 = { .probe = ml26124_probe, .set_bias_level = ml26124_set_bias_level, .suspend_bias_off = true, .component_driver = { .controls = ml26124_snd_controls, .num_controls = ARRAY_SIZE(ml26124_snd_controls), .dapm_widgets = ml26124_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(ml26124_dapm_widgets), .dapm_routes = ml26124_intercon, .num_dapm_routes = ARRAY_SIZE(ml26124_intercon), }, .suspend_bias_off = 1, .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, .non_legacy_dai_naming = 1, }; static const struct regmap_config ml26124_i2c_regmap = { Loading Loading @@ -580,14 +582,8 @@ static int ml26124_i2c_probe(struct i2c_client *i2c, return ret; } return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ml26124, &ml26124_dai, 1); } static int ml26124_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); return 0; return devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_ml26124, &ml26124_dai, 1); } static const struct i2c_device_id ml26124_i2c_id[] = { Loading @@ -601,7 +597,6 @@ static struct i2c_driver ml26124_i2c_driver = { .name = "ml26124", }, .probe = ml26124_i2c_probe, .remove = ml26124_i2c_remove, .id_table = ml26124_i2c_id, }; Loading Loading
Documentation/devicetree/bindings/sound/mt2701-afe-pcm.txt +1 −1 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ See ../arm/mediatek/mediatek,audsys.txt for details about the parent node. Example: audsys: audio-subsystem@11220000 { compatible = "mediatek,mt2701-audsys", "syscon", "simple-mfd"; compatible = "mediatek,mt2701-audsys", "syscon"; ... afe: audio-controller { Loading
sound/soc/codecs/max98927.c +39 −43 Original line number Diff line number Diff line Loading @@ -142,14 +142,14 @@ static struct reg_default max98927_reg[] = { static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { struct snd_soc_codec *codec = codec_dai->codec; struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = codec_dai->component; struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); unsigned int mode = 0; unsigned int format = 0; bool use_pdm = false; unsigned int invert = 0; dev_dbg(codec->dev, "%s: fmt 0x%08X\n", __func__, fmt); dev_dbg(component->dev, "%s: fmt 0x%08X\n", __func__, fmt); switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS: Loading @@ -160,7 +160,7 @@ static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) mode = MAX98927_PCM_MASTER_MODE_MASTER; break; default: dev_err(codec->dev, "DAI clock mode unsupported\n"); dev_err(component->dev, "DAI clock mode unsupported\n"); return -EINVAL; } Loading @@ -176,7 +176,7 @@ static int max98927_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) invert = MAX98927_PCM_MODE_CFG_PCM_BCLKEDGE; break; default: dev_err(codec->dev, "DAI invert mode unsupported\n"); dev_err(component->dev, "DAI invert mode unsupported\n"); return -EINVAL; } Loading Loading @@ -268,7 +268,7 @@ static int max98927_get_bclk_sel(int bclk) static int max98927_set_clock(struct max98927_priv *max98927, struct snd_pcm_hw_params *params) { struct snd_soc_codec *codec = max98927->codec; struct snd_soc_component *component = max98927->component; /* BCLK/LRCLK ratio calculation */ int blr_clk_ratio = params_channels(params) * max98927->ch_size; int value; Loading @@ -281,7 +281,7 @@ static int max98927_set_clock(struct max98927_priv *max98927, break; } if (i == ARRAY_SIZE(rate_table)) { dev_err(codec->dev, "failed to find proper clock rate.\n"); dev_err(component->dev, "failed to find proper clock rate.\n"); return -EINVAL; } regmap_update_bits(max98927->regmap, Loading @@ -294,7 +294,7 @@ static int max98927_set_clock(struct max98927_priv *max98927, /* BCLK configuration */ value = max98927_get_bclk_sel(blr_clk_ratio); if (!value) { dev_err(codec->dev, "format unsupported %d\n", dev_err(component->dev, "format unsupported %d\n", params_format(params)); return -EINVAL; } Loading @@ -311,8 +311,8 @@ static int max98927_dai_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 max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); unsigned int sampling_rate = 0; unsigned int chan_sz = 0; Loading @@ -328,7 +328,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, chan_sz = MAX98927_PCM_MODE_CFG_CHANSZ_32; break; default: dev_err(codec->dev, "format unsupported %d\n", dev_err(component->dev, "format unsupported %d\n", params_format(params)); goto err; } Loading @@ -339,7 +339,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, MAX98927_R0020_PCM_MODE_CFG, MAX98927_PCM_MODE_CFG_CHANSZ_MASK, chan_sz); dev_dbg(codec->dev, "format supported %d", dev_dbg(component->dev, "format supported %d", params_format(params)); /* sampling rate configuration */ Loading Loading @@ -372,7 +372,7 @@ static int max98927_dai_hw_params(struct snd_pcm_substream *substream, sampling_rate = MAX98927_PCM_SR_SET1_SR_48000; break; default: dev_err(codec->dev, "rate %d not supported\n", dev_err(component->dev, "rate %d not supported\n", params_rate(params)); goto err; } Loading Loading @@ -407,8 +407,8 @@ static int max98927_dai_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 max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); int bsel = 0; unsigned int chan_sz = 0; Loading @@ -417,7 +417,7 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, /* BCLK configuration */ bsel = max98927_get_bclk_sel(slots * slot_width); if (bsel == 0) { dev_err(codec->dev, "BCLK %d not supported\n", dev_err(component->dev, "BCLK %d not supported\n", slots * slot_width); return -EINVAL; } Loading @@ -439,7 +439,7 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, chan_sz = MAX98927_PCM_MODE_CFG_CHANSZ_32; break; default: dev_err(codec->dev, "format unsupported %d\n", dev_err(component->dev, "format unsupported %d\n", slot_width); return -EINVAL; } Loading Loading @@ -483,8 +483,8 @@ static int max98927_dai_tdm_slot(struct snd_soc_dai *dai, static int max98927_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_codec *codec = dai->codec; struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); max98927->sysclk = freq; return 0; Loading @@ -500,8 +500,8 @@ static const struct snd_soc_dai_ops max98927_dai_ops = { static int max98927_dac_event(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, int event) { struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); switch (event) { case SND_SOC_DAPM_PRE_PMU: Loading Loading @@ -677,11 +677,11 @@ static struct snd_soc_dai_driver max98927_dai[] = { } }; static int max98927_probe(struct snd_soc_codec *codec) static int max98927_probe(struct snd_soc_component *component) { struct max98927_priv *max98927 = snd_soc_codec_get_drvdata(codec); struct max98927_priv *max98927 = snd_soc_component_get_drvdata(component); max98927->codec = codec; max98927->component = component; /* Software Reset */ regmap_write(max98927->regmap, Loading Loading @@ -823,16 +823,18 @@ static const struct dev_pm_ops max98927_pm = { SET_SYSTEM_SLEEP_PM_OPS(max98927_suspend, max98927_resume) }; static const struct snd_soc_codec_driver soc_codec_dev_max98927 = { static const struct snd_soc_component_driver soc_component_dev_max98927 = { .probe = max98927_probe, .component_driver = { .controls = max98927_snd_controls, .num_controls = ARRAY_SIZE(max98927_snd_controls), .dapm_widgets = max98927_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(max98927_dapm_widgets), .dapm_routes = max98927_audio_map, .num_dapm_routes = ARRAY_SIZE(max98927_audio_map), }, .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, .non_legacy_dai_naming = 1, }; static const struct regmap_config max98927_regmap = { Loading Loading @@ -914,20 +916,15 @@ static int max98927_i2c_probe(struct i2c_client *i2c, max98927_slot_config(i2c, max98927); /* codec registeration */ ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98927, ret = devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_max98927, max98927_dai, ARRAY_SIZE(max98927_dai)); if (ret < 0) dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); dev_err(&i2c->dev, "Failed to register component: %d\n", ret); return ret; } static int max98927_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); return 0; } static const struct i2c_device_id max98927_i2c_id[] = { { "max98927", 0}, { }, Loading Loading @@ -959,7 +956,6 @@ static struct i2c_driver max98927_i2c_driver = { .pm = &max98927_pm, }, .probe = max98927_i2c_probe, .remove = max98927_i2c_remove, .id_table = max98927_i2c_id, }; Loading
sound/soc/codecs/max98927.h +1 −1 Original line number Diff line number Diff line Loading @@ -258,7 +258,7 @@ struct max98927_priv { struct regmap *regmap; struct snd_soc_codec *codec; struct snd_soc_component *component; struct max98927_pdata *pdata; unsigned int spk_gain; unsigned int sysclk; Loading
sound/soc/codecs/mc13783.c +33 −35 Original line number Diff line number Diff line Loading @@ -107,13 +107,13 @@ static int mc13783_pcm_hw_params_dac(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component; unsigned int rate = params_rate(params); int i; for (i = 0; i < ARRAY_SIZE(mc13783_rates); i++) { if (rate == mc13783_rates[i]) { snd_soc_update_bits(codec, MC13783_AUDIO_DAC, snd_soc_component_update_bits(component, MC13783_AUDIO_DAC, 0xf << 17, i << 17); return 0; } Loading @@ -126,7 +126,7 @@ static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component; unsigned int rate = params_rate(params); unsigned int val; Loading @@ -141,7 +141,7 @@ static int mc13783_pcm_hw_params_codec(struct snd_pcm_substream *substream, return -EINVAL; } snd_soc_update_bits(codec, MC13783_AUDIO_CODEC, AUDIO_CODEC_CDCFS8K16K, snd_soc_component_update_bits(component, MC13783_AUDIO_CODEC, AUDIO_CODEC_CDCFS8K16K, val); return 0; Loading @@ -160,7 +160,7 @@ static int mc13783_pcm_hw_params_sync(struct snd_pcm_substream *substream, static int mc13783_set_fmt(struct snd_soc_dai *dai, unsigned int fmt, unsigned int reg) { struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component; unsigned int val = 0; unsigned int mask = AUDIO_CFS(3) | AUDIO_BCL_INV | AUDIO_CFS_INV | AUDIO_CSM | AUDIO_C_CLK_EN | AUDIO_C_RESET; Loading Loading @@ -208,7 +208,7 @@ static int mc13783_set_fmt(struct snd_soc_dai *dai, unsigned int fmt, val |= AUDIO_C_RESET; snd_soc_update_bits(codec, reg, mask, val); snd_soc_component_update_bits(component, reg, mask, val); return 0; } Loading Loading @@ -255,7 +255,7 @@ static int mc13783_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir, unsigned int reg) { struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component; int clk; unsigned int val = 0; unsigned int mask = AUDIO_CLK(0x7) | AUDIO_CLK_SEL; Loading @@ -275,7 +275,7 @@ static int mc13783_set_sysclk(struct snd_soc_dai *dai, val |= AUDIO_CLK(clk); snd_soc_update_bits(codec, reg, mask, val); snd_soc_component_update_bits(component, reg, mask, val); return 0; } Loading Loading @@ -308,7 +308,7 @@ static int mc13783_set_tdm_slot_dac(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 snd_soc_component *component = dai->component; unsigned int val = 0; unsigned int mask = SSI_NETWORK_DAC_SLOT_MASK | SSI_NETWORK_DAC_RXSLOT_MASK; Loading Loading @@ -344,7 +344,7 @@ static int mc13783_set_tdm_slot_dac(struct snd_soc_dai *dai, return -EINVAL; } snd_soc_update_bits(codec, MC13783_SSI_NETWORK, mask, val); snd_soc_component_update_bits(component, MC13783_SSI_NETWORK, mask, val); return 0; } Loading @@ -353,7 +353,7 @@ static int mc13783_set_tdm_slot_codec(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 snd_soc_component *component = dai->component; unsigned int val = 0; unsigned int mask = 0x3f; Loading @@ -366,7 +366,7 @@ static int mc13783_set_tdm_slot_codec(struct snd_soc_dai *dai, val |= (0x00 << 2); /* primary timeslot RX/TX(?) is 0 */ val |= (0x01 << 4); /* secondary timeslot TX is 1 */ snd_soc_update_bits(codec, MC13783_SSI_NETWORK, mask, val); snd_soc_component_update_bits(component, MC13783_SSI_NETWORK, mask, val); return 0; } Loading Loading @@ -606,12 +606,12 @@ static struct snd_kcontrol_new mc13783_control_list[] = { SOC_SINGLE("MC2 Capture Bias Switch", MC13783_AUDIO_TX, 1, 1, 0), }; static int mc13783_probe(struct snd_soc_codec *codec) static int mc13783_probe(struct snd_soc_component *component) { struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); struct mc13783_priv *priv = snd_soc_component_get_drvdata(component); snd_soc_codec_init_regmap(codec, dev_get_regmap(codec->dev->parent, NULL)); snd_soc_component_init_regmap(component, dev_get_regmap(component->dev->parent, NULL)); /* these are the reset values */ mc13xxx_reg_write(priv->mc13xxx, MC13783_AUDIO_RX0, 0x25893); Loading @@ -638,14 +638,12 @@ static int mc13783_probe(struct snd_soc_codec *codec) return 0; } static int mc13783_remove(struct snd_soc_codec *codec) static void mc13783_remove(struct snd_soc_component *component) { struct mc13783_priv *priv = snd_soc_codec_get_drvdata(codec); struct mc13783_priv *priv = snd_soc_component_get_drvdata(component); /* Make sure VAUDIOON is off */ mc13xxx_reg_rmw(priv->mc13xxx, MC13783_AUDIO_RX0, 0x3, 0); return 0; } #define MC13783_RATES_RECORD (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000) Loading Loading @@ -731,17 +729,19 @@ static struct snd_soc_dai_driver mc13783_dai_sync[] = { } }; static const struct snd_soc_codec_driver soc_codec_dev_mc13783 = { static const struct snd_soc_component_driver soc_component_dev_mc13783 = { .probe = mc13783_probe, .remove = mc13783_remove, .component_driver = { .controls = mc13783_control_list, .num_controls = ARRAY_SIZE(mc13783_control_list), .dapm_widgets = mc13783_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(mc13783_dapm_widgets), .dapm_routes = mc13783_routes, .num_dapm_routes = ARRAY_SIZE(mc13783_routes), }, .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, .non_legacy_dai_naming = 1, }; static int __init mc13783_codec_probe(struct platform_device *pdev) Loading Loading @@ -782,10 +782,10 @@ static int __init mc13783_codec_probe(struct platform_device *pdev) priv->mc13xxx = dev_get_drvdata(pdev->dev.parent); if (priv->adc_ssi_port == priv->dac_ssi_port) ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_mc13783, ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_mc13783, mc13783_dai_sync, ARRAY_SIZE(mc13783_dai_sync)); else ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_mc13783, ret = devm_snd_soc_register_component(&pdev->dev, &soc_component_dev_mc13783, mc13783_dai_async, ARRAY_SIZE(mc13783_dai_async)); return ret; Loading @@ -793,8 +793,6 @@ static int __init mc13783_codec_probe(struct platform_device *pdev) static int mc13783_codec_remove(struct platform_device *pdev) { snd_soc_unregister_codec(&pdev->dev); return 0; } Loading
sound/soc/codecs/ml26124.c +49 −54 Original line number Diff line number Diff line Loading @@ -338,8 +338,8 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params, struct snd_soc_dai *dai) { struct snd_soc_codec *codec = dai->codec; struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); int i = get_coeff(priv->mclk, params_rate(hw_params)); int srate; Loading @@ -351,23 +351,23 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, if (priv->clk_in) { switch (priv->mclk / params_rate(hw_params)) { case 256: snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 1); break; case 512: snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 2); break; case 1024: snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 3); break; default: dev_err(codec->dev, "Unsupported MCLKI\n"); dev_err(component->dev, "Unsupported MCLKI\n"); break; } } else { snd_soc_update_bits(codec, ML26124_CLK_CTL, snd_soc_component_update_bits(component, ML26124_CLK_CTL, BIT(0) | BIT(1), 0); } Loading @@ -375,35 +375,35 @@ static int ml26124_hw_params(struct snd_pcm_substream *substream, if (srate < 0) return srate; snd_soc_update_bits(codec, ML26124_SMPLING_RATE, 0xf, srate); snd_soc_update_bits(codec, ML26124_PLLNL, 0xff, coeff_div[i].pllnl); snd_soc_update_bits(codec, ML26124_PLLNH, 0x1, coeff_div[i].pllnh); snd_soc_update_bits(codec, ML26124_PLLML, 0xff, coeff_div[i].pllml); snd_soc_update_bits(codec, ML26124_PLLMH, 0x3f, coeff_div[i].pllmh); snd_soc_update_bits(codec, ML26124_PLLDIV, 0x1f, coeff_div[i].plldiv); snd_soc_component_update_bits(component, ML26124_SMPLING_RATE, 0xf, srate); snd_soc_component_update_bits(component, ML26124_PLLNL, 0xff, coeff_div[i].pllnl); snd_soc_component_update_bits(component, ML26124_PLLNH, 0x1, coeff_div[i].pllnh); snd_soc_component_update_bits(component, ML26124_PLLML, 0xff, coeff_div[i].pllml); snd_soc_component_update_bits(component, ML26124_PLLMH, 0x3f, coeff_div[i].pllmh); snd_soc_component_update_bits(component, ML26124_PLLDIV, 0x1f, coeff_div[i].plldiv); return 0; } static int ml26124_mute(struct snd_soc_dai *dai, int mute) { struct snd_soc_codec *codec = dai->codec; struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = dai->component; struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); switch (priv->substream->stream) { case SNDRV_PCM_STREAM_CAPTURE: snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, BIT(0), 1); snd_soc_component_update_bits(component, ML26124_REC_PLYBAK_RUN, BIT(0), 1); break; case SNDRV_PCM_STREAM_PLAYBACK: snd_soc_update_bits(codec, ML26124_REC_PLYBAK_RUN, BIT(1), 2); snd_soc_component_update_bits(component, ML26124_REC_PLYBAK_RUN, BIT(1), 2); break; } if (mute) snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4), snd_soc_component_update_bits(component, ML26124_DVOL_CTL, BIT(4), DVOL_CTL_DVMUTE_ON); else snd_soc_update_bits(codec, ML26124_DVOL_CTL, BIT(4), snd_soc_component_update_bits(component, ML26124_DVOL_CTL, BIT(4), DVOL_CTL_DVMUTE_OFF); return 0; Loading @@ -413,7 +413,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { unsigned char mode; struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component; /* set master/slave audio interface */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { Loading @@ -426,7 +426,7 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, default: return -EINVAL; } snd_soc_update_bits(codec, ML26124_SAI_MODE_SEL, BIT(0), mode); snd_soc_component_update_bits(component, ML26124_SAI_MODE_SEL, BIT(0), mode); /* interface format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { Loading @@ -450,8 +450,8 @@ static int ml26124_set_dai_fmt(struct snd_soc_dai *codec_dai, static int ml26124_set_dai_sysclk(struct snd_soc_dai *codec_dai, int clk_id, unsigned int freq, int dir) { struct snd_soc_codec *codec = codec_dai->codec; struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct snd_soc_component *component = codec_dai->component; struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); switch (clk_id) { case ML26124_USE_PLLOUT: Loading @@ -469,17 +469,17 @@ static int ml26124_set_dai_sysclk(struct snd_soc_dai *codec_dai, return 0; } static int ml26124_set_bias_level(struct snd_soc_codec *codec, static int ml26124_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { struct ml26124_priv *priv = snd_soc_codec_get_drvdata(codec); struct ml26124_priv *priv = snd_soc_component_get_drvdata(component); switch (level) { case SND_SOC_BIAS_ON: snd_soc_update_bits(codec, ML26124_PW_SPAMP_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_SPAMP_PW_MNG, ML26124_R26_MASK, ML26124_BLT_PREAMP_ON); msleep(100); snd_soc_update_bits(codec, ML26124_PW_SPAMP_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_SPAMP_PW_MNG, ML26124_R26_MASK, ML26124_MICBEN_ON | ML26124_BLT_ALL_ON); break; Loading @@ -487,8 +487,8 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: /* VMID ON */ if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG, ML26124_VMID, ML26124_VMID); msleep(500); regcache_sync(priv->regmap); Loading @@ -496,7 +496,7 @@ static int ml26124_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_OFF: /* VMID OFF */ snd_soc_update_bits(codec, ML26124_PW_REF_PW_MNG, snd_soc_component_update_bits(component, ML26124_PW_REF_PW_MNG, ML26124_VMID, 0); break; } Loading Loading @@ -528,27 +528,29 @@ static struct snd_soc_dai_driver ml26124_dai = { .symmetric_rates = 1, }; static int ml26124_probe(struct snd_soc_codec *codec) static int ml26124_probe(struct snd_soc_component *component) { /* Software Reset */ snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 1); snd_soc_update_bits(codec, ML26124_SW_RST, 0x01, 0); snd_soc_component_update_bits(component, ML26124_SW_RST, 0x01, 1); snd_soc_component_update_bits(component, ML26124_SW_RST, 0x01, 0); return 0; } static const struct snd_soc_codec_driver soc_codec_dev_ml26124 = { static const struct snd_soc_component_driver soc_component_dev_ml26124 = { .probe = ml26124_probe, .set_bias_level = ml26124_set_bias_level, .suspend_bias_off = true, .component_driver = { .controls = ml26124_snd_controls, .num_controls = ARRAY_SIZE(ml26124_snd_controls), .dapm_widgets = ml26124_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(ml26124_dapm_widgets), .dapm_routes = ml26124_intercon, .num_dapm_routes = ARRAY_SIZE(ml26124_intercon), }, .suspend_bias_off = 1, .idle_bias_on = 1, .use_pmdown_time = 1, .endianness = 1, .non_legacy_dai_naming = 1, }; static const struct regmap_config ml26124_i2c_regmap = { Loading Loading @@ -580,14 +582,8 @@ static int ml26124_i2c_probe(struct i2c_client *i2c, return ret; } return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ml26124, &ml26124_dai, 1); } static int ml26124_i2c_remove(struct i2c_client *client) { snd_soc_unregister_codec(&client->dev); return 0; return devm_snd_soc_register_component(&i2c->dev, &soc_component_dev_ml26124, &ml26124_dai, 1); } static const struct i2c_device_id ml26124_i2c_id[] = { Loading @@ -601,7 +597,6 @@ static struct i2c_driver ml26124_i2c_driver = { .name = "ml26124", }, .probe = ml26124_i2c_probe, .remove = ml26124_i2c_remove, .id_table = ml26124_i2c_id, }; Loading