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 -> .pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto kuninori.morimoto.gx@renesas.com --- sound/soc/codecs/max98371.c | 43 +++++++++++++++++++------------------------ sound/soc/codecs/max98371.h | 1 - 2 files changed, 19 insertions(+), 25 deletions(-)
diff --git a/sound/soc/codecs/max98371.c b/sound/soc/codecs/max98371.c index 7bc2a17..19dcfaa 100644 --- a/sound/soc/codecs/max98371.c +++ b/sound/soc/codecs/max98371.c @@ -187,15 +187,15 @@ static const DECLARE_TLV_DB_RANGE(max98371_noload_gain_tlv, static int max98371_dai_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) { - struct snd_soc_codec *codec = codec_dai->codec; - struct max98371_priv *max98371 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = codec_dai->component; + struct max98371_priv *max98371 = snd_soc_component_get_drvdata(component); unsigned int val = 0;
switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { case SND_SOC_DAIFMT_CBS_CFS: break; default: - dev_err(codec->dev, "DAI clock mode unsupported"); + dev_err(component->dev, "DAI clock mode unsupported"); return -EINVAL; }
@@ -210,7 +210,7 @@ static int max98371_dai_set_fmt(struct snd_soc_dai *codec_dai, val |= MAX98371_DAI_LEFT; break; default: - dev_err(codec->dev, "DAI wrong mode unsupported"); + dev_err(component->dev, "DAI wrong mode unsupported"); return -EINVAL; } regmap_update_bits(max98371->regmap, MAX98371_FMT, @@ -222,8 +222,8 @@ static int max98371_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 max98371_priv *max98371 = snd_soc_codec_get_drvdata(codec); + struct snd_soc_component *component = dai->component; + struct max98371_priv *max98371 = snd_soc_component_get_drvdata(component); int blr_clk_ratio, ch_size, channels = params_channels(params); int rate = params_rate(params);
@@ -348,15 +348,17 @@ static int max98371_dai_hw_params(struct snd_pcm_substream *substream, } };
-static const struct snd_soc_codec_driver max98371_codec = { - .component_driver = { - .controls = max98371_snd_controls, - .num_controls = ARRAY_SIZE(max98371_snd_controls), - .dapm_routes = max98371_audio_map, - .num_dapm_routes = ARRAY_SIZE(max98371_audio_map), - .dapm_widgets = max98371_dapm_widgets, - .num_dapm_widgets = ARRAY_SIZE(max98371_dapm_widgets), - }, +static const struct snd_soc_component_driver max98371_component = { + .controls = max98371_snd_controls, + .num_controls = ARRAY_SIZE(max98371_snd_controls), + .dapm_routes = max98371_audio_map, + .num_dapm_routes = ARRAY_SIZE(max98371_audio_map), + .dapm_widgets = max98371_dapm_widgets, + .num_dapm_widgets = ARRAY_SIZE(max98371_dapm_widgets), + .idle_bias_on = 1, + .pmdown_time = 1, + .endianness = 1, + .non_legacy_dai_naming = 1, };
static const struct regmap_config max98371_regmap = { @@ -397,21 +399,15 @@ static int max98371_i2c_probe(struct i2c_client *i2c, } dev_info(&i2c->dev, "device version %x\n", reg);
- ret = snd_soc_register_codec(&i2c->dev, &max98371_codec, + ret = devm_snd_soc_register_component(&i2c->dev, &max98371_component, max98371_dai, ARRAY_SIZE(max98371_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; } return ret; }
-static int max98371_i2c_remove(struct i2c_client *client) -{ - snd_soc_unregister_codec(&client->dev); - return 0; -} - static const struct i2c_device_id max98371_i2c_id[] = { { "max98371", 0 }, { } @@ -432,7 +428,6 @@ static int max98371_i2c_remove(struct i2c_client *client) .of_match_table = of_match_ptr(max98371_of_match), }, .probe = max98371_i2c_probe, - .remove = max98371_i2c_remove, .id_table = max98371_i2c_id, };
diff --git a/sound/soc/codecs/max98371.h b/sound/soc/codecs/max98371.h index 9f63309..06e9ba7 100644 --- a/sound/soc/codecs/max98371.h +++ b/sound/soc/codecs/max98371.h @@ -62,6 +62,5 @@
struct max98371_priv { struct regmap *regmap; - struct snd_soc_codec *codec; }; #endif