diff options
-rw-r--r-- | sound/soc/codecs/uda134x.c | 78 |
1 files changed, 36 insertions, 42 deletions
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c index 77c9cc4467b8..3c935a941129 100644 --- a/sound/soc/codecs/uda134x.c +++ b/sound/soc/codecs/uda134x.c | |||
@@ -110,9 +110,9 @@ static int uda134x_regmap_write(void *context, unsigned int reg, | |||
110 | return 0; | 110 | return 0; |
111 | } | 111 | } |
112 | 112 | ||
113 | static inline void uda134x_reset(struct snd_soc_codec *codec) | 113 | static inline void uda134x_reset(struct snd_soc_component *component) |
114 | { | 114 | { |
115 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); | 115 | struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(component); |
116 | unsigned int mask = 1<<6; | 116 | unsigned int mask = 1<<6; |
117 | 117 | ||
118 | regmap_update_bits(uda134x->regmap, UDA134X_STATUS0, mask, mask); | 118 | regmap_update_bits(uda134x->regmap, UDA134X_STATUS0, mask, mask); |
@@ -122,7 +122,7 @@ static inline void uda134x_reset(struct snd_soc_codec *codec) | |||
122 | 122 | ||
123 | static int uda134x_mute(struct snd_soc_dai *dai, int mute) | 123 | static int uda134x_mute(struct snd_soc_dai *dai, int mute) |
124 | { | 124 | { |
125 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(dai->codec); | 125 | struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(dai->component); |
126 | unsigned int mask = 1<<2; | 126 | unsigned int mask = 1<<2; |
127 | unsigned int val; | 127 | unsigned int val; |
128 | 128 | ||
@@ -139,8 +139,8 @@ static int uda134x_mute(struct snd_soc_dai *dai, int mute) | |||
139 | static int uda134x_startup(struct snd_pcm_substream *substream, | 139 | static int uda134x_startup(struct snd_pcm_substream *substream, |
140 | struct snd_soc_dai *dai) | 140 | struct snd_soc_dai *dai) |
141 | { | 141 | { |
142 | struct snd_soc_codec *codec = dai->codec; | 142 | struct snd_soc_component *component = dai->component; |
143 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); | 143 | struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(component); |
144 | struct snd_pcm_runtime *master_runtime; | 144 | struct snd_pcm_runtime *master_runtime; |
145 | 145 | ||
146 | if (uda134x->master_substream) { | 146 | if (uda134x->master_substream) { |
@@ -168,8 +168,8 @@ static int uda134x_startup(struct snd_pcm_substream *substream, | |||
168 | static void uda134x_shutdown(struct snd_pcm_substream *substream, | 168 | static void uda134x_shutdown(struct snd_pcm_substream *substream, |
169 | struct snd_soc_dai *dai) | 169 | struct snd_soc_dai *dai) |
170 | { | 170 | { |
171 | struct snd_soc_codec *codec = dai->codec; | 171 | struct snd_soc_component *component = dai->component; |
172 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); | 172 | struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(component); |
173 | 173 | ||
174 | if (uda134x->master_substream == substream) | 174 | if (uda134x->master_substream == substream) |
175 | uda134x->master_substream = uda134x->slave_substream; | 175 | uda134x->master_substream = uda134x->slave_substream; |
@@ -181,8 +181,8 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream, | |||
181 | struct snd_pcm_hw_params *params, | 181 | struct snd_pcm_hw_params *params, |
182 | struct snd_soc_dai *dai) | 182 | struct snd_soc_dai *dai) |
183 | { | 183 | { |
184 | struct snd_soc_codec *codec = dai->codec; | 184 | struct snd_soc_component *component = dai->component; |
185 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); | 185 | struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(component); |
186 | unsigned int hw_params = 0; | 186 | unsigned int hw_params = 0; |
187 | 187 | ||
188 | if (substream == uda134x->slave_substream) { | 188 | if (substream == uda134x->slave_substream) { |
@@ -248,8 +248,8 @@ static int uda134x_hw_params(struct snd_pcm_substream *substream, | |||
248 | static int uda134x_set_dai_sysclk(struct snd_soc_dai *codec_dai, | 248 | static int uda134x_set_dai_sysclk(struct snd_soc_dai *codec_dai, |
249 | int clk_id, unsigned int freq, int dir) | 249 | int clk_id, unsigned int freq, int dir) |
250 | { | 250 | { |
251 | struct snd_soc_codec *codec = codec_dai->codec; | 251 | struct snd_soc_component *component = codec_dai->component; |
252 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); | 252 | struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(component); |
253 | 253 | ||
254 | pr_debug("%s clk_id: %d, freq: %u, dir: %d\n", __func__, | 254 | pr_debug("%s clk_id: %d, freq: %u, dir: %d\n", __func__, |
255 | clk_id, freq, dir); | 255 | clk_id, freq, dir); |
@@ -270,8 +270,8 @@ static int uda134x_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
270 | static int uda134x_set_dai_fmt(struct snd_soc_dai *codec_dai, | 270 | static int uda134x_set_dai_fmt(struct snd_soc_dai *codec_dai, |
271 | unsigned int fmt) | 271 | unsigned int fmt) |
272 | { | 272 | { |
273 | struct snd_soc_codec *codec = codec_dai->codec; | 273 | struct snd_soc_component *component = codec_dai->component; |
274 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); | 274 | struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(component); |
275 | 275 | ||
276 | pr_debug("%s fmt: %08X\n", __func__, fmt); | 276 | pr_debug("%s fmt: %08X\n", __func__, fmt); |
277 | 277 | ||
@@ -294,10 +294,10 @@ static int uda134x_set_dai_fmt(struct snd_soc_dai *codec_dai, | |||
294 | return 0; | 294 | return 0; |
295 | } | 295 | } |
296 | 296 | ||
297 | static int uda134x_set_bias_level(struct snd_soc_codec *codec, | 297 | static int uda134x_set_bias_level(struct snd_soc_component *component, |
298 | enum snd_soc_bias_level level) | 298 | enum snd_soc_bias_level level) |
299 | { | 299 | { |
300 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); | 300 | struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(component); |
301 | struct uda134x_platform_data *pd = uda134x->pd; | 301 | struct uda134x_platform_data *pd = uda134x->pd; |
302 | pr_debug("%s bias level %d\n", __func__, level); | 302 | pr_debug("%s bias level %d\n", __func__, level); |
303 | 303 | ||
@@ -446,10 +446,10 @@ static struct snd_soc_dai_driver uda134x_dai = { | |||
446 | .ops = &uda134x_dai_ops, | 446 | .ops = &uda134x_dai_ops, |
447 | }; | 447 | }; |
448 | 448 | ||
449 | static int uda134x_soc_probe(struct snd_soc_codec *codec) | 449 | static int uda134x_soc_probe(struct snd_soc_component *component) |
450 | { | 450 | { |
451 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | 451 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); |
452 | struct uda134x_priv *uda134x = snd_soc_codec_get_drvdata(codec); | 452 | struct uda134x_priv *uda134x = snd_soc_component_get_drvdata(component); |
453 | struct uda134x_platform_data *pd = uda134x->pd; | 453 | struct uda134x_platform_data *pd = uda134x->pd; |
454 | const struct snd_soc_dapm_widget *widgets; | 454 | const struct snd_soc_dapm_widget *widgets; |
455 | unsigned num_widgets; | 455 | unsigned num_widgets; |
@@ -473,7 +473,7 @@ static int uda134x_soc_probe(struct snd_soc_codec *codec) | |||
473 | if (pd->power) | 473 | if (pd->power) |
474 | pd->power(1); | 474 | pd->power(1); |
475 | 475 | ||
476 | uda134x_reset(codec); | 476 | uda134x_reset(component); |
477 | 477 | ||
478 | if (pd->model == UDA134X_UDA1341) { | 478 | if (pd->model == UDA134X_UDA1341) { |
479 | widgets = uda1341_dapm_widgets; | 479 | widgets = uda1341_dapm_widgets; |
@@ -493,15 +493,15 @@ static int uda134x_soc_probe(struct snd_soc_codec *codec) | |||
493 | switch (pd->model) { | 493 | switch (pd->model) { |
494 | case UDA134X_UDA1340: | 494 | case UDA134X_UDA1340: |
495 | case UDA134X_UDA1344: | 495 | case UDA134X_UDA1344: |
496 | ret = snd_soc_add_codec_controls(codec, uda1340_snd_controls, | 496 | ret = snd_soc_add_component_controls(component, uda1340_snd_controls, |
497 | ARRAY_SIZE(uda1340_snd_controls)); | 497 | ARRAY_SIZE(uda1340_snd_controls)); |
498 | break; | 498 | break; |
499 | case UDA134X_UDA1341: | 499 | case UDA134X_UDA1341: |
500 | ret = snd_soc_add_codec_controls(codec, uda1341_snd_controls, | 500 | ret = snd_soc_add_component_controls(component, uda1341_snd_controls, |
501 | ARRAY_SIZE(uda1341_snd_controls)); | 501 | ARRAY_SIZE(uda1341_snd_controls)); |
502 | break; | 502 | break; |
503 | case UDA134X_UDA1345: | 503 | case UDA134X_UDA1345: |
504 | ret = snd_soc_add_codec_controls(codec, uda1345_snd_controls, | 504 | ret = snd_soc_add_component_controls(component, uda1345_snd_controls, |
505 | ARRAY_SIZE(uda1345_snd_controls)); | 505 | ARRAY_SIZE(uda1345_snd_controls)); |
506 | break; | 506 | break; |
507 | default: | 507 | default: |
@@ -518,17 +518,18 @@ static int uda134x_soc_probe(struct snd_soc_codec *codec) | |||
518 | return 0; | 518 | return 0; |
519 | } | 519 | } |
520 | 520 | ||
521 | static const struct snd_soc_codec_driver soc_codec_dev_uda134x = { | 521 | static const struct snd_soc_component_driver soc_component_dev_uda134x = { |
522 | .probe = uda134x_soc_probe, | 522 | .probe = uda134x_soc_probe, |
523 | .set_bias_level = uda134x_set_bias_level, | 523 | .set_bias_level = uda134x_set_bias_level, |
524 | .suspend_bias_off = true, | 524 | .dapm_widgets = uda134x_dapm_widgets, |
525 | 525 | .num_dapm_widgets = ARRAY_SIZE(uda134x_dapm_widgets), | |
526 | .component_driver = { | 526 | .dapm_routes = uda134x_dapm_routes, |
527 | .dapm_widgets = uda134x_dapm_widgets, | 527 | .num_dapm_routes = ARRAY_SIZE(uda134x_dapm_routes), |
528 | .num_dapm_widgets = ARRAY_SIZE(uda134x_dapm_widgets), | 528 | .suspend_bias_off = 1, |
529 | .dapm_routes = uda134x_dapm_routes, | 529 | .idle_bias_on = 1, |
530 | .num_dapm_routes = ARRAY_SIZE(uda134x_dapm_routes), | 530 | .use_pmdown_time = 1, |
531 | }, | 531 | .endianness = 1, |
532 | .non_legacy_dai_naming = 1, | ||
532 | }; | 533 | }; |
533 | 534 | ||
534 | static const struct regmap_config uda134x_regmap_config = { | 535 | static const struct regmap_config uda134x_regmap_config = { |
@@ -571,14 +572,8 @@ static int uda134x_codec_probe(struct platform_device *pdev) | |||
571 | if (IS_ERR(uda134x->regmap)) | 572 | if (IS_ERR(uda134x->regmap)) |
572 | return PTR_ERR(uda134x->regmap); | 573 | return PTR_ERR(uda134x->regmap); |
573 | 574 | ||
574 | return snd_soc_register_codec(&pdev->dev, | 575 | return devm_snd_soc_register_component(&pdev->dev, |
575 | &soc_codec_dev_uda134x, &uda134x_dai, 1); | 576 | &soc_component_dev_uda134x, &uda134x_dai, 1); |
576 | } | ||
577 | |||
578 | static int uda134x_codec_remove(struct platform_device *pdev) | ||
579 | { | ||
580 | snd_soc_unregister_codec(&pdev->dev); | ||
581 | return 0; | ||
582 | } | 577 | } |
583 | 578 | ||
584 | static struct platform_driver uda134x_codec_driver = { | 579 | static struct platform_driver uda134x_codec_driver = { |
@@ -586,7 +581,6 @@ static struct platform_driver uda134x_codec_driver = { | |||
586 | .name = "uda134x-codec", | 581 | .name = "uda134x-codec", |
587 | }, | 582 | }, |
588 | .probe = uda134x_codec_probe, | 583 | .probe = uda134x_codec_probe, |
589 | .remove = uda134x_codec_remove, | ||
590 | }; | 584 | }; |
591 | 585 | ||
592 | module_platform_driver(uda134x_codec_driver); | 586 | module_platform_driver(uda134x_codec_driver); |