Commit 9123ea9f authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: ak4613: 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
...@@ -243,9 +243,9 @@ static const struct snd_soc_dapm_route ak4613_intercon[] = { ...@@ -243,9 +243,9 @@ static const struct snd_soc_dapm_route ak4613_intercon[] = {
static void ak4613_dai_shutdown(struct snd_pcm_substream *substream, static void ak4613_dai_shutdown(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 ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
struct device *dev = codec->dev; struct device *dev = component->dev;
mutex_lock(&priv->lock); mutex_lock(&priv->lock);
priv->cnt--; priv->cnt--;
...@@ -305,8 +305,8 @@ static void ak4613_hw_constraints(struct ak4613_priv *priv, ...@@ -305,8 +305,8 @@ static void ak4613_hw_constraints(struct ak4613_priv *priv,
static int ak4613_dai_startup(struct snd_pcm_substream *substream, static int ak4613_dai_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 ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
priv->cnt++; priv->cnt++;
...@@ -318,8 +318,8 @@ static int ak4613_dai_startup(struct snd_pcm_substream *substream, ...@@ -318,8 +318,8 @@ static int ak4613_dai_startup(struct snd_pcm_substream *substream,
static int ak4613_dai_set_sysclk(struct snd_soc_dai *codec_dai, static int ak4613_dai_set_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 ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
priv->sysclk = freq; priv->sysclk = freq;
...@@ -328,8 +328,8 @@ static int ak4613_dai_set_sysclk(struct snd_soc_dai *codec_dai, ...@@ -328,8 +328,8 @@ static int ak4613_dai_set_sysclk(struct snd_soc_dai *codec_dai,
static int ak4613_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int ak4613_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
fmt &= SND_SOC_DAIFMT_FORMAT_MASK; fmt &= SND_SOC_DAIFMT_FORMAT_MASK;
...@@ -366,10 +366,10 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -366,10 +366,10 @@ static int ak4613_dai_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 ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
const struct ak4613_interface *iface; const struct ak4613_interface *iface;
struct device *dev = codec->dev; struct device *dev = component->dev;
unsigned int width = params_width(params); unsigned int width = params_width(params);
unsigned int fmt = priv->fmt; unsigned int fmt = priv->fmt;
unsigned int rate; unsigned int rate;
...@@ -434,11 +434,11 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -434,11 +434,11 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
fmt_ctrl = AUDIO_IFACE_TO_VAL(iface); fmt_ctrl = AUDIO_IFACE_TO_VAL(iface);
snd_soc_update_bits(codec, CTRL1, FMT_MASK, fmt_ctrl); snd_soc_component_update_bits(component, CTRL1, FMT_MASK, fmt_ctrl);
snd_soc_update_bits(codec, CTRL2, DFS_MASK, ctrl2); snd_soc_component_update_bits(component, CTRL2, DFS_MASK, ctrl2);
snd_soc_update_bits(codec, ICTRL, ICTRL_MASK, priv->ic); snd_soc_component_update_bits(component, ICTRL, ICTRL_MASK, priv->ic);
snd_soc_update_bits(codec, OCTRL, OCTRL_MASK, priv->oc); snd_soc_component_update_bits(component, OCTRL, OCTRL_MASK, priv->oc);
hw_params_end: hw_params_end:
if (ret < 0) if (ret < 0)
...@@ -447,7 +447,7 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -447,7 +447,7 @@ static int ak4613_dai_hw_params(struct snd_pcm_substream *substream,
return ret; return ret;
} }
static int ak4613_set_bias_level(struct snd_soc_codec *codec, static int ak4613_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
u8 mgmt1 = 0; u8 mgmt1 = 0;
...@@ -467,7 +467,7 @@ static int ak4613_set_bias_level(struct snd_soc_codec *codec, ...@@ -467,7 +467,7 @@ static int ak4613_set_bias_level(struct snd_soc_codec *codec,
break; break;
} }
snd_soc_write(codec, PW_MGMT1, mgmt1); snd_soc_component_write(component, PW_MGMT1, mgmt1);
return 0; return 0;
} }
...@@ -504,8 +504,8 @@ static void ak4613_dummy_write(struct work_struct *work) ...@@ -504,8 +504,8 @@ static void ak4613_dummy_write(struct work_struct *work)
static int ak4613_dai_trigger(struct snd_pcm_substream *substream, int cmd, static int ak4613_dai_trigger(struct snd_pcm_substream *substream, int cmd,
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 ak4613_priv *priv = snd_soc_codec_get_drvdata(codec); struct ak4613_priv *priv = snd_soc_component_get_drvdata(component);
/* /*
* FIXME * FIXME
...@@ -537,7 +537,7 @@ static int ak4613_dai_trigger(struct snd_pcm_substream *substream, int cmd, ...@@ -537,7 +537,7 @@ static int ak4613_dai_trigger(struct snd_pcm_substream *substream, int cmd,
if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK) if (substream->stream != SNDRV_PCM_STREAM_PLAYBACK)
return 0; return 0;
priv->component = &codec->component; priv->component = component;
schedule_work(&priv->dummy_write_work); schedule_work(&priv->dummy_write_work);
return 0; return 0;
...@@ -582,35 +582,37 @@ static struct snd_soc_dai_driver ak4613_dai = { ...@@ -582,35 +582,37 @@ static struct snd_soc_dai_driver ak4613_dai = {
.symmetric_rates = 1, .symmetric_rates = 1,
}; };
static int ak4613_suspend(struct snd_soc_codec *codec) static int ak4613_suspend(struct snd_soc_component *component)
{ {
struct regmap *regmap = dev_get_regmap(codec->dev, NULL); struct regmap *regmap = dev_get_regmap(component->dev, NULL);
regcache_cache_only(regmap, true); regcache_cache_only(regmap, true);
regcache_mark_dirty(regmap); regcache_mark_dirty(regmap);
return 0; return 0;
} }
static int ak4613_resume(struct snd_soc_codec *codec) static int ak4613_resume(struct snd_soc_component *component)
{ {
struct regmap *regmap = dev_get_regmap(codec->dev, NULL); struct regmap *regmap = dev_get_regmap(component->dev, NULL);
regcache_cache_only(regmap, false); regcache_cache_only(regmap, false);
return regcache_sync(regmap); return regcache_sync(regmap);
} }
static const struct snd_soc_codec_driver soc_codec_dev_ak4613 = { static const struct snd_soc_component_driver soc_component_dev_ak4613 = {
.suspend = ak4613_suspend, .suspend = ak4613_suspend,
.resume = ak4613_resume, .resume = ak4613_resume,
.set_bias_level = ak4613_set_bias_level, .set_bias_level = ak4613_set_bias_level,
.component_driver = { .controls = ak4613_snd_controls,
.controls = ak4613_snd_controls, .num_controls = ARRAY_SIZE(ak4613_snd_controls),
.num_controls = ARRAY_SIZE(ak4613_snd_controls), .dapm_widgets = ak4613_dapm_widgets,
.dapm_widgets = ak4613_dapm_widgets, .num_dapm_widgets = ARRAY_SIZE(ak4613_dapm_widgets),
.num_dapm_widgets = ARRAY_SIZE(ak4613_dapm_widgets), .dapm_routes = ak4613_intercon,
.dapm_routes = ak4613_intercon, .num_dapm_routes = ARRAY_SIZE(ak4613_intercon),
.num_dapm_routes = ARRAY_SIZE(ak4613_intercon), .idle_bias_on = 1,
}, .use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static void ak4613_parse_of(struct ak4613_priv *priv, static void ak4613_parse_of(struct ak4613_priv *priv,
...@@ -677,13 +679,12 @@ static int ak4613_i2c_probe(struct i2c_client *i2c, ...@@ -677,13 +679,12 @@ static int ak4613_i2c_probe(struct i2c_client *i2c,
if (IS_ERR(regmap)) if (IS_ERR(regmap))
return PTR_ERR(regmap); return PTR_ERR(regmap);
return snd_soc_register_codec(dev, &soc_codec_dev_ak4613, return devm_snd_soc_register_component(dev, &soc_component_dev_ak4613,
&ak4613_dai, 1); &ak4613_dai, 1);
} }
static int ak4613_i2c_remove(struct i2c_client *client) static int ak4613_i2c_remove(struct i2c_client *client)
{ {
snd_soc_unregister_codec(&client->dev);
return 0; return 0;
} }
......
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