Commit ad4771ef authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: ssm2602: 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
...@@ -27,12 +27,6 @@ static int ssm2602_i2c_probe(struct i2c_client *client, ...@@ -27,12 +27,6 @@ static int ssm2602_i2c_probe(struct i2c_client *client,
devm_regmap_init_i2c(client, &ssm2602_regmap_config)); devm_regmap_init_i2c(client, &ssm2602_regmap_config));
} }
static int ssm2602_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
}
static const struct i2c_device_id ssm2602_i2c_id[] = { static const struct i2c_device_id ssm2602_i2c_id[] = {
{ "ssm2602", SSM2602 }, { "ssm2602", SSM2602 },
{ "ssm2603", SSM2602 }, { "ssm2603", SSM2602 },
...@@ -55,7 +49,6 @@ static struct i2c_driver ssm2602_i2c_driver = { ...@@ -55,7 +49,6 @@ static struct i2c_driver ssm2602_i2c_driver = {
.of_match_table = ssm2602_of_match, .of_match_table = ssm2602_of_match,
}, },
.probe = ssm2602_i2c_probe, .probe = ssm2602_i2c_probe,
.remove = ssm2602_i2c_remove,
.id_table = ssm2602_i2c_id, .id_table = ssm2602_i2c_id,
}; };
module_i2c_driver(ssm2602_i2c_driver); module_i2c_driver(ssm2602_i2c_driver);
......
...@@ -20,12 +20,6 @@ static int ssm2602_spi_probe(struct spi_device *spi) ...@@ -20,12 +20,6 @@ static int ssm2602_spi_probe(struct spi_device *spi)
devm_regmap_init_spi(spi, &ssm2602_regmap_config)); devm_regmap_init_spi(spi, &ssm2602_regmap_config));
} }
static int ssm2602_spi_remove(struct spi_device *spi)
{
snd_soc_unregister_codec(&spi->dev);
return 0;
}
static const struct of_device_id ssm2602_of_match[] = { static const struct of_device_id ssm2602_of_match[] = {
{ .compatible = "adi,ssm2602", }, { .compatible = "adi,ssm2602", },
{ } { }
...@@ -38,7 +32,6 @@ static struct spi_driver ssm2602_spi_driver = { ...@@ -38,7 +32,6 @@ static struct spi_driver ssm2602_spi_driver = {
.of_match_table = ssm2602_of_match, .of_match_table = ssm2602_of_match,
}, },
.probe = ssm2602_spi_probe, .probe = ssm2602_spi_probe,
.remove = ssm2602_spi_remove,
}; };
module_spi_driver(ssm2602_spi_driver); module_spi_driver(ssm2602_spi_driver);
......
...@@ -273,8 +273,8 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream, ...@@ -273,8 +273,8 @@ static int ssm2602_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 ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
int srate = ssm2602_get_coeff(ssm2602->sysclk, params_rate(params)); int srate = ssm2602_get_coeff(ssm2602->sysclk, params_rate(params));
unsigned int iface; unsigned int iface;
...@@ -308,8 +308,8 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream, ...@@ -308,8 +308,8 @@ static int ssm2602_hw_params(struct snd_pcm_substream *substream,
static int ssm2602_startup(struct snd_pcm_substream *substream, static int ssm2602_startup(struct snd_pcm_substream *substream,
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 ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
if (ssm2602->sysclk_constraints) { if (ssm2602->sysclk_constraints) {
snd_pcm_hw_constraint_list(substream->runtime, 0, snd_pcm_hw_constraint_list(substream->runtime, 0,
...@@ -322,7 +322,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream, ...@@ -322,7 +322,7 @@ static int ssm2602_startup(struct snd_pcm_substream *substream,
static int ssm2602_mute(struct snd_soc_dai *dai, int mute) static int ssm2602_mute(struct snd_soc_dai *dai, int mute)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(dai->codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(dai->component);
if (mute) if (mute)
regmap_update_bits(ssm2602->regmap, SSM2602_APDIGI, regmap_update_bits(ssm2602->regmap, SSM2602_APDIGI,
...@@ -337,8 +337,8 @@ static int ssm2602_mute(struct snd_soc_dai *dai, int mute) ...@@ -337,8 +337,8 @@ static int ssm2602_mute(struct snd_soc_dai *dai, int mute)
static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai, static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
int clk_id, unsigned int freq, int dir) int clk_id, unsigned int freq, int dir)
{ {
struct snd_soc_codec *codec = codec_dai->codec; struct snd_soc_component *component = codec_dai->component;
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
if (dir == SND_SOC_CLOCK_IN) { if (dir == SND_SOC_CLOCK_IN) {
if (clk_id != SSM2602_SYSCLK) if (clk_id != SSM2602_SYSCLK)
...@@ -389,7 +389,7 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai, ...@@ -389,7 +389,7 @@ static int ssm2602_set_dai_sysclk(struct snd_soc_dai *codec_dai,
static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai, static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai,
unsigned int fmt) unsigned int fmt)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec_dai->codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(codec_dai->component);
unsigned int iface = 0; unsigned int iface = 0;
/* set master/slave audio interface */ /* set master/slave audio interface */
...@@ -445,10 +445,10 @@ static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai, ...@@ -445,10 +445,10 @@ static int ssm2602_set_dai_fmt(struct snd_soc_dai *codec_dai,
return 0; return 0;
} }
static int ssm2602_set_bias_level(struct snd_soc_codec *codec, static int ssm2602_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
...@@ -511,19 +511,19 @@ static struct snd_soc_dai_driver ssm2602_dai = { ...@@ -511,19 +511,19 @@ static struct snd_soc_dai_driver ssm2602_dai = {
.symmetric_samplebits = 1, .symmetric_samplebits = 1,
}; };
static int ssm2602_resume(struct snd_soc_codec *codec) static int ssm2602_resume(struct snd_soc_component *component)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
regcache_sync(ssm2602->regmap); regcache_sync(ssm2602->regmap);
return 0; return 0;
} }
static int ssm2602_codec_probe(struct snd_soc_codec *codec) static int ssm2602_component_probe(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
int ret; int ret;
regmap_update_bits(ssm2602->regmap, SSM2602_LOUT1V, regmap_update_bits(ssm2602->regmap, SSM2602_LOUT1V,
...@@ -531,7 +531,7 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec) ...@@ -531,7 +531,7 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec)
regmap_update_bits(ssm2602->regmap, SSM2602_ROUT1V, regmap_update_bits(ssm2602->regmap, SSM2602_ROUT1V,
ROUT1V_RLHP_BOTH, ROUT1V_RLHP_BOTH); ROUT1V_RLHP_BOTH, ROUT1V_RLHP_BOTH);
ret = snd_soc_add_codec_controls(codec, ssm2602_snd_controls, ret = snd_soc_add_component_controls(component, ssm2602_snd_controls,
ARRAY_SIZE(ssm2602_snd_controls)); ARRAY_SIZE(ssm2602_snd_controls));
if (ret) if (ret)
return ret; return ret;
...@@ -545,9 +545,9 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec) ...@@ -545,9 +545,9 @@ static int ssm2602_codec_probe(struct snd_soc_codec *codec)
ARRAY_SIZE(ssm2602_routes)); ARRAY_SIZE(ssm2602_routes));
} }
static int ssm2604_codec_probe(struct snd_soc_codec *codec) static int ssm2604_component_probe(struct snd_soc_component *component)
{ {
struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
int ret; int ret;
ret = snd_soc_dapm_new_controls(dapm, ssm2604_dapm_widgets, ret = snd_soc_dapm_new_controls(dapm, ssm2604_dapm_widgets,
...@@ -559,14 +559,14 @@ static int ssm2604_codec_probe(struct snd_soc_codec *codec) ...@@ -559,14 +559,14 @@ static int ssm2604_codec_probe(struct snd_soc_codec *codec)
ARRAY_SIZE(ssm2604_routes)); ARRAY_SIZE(ssm2604_routes));
} }
static int ssm260x_codec_probe(struct snd_soc_codec *codec) static int ssm260x_component_probe(struct snd_soc_component *component)
{ {
struct ssm2602_priv *ssm2602 = snd_soc_codec_get_drvdata(codec); struct ssm2602_priv *ssm2602 = snd_soc_component_get_drvdata(component);
int ret; int ret;
ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0); ret = regmap_write(ssm2602->regmap, SSM2602_RESET, 0);
if (ret < 0) { if (ret < 0) {
dev_err(codec->dev, "Failed to issue reset: %d\n", ret); dev_err(component->dev, "Failed to issue reset: %d\n", ret);
return ret; return ret;
} }
...@@ -581,30 +581,31 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec) ...@@ -581,30 +581,31 @@ static int ssm260x_codec_probe(struct snd_soc_codec *codec)
switch (ssm2602->type) { switch (ssm2602->type) {
case SSM2602: case SSM2602:
ret = ssm2602_codec_probe(codec); ret = ssm2602_component_probe(component);
break; break;
case SSM2604: case SSM2604:
ret = ssm2604_codec_probe(codec); ret = ssm2604_component_probe(component);
break; break;
} }
return ret; return ret;
} }
static const struct snd_soc_codec_driver soc_codec_dev_ssm2602 = { static const struct snd_soc_component_driver soc_component_dev_ssm2602 = {
.probe = ssm260x_codec_probe, .probe = ssm260x_component_probe,
.resume = ssm2602_resume, .resume = ssm2602_resume,
.set_bias_level = ssm2602_set_bias_level, .set_bias_level = ssm2602_set_bias_level,
.suspend_bias_off = true,
.component_driver = {
.controls = ssm260x_snd_controls, .controls = ssm260x_snd_controls,
.num_controls = ARRAY_SIZE(ssm260x_snd_controls), .num_controls = ARRAY_SIZE(ssm260x_snd_controls),
.dapm_widgets = ssm260x_dapm_widgets, .dapm_widgets = ssm260x_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(ssm260x_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(ssm260x_dapm_widgets),
.dapm_routes = ssm260x_routes, .dapm_routes = ssm260x_routes,
.num_dapm_routes = ARRAY_SIZE(ssm260x_routes), .num_dapm_routes = ARRAY_SIZE(ssm260x_routes),
}, .suspend_bias_off = 1,
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static bool ssm2602_register_volatile(struct device *dev, unsigned int reg) static bool ssm2602_register_volatile(struct device *dev, unsigned int reg)
...@@ -641,7 +642,7 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type, ...@@ -641,7 +642,7 @@ int ssm2602_probe(struct device *dev, enum ssm2602_type type,
ssm2602->type = type; ssm2602->type = type;
ssm2602->regmap = regmap; ssm2602->regmap = regmap;
return snd_soc_register_codec(dev, &soc_codec_dev_ssm2602, return devm_snd_soc_register_component(dev, &soc_component_dev_ssm2602,
&ssm2602_dai, 1); &ssm2602_dai, 1);
} }
EXPORT_SYMBOL_GPL(ssm2602_probe); EXPORT_SYMBOL_GPL(ssm2602_probe);
......
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