diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 23:36:21 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 05:01:22 -0500 |
commit | 559ab3977633e5822712c6f44bd06e7f3200f9fe (patch) | |
tree | 417e6f9cc391af8ca2b29c0eeccdc4d9b75dc152 | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
ASoC: wl1273: 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: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/wl1273.c | 93 | ||||
-rw-r--r-- | sound/soc/codecs/wl1273.h | 2 |
2 files changed, 47 insertions, 48 deletions
diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c index 942f1644973e..929ef1fdbb69 100644 --- a/sound/soc/codecs/wl1273.c +++ b/sound/soc/codecs/wl1273.c | |||
@@ -172,8 +172,8 @@ out: | |||
172 | static int snd_wl1273_get_audio_route(struct snd_kcontrol *kcontrol, | 172 | static int snd_wl1273_get_audio_route(struct snd_kcontrol *kcontrol, |
173 | struct snd_ctl_elem_value *ucontrol) | 173 | struct snd_ctl_elem_value *ucontrol) |
174 | { | 174 | { |
175 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 175 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
176 | struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); | 176 | struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component); |
177 | 177 | ||
178 | ucontrol->value.enumerated.item[0] = wl1273->mode; | 178 | ucontrol->value.enumerated.item[0] = wl1273->mode; |
179 | 179 | ||
@@ -190,14 +190,14 @@ static const char * const wl1273_audio_route[] = { "Bt", "FmRx", "FmTx" }; | |||
190 | static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol, | 190 | static int snd_wl1273_set_audio_route(struct snd_kcontrol *kcontrol, |
191 | struct snd_ctl_elem_value *ucontrol) | 191 | struct snd_ctl_elem_value *ucontrol) |
192 | { | 192 | { |
193 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 193 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
194 | struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); | 194 | struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component); |
195 | 195 | ||
196 | if (wl1273->mode == ucontrol->value.enumerated.item[0]) | 196 | if (wl1273->mode == ucontrol->value.enumerated.item[0]) |
197 | return 0; | 197 | return 0; |
198 | 198 | ||
199 | /* Do not allow changes while stream is running */ | 199 | /* Do not allow changes while stream is running */ |
200 | if (snd_soc_codec_is_active(codec)) | 200 | if (snd_soc_component_is_active(component)) |
201 | return -EPERM; | 201 | return -EPERM; |
202 | 202 | ||
203 | if (ucontrol->value.enumerated.item[0] >= ARRAY_SIZE(wl1273_audio_route)) | 203 | if (ucontrol->value.enumerated.item[0] >= ARRAY_SIZE(wl1273_audio_route)) |
@@ -213,10 +213,10 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_enum, wl1273_audio_route); | |||
213 | static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol, | 213 | static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol, |
214 | struct snd_ctl_elem_value *ucontrol) | 214 | struct snd_ctl_elem_value *ucontrol) |
215 | { | 215 | { |
216 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 216 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
217 | struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); | 217 | struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component); |
218 | 218 | ||
219 | dev_dbg(codec->dev, "%s: enter.\n", __func__); | 219 | dev_dbg(component->dev, "%s: enter.\n", __func__); |
220 | 220 | ||
221 | ucontrol->value.enumerated.item[0] = wl1273->core->audio_mode; | 221 | ucontrol->value.enumerated.item[0] = wl1273->core->audio_mode; |
222 | 222 | ||
@@ -226,11 +226,11 @@ static int snd_wl1273_fm_audio_get(struct snd_kcontrol *kcontrol, | |||
226 | static int snd_wl1273_fm_audio_put(struct snd_kcontrol *kcontrol, | 226 | static int snd_wl1273_fm_audio_put(struct snd_kcontrol *kcontrol, |
227 | struct snd_ctl_elem_value *ucontrol) | 227 | struct snd_ctl_elem_value *ucontrol) |
228 | { | 228 | { |
229 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 229 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
230 | struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); | 230 | struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component); |
231 | int val, r = 0; | 231 | int val, r = 0; |
232 | 232 | ||
233 | dev_dbg(codec->dev, "%s: enter.\n", __func__); | 233 | dev_dbg(component->dev, "%s: enter.\n", __func__); |
234 | 234 | ||
235 | val = ucontrol->value.enumerated.item[0]; | 235 | val = ucontrol->value.enumerated.item[0]; |
236 | if (wl1273->core->audio_mode == val) | 236 | if (wl1273->core->audio_mode == val) |
@@ -250,10 +250,10 @@ static SOC_ENUM_SINGLE_EXT_DECL(wl1273_audio_enum, wl1273_audio_strings); | |||
250 | static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol, | 250 | static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol, |
251 | struct snd_ctl_elem_value *ucontrol) | 251 | struct snd_ctl_elem_value *ucontrol) |
252 | { | 252 | { |
253 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 253 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
254 | struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); | 254 | struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component); |
255 | 255 | ||
256 | dev_dbg(codec->dev, "%s: enter.\n", __func__); | 256 | dev_dbg(component->dev, "%s: enter.\n", __func__); |
257 | 257 | ||
258 | ucontrol->value.integer.value[0] = wl1273->core->volume; | 258 | ucontrol->value.integer.value[0] = wl1273->core->volume; |
259 | 259 | ||
@@ -263,11 +263,11 @@ static int snd_wl1273_fm_volume_get(struct snd_kcontrol *kcontrol, | |||
263 | static int snd_wl1273_fm_volume_put(struct snd_kcontrol *kcontrol, | 263 | static int snd_wl1273_fm_volume_put(struct snd_kcontrol *kcontrol, |
264 | struct snd_ctl_elem_value *ucontrol) | 264 | struct snd_ctl_elem_value *ucontrol) |
265 | { | 265 | { |
266 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 266 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
267 | struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); | 267 | struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component); |
268 | int r; | 268 | int r; |
269 | 269 | ||
270 | dev_dbg(codec->dev, "%s: enter.\n", __func__); | 270 | dev_dbg(component->dev, "%s: enter.\n", __func__); |
271 | 271 | ||
272 | r = wl1273->core->set_volume(wl1273->core, | 272 | r = wl1273->core->set_volume(wl1273->core, |
273 | ucontrol->value.integer.value[0]); | 273 | ucontrol->value.integer.value[0]); |
@@ -301,8 +301,8 @@ static const struct snd_soc_dapm_route wl1273_dapm_routes[] = { | |||
301 | static int wl1273_startup(struct snd_pcm_substream *substream, | 301 | static int wl1273_startup(struct snd_pcm_substream *substream, |
302 | struct snd_soc_dai *dai) | 302 | struct snd_soc_dai *dai) |
303 | { | 303 | { |
304 | struct snd_soc_codec *codec = dai->codec; | 304 | struct snd_soc_component *component = dai->component; |
305 | struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); | 305 | struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component); |
306 | 306 | ||
307 | switch (wl1273->mode) { | 307 | switch (wl1273->mode) { |
308 | case WL1273_MODE_BT: | 308 | case WL1273_MODE_BT: |
@@ -335,7 +335,7 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream, | |||
335 | struct snd_pcm_hw_params *params, | 335 | struct snd_pcm_hw_params *params, |
336 | struct snd_soc_dai *dai) | 336 | struct snd_soc_dai *dai) |
337 | { | 337 | { |
338 | struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(dai->codec); | 338 | struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(dai->component); |
339 | struct wl1273_core *core = wl1273->core; | 339 | struct wl1273_core *core = wl1273->core; |
340 | unsigned int rate, width, r; | 340 | unsigned int rate, width, r; |
341 | 341 | ||
@@ -415,14 +415,14 @@ static struct snd_soc_dai_driver wl1273_dai = { | |||
415 | }; | 415 | }; |
416 | 416 | ||
417 | /* Audio interface format for the soc_card driver */ | 417 | /* Audio interface format for the soc_card driver */ |
418 | int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt) | 418 | int wl1273_get_format(struct snd_soc_component *component, unsigned int *fmt) |
419 | { | 419 | { |
420 | struct wl1273_priv *wl1273; | 420 | struct wl1273_priv *wl1273; |
421 | 421 | ||
422 | if (codec == NULL || fmt == NULL) | 422 | if (component == NULL || fmt == NULL) |
423 | return -EINVAL; | 423 | return -EINVAL; |
424 | 424 | ||
425 | wl1273 = snd_soc_codec_get_drvdata(codec); | 425 | wl1273 = snd_soc_component_get_drvdata(component); |
426 | 426 | ||
427 | switch (wl1273->mode) { | 427 | switch (wl1273->mode) { |
428 | case WL1273_MODE_FM_RX: | 428 | case WL1273_MODE_FM_RX: |
@@ -446,15 +446,15 @@ int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt) | |||
446 | } | 446 | } |
447 | EXPORT_SYMBOL_GPL(wl1273_get_format); | 447 | EXPORT_SYMBOL_GPL(wl1273_get_format); |
448 | 448 | ||
449 | static int wl1273_probe(struct snd_soc_codec *codec) | 449 | static int wl1273_probe(struct snd_soc_component *component) |
450 | { | 450 | { |
451 | struct wl1273_core **core = codec->dev->platform_data; | 451 | struct wl1273_core **core = component->dev->platform_data; |
452 | struct wl1273_priv *wl1273; | 452 | struct wl1273_priv *wl1273; |
453 | 453 | ||
454 | dev_dbg(codec->dev, "%s.\n", __func__); | 454 | dev_dbg(component->dev, "%s.\n", __func__); |
455 | 455 | ||
456 | if (!core) { | 456 | if (!core) { |
457 | dev_err(codec->dev, "Platform data is missing.\n"); | 457 | dev_err(component->dev, "Platform data is missing.\n"); |
458 | return -EINVAL; | 458 | return -EINVAL; |
459 | } | 459 | } |
460 | 460 | ||
@@ -465,44 +465,43 @@ static int wl1273_probe(struct snd_soc_codec *codec) | |||
465 | wl1273->mode = WL1273_MODE_BT; | 465 | wl1273->mode = WL1273_MODE_BT; |
466 | wl1273->core = *core; | 466 | wl1273->core = *core; |
467 | 467 | ||
468 | snd_soc_codec_set_drvdata(codec, wl1273); | 468 | snd_soc_component_set_drvdata(component, wl1273); |
469 | 469 | ||
470 | return 0; | 470 | return 0; |
471 | } | 471 | } |
472 | 472 | ||
473 | static int wl1273_remove(struct snd_soc_codec *codec) | 473 | static void wl1273_remove(struct snd_soc_component *component) |
474 | { | 474 | { |
475 | struct wl1273_priv *wl1273 = snd_soc_codec_get_drvdata(codec); | 475 | struct wl1273_priv *wl1273 = snd_soc_component_get_drvdata(component); |
476 | 476 | ||
477 | dev_dbg(codec->dev, "%s\n", __func__); | 477 | dev_dbg(component->dev, "%s\n", __func__); |
478 | kfree(wl1273); | 478 | kfree(wl1273); |
479 | |||
480 | return 0; | ||
481 | } | 479 | } |
482 | 480 | ||
483 | static const struct snd_soc_codec_driver soc_codec_dev_wl1273 = { | 481 | static const struct snd_soc_component_driver soc_component_dev_wl1273 = { |
484 | .probe = wl1273_probe, | 482 | .probe = wl1273_probe, |
485 | .remove = wl1273_remove, | 483 | .remove = wl1273_remove, |
486 | 484 | .controls = wl1273_controls, | |
487 | .component_driver = { | 485 | .num_controls = ARRAY_SIZE(wl1273_controls), |
488 | .controls = wl1273_controls, | 486 | .dapm_widgets = wl1273_dapm_widgets, |
489 | .num_controls = ARRAY_SIZE(wl1273_controls), | 487 | .num_dapm_widgets = ARRAY_SIZE(wl1273_dapm_widgets), |
490 | .dapm_widgets = wl1273_dapm_widgets, | 488 | .dapm_routes = wl1273_dapm_routes, |
491 | .num_dapm_widgets = ARRAY_SIZE(wl1273_dapm_widgets), | 489 | .num_dapm_routes = ARRAY_SIZE(wl1273_dapm_routes), |
492 | .dapm_routes = wl1273_dapm_routes, | 490 | .idle_bias_on = 1, |
493 | .num_dapm_routes = ARRAY_SIZE(wl1273_dapm_routes), | 491 | .use_pmdown_time = 1, |
494 | }, | 492 | .endianness = 1, |
493 | .non_legacy_dai_naming = 1, | ||
495 | }; | 494 | }; |
496 | 495 | ||
497 | static int wl1273_platform_probe(struct platform_device *pdev) | 496 | static int wl1273_platform_probe(struct platform_device *pdev) |
498 | { | 497 | { |
499 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wl1273, | 498 | return devm_snd_soc_register_component(&pdev->dev, |
499 | &soc_component_dev_wl1273, | ||
500 | &wl1273_dai, 1); | 500 | &wl1273_dai, 1); |
501 | } | 501 | } |
502 | 502 | ||
503 | static int wl1273_platform_remove(struct platform_device *pdev) | 503 | static int wl1273_platform_remove(struct platform_device *pdev) |
504 | { | 504 | { |
505 | snd_soc_unregister_codec(&pdev->dev); | ||
506 | return 0; | 505 | return 0; |
507 | } | 506 | } |
508 | 507 | ||
diff --git a/sound/soc/codecs/wl1273.h b/sound/soc/codecs/wl1273.h index 43ec7e668c51..43a81d5cab4d 100644 --- a/sound/soc/codecs/wl1273.h +++ b/sound/soc/codecs/wl1273.h | |||
@@ -25,6 +25,6 @@ | |||
25 | #ifndef __WL1273_CODEC_H__ | 25 | #ifndef __WL1273_CODEC_H__ |
26 | #define __WL1273_CODEC_H__ | 26 | #define __WL1273_CODEC_H__ |
27 | 27 | ||
28 | int wl1273_get_format(struct snd_soc_codec *codec, unsigned int *fmt); | 28 | int wl1273_get_format(struct snd_soc_component *component, unsigned int *fmt); |
29 | 29 | ||
30 | #endif /* End of __WL1273_CODEC_H__ */ | 30 | #endif /* End of __WL1273_CODEC_H__ */ |