Commit 12a72f91 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: nau8824: 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
...@@ -414,8 +414,8 @@ static const struct snd_kcontrol_new nau8824_snd_controls[] = { ...@@ -414,8 +414,8 @@ static const struct snd_kcontrol_new nau8824_snd_controls[] = {
static int nau8824_output_dac_event(struct snd_soc_dapm_widget *w, static int nau8824_output_dac_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMU: case SND_SOC_DAPM_PRE_PMU:
...@@ -437,8 +437,8 @@ static int nau8824_output_dac_event(struct snd_soc_dapm_widget *w, ...@@ -437,8 +437,8 @@ static int nau8824_output_dac_event(struct snd_soc_dapm_widget *w,
static int nau8824_spk_event(struct snd_soc_dapm_widget *w, static int nau8824_spk_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
switch (event) { switch (event) {
case SND_SOC_DAPM_PRE_PMU: case SND_SOC_DAPM_PRE_PMU:
...@@ -461,8 +461,8 @@ static int nau8824_spk_event(struct snd_soc_dapm_widget *w, ...@@ -461,8 +461,8 @@ static int nau8824_spk_event(struct snd_soc_dapm_widget *w,
static int nau8824_pump_event(struct snd_soc_dapm_widget *w, static int nau8824_pump_event(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *kcontrol, int event) struct snd_kcontrol *kcontrol, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
switch (event) { switch (event) {
case SND_SOC_DAPM_POST_PMU: case SND_SOC_DAPM_POST_PMU:
...@@ -487,8 +487,8 @@ static int nau8824_pump_event(struct snd_soc_dapm_widget *w, ...@@ -487,8 +487,8 @@ static int nau8824_pump_event(struct snd_soc_dapm_widget *w,
static int system_clock_control(struct snd_soc_dapm_widget *w, static int system_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event) struct snd_kcontrol *k, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
if (SND_SOC_DAPM_EVENT_OFF(event)) { if (SND_SOC_DAPM_EVENT_OFF(event)) {
/* Set clock source to disable or internal clock before the /* Set clock source to disable or internal clock before the
...@@ -509,8 +509,8 @@ static int system_clock_control(struct snd_soc_dapm_widget *w, ...@@ -509,8 +509,8 @@ static int system_clock_control(struct snd_soc_dapm_widget *w,
static int dmic_clock_control(struct snd_soc_dapm_widget *w, static int dmic_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event) struct snd_kcontrol *k, int event)
{ {
struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
int src; int src;
/* The DMIC clock is gotten from system clock (256fs) divided by /* The DMIC clock is gotten from system clock (256fs) divided by
...@@ -988,8 +988,8 @@ static int nau8824_clock_check(struct nau8824 *nau8824, ...@@ -988,8 +988,8 @@ static int nau8824_clock_check(struct nau8824 *nau8824,
static int nau8824_hw_params(struct snd_pcm_substream *substream, static int nau8824_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
unsigned int val_len = 0, osr, ctrl_val, bclk_fs, bclk_div; unsigned int val_len = 0, osr, ctrl_val, bclk_fs, bclk_div;
nau8824_sema_acquire(nau8824, HZ); nau8824_sema_acquire(nau8824, HZ);
...@@ -1072,8 +1072,8 @@ static int nau8824_hw_params(struct snd_pcm_substream *substream, ...@@ -1072,8 +1072,8 @@ static int nau8824_hw_params(struct snd_pcm_substream *substream,
static int nau8824_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) static int nau8824_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 nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
unsigned int ctrl1_val = 0, ctrl2_val = 0; unsigned int ctrl1_val = 0, ctrl2_val = 0;
nau8824_sema_acquire(nau8824, HZ); nau8824_sema_acquire(nau8824, HZ);
...@@ -1149,8 +1149,8 @@ static int nau8824_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) ...@@ -1149,8 +1149,8 @@ static int nau8824_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
static int nau8824_set_tdm_slot(struct snd_soc_dai *dai, static int nau8824_set_tdm_slot(struct snd_soc_dai *dai,
unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width)
{ {
struct snd_soc_codec *codec = dai->codec; struct snd_soc_component *component = dai->component;
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
unsigned int tslot_l = 0, ctrl_val = 0; unsigned int tslot_l = 0, ctrl_val = 0;
if (slots > 4 || ((tx_mask & 0xf0) && (tx_mask & 0xf)) || if (slots > 4 || ((tx_mask & 0xf0) && (tx_mask & 0xf)) ||
...@@ -1288,10 +1288,10 @@ static void nau8824_fll_apply(struct regmap *regmap, ...@@ -1288,10 +1288,10 @@ static void nau8824_fll_apply(struct regmap *regmap,
} }
/* freq_out must be 256*Fs in order to achieve the best performance */ /* freq_out must be 256*Fs in order to achieve the best performance */
static int nau8824_set_pll(struct snd_soc_codec *codec, int pll_id, int source, static int nau8824_set_pll(struct snd_soc_component *component, int pll_id, int source,
unsigned int freq_in, unsigned int freq_out) unsigned int freq_in, unsigned int freq_out)
{ {
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
struct nau8824_fll fll_param; struct nau8824_fll fll_param;
int ret, fs; int ret, fs;
...@@ -1374,10 +1374,10 @@ static int nau8824_config_sysclk(struct nau8824 *nau8824, ...@@ -1374,10 +1374,10 @@ static int nau8824_config_sysclk(struct nau8824 *nau8824,
return 0; return 0;
} }
static int nau8824_set_sysclk(struct snd_soc_codec *codec, static int nau8824_set_sysclk(struct snd_soc_component *component,
int clk_id, int source, unsigned int freq, int dir) int clk_id, int source, unsigned int freq, int dir)
{ {
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
return nau8824_config_sysclk(nau8824, clk_id, freq); return nau8824_config_sysclk(nau8824, clk_id, freq);
} }
...@@ -1403,10 +1403,10 @@ static void nau8824_resume_setup(struct nau8824 *nau8824) ...@@ -1403,10 +1403,10 @@ static void nau8824_resume_setup(struct nau8824 *nau8824)
} }
} }
static int nau8824_set_bias_level(struct snd_soc_codec *codec, static int nau8824_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level) enum snd_soc_bias_level level)
{ {
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
switch (level) { switch (level) {
case SND_SOC_BIAS_ON: case SND_SOC_BIAS_ON:
...@@ -1416,7 +1416,7 @@ static int nau8824_set_bias_level(struct snd_soc_codec *codec, ...@@ -1416,7 +1416,7 @@ static int nau8824_set_bias_level(struct snd_soc_codec *codec,
break; break;
case SND_SOC_BIAS_STANDBY: case SND_SOC_BIAS_STANDBY:
if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
/* Setup codec configuration after resume */ /* Setup codec configuration after resume */
nau8824_resume_setup(nau8824); nau8824_resume_setup(nau8824);
} }
...@@ -1434,23 +1434,23 @@ static int nau8824_set_bias_level(struct snd_soc_codec *codec, ...@@ -1434,23 +1434,23 @@ static int nau8824_set_bias_level(struct snd_soc_codec *codec,
return 0; return 0;
} }
static int nau8824_codec_probe(struct snd_soc_codec *codec) static int nau8824_component_probe(struct snd_soc_component *component)
{ {
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(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);
nau8824->dapm = dapm; nau8824->dapm = dapm;
return 0; return 0;
} }
static int __maybe_unused nau8824_suspend(struct snd_soc_codec *codec) static int __maybe_unused nau8824_suspend(struct snd_soc_component *component)
{ {
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
if (nau8824->irq) { if (nau8824->irq) {
disable_irq(nau8824->irq); disable_irq(nau8824->irq);
snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_OFF); snd_soc_component_force_bias_level(component, SND_SOC_BIAS_OFF);
} }
regcache_cache_only(nau8824->regmap, true); regcache_cache_only(nau8824->regmap, true);
regcache_mark_dirty(nau8824->regmap); regcache_mark_dirty(nau8824->regmap);
...@@ -1458,9 +1458,9 @@ static int __maybe_unused nau8824_suspend(struct snd_soc_codec *codec) ...@@ -1458,9 +1458,9 @@ static int __maybe_unused nau8824_suspend(struct snd_soc_codec *codec)
return 0; return 0;
} }
static int __maybe_unused nau8824_resume(struct snd_soc_codec *codec) static int __maybe_unused nau8824_resume(struct snd_soc_component *component)
{ {
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
regcache_cache_only(nau8824->regmap, false); regcache_cache_only(nau8824->regmap, false);
regcache_sync(nau8824->regmap); regcache_sync(nau8824->regmap);
...@@ -1475,23 +1475,24 @@ static int __maybe_unused nau8824_resume(struct snd_soc_codec *codec) ...@@ -1475,23 +1475,24 @@ static int __maybe_unused nau8824_resume(struct snd_soc_codec *codec)
return 0; return 0;
} }
static const struct snd_soc_codec_driver nau8824_codec_driver = { static const struct snd_soc_component_driver nau8824_component_driver = {
.probe = nau8824_codec_probe, .probe = nau8824_component_probe,
.set_sysclk = nau8824_set_sysclk, .set_sysclk = nau8824_set_sysclk,
.set_pll = nau8824_set_pll, .set_pll = nau8824_set_pll,
.set_bias_level = nau8824_set_bias_level, .set_bias_level = nau8824_set_bias_level,
.suspend = nau8824_suspend, .suspend = nau8824_suspend,
.resume = nau8824_resume, .resume = nau8824_resume,
.suspend_bias_off = true,
.component_driver = {
.controls = nau8824_snd_controls, .controls = nau8824_snd_controls,
.num_controls = ARRAY_SIZE(nau8824_snd_controls), .num_controls = ARRAY_SIZE(nau8824_snd_controls),
.dapm_widgets = nau8824_dapm_widgets, .dapm_widgets = nau8824_dapm_widgets,
.num_dapm_widgets = ARRAY_SIZE(nau8824_dapm_widgets), .num_dapm_widgets = ARRAY_SIZE(nau8824_dapm_widgets),
.dapm_routes = nau8824_dapm_routes, .dapm_routes = nau8824_dapm_routes,
.num_dapm_routes = ARRAY_SIZE(nau8824_dapm_routes), .num_dapm_routes = ARRAY_SIZE(nau8824_dapm_routes),
}, .suspend_bias_off = 1,
.idle_bias_on = 1,
.use_pmdown_time = 1,
.endianness = 1,
.non_legacy_dai_naming = 1,
}; };
static const struct snd_soc_dai_ops nau8824_dai_ops = { static const struct snd_soc_dai_ops nau8824_dai_ops = {
...@@ -1547,10 +1548,10 @@ static const struct regmap_config nau8824_regmap_config = { ...@@ -1547,10 +1548,10 @@ static const struct regmap_config nau8824_regmap_config = {
* events will be routed to the given jack. Jack can be null to stop * events will be routed to the given jack. Jack can be null to stop
* reporting. * reporting.
*/ */
int nau8824_enable_jack_detect(struct snd_soc_codec *codec, int nau8824_enable_jack_detect(struct snd_soc_component *component,
struct snd_soc_jack *jack) struct snd_soc_jack *jack)
{ {
struct nau8824 *nau8824 = snd_soc_codec_get_drvdata(codec); struct nau8824 *nau8824 = snd_soc_component_get_drvdata(component);
int ret; int ret;
nau8824->jack = jack; nau8824->jack = jack;
...@@ -1838,15 +1839,8 @@ static int nau8824_i2c_probe(struct i2c_client *i2c, ...@@ -1838,15 +1839,8 @@ static int nau8824_i2c_probe(struct i2c_client *i2c,
if (i2c->irq) if (i2c->irq)
nau8824_setup_irq(nau8824); nau8824_setup_irq(nau8824);
return snd_soc_register_codec(dev, return devm_snd_soc_register_component(dev,
&nau8824_codec_driver, &nau8824_dai, 1); &nau8824_component_driver, &nau8824_dai, 1);
}
static int nau8824_i2c_remove(struct i2c_client *client)
{
snd_soc_unregister_codec(&client->dev);
return 0;
} }
static const struct i2c_device_id nau8824_i2c_ids[] = { static const struct i2c_device_id nau8824_i2c_ids[] = {
...@@ -1878,7 +1872,6 @@ static struct i2c_driver nau8824_i2c_driver = { ...@@ -1878,7 +1872,6 @@ static struct i2c_driver nau8824_i2c_driver = {
.acpi_match_table = ACPI_PTR(nau8824_acpi_match), .acpi_match_table = ACPI_PTR(nau8824_acpi_match),
}, },
.probe = nau8824_i2c_probe, .probe = nau8824_i2c_probe,
.remove = nau8824_i2c_remove,
.id_table = nau8824_i2c_ids, .id_table = nau8824_i2c_ids,
}; };
module_i2c_driver(nau8824_i2c_driver); module_i2c_driver(nau8824_i2c_driver);
......
...@@ -471,7 +471,7 @@ struct nau8824_osr_attr { ...@@ -471,7 +471,7 @@ struct nau8824_osr_attr {
}; };
int nau8824_enable_jack_detect(struct snd_soc_codec *codec, int nau8824_enable_jack_detect(struct snd_soc_component *component,
struct snd_soc_jack *jack); struct snd_soc_jack *jack);
#endif /* _NAU8824_H */ #endif /* _NAU8824_H */
......
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