diff options
-rw-r--r-- | sound/soc/codecs/jz4740.c | 50 |
1 files changed, 22 insertions, 28 deletions
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c index 6324ccdc8a5c..9395b583432c 100644 --- a/sound/soc/codecs/jz4740.c +++ b/sound/soc/codecs/jz4740.c @@ -157,7 +157,7 @@ static const struct snd_soc_dapm_route jz4740_codec_dapm_routes[] = { static int jz4740_codec_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { - struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(dai->codec); + struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(dai->component); uint32_t val; switch (params_rate(params)) { @@ -236,10 +236,10 @@ static void jz4740_codec_wakeup(struct regmap *regmap) regcache_sync(regmap); } -static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, +static int jz4740_codec_set_bias_level(struct snd_soc_component *component, enum snd_soc_bias_level level) { - struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec); + struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(component); struct regmap *regmap = jz4740_codec->regmap; unsigned int mask; unsigned int value; @@ -257,7 +257,7 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, break; case SND_SOC_BIAS_STANDBY: /* The only way to clear the suspend flag is to reset the codec */ - if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) + if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) jz4740_codec_wakeup(regmap); mask = JZ4740_CODEC_1_VREF_DISABLE | @@ -283,9 +283,9 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, return 0; } -static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) +static int jz4740_codec_dev_probe(struct snd_soc_component *component) { - struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec); + struct jz4740_codec *jz4740_codec = snd_soc_component_get_drvdata(component); regmap_update_bits(jz4740_codec->regmap, JZ4740_REG_CODEC_1, JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE); @@ -293,19 +293,21 @@ static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) return 0; } -static const struct snd_soc_codec_driver soc_codec_dev_jz4740_codec = { - .probe = jz4740_codec_dev_probe, - .set_bias_level = jz4740_codec_set_bias_level, - .suspend_bias_off = true, - - .component_driver = { - .controls = jz4740_codec_controls, - .num_controls = ARRAY_SIZE(jz4740_codec_controls), - .dapm_widgets = jz4740_codec_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(jz4740_codec_dapm_widgets), - .dapm_routes = jz4740_codec_dapm_routes, - .num_dapm_routes = ARRAY_SIZE(jz4740_codec_dapm_routes), - }, +static const struct snd_soc_component_driver soc_codec_dev_jz4740_codec = { + .probe = jz4740_codec_dev_probe, + .set_bias_level = jz4740_codec_set_bias_level, + .controls = jz4740_codec_controls, + .num_controls = ARRAY_SIZE(jz4740_codec_controls), + .dapm_widgets = jz4740_codec_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(jz4740_codec_dapm_widgets), + .dapm_routes = jz4740_codec_dapm_routes, + .num_dapm_routes = ARRAY_SIZE(jz4740_codec_dapm_routes), + .suspend_bias_off = 1, + .idle_bias_on = 1, + .use_pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, + }; static const struct regmap_config jz4740_codec_regmap_config = { @@ -343,7 +345,7 @@ static int jz4740_codec_probe(struct platform_device *pdev) platform_set_drvdata(pdev, jz4740_codec); - ret = snd_soc_register_codec(&pdev->dev, + ret = devm_snd_soc_register_component(&pdev->dev, &soc_codec_dev_jz4740_codec, &jz4740_codec_dai, 1); if (ret) dev_err(&pdev->dev, "Failed to register codec\n"); @@ -351,16 +353,8 @@ static int jz4740_codec_probe(struct platform_device *pdev) return ret; } -static int jz4740_codec_remove(struct platform_device *pdev) -{ - snd_soc_unregister_codec(&pdev->dev); - - return 0; -} - static struct platform_driver jz4740_codec_driver = { .probe = jz4740_codec_probe, - .remove = jz4740_codec_remove, .driver = { .name = "jz4740-codec", }, |