Commit 61feead8 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: ak4104: replace codec to component

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: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7928b2cb
...@@ -65,8 +65,8 @@ static const struct snd_soc_dapm_route ak4104_dapm_routes[] = { ...@@ -65,8 +65,8 @@ static const struct snd_soc_dapm_route ak4104_dapm_routes[] = {
static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai, static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int format) unsigned int format)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); struct ak4104_private *ak4104 = snd_soc_component_get_drvdata(component);
int val = 0; int val = 0;
int ret; int ret;
...@@ -81,7 +81,7 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -81,7 +81,7 @@ static int ak4104_set_dai_fmt(struct snd_soc_dai *codec_dai,
val |= AK4104_CONTROL1_DIF0 | AK4104_CONTROL1_DIF1; val |= AK4104_CONTROL1_DIF0 | AK4104_CONTROL1_DIF1;
break; break;
default: default:
dev_err(codec->dev, "invalid dai format\n"); dev_err(component->dev, "invalid dai format\n");
return -EINVAL; return -EINVAL;
} }
...@@ -102,8 +102,8 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, ...@@ -102,8 +102,8 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); struct ak4104_private *ak4104 = snd_soc_component_get_drvdata(component);
int ret, val = 0; int ret, val = 0;
/* set the IEC958 bits: consumer mode, no copyright bit */ /* set the IEC958 bits: consumer mode, no copyright bit */
...@@ -141,7 +141,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream, ...@@ -141,7 +141,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
val |= IEC958_AES3_CON_FS_192000; val |= IEC958_AES3_CON_FS_192000;
break; break;
default: default:
dev_err(codec->dev, "unsupported sampling rate\n"); dev_err(component->dev, "unsupported sampling rate\n");
return -EINVAL; return -EINVAL;
} }
...@@ -174,14 +174,14 @@ static struct snd_soc_dai_driver ak4104_dai = { ...@@ -174,14 +174,14 @@ static struct snd_soc_dai_driver ak4104_dai = {
.ops = &ak4101_dai_ops, .ops = &ak4101_dai_ops,
}; };
static int ak4104_probe(struct snd_soc_codec *codec) static int ak4104_probe(struct snd_soc_component *component)
{ {
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); struct ak4104_private *ak4104 = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = regulator_enable(ak4104->regulator); ret = regulator_enable(ak4104->regulator);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Unable to enable regulator: %d\n", ret); dev_err(component->dev, "Unable to enable regulator: %d\n", ret);
return ret; return ret;
} }
...@@ -205,30 +205,28 @@ static int ak4104_probe(struct snd_soc_codec *codec) ...@@ -205,30 +205,28 @@ static int ak4104_probe(struct snd_soc_codec *codec)
return ret; return ret;
} }
static int ak4104_remove(struct snd_soc_codec *codec) static void ak4104_remove(struct snd_soc_component *component)
{ {
struct ak4104_private *ak4104 = snd_soc_codec_get_drvdata(codec); struct ak4104_private *ak4104 = snd_soc_component_get_drvdata(component);
regmap_update_bits(ak4104->regmap, AK4104_REG_CONTROL1, regmap_update_bits(ak4104->regmap, AK4104_REG_CONTROL1,
AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN, 0); AK4104_CONTROL1_PW | AK4104_CONTROL1_RSTN, 0);
regulator_disable(ak4104->regulator); regulator_disable(ak4104->regulator);
return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM
static int ak4104_soc_suspend(struct snd_soc_codec *codec) static int ak4104_soc_suspend(struct snd_soc_component *component)
{ {
struct ak4104_private *priv = snd_soc_codec_get_drvdata(codec); struct ak4104_private *priv = snd_soc_component_get_drvdata(component);
regulator_disable(priv->regulator); regulator_disable(priv->regulator);
return 0; return 0;
} }
static int ak4104_soc_resume(struct snd_soc_codec *codec) static int ak4104_soc_resume(struct snd_soc_component *component)
{ {
struct ak4104_private *priv = snd_soc_codec_get_drvdata(codec); struct ak4104_private *priv = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = regulator_enable(priv->regulator); ret = regulator_enable(priv->regulator);
...@@ -242,18 +240,19 @@ static int ak4104_soc_resume(struct snd_soc_codec *codec) ...@@ -242,18 +240,19 @@ static int ak4104_soc_resume(struct snd_soc_codec *codec)
#define ak4104_soc_resume NULL #define ak4104_soc_resume NULL
#endif /* CONFIG_PM */ #endif /* CONFIG_PM */
static const struct snd_soc_codec_driver soc_codec_device_ak4104 = { static const struct snd_soc_component_driver soc_component_device_ak4104 = {
.probe = ak4104_probe, .probe = ak4104_probe,
.remove = ak4104_remove, .remove = ak4104_remove,
.suspend = ak4104_soc_suspend, .suspend = ak4104_soc_suspend,
.resume = ak4104_soc_resume, .resume = ak4104_soc_resume,
.dapm_widgets = ak4104_dapm_widgets,
.component_driver = { .num_dapm_widgets = ARRAY_SIZE(ak4104_dapm_widgets),
.dapm_widgets = ak4104_dapm_widgets, .dapm_routes = ak4104_dapm_routes,
.num_dapm_widgets = ARRAY_SIZE(ak4104_dapm_widgets), .num_dapm_routes = ARRAY_SIZE(ak4104_dapm_routes),
.dapm_routes = ak4104_dapm_routes, .idle_bias_on = 1,
.num_dapm_routes = ARRAY_SIZE(ak4104_dapm_routes), .use_pmdown_time = 1,
} .endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct regmap_config ak4104_regmap = { static const struct regmap_config ak4104_regmap = {
...@@ -323,17 +322,11 @@ static int ak4104_spi_probe(struct spi_device *spi) ...@@ -323,17 +322,11 @@ static int ak4104_spi_probe(struct spi_device *spi)
spi_set_drvdata(spi, ak4104); spi_set_drvdata(spi, ak4104);
ret = snd_soc_register_codec(&spi->dev, ret = devm_snd_soc_register_component(&spi->dev,
&soc_codec_device_ak4104, &ak4104_dai, 1); &soc_component_device_ak4104, &ak4104_dai, 1);
return ret; return ret;
} }
static int ak4104_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
return 0;
}
static const struct of_device_id ak4104_of_match[] = { static const struct of_device_id ak4104_of_match[] = {
{ .compatible = "asahi-kasei,ak4104", }, { .compatible = "asahi-kasei,ak4104", },
{ } { }
...@@ -353,7 +346,6 @@ static struct spi_driver ak4104_spi_driver = { ...@@ -353,7 +346,6 @@ static struct spi_driver ak4104_spi_driver = {
}, },
.id_table = ak4104_id_table, .id_table = ak4104_id_table,
.probe = ak4104_spi_probe, .probe = ak4104_spi_probe,
.remove = ak4104_spi_remove,
}; };
module_spi_driver(ak4104_spi_driver); module_spi_driver(ak4104_spi_driver);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment