diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 22:09:37 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 04:42:52 -0500 |
commit | 46a9100c8a94a01bb2d6780b19c9258e9aec323c (patch) | |
tree | 16b61879839a2db32fbb73418c9f913811e9a2db | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
ASoC: wm8904: 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 = 1 -> .idle_bias_on = 0
.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/wm8904.c | 355 |
1 files changed, 174 insertions, 181 deletions
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c index 4fd350e8420d..20fdcae06c6b 100644 --- a/sound/soc/codecs/wm8904.c +++ b/sound/soc/codecs/wm8904.c | |||
@@ -316,31 +316,31 @@ static bool wm8904_readable_register(struct device *dev, unsigned int reg) | |||
316 | } | 316 | } |
317 | } | 317 | } |
318 | 318 | ||
319 | static int wm8904_configure_clocking(struct snd_soc_codec *codec) | 319 | static int wm8904_configure_clocking(struct snd_soc_component *component) |
320 | { | 320 | { |
321 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 321 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
322 | unsigned int clock0, clock2, rate; | 322 | unsigned int clock0, clock2, rate; |
323 | 323 | ||
324 | /* Gate the clock while we're updating to avoid misclocking */ | 324 | /* Gate the clock while we're updating to avoid misclocking */ |
325 | clock2 = snd_soc_read(codec, WM8904_CLOCK_RATES_2); | 325 | clock2 = snd_soc_component_read32(component, WM8904_CLOCK_RATES_2); |
326 | snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, | 326 | snd_soc_component_update_bits(component, WM8904_CLOCK_RATES_2, |
327 | WM8904_SYSCLK_SRC, 0); | 327 | WM8904_SYSCLK_SRC, 0); |
328 | 328 | ||
329 | /* This should be done on init() for bypass paths */ | 329 | /* This should be done on init() for bypass paths */ |
330 | switch (wm8904->sysclk_src) { | 330 | switch (wm8904->sysclk_src) { |
331 | case WM8904_CLK_MCLK: | 331 | case WM8904_CLK_MCLK: |
332 | dev_dbg(codec->dev, "Using %dHz MCLK\n", wm8904->mclk_rate); | 332 | dev_dbg(component->dev, "Using %dHz MCLK\n", wm8904->mclk_rate); |
333 | 333 | ||
334 | clock2 &= ~WM8904_SYSCLK_SRC; | 334 | clock2 &= ~WM8904_SYSCLK_SRC; |
335 | rate = wm8904->mclk_rate; | 335 | rate = wm8904->mclk_rate; |
336 | 336 | ||
337 | /* Ensure the FLL is stopped */ | 337 | /* Ensure the FLL is stopped */ |
338 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, | 338 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_1, |
339 | WM8904_FLL_OSC_ENA | WM8904_FLL_ENA, 0); | 339 | WM8904_FLL_OSC_ENA | WM8904_FLL_ENA, 0); |
340 | break; | 340 | break; |
341 | 341 | ||
342 | case WM8904_CLK_FLL: | 342 | case WM8904_CLK_FLL: |
343 | dev_dbg(codec->dev, "Using %dHz FLL clock\n", | 343 | dev_dbg(component->dev, "Using %dHz FLL clock\n", |
344 | wm8904->fll_fout); | 344 | wm8904->fll_fout); |
345 | 345 | ||
346 | clock2 |= WM8904_SYSCLK_SRC; | 346 | clock2 |= WM8904_SYSCLK_SRC; |
@@ -348,7 +348,7 @@ static int wm8904_configure_clocking(struct snd_soc_codec *codec) | |||
348 | break; | 348 | break; |
349 | 349 | ||
350 | default: | 350 | default: |
351 | dev_err(codec->dev, "System clock not configured\n"); | 351 | dev_err(component->dev, "System clock not configured\n"); |
352 | return -EINVAL; | 352 | return -EINVAL; |
353 | } | 353 | } |
354 | 354 | ||
@@ -361,40 +361,40 @@ static int wm8904_configure_clocking(struct snd_soc_codec *codec) | |||
361 | wm8904->sysclk_rate = rate; | 361 | wm8904->sysclk_rate = rate; |
362 | } | 362 | } |
363 | 363 | ||
364 | snd_soc_update_bits(codec, WM8904_CLOCK_RATES_0, WM8904_MCLK_DIV, | 364 | snd_soc_component_update_bits(component, WM8904_CLOCK_RATES_0, WM8904_MCLK_DIV, |
365 | clock0); | 365 | clock0); |
366 | 366 | ||
367 | snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, | 367 | snd_soc_component_update_bits(component, WM8904_CLOCK_RATES_2, |
368 | WM8904_CLK_SYS_ENA | WM8904_SYSCLK_SRC, clock2); | 368 | WM8904_CLK_SYS_ENA | WM8904_SYSCLK_SRC, clock2); |
369 | 369 | ||
370 | dev_dbg(codec->dev, "CLK_SYS is %dHz\n", wm8904->sysclk_rate); | 370 | dev_dbg(component->dev, "CLK_SYS is %dHz\n", wm8904->sysclk_rate); |
371 | 371 | ||
372 | return 0; | 372 | return 0; |
373 | } | 373 | } |
374 | 374 | ||
375 | static void wm8904_set_drc(struct snd_soc_codec *codec) | 375 | static void wm8904_set_drc(struct snd_soc_component *component) |
376 | { | 376 | { |
377 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 377 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
378 | struct wm8904_pdata *pdata = wm8904->pdata; | 378 | struct wm8904_pdata *pdata = wm8904->pdata; |
379 | int save, i; | 379 | int save, i; |
380 | 380 | ||
381 | /* Save any enables; the configuration should clear them. */ | 381 | /* Save any enables; the configuration should clear them. */ |
382 | save = snd_soc_read(codec, WM8904_DRC_0); | 382 | save = snd_soc_component_read32(component, WM8904_DRC_0); |
383 | 383 | ||
384 | for (i = 0; i < WM8904_DRC_REGS; i++) | 384 | for (i = 0; i < WM8904_DRC_REGS; i++) |
385 | snd_soc_update_bits(codec, WM8904_DRC_0 + i, 0xffff, | 385 | snd_soc_component_update_bits(component, WM8904_DRC_0 + i, 0xffff, |
386 | pdata->drc_cfgs[wm8904->drc_cfg].regs[i]); | 386 | pdata->drc_cfgs[wm8904->drc_cfg].regs[i]); |
387 | 387 | ||
388 | /* Reenable the DRC */ | 388 | /* Reenable the DRC */ |
389 | snd_soc_update_bits(codec, WM8904_DRC_0, | 389 | snd_soc_component_update_bits(component, WM8904_DRC_0, |
390 | WM8904_DRC_ENA | WM8904_DRC_DAC_PATH, save); | 390 | WM8904_DRC_ENA | WM8904_DRC_DAC_PATH, save); |
391 | } | 391 | } |
392 | 392 | ||
393 | static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol, | 393 | static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol, |
394 | struct snd_ctl_elem_value *ucontrol) | 394 | struct snd_ctl_elem_value *ucontrol) |
395 | { | 395 | { |
396 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 396 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
397 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 397 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
398 | struct wm8904_pdata *pdata = wm8904->pdata; | 398 | struct wm8904_pdata *pdata = wm8904->pdata; |
399 | int value = ucontrol->value.enumerated.item[0]; | 399 | int value = ucontrol->value.enumerated.item[0]; |
400 | 400 | ||
@@ -403,7 +403,7 @@ static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol, | |||
403 | 403 | ||
404 | wm8904->drc_cfg = value; | 404 | wm8904->drc_cfg = value; |
405 | 405 | ||
406 | wm8904_set_drc(codec); | 406 | wm8904_set_drc(component); |
407 | 407 | ||
408 | return 0; | 408 | return 0; |
409 | } | 409 | } |
@@ -411,17 +411,17 @@ static int wm8904_put_drc_enum(struct snd_kcontrol *kcontrol, | |||
411 | static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol, | 411 | static int wm8904_get_drc_enum(struct snd_kcontrol *kcontrol, |
412 | struct snd_ctl_elem_value *ucontrol) | 412 | struct snd_ctl_elem_value *ucontrol) |
413 | { | 413 | { |
414 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 414 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
415 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 415 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
416 | 416 | ||
417 | ucontrol->value.enumerated.item[0] = wm8904->drc_cfg; | 417 | ucontrol->value.enumerated.item[0] = wm8904->drc_cfg; |
418 | 418 | ||
419 | return 0; | 419 | return 0; |
420 | } | 420 | } |
421 | 421 | ||
422 | static void wm8904_set_retune_mobile(struct snd_soc_codec *codec) | 422 | static void wm8904_set_retune_mobile(struct snd_soc_component *component) |
423 | { | 423 | { |
424 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 424 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
425 | struct wm8904_pdata *pdata = wm8904->pdata; | 425 | struct wm8904_pdata *pdata = wm8904->pdata; |
426 | int best, best_val, save, i, cfg; | 426 | int best, best_val, save, i, cfg; |
427 | 427 | ||
@@ -444,7 +444,7 @@ static void wm8904_set_retune_mobile(struct snd_soc_codec *codec) | |||
444 | } | 444 | } |
445 | } | 445 | } |
446 | 446 | ||
447 | dev_dbg(codec->dev, "ReTune Mobile %s/%dHz for %dHz sample rate\n", | 447 | dev_dbg(component->dev, "ReTune Mobile %s/%dHz for %dHz sample rate\n", |
448 | pdata->retune_mobile_cfgs[best].name, | 448 | pdata->retune_mobile_cfgs[best].name, |
449 | pdata->retune_mobile_cfgs[best].rate, | 449 | pdata->retune_mobile_cfgs[best].rate, |
450 | wm8904->fs); | 450 | wm8904->fs); |
@@ -452,20 +452,20 @@ static void wm8904_set_retune_mobile(struct snd_soc_codec *codec) | |||
452 | /* The EQ will be disabled while reconfiguring it, remember the | 452 | /* The EQ will be disabled while reconfiguring it, remember the |
453 | * current configuration. | 453 | * current configuration. |
454 | */ | 454 | */ |
455 | save = snd_soc_read(codec, WM8904_EQ1); | 455 | save = snd_soc_component_read32(component, WM8904_EQ1); |
456 | 456 | ||
457 | for (i = 0; i < WM8904_EQ_REGS; i++) | 457 | for (i = 0; i < WM8904_EQ_REGS; i++) |
458 | snd_soc_update_bits(codec, WM8904_EQ1 + i, 0xffff, | 458 | snd_soc_component_update_bits(component, WM8904_EQ1 + i, 0xffff, |
459 | pdata->retune_mobile_cfgs[best].regs[i]); | 459 | pdata->retune_mobile_cfgs[best].regs[i]); |
460 | 460 | ||
461 | snd_soc_update_bits(codec, WM8904_EQ1, WM8904_EQ_ENA, save); | 461 | snd_soc_component_update_bits(component, WM8904_EQ1, WM8904_EQ_ENA, save); |
462 | } | 462 | } |
463 | 463 | ||
464 | static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol, | 464 | static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol, |
465 | struct snd_ctl_elem_value *ucontrol) | 465 | struct snd_ctl_elem_value *ucontrol) |
466 | { | 466 | { |
467 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 467 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
468 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 468 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
469 | struct wm8904_pdata *pdata = wm8904->pdata; | 469 | struct wm8904_pdata *pdata = wm8904->pdata; |
470 | int value = ucontrol->value.enumerated.item[0]; | 470 | int value = ucontrol->value.enumerated.item[0]; |
471 | 471 | ||
@@ -474,7 +474,7 @@ static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol, | |||
474 | 474 | ||
475 | wm8904->retune_mobile_cfg = value; | 475 | wm8904->retune_mobile_cfg = value; |
476 | 476 | ||
477 | wm8904_set_retune_mobile(codec); | 477 | wm8904_set_retune_mobile(component); |
478 | 478 | ||
479 | return 0; | 479 | return 0; |
480 | } | 480 | } |
@@ -482,8 +482,8 @@ static int wm8904_put_retune_mobile_enum(struct snd_kcontrol *kcontrol, | |||
482 | static int wm8904_get_retune_mobile_enum(struct snd_kcontrol *kcontrol, | 482 | static int wm8904_get_retune_mobile_enum(struct snd_kcontrol *kcontrol, |
483 | struct snd_ctl_elem_value *ucontrol) | 483 | struct snd_ctl_elem_value *ucontrol) |
484 | { | 484 | { |
485 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 485 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
486 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 486 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
487 | 487 | ||
488 | ucontrol->value.enumerated.item[0] = wm8904->retune_mobile_cfg; | 488 | ucontrol->value.enumerated.item[0] = wm8904->retune_mobile_cfg; |
489 | 489 | ||
@@ -492,9 +492,9 @@ static int wm8904_get_retune_mobile_enum(struct snd_kcontrol *kcontrol, | |||
492 | 492 | ||
493 | static int deemph_settings[] = { 0, 32000, 44100, 48000 }; | 493 | static int deemph_settings[] = { 0, 32000, 44100, 48000 }; |
494 | 494 | ||
495 | static int wm8904_set_deemph(struct snd_soc_codec *codec) | 495 | static int wm8904_set_deemph(struct snd_soc_component *component) |
496 | { | 496 | { |
497 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 497 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
498 | int val, i, best; | 498 | int val, i, best; |
499 | 499 | ||
500 | /* If we're using deemphasis select the nearest available sample | 500 | /* If we're using deemphasis select the nearest available sample |
@@ -513,17 +513,17 @@ static int wm8904_set_deemph(struct snd_soc_codec *codec) | |||
513 | val = 0; | 513 | val = 0; |
514 | } | 514 | } |
515 | 515 | ||
516 | dev_dbg(codec->dev, "Set deemphasis %d\n", val); | 516 | dev_dbg(component->dev, "Set deemphasis %d\n", val); |
517 | 517 | ||
518 | return snd_soc_update_bits(codec, WM8904_DAC_DIGITAL_1, | 518 | return snd_soc_component_update_bits(component, WM8904_DAC_DIGITAL_1, |
519 | WM8904_DEEMPH_MASK, val); | 519 | WM8904_DEEMPH_MASK, val); |
520 | } | 520 | } |
521 | 521 | ||
522 | static int wm8904_get_deemph(struct snd_kcontrol *kcontrol, | 522 | static int wm8904_get_deemph(struct snd_kcontrol *kcontrol, |
523 | struct snd_ctl_elem_value *ucontrol) | 523 | struct snd_ctl_elem_value *ucontrol) |
524 | { | 524 | { |
525 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 525 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
526 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 526 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
527 | 527 | ||
528 | ucontrol->value.integer.value[0] = wm8904->deemph; | 528 | ucontrol->value.integer.value[0] = wm8904->deemph; |
529 | return 0; | 529 | return 0; |
@@ -532,8 +532,8 @@ static int wm8904_get_deemph(struct snd_kcontrol *kcontrol, | |||
532 | static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, | 532 | static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, |
533 | struct snd_ctl_elem_value *ucontrol) | 533 | struct snd_ctl_elem_value *ucontrol) |
534 | { | 534 | { |
535 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 535 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
536 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 536 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
537 | unsigned int deemph = ucontrol->value.integer.value[0]; | 537 | unsigned int deemph = ucontrol->value.integer.value[0]; |
538 | 538 | ||
539 | if (deemph > 1) | 539 | if (deemph > 1) |
@@ -541,7 +541,7 @@ static int wm8904_put_deemph(struct snd_kcontrol *kcontrol, | |||
541 | 541 | ||
542 | wm8904->deemph = deemph; | 542 | wm8904->deemph = deemph; |
543 | 543 | ||
544 | return wm8904_set_deemph(codec); | 544 | return wm8904_set_deemph(component); |
545 | } | 545 | } |
546 | 546 | ||
547 | static const DECLARE_TLV_DB_SCALE(dac_boost_tlv, 0, 600, 0); | 547 | static const DECLARE_TLV_DB_SCALE(dac_boost_tlv, 0, 600, 0); |
@@ -572,7 +572,7 @@ static SOC_ENUM_SINGLE_DECL(hpf_mode, WM8904_ADC_DIGITAL_0, 5, | |||
572 | static int wm8904_adc_osr_put(struct snd_kcontrol *kcontrol, | 572 | static int wm8904_adc_osr_put(struct snd_kcontrol *kcontrol, |
573 | struct snd_ctl_elem_value *ucontrol) | 573 | struct snd_ctl_elem_value *ucontrol) |
574 | { | 574 | { |
575 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 575 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
576 | unsigned int val; | 576 | unsigned int val; |
577 | int ret; | 577 | int ret; |
578 | 578 | ||
@@ -585,7 +585,7 @@ static int wm8904_adc_osr_put(struct snd_kcontrol *kcontrol, | |||
585 | else | 585 | else |
586 | val = WM8904_ADC_128_OSR_TST_MODE | WM8904_ADC_BIASX1P5; | 586 | val = WM8904_ADC_128_OSR_TST_MODE | WM8904_ADC_BIASX1P5; |
587 | 587 | ||
588 | snd_soc_update_bits(codec, WM8904_ADC_TEST_0, | 588 | snd_soc_component_update_bits(component, WM8904_ADC_TEST_0, |
589 | WM8904_ADC_128_OSR_TST_MODE | WM8904_ADC_BIASX1P5, | 589 | WM8904_ADC_128_OSR_TST_MODE | WM8904_ADC_BIASX1P5, |
590 | val); | 590 | val); |
591 | 591 | ||
@@ -673,8 +673,8 @@ static int cp_event(struct snd_soc_dapm_widget *w, | |||
673 | static int sysclk_event(struct snd_soc_dapm_widget *w, | 673 | static int sysclk_event(struct snd_soc_dapm_widget *w, |
674 | struct snd_kcontrol *kcontrol, int event) | 674 | struct snd_kcontrol *kcontrol, int event) |
675 | { | 675 | { |
676 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 676 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
677 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 677 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
678 | 678 | ||
679 | switch (event) { | 679 | switch (event) { |
680 | case SND_SOC_DAPM_PRE_PMU: | 680 | case SND_SOC_DAPM_PRE_PMU: |
@@ -685,11 +685,11 @@ static int sysclk_event(struct snd_soc_dapm_widget *w, | |||
685 | */ | 685 | */ |
686 | switch (wm8904->sysclk_src) { | 686 | switch (wm8904->sysclk_src) { |
687 | case WM8904_CLK_FLL: | 687 | case WM8904_CLK_FLL: |
688 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, | 688 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_1, |
689 | WM8904_FLL_OSC_ENA, | 689 | WM8904_FLL_OSC_ENA, |
690 | WM8904_FLL_OSC_ENA); | 690 | WM8904_FLL_OSC_ENA); |
691 | 691 | ||
692 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, | 692 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_1, |
693 | WM8904_FLL_ENA, | 693 | WM8904_FLL_ENA, |
694 | WM8904_FLL_ENA); | 694 | WM8904_FLL_ENA); |
695 | break; | 695 | break; |
@@ -700,7 +700,7 @@ static int sysclk_event(struct snd_soc_dapm_widget *w, | |||
700 | break; | 700 | break; |
701 | 701 | ||
702 | case SND_SOC_DAPM_POST_PMD: | 702 | case SND_SOC_DAPM_POST_PMD: |
703 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, | 703 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_1, |
704 | WM8904_FLL_OSC_ENA | WM8904_FLL_ENA, 0); | 704 | WM8904_FLL_OSC_ENA | WM8904_FLL_ENA, 0); |
705 | break; | 705 | break; |
706 | } | 706 | } |
@@ -711,8 +711,8 @@ static int sysclk_event(struct snd_soc_dapm_widget *w, | |||
711 | static int out_pga_event(struct snd_soc_dapm_widget *w, | 711 | static int out_pga_event(struct snd_soc_dapm_widget *w, |
712 | struct snd_kcontrol *kcontrol, int event) | 712 | struct snd_kcontrol *kcontrol, int event) |
713 | { | 713 | { |
714 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 714 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
715 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 715 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
716 | int reg, val; | 716 | int reg, val; |
717 | int dcs_mask; | 717 | int dcs_mask; |
718 | int dcs_l, dcs_r; | 718 | int dcs_l, dcs_r; |
@@ -751,43 +751,43 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
751 | switch (event) { | 751 | switch (event) { |
752 | case SND_SOC_DAPM_PRE_PMU: | 752 | case SND_SOC_DAPM_PRE_PMU: |
753 | /* Power on the PGAs */ | 753 | /* Power on the PGAs */ |
754 | snd_soc_update_bits(codec, pwr_reg, | 754 | snd_soc_component_update_bits(component, pwr_reg, |
755 | WM8904_HPL_PGA_ENA | WM8904_HPR_PGA_ENA, | 755 | WM8904_HPL_PGA_ENA | WM8904_HPR_PGA_ENA, |
756 | WM8904_HPL_PGA_ENA | WM8904_HPR_PGA_ENA); | 756 | WM8904_HPL_PGA_ENA | WM8904_HPR_PGA_ENA); |
757 | 757 | ||
758 | /* Power on the amplifier */ | 758 | /* Power on the amplifier */ |
759 | snd_soc_update_bits(codec, reg, | 759 | snd_soc_component_update_bits(component, reg, |
760 | WM8904_HPL_ENA | WM8904_HPR_ENA, | 760 | WM8904_HPL_ENA | WM8904_HPR_ENA, |
761 | WM8904_HPL_ENA | WM8904_HPR_ENA); | 761 | WM8904_HPL_ENA | WM8904_HPR_ENA); |
762 | 762 | ||
763 | 763 | ||
764 | /* Enable the first stage */ | 764 | /* Enable the first stage */ |
765 | snd_soc_update_bits(codec, reg, | 765 | snd_soc_component_update_bits(component, reg, |
766 | WM8904_HPL_ENA_DLY | WM8904_HPR_ENA_DLY, | 766 | WM8904_HPL_ENA_DLY | WM8904_HPR_ENA_DLY, |
767 | WM8904_HPL_ENA_DLY | WM8904_HPR_ENA_DLY); | 767 | WM8904_HPL_ENA_DLY | WM8904_HPR_ENA_DLY); |
768 | 768 | ||
769 | /* Power up the DC servo */ | 769 | /* Power up the DC servo */ |
770 | snd_soc_update_bits(codec, WM8904_DC_SERVO_0, | 770 | snd_soc_component_update_bits(component, WM8904_DC_SERVO_0, |
771 | dcs_mask, dcs_mask); | 771 | dcs_mask, dcs_mask); |
772 | 772 | ||
773 | /* Either calibrate the DC servo or restore cached state | 773 | /* Either calibrate the DC servo or restore cached state |
774 | * if we have that. | 774 | * if we have that. |
775 | */ | 775 | */ |
776 | if (wm8904->dcs_state[dcs_l] || wm8904->dcs_state[dcs_r]) { | 776 | if (wm8904->dcs_state[dcs_l] || wm8904->dcs_state[dcs_r]) { |
777 | dev_dbg(codec->dev, "Restoring DC servo state\n"); | 777 | dev_dbg(component->dev, "Restoring DC servo state\n"); |
778 | 778 | ||
779 | snd_soc_write(codec, dcs_l_reg, | 779 | snd_soc_component_write(component, dcs_l_reg, |
780 | wm8904->dcs_state[dcs_l]); | 780 | wm8904->dcs_state[dcs_l]); |
781 | snd_soc_write(codec, dcs_r_reg, | 781 | snd_soc_component_write(component, dcs_r_reg, |
782 | wm8904->dcs_state[dcs_r]); | 782 | wm8904->dcs_state[dcs_r]); |
783 | 783 | ||
784 | snd_soc_write(codec, WM8904_DC_SERVO_1, dcs_mask); | 784 | snd_soc_component_write(component, WM8904_DC_SERVO_1, dcs_mask); |
785 | 785 | ||
786 | timeout = 20; | 786 | timeout = 20; |
787 | } else { | 787 | } else { |
788 | dev_dbg(codec->dev, "Calibrating DC servo\n"); | 788 | dev_dbg(component->dev, "Calibrating DC servo\n"); |
789 | 789 | ||
790 | snd_soc_write(codec, WM8904_DC_SERVO_1, | 790 | snd_soc_component_write(component, WM8904_DC_SERVO_1, |
791 | dcs_mask << WM8904_DCS_TRIG_STARTUP_0_SHIFT); | 791 | dcs_mask << WM8904_DCS_TRIG_STARTUP_0_SHIFT); |
792 | 792 | ||
793 | timeout = 500; | 793 | timeout = 500; |
@@ -796,7 +796,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
796 | /* Wait for DC servo to complete */ | 796 | /* Wait for DC servo to complete */ |
797 | dcs_mask <<= WM8904_DCS_CAL_COMPLETE_SHIFT; | 797 | dcs_mask <<= WM8904_DCS_CAL_COMPLETE_SHIFT; |
798 | do { | 798 | do { |
799 | val = snd_soc_read(codec, WM8904_DC_SERVO_READBACK_0); | 799 | val = snd_soc_component_read32(component, WM8904_DC_SERVO_READBACK_0); |
800 | if ((val & dcs_mask) == dcs_mask) | 800 | if ((val & dcs_mask) == dcs_mask) |
801 | break; | 801 | break; |
802 | 802 | ||
@@ -804,19 +804,19 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
804 | } while (--timeout); | 804 | } while (--timeout); |
805 | 805 | ||
806 | if ((val & dcs_mask) != dcs_mask) | 806 | if ((val & dcs_mask) != dcs_mask) |
807 | dev_warn(codec->dev, "DC servo timed out\n"); | 807 | dev_warn(component->dev, "DC servo timed out\n"); |
808 | else | 808 | else |
809 | dev_dbg(codec->dev, "DC servo ready\n"); | 809 | dev_dbg(component->dev, "DC servo ready\n"); |
810 | 810 | ||
811 | /* Enable the output stage */ | 811 | /* Enable the output stage */ |
812 | snd_soc_update_bits(codec, reg, | 812 | snd_soc_component_update_bits(component, reg, |
813 | WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP, | 813 | WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP, |
814 | WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP); | 814 | WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP); |
815 | break; | 815 | break; |
816 | 816 | ||
817 | case SND_SOC_DAPM_POST_PMU: | 817 | case SND_SOC_DAPM_POST_PMU: |
818 | /* Unshort the output itself */ | 818 | /* Unshort the output itself */ |
819 | snd_soc_update_bits(codec, reg, | 819 | snd_soc_component_update_bits(component, reg, |
820 | WM8904_HPL_RMV_SHORT | | 820 | WM8904_HPL_RMV_SHORT | |
821 | WM8904_HPR_RMV_SHORT, | 821 | WM8904_HPR_RMV_SHORT, |
822 | WM8904_HPL_RMV_SHORT | | 822 | WM8904_HPL_RMV_SHORT | |
@@ -826,7 +826,7 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
826 | 826 | ||
827 | case SND_SOC_DAPM_PRE_PMD: | 827 | case SND_SOC_DAPM_PRE_PMD: |
828 | /* Short the output */ | 828 | /* Short the output */ |
829 | snd_soc_update_bits(codec, reg, | 829 | snd_soc_component_update_bits(component, reg, |
830 | WM8904_HPL_RMV_SHORT | | 830 | WM8904_HPL_RMV_SHORT | |
831 | WM8904_HPR_RMV_SHORT, 0); | 831 | WM8904_HPR_RMV_SHORT, 0); |
832 | break; | 832 | break; |
@@ -834,21 +834,21 @@ static int out_pga_event(struct snd_soc_dapm_widget *w, | |||
834 | case SND_SOC_DAPM_POST_PMD: | 834 | case SND_SOC_DAPM_POST_PMD: |
835 | /* Cache the DC servo configuration; this will be | 835 | /* Cache the DC servo configuration; this will be |
836 | * invalidated if we change the configuration. */ | 836 | * invalidated if we change the configuration. */ |
837 | wm8904->dcs_state[dcs_l] = snd_soc_read(codec, dcs_l_reg); | 837 | wm8904->dcs_state[dcs_l] = snd_soc_component_read32(component, dcs_l_reg); |
838 | wm8904->dcs_state[dcs_r] = snd_soc_read(codec, dcs_r_reg); | 838 | wm8904->dcs_state[dcs_r] = snd_soc_component_read32(component, dcs_r_reg); |
839 | 839 | ||
840 | snd_soc_update_bits(codec, WM8904_DC_SERVO_0, | 840 | snd_soc_component_update_bits(component, WM8904_DC_SERVO_0, |
841 | dcs_mask, 0); | 841 | dcs_mask, 0); |
842 | 842 | ||
843 | /* Disable the amplifier input and output stages */ | 843 | /* Disable the amplifier input and output stages */ |
844 | snd_soc_update_bits(codec, reg, | 844 | snd_soc_component_update_bits(component, reg, |
845 | WM8904_HPL_ENA | WM8904_HPR_ENA | | 845 | WM8904_HPL_ENA | WM8904_HPR_ENA | |
846 | WM8904_HPL_ENA_DLY | WM8904_HPR_ENA_DLY | | 846 | WM8904_HPL_ENA_DLY | WM8904_HPR_ENA_DLY | |
847 | WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP, | 847 | WM8904_HPL_ENA_OUTP | WM8904_HPR_ENA_OUTP, |
848 | 0); | 848 | 0); |
849 | 849 | ||
850 | /* PGAs too */ | 850 | /* PGAs too */ |
851 | snd_soc_update_bits(codec, pwr_reg, | 851 | snd_soc_component_update_bits(component, pwr_reg, |
852 | WM8904_HPL_PGA_ENA | WM8904_HPR_PGA_ENA, | 852 | WM8904_HPL_PGA_ENA | WM8904_HPR_PGA_ENA, |
853 | 0); | 853 | 0); |
854 | break; | 854 | break; |
@@ -1165,10 +1165,10 @@ static const struct snd_soc_dapm_route wm8912_intercon[] = { | |||
1165 | { "LINER PGA", NULL, "DACR" }, | 1165 | { "LINER PGA", NULL, "DACR" }, |
1166 | }; | 1166 | }; |
1167 | 1167 | ||
1168 | static int wm8904_add_widgets(struct snd_soc_codec *codec) | 1168 | static int wm8904_add_widgets(struct snd_soc_component *component) |
1169 | { | 1169 | { |
1170 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 1170 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
1171 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | 1171 | struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component); |
1172 | 1172 | ||
1173 | snd_soc_dapm_new_controls(dapm, wm8904_core_dapm_widgets, | 1173 | snd_soc_dapm_new_controls(dapm, wm8904_core_dapm_widgets, |
1174 | ARRAY_SIZE(wm8904_core_dapm_widgets)); | 1174 | ARRAY_SIZE(wm8904_core_dapm_widgets)); |
@@ -1177,11 +1177,11 @@ static int wm8904_add_widgets(struct snd_soc_codec *codec) | |||
1177 | 1177 | ||
1178 | switch (wm8904->devtype) { | 1178 | switch (wm8904->devtype) { |
1179 | case WM8904: | 1179 | case WM8904: |
1180 | snd_soc_add_codec_controls(codec, wm8904_adc_snd_controls, | 1180 | snd_soc_add_component_controls(component, wm8904_adc_snd_controls, |
1181 | ARRAY_SIZE(wm8904_adc_snd_controls)); | 1181 | ARRAY_SIZE(wm8904_adc_snd_controls)); |
1182 | snd_soc_add_codec_controls(codec, wm8904_dac_snd_controls, | 1182 | snd_soc_add_component_controls(component, wm8904_dac_snd_controls, |
1183 | ARRAY_SIZE(wm8904_dac_snd_controls)); | 1183 | ARRAY_SIZE(wm8904_dac_snd_controls)); |
1184 | snd_soc_add_codec_controls(codec, wm8904_snd_controls, | 1184 | snd_soc_add_component_controls(component, wm8904_snd_controls, |
1185 | ARRAY_SIZE(wm8904_snd_controls)); | 1185 | ARRAY_SIZE(wm8904_snd_controls)); |
1186 | 1186 | ||
1187 | snd_soc_dapm_new_controls(dapm, wm8904_adc_dapm_widgets, | 1187 | snd_soc_dapm_new_controls(dapm, wm8904_adc_dapm_widgets, |
@@ -1200,7 +1200,7 @@ static int wm8904_add_widgets(struct snd_soc_codec *codec) | |||
1200 | break; | 1200 | break; |
1201 | 1201 | ||
1202 | case WM8912: | 1202 | case WM8912: |
1203 | snd_soc_add_codec_controls(codec, wm8904_dac_snd_controls, | 1203 | snd_soc_add_component_controls(component, wm8904_dac_snd_controls, |
1204 | ARRAY_SIZE(wm8904_dac_snd_controls)); | 1204 | ARRAY_SIZE(wm8904_dac_snd_controls)); |
1205 | 1205 | ||
1206 | snd_soc_dapm_new_controls(dapm, wm8904_dac_dapm_widgets, | 1206 | snd_soc_dapm_new_controls(dapm, wm8904_dac_dapm_widgets, |
@@ -1278,8 +1278,8 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream, | |||
1278 | struct snd_pcm_hw_params *params, | 1278 | struct snd_pcm_hw_params *params, |
1279 | struct snd_soc_dai *dai) | 1279 | struct snd_soc_dai *dai) |
1280 | { | 1280 | { |
1281 | struct snd_soc_codec *codec = dai->codec; | 1281 | struct snd_soc_component *component = dai->component; |
1282 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 1282 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
1283 | int ret, i, best, best_val, cur_val; | 1283 | int ret, i, best, best_val, cur_val; |
1284 | unsigned int aif1 = 0; | 1284 | unsigned int aif1 = 0; |
1285 | unsigned int aif2 = 0; | 1285 | unsigned int aif2 = 0; |
@@ -1290,7 +1290,7 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream, | |||
1290 | /* What BCLK do we need? */ | 1290 | /* What BCLK do we need? */ |
1291 | wm8904->fs = params_rate(params); | 1291 | wm8904->fs = params_rate(params); |
1292 | if (wm8904->tdm_slots) { | 1292 | if (wm8904->tdm_slots) { |
1293 | dev_dbg(codec->dev, "Configuring for %d %d bit TDM slots\n", | 1293 | dev_dbg(component->dev, "Configuring for %d %d bit TDM slots\n", |
1294 | wm8904->tdm_slots, wm8904->tdm_width); | 1294 | wm8904->tdm_slots, wm8904->tdm_width); |
1295 | wm8904->bclk = snd_soc_calc_bclk(wm8904->fs, | 1295 | wm8904->bclk = snd_soc_calc_bclk(wm8904->fs, |
1296 | wm8904->tdm_width, 2, | 1296 | wm8904->tdm_width, 2, |
@@ -1316,9 +1316,9 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream, | |||
1316 | } | 1316 | } |
1317 | 1317 | ||
1318 | 1318 | ||
1319 | dev_dbg(codec->dev, "Target BCLK is %dHz\n", wm8904->bclk); | 1319 | dev_dbg(component->dev, "Target BCLK is %dHz\n", wm8904->bclk); |
1320 | 1320 | ||
1321 | ret = wm8904_configure_clocking(codec); | 1321 | ret = wm8904_configure_clocking(component); |
1322 | if (ret != 0) | 1322 | if (ret != 0) |
1323 | return ret; | 1323 | return ret; |
1324 | 1324 | ||
@@ -1334,7 +1334,7 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream, | |||
1334 | best_val = cur_val; | 1334 | best_val = cur_val; |
1335 | } | 1335 | } |
1336 | } | 1336 | } |
1337 | dev_dbg(codec->dev, "Selected CLK_SYS_RATIO of %d\n", | 1337 | dev_dbg(component->dev, "Selected CLK_SYS_RATIO of %d\n", |
1338 | clk_sys_rates[best].ratio); | 1338 | clk_sys_rates[best].ratio); |
1339 | clock1 |= (clk_sys_rates[best].clk_sys_rate | 1339 | clock1 |= (clk_sys_rates[best].clk_sys_rate |
1340 | << WM8904_CLK_SYS_RATE_SHIFT); | 1340 | << WM8904_CLK_SYS_RATE_SHIFT); |
@@ -1350,7 +1350,7 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream, | |||
1350 | best_val = cur_val; | 1350 | best_val = cur_val; |
1351 | } | 1351 | } |
1352 | } | 1352 | } |
1353 | dev_dbg(codec->dev, "Selected SAMPLE_RATE of %dHz\n", | 1353 | dev_dbg(component->dev, "Selected SAMPLE_RATE of %dHz\n", |
1354 | sample_rates[best].rate); | 1354 | sample_rates[best].rate); |
1355 | clock1 |= (sample_rates[best].sample_rate | 1355 | clock1 |= (sample_rates[best].sample_rate |
1356 | << WM8904_SAMPLE_RATE_SHIFT); | 1356 | << WM8904_SAMPLE_RATE_SHIFT); |
@@ -1373,30 +1373,30 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream, | |||
1373 | } | 1373 | } |
1374 | } | 1374 | } |
1375 | wm8904->bclk = (wm8904->sysclk_rate * 10) / bclk_divs[best].div; | 1375 | wm8904->bclk = (wm8904->sysclk_rate * 10) / bclk_divs[best].div; |
1376 | dev_dbg(codec->dev, "Selected BCLK_DIV of %d for %dHz BCLK\n", | 1376 | dev_dbg(component->dev, "Selected BCLK_DIV of %d for %dHz BCLK\n", |
1377 | bclk_divs[best].div, wm8904->bclk); | 1377 | bclk_divs[best].div, wm8904->bclk); |
1378 | aif2 |= bclk_divs[best].bclk_div; | 1378 | aif2 |= bclk_divs[best].bclk_div; |
1379 | 1379 | ||
1380 | /* LRCLK is a simple fraction of BCLK */ | 1380 | /* LRCLK is a simple fraction of BCLK */ |
1381 | dev_dbg(codec->dev, "LRCLK_RATE is %d\n", wm8904->bclk / wm8904->fs); | 1381 | dev_dbg(component->dev, "LRCLK_RATE is %d\n", wm8904->bclk / wm8904->fs); |
1382 | aif3 |= wm8904->bclk / wm8904->fs; | 1382 | aif3 |= wm8904->bclk / wm8904->fs; |
1383 | 1383 | ||
1384 | /* Apply the settings */ | 1384 | /* Apply the settings */ |
1385 | snd_soc_update_bits(codec, WM8904_DAC_DIGITAL_1, | 1385 | snd_soc_component_update_bits(component, WM8904_DAC_DIGITAL_1, |
1386 | WM8904_DAC_SB_FILT, dac_digital1); | 1386 | WM8904_DAC_SB_FILT, dac_digital1); |
1387 | snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_1, | 1387 | snd_soc_component_update_bits(component, WM8904_AUDIO_INTERFACE_1, |
1388 | WM8904_AIF_WL_MASK, aif1); | 1388 | WM8904_AIF_WL_MASK, aif1); |
1389 | snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_2, | 1389 | snd_soc_component_update_bits(component, WM8904_AUDIO_INTERFACE_2, |
1390 | WM8904_BCLK_DIV_MASK, aif2); | 1390 | WM8904_BCLK_DIV_MASK, aif2); |
1391 | snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_3, | 1391 | snd_soc_component_update_bits(component, WM8904_AUDIO_INTERFACE_3, |
1392 | WM8904_LRCLK_RATE_MASK, aif3); | 1392 | WM8904_LRCLK_RATE_MASK, aif3); |
1393 | snd_soc_update_bits(codec, WM8904_CLOCK_RATES_1, | 1393 | snd_soc_component_update_bits(component, WM8904_CLOCK_RATES_1, |
1394 | WM8904_SAMPLE_RATE_MASK | | 1394 | WM8904_SAMPLE_RATE_MASK | |
1395 | WM8904_CLK_SYS_RATE_MASK, clock1); | 1395 | WM8904_CLK_SYS_RATE_MASK, clock1); |
1396 | 1396 | ||
1397 | /* Update filters for the new settings */ | 1397 | /* Update filters for the new settings */ |
1398 | wm8904_set_retune_mobile(codec); | 1398 | wm8904_set_retune_mobile(component); |
1399 | wm8904_set_deemph(codec); | 1399 | wm8904_set_deemph(component); |
1400 | 1400 | ||
1401 | return 0; | 1401 | return 0; |
1402 | } | 1402 | } |
@@ -1405,8 +1405,8 @@ static int wm8904_hw_params(struct snd_pcm_substream *substream, | |||
1405 | static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id, | 1405 | static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id, |
1406 | unsigned int freq, int dir) | 1406 | unsigned int freq, int dir) |
1407 | { | 1407 | { |
1408 | struct snd_soc_codec *codec = dai->codec; | 1408 | struct snd_soc_component *component = dai->component; |
1409 | struct wm8904_priv *priv = snd_soc_codec_get_drvdata(codec); | 1409 | struct wm8904_priv *priv = snd_soc_component_get_drvdata(component); |
1410 | 1410 | ||
1411 | switch (clk_id) { | 1411 | switch (clk_id) { |
1412 | case WM8904_CLK_MCLK: | 1412 | case WM8904_CLK_MCLK: |
@@ -1424,14 +1424,14 @@ static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id, | |||
1424 | 1424 | ||
1425 | dev_dbg(dai->dev, "Clock source is %d at %uHz\n", clk_id, freq); | 1425 | dev_dbg(dai->dev, "Clock source is %d at %uHz\n", clk_id, freq); |
1426 | 1426 | ||
1427 | wm8904_configure_clocking(codec); | 1427 | wm8904_configure_clocking(component); |
1428 | 1428 | ||
1429 | return 0; | 1429 | return 0; |
1430 | } | 1430 | } |
1431 | 1431 | ||
1432 | static int wm8904_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | 1432 | static int wm8904_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) |
1433 | { | 1433 | { |
1434 | struct snd_soc_codec *codec = dai->codec; | 1434 | struct snd_soc_component *component = dai->component; |
1435 | unsigned int aif1 = 0; | 1435 | unsigned int aif1 = 0; |
1436 | unsigned int aif3 = 0; | 1436 | unsigned int aif3 = 0; |
1437 | 1437 | ||
@@ -1508,10 +1508,10 @@ static int wm8904_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
1508 | return -EINVAL; | 1508 | return -EINVAL; |
1509 | } | 1509 | } |
1510 | 1510 | ||
1511 | snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_1, | 1511 | snd_soc_component_update_bits(component, WM8904_AUDIO_INTERFACE_1, |
1512 | WM8904_AIF_BCLK_INV | WM8904_AIF_LRCLK_INV | | 1512 | WM8904_AIF_BCLK_INV | WM8904_AIF_LRCLK_INV | |
1513 | WM8904_AIF_FMT_MASK | WM8904_BCLK_DIR, aif1); | 1513 | WM8904_AIF_FMT_MASK | WM8904_BCLK_DIR, aif1); |
1514 | snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_3, | 1514 | snd_soc_component_update_bits(component, WM8904_AUDIO_INTERFACE_3, |
1515 | WM8904_LRCLK_DIR, aif3); | 1515 | WM8904_LRCLK_DIR, aif3); |
1516 | 1516 | ||
1517 | return 0; | 1517 | return 0; |
@@ -1521,8 +1521,8 @@ static int wm8904_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) | |||
1521 | static int wm8904_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, | 1521 | static int wm8904_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, |
1522 | unsigned int rx_mask, int slots, int slot_width) | 1522 | unsigned int rx_mask, int slots, int slot_width) |
1523 | { | 1523 | { |
1524 | struct snd_soc_codec *codec = dai->codec; | 1524 | struct snd_soc_component *component = dai->component; |
1525 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 1525 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
1526 | int aif1 = 0; | 1526 | int aif1 = 0; |
1527 | 1527 | ||
1528 | /* Don't need to validate anything if we're turning off TDM */ | 1528 | /* Don't need to validate anything if we're turning off TDM */ |
@@ -1560,7 +1560,7 @@ out: | |||
1560 | wm8904->tdm_width = slot_width; | 1560 | wm8904->tdm_width = slot_width; |
1561 | wm8904->tdm_slots = slots / 2; | 1561 | wm8904->tdm_slots = slots / 2; |
1562 | 1562 | ||
1563 | snd_soc_update_bits(codec, WM8904_AUDIO_INTERFACE_1, | 1563 | snd_soc_component_update_bits(component, WM8904_AUDIO_INTERFACE_1, |
1564 | WM8904_AIFADC_TDM | WM8904_AIFADC_TDM_CHAN | | 1564 | WM8904_AIFADC_TDM | WM8904_AIFADC_TDM_CHAN | |
1565 | WM8904_AIFDAC_TDM | WM8904_AIFDAC_TDM_CHAN, aif1); | 1565 | WM8904_AIFDAC_TDM | WM8904_AIFDAC_TDM_CHAN, aif1); |
1566 | 1566 | ||
@@ -1678,8 +1678,8 @@ static int fll_factors(struct _fll_div *fll_div, unsigned int Fref, | |||
1678 | static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source, | 1678 | static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source, |
1679 | unsigned int Fref, unsigned int Fout) | 1679 | unsigned int Fref, unsigned int Fout) |
1680 | { | 1680 | { |
1681 | struct snd_soc_codec *codec = dai->codec; | 1681 | struct snd_soc_component *component = dai->component; |
1682 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 1682 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
1683 | struct _fll_div fll_div; | 1683 | struct _fll_div fll_div; |
1684 | int ret, val; | 1684 | int ret, val; |
1685 | int clock2, fll1; | 1685 | int clock2, fll1; |
@@ -1689,19 +1689,19 @@ static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source, | |||
1689 | Fout == wm8904->fll_fout) | 1689 | Fout == wm8904->fll_fout) |
1690 | return 0; | 1690 | return 0; |
1691 | 1691 | ||
1692 | clock2 = snd_soc_read(codec, WM8904_CLOCK_RATES_2); | 1692 | clock2 = snd_soc_component_read32(component, WM8904_CLOCK_RATES_2); |
1693 | 1693 | ||
1694 | if (Fout == 0) { | 1694 | if (Fout == 0) { |
1695 | dev_dbg(codec->dev, "FLL disabled\n"); | 1695 | dev_dbg(component->dev, "FLL disabled\n"); |
1696 | 1696 | ||
1697 | wm8904->fll_fref = 0; | 1697 | wm8904->fll_fref = 0; |
1698 | wm8904->fll_fout = 0; | 1698 | wm8904->fll_fout = 0; |
1699 | 1699 | ||
1700 | /* Gate SYSCLK to avoid glitches */ | 1700 | /* Gate SYSCLK to avoid glitches */ |
1701 | snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, | 1701 | snd_soc_component_update_bits(component, WM8904_CLOCK_RATES_2, |
1702 | WM8904_CLK_SYS_ENA, 0); | 1702 | WM8904_CLK_SYS_ENA, 0); |
1703 | 1703 | ||
1704 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, | 1704 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_1, |
1705 | WM8904_FLL_OSC_ENA | WM8904_FLL_ENA, 0); | 1705 | WM8904_FLL_OSC_ENA | WM8904_FLL_ENA, 0); |
1706 | 1706 | ||
1707 | goto out; | 1707 | goto out; |
@@ -1718,7 +1718,7 @@ static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source, | |||
1718 | break; | 1718 | break; |
1719 | 1719 | ||
1720 | case WM8904_FLL_FREE_RUNNING: | 1720 | case WM8904_FLL_FREE_RUNNING: |
1721 | dev_dbg(codec->dev, "Using free running FLL\n"); | 1721 | dev_dbg(component->dev, "Using free running FLL\n"); |
1722 | /* Force 12MHz and output/4 for now */ | 1722 | /* Force 12MHz and output/4 for now */ |
1723 | Fout = 12000000; | 1723 | Fout = 12000000; |
1724 | Fref = 12000000; | 1724 | Fref = 12000000; |
@@ -1728,20 +1728,20 @@ static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source, | |||
1728 | break; | 1728 | break; |
1729 | 1729 | ||
1730 | default: | 1730 | default: |
1731 | dev_err(codec->dev, "Unknown FLL ID %d\n", fll_id); | 1731 | dev_err(component->dev, "Unknown FLL ID %d\n", fll_id); |
1732 | return -EINVAL; | 1732 | return -EINVAL; |
1733 | } | 1733 | } |
1734 | 1734 | ||
1735 | /* Save current state then disable the FLL and SYSCLK to avoid | 1735 | /* Save current state then disable the FLL and SYSCLK to avoid |
1736 | * misclocking */ | 1736 | * misclocking */ |
1737 | fll1 = snd_soc_read(codec, WM8904_FLL_CONTROL_1); | 1737 | fll1 = snd_soc_component_read32(component, WM8904_FLL_CONTROL_1); |
1738 | snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, | 1738 | snd_soc_component_update_bits(component, WM8904_CLOCK_RATES_2, |
1739 | WM8904_CLK_SYS_ENA, 0); | 1739 | WM8904_CLK_SYS_ENA, 0); |
1740 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, | 1740 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_1, |
1741 | WM8904_FLL_OSC_ENA | WM8904_FLL_ENA, 0); | 1741 | WM8904_FLL_OSC_ENA | WM8904_FLL_ENA, 0); |
1742 | 1742 | ||
1743 | /* Unlock forced oscilator control to switch it on/off */ | 1743 | /* Unlock forced oscilator control to switch it on/off */ |
1744 | snd_soc_update_bits(codec, WM8904_CONTROL_INTERFACE_TEST_1, | 1744 | snd_soc_component_update_bits(component, WM8904_CONTROL_INTERFACE_TEST_1, |
1745 | WM8904_USER_KEY, WM8904_USER_KEY); | 1745 | WM8904_USER_KEY, WM8904_USER_KEY); |
1746 | 1746 | ||
1747 | if (fll_id == WM8904_FLL_FREE_RUNNING) { | 1747 | if (fll_id == WM8904_FLL_FREE_RUNNING) { |
@@ -1750,24 +1750,24 @@ static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source, | |||
1750 | val = 0; | 1750 | val = 0; |
1751 | } | 1751 | } |
1752 | 1752 | ||
1753 | snd_soc_update_bits(codec, WM8904_FLL_NCO_TEST_1, WM8904_FLL_FRC_NCO, | 1753 | snd_soc_component_update_bits(component, WM8904_FLL_NCO_TEST_1, WM8904_FLL_FRC_NCO, |
1754 | val); | 1754 | val); |
1755 | snd_soc_update_bits(codec, WM8904_CONTROL_INTERFACE_TEST_1, | 1755 | snd_soc_component_update_bits(component, WM8904_CONTROL_INTERFACE_TEST_1, |
1756 | WM8904_USER_KEY, 0); | 1756 | WM8904_USER_KEY, 0); |
1757 | 1757 | ||
1758 | switch (fll_id) { | 1758 | switch (fll_id) { |
1759 | case WM8904_FLL_MCLK: | 1759 | case WM8904_FLL_MCLK: |
1760 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_5, | 1760 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_5, |
1761 | WM8904_FLL_CLK_REF_SRC_MASK, 0); | 1761 | WM8904_FLL_CLK_REF_SRC_MASK, 0); |
1762 | break; | 1762 | break; |
1763 | 1763 | ||
1764 | case WM8904_FLL_LRCLK: | 1764 | case WM8904_FLL_LRCLK: |
1765 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_5, | 1765 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_5, |
1766 | WM8904_FLL_CLK_REF_SRC_MASK, 1); | 1766 | WM8904_FLL_CLK_REF_SRC_MASK, 1); |
1767 | break; | 1767 | break; |
1768 | 1768 | ||
1769 | case WM8904_FLL_BCLK: | 1769 | case WM8904_FLL_BCLK: |
1770 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_5, | 1770 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_5, |
1771 | WM8904_FLL_CLK_REF_SRC_MASK, 2); | 1771 | WM8904_FLL_CLK_REF_SRC_MASK, 2); |
1772 | break; | 1772 | break; |
1773 | } | 1773 | } |
@@ -1776,39 +1776,39 @@ static int wm8904_set_fll(struct snd_soc_dai *dai, int fll_id, int source, | |||
1776 | val = WM8904_FLL_FRACN_ENA; | 1776 | val = WM8904_FLL_FRACN_ENA; |
1777 | else | 1777 | else |
1778 | val = 0; | 1778 | val = 0; |
1779 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, | 1779 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_1, |
1780 | WM8904_FLL_FRACN_ENA, val); | 1780 | WM8904_FLL_FRACN_ENA, val); |
1781 | 1781 | ||
1782 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_2, | 1782 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_2, |
1783 | WM8904_FLL_OUTDIV_MASK | WM8904_FLL_FRATIO_MASK, | 1783 | WM8904_FLL_OUTDIV_MASK | WM8904_FLL_FRATIO_MASK, |
1784 | (fll_div.fll_outdiv << WM8904_FLL_OUTDIV_SHIFT) | | 1784 | (fll_div.fll_outdiv << WM8904_FLL_OUTDIV_SHIFT) | |
1785 | (fll_div.fll_fratio << WM8904_FLL_FRATIO_SHIFT)); | 1785 | (fll_div.fll_fratio << WM8904_FLL_FRATIO_SHIFT)); |
1786 | 1786 | ||
1787 | snd_soc_write(codec, WM8904_FLL_CONTROL_3, fll_div.k); | 1787 | snd_soc_component_write(component, WM8904_FLL_CONTROL_3, fll_div.k); |
1788 | 1788 | ||
1789 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_4, WM8904_FLL_N_MASK, | 1789 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_4, WM8904_FLL_N_MASK, |
1790 | fll_div.n << WM8904_FLL_N_SHIFT); | 1790 | fll_div.n << WM8904_FLL_N_SHIFT); |
1791 | 1791 | ||
1792 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_5, | 1792 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_5, |
1793 | WM8904_FLL_CLK_REF_DIV_MASK, | 1793 | WM8904_FLL_CLK_REF_DIV_MASK, |
1794 | fll_div.fll_clk_ref_div | 1794 | fll_div.fll_clk_ref_div |
1795 | << WM8904_FLL_CLK_REF_DIV_SHIFT); | 1795 | << WM8904_FLL_CLK_REF_DIV_SHIFT); |
1796 | 1796 | ||
1797 | dev_dbg(codec->dev, "FLL configured for %dHz->%dHz\n", Fref, Fout); | 1797 | dev_dbg(component->dev, "FLL configured for %dHz->%dHz\n", Fref, Fout); |
1798 | 1798 | ||
1799 | wm8904->fll_fref = Fref; | 1799 | wm8904->fll_fref = Fref; |
1800 | wm8904->fll_fout = Fout; | 1800 | wm8904->fll_fout = Fout; |
1801 | wm8904->fll_src = source; | 1801 | wm8904->fll_src = source; |
1802 | 1802 | ||
1803 | /* Enable the FLL if it was previously active */ | 1803 | /* Enable the FLL if it was previously active */ |
1804 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, | 1804 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_1, |
1805 | WM8904_FLL_OSC_ENA, fll1); | 1805 | WM8904_FLL_OSC_ENA, fll1); |
1806 | snd_soc_update_bits(codec, WM8904_FLL_CONTROL_1, | 1806 | snd_soc_component_update_bits(component, WM8904_FLL_CONTROL_1, |
1807 | WM8904_FLL_ENA, fll1); | 1807 | WM8904_FLL_ENA, fll1); |
1808 | 1808 | ||
1809 | out: | 1809 | out: |
1810 | /* Reenable SYSCLK if it was previously active */ | 1810 | /* Reenable SYSCLK if it was previously active */ |
1811 | snd_soc_update_bits(codec, WM8904_CLOCK_RATES_2, | 1811 | snd_soc_component_update_bits(component, WM8904_CLOCK_RATES_2, |
1812 | WM8904_CLK_SYS_ENA, clock2); | 1812 | WM8904_CLK_SYS_ENA, clock2); |
1813 | 1813 | ||
1814 | return 0; | 1814 | return 0; |
@@ -1816,7 +1816,7 @@ out: | |||
1816 | 1816 | ||
1817 | static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute) | 1817 | static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute) |
1818 | { | 1818 | { |
1819 | struct snd_soc_codec *codec = codec_dai->codec; | 1819 | struct snd_soc_component *component = codec_dai->component; |
1820 | int val; | 1820 | int val; |
1821 | 1821 | ||
1822 | if (mute) | 1822 | if (mute) |
@@ -1824,15 +1824,15 @@ static int wm8904_digital_mute(struct snd_soc_dai *codec_dai, int mute) | |||
1824 | else | 1824 | else |
1825 | val = 0; | 1825 | val = 0; |
1826 | 1826 | ||
1827 | snd_soc_update_bits(codec, WM8904_DAC_DIGITAL_1, WM8904_DAC_MUTE, val); | 1827 | snd_soc_component_update_bits(component, WM8904_DAC_DIGITAL_1, WM8904_DAC_MUTE, val); |
1828 | 1828 | ||
1829 | return 0; | 1829 | return 0; |
1830 | } | 1830 | } |
1831 | 1831 | ||
1832 | static int wm8904_set_bias_level(struct snd_soc_codec *codec, | 1832 | static int wm8904_set_bias_level(struct snd_soc_component *component, |
1833 | enum snd_soc_bias_level level) | 1833 | enum snd_soc_bias_level level) |
1834 | { | 1834 | { |
1835 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 1835 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
1836 | int ret; | 1836 | int ret; |
1837 | 1837 | ||
1838 | switch (level) { | 1838 | switch (level) { |
@@ -1844,21 +1844,21 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, | |||
1844 | 1844 | ||
1845 | case SND_SOC_BIAS_PREPARE: | 1845 | case SND_SOC_BIAS_PREPARE: |
1846 | /* VMID resistance 2*50k */ | 1846 | /* VMID resistance 2*50k */ |
1847 | snd_soc_update_bits(codec, WM8904_VMID_CONTROL_0, | 1847 | snd_soc_component_update_bits(component, WM8904_VMID_CONTROL_0, |
1848 | WM8904_VMID_RES_MASK, | 1848 | WM8904_VMID_RES_MASK, |
1849 | 0x1 << WM8904_VMID_RES_SHIFT); | 1849 | 0x1 << WM8904_VMID_RES_SHIFT); |
1850 | 1850 | ||
1851 | /* Normal bias current */ | 1851 | /* Normal bias current */ |
1852 | snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, | 1852 | snd_soc_component_update_bits(component, WM8904_BIAS_CONTROL_0, |
1853 | WM8904_ISEL_MASK, 2 << WM8904_ISEL_SHIFT); | 1853 | WM8904_ISEL_MASK, 2 << WM8904_ISEL_SHIFT); |
1854 | break; | 1854 | break; |
1855 | 1855 | ||
1856 | case SND_SOC_BIAS_STANDBY: | 1856 | case SND_SOC_BIAS_STANDBY: |
1857 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { | 1857 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { |
1858 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8904->supplies), | 1858 | ret = regulator_bulk_enable(ARRAY_SIZE(wm8904->supplies), |
1859 | wm8904->supplies); | 1859 | wm8904->supplies); |
1860 | if (ret != 0) { | 1860 | if (ret != 0) { |
1861 | dev_err(codec->dev, | 1861 | dev_err(component->dev, |
1862 | "Failed to enable supplies: %d\n", | 1862 | "Failed to enable supplies: %d\n", |
1863 | ret); | 1863 | ret); |
1864 | return ret; | 1864 | return ret; |
@@ -1868,11 +1868,11 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, | |||
1868 | regcache_sync(wm8904->regmap); | 1868 | regcache_sync(wm8904->regmap); |
1869 | 1869 | ||
1870 | /* Enable bias */ | 1870 | /* Enable bias */ |
1871 | snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, | 1871 | snd_soc_component_update_bits(component, WM8904_BIAS_CONTROL_0, |
1872 | WM8904_BIAS_ENA, WM8904_BIAS_ENA); | 1872 | WM8904_BIAS_ENA, WM8904_BIAS_ENA); |
1873 | 1873 | ||
1874 | /* Enable VMID, VMID buffering, 2*5k resistance */ | 1874 | /* Enable VMID, VMID buffering, 2*5k resistance */ |
1875 | snd_soc_update_bits(codec, WM8904_VMID_CONTROL_0, | 1875 | snd_soc_component_update_bits(component, WM8904_VMID_CONTROL_0, |
1876 | WM8904_VMID_ENA | | 1876 | WM8904_VMID_ENA | |
1877 | WM8904_VMID_RES_MASK, | 1877 | WM8904_VMID_RES_MASK, |
1878 | WM8904_VMID_ENA | | 1878 | WM8904_VMID_ENA | |
@@ -1883,22 +1883,22 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec, | |||
1883 | } | 1883 | } |
1884 | 1884 | ||
1885 | /* Maintain VMID with 2*250k */ | 1885 | /* Maintain VMID with 2*250k */ |
1886 | snd_soc_update_bits(codec, WM8904_VMID_CONTROL_0, | 1886 | snd_soc_component_update_bits(component, WM8904_VMID_CONTROL_0, |
1887 | WM8904_VMID_RES_MASK, | 1887 | WM8904_VMID_RES_MASK, |
1888 | 0x2 << WM8904_VMID_RES_SHIFT); | 1888 | 0x2 << WM8904_VMID_RES_SHIFT); |
1889 | 1889 | ||
1890 | /* Bias current *0.5 */ | 1890 | /* Bias current *0.5 */ |
1891 | snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, | 1891 | snd_soc_component_update_bits(component, WM8904_BIAS_CONTROL_0, |
1892 | WM8904_ISEL_MASK, 0); | 1892 | WM8904_ISEL_MASK, 0); |
1893 | break; | 1893 | break; |
1894 | 1894 | ||
1895 | case SND_SOC_BIAS_OFF: | 1895 | case SND_SOC_BIAS_OFF: |
1896 | /* Turn off VMID */ | 1896 | /* Turn off VMID */ |
1897 | snd_soc_update_bits(codec, WM8904_VMID_CONTROL_0, | 1897 | snd_soc_component_update_bits(component, WM8904_VMID_CONTROL_0, |
1898 | WM8904_VMID_RES_MASK | WM8904_VMID_ENA, 0); | 1898 | WM8904_VMID_RES_MASK | WM8904_VMID_ENA, 0); |
1899 | 1899 | ||
1900 | /* Stop bias generation */ | 1900 | /* Stop bias generation */ |
1901 | snd_soc_update_bits(codec, WM8904_BIAS_CONTROL_0, | 1901 | snd_soc_component_update_bits(component, WM8904_BIAS_CONTROL_0, |
1902 | WM8904_BIAS_ENA, 0); | 1902 | WM8904_BIAS_ENA, 0); |
1903 | 1903 | ||
1904 | regcache_cache_only(wm8904->regmap, true); | 1904 | regcache_cache_only(wm8904->regmap, true); |
@@ -1946,9 +1946,9 @@ static struct snd_soc_dai_driver wm8904_dai = { | |||
1946 | .symmetric_rates = 1, | 1946 | .symmetric_rates = 1, |
1947 | }; | 1947 | }; |
1948 | 1948 | ||
1949 | static void wm8904_handle_retune_mobile_pdata(struct snd_soc_codec *codec) | 1949 | static void wm8904_handle_retune_mobile_pdata(struct snd_soc_component *component) |
1950 | { | 1950 | { |
1951 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 1951 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
1952 | struct wm8904_pdata *pdata = wm8904->pdata; | 1952 | struct wm8904_pdata *pdata = wm8904->pdata; |
1953 | struct snd_kcontrol_new control = | 1953 | struct snd_kcontrol_new control = |
1954 | SOC_ENUM_EXT("EQ Mode", | 1954 | SOC_ENUM_EXT("EQ Mode", |
@@ -1991,31 +1991,31 @@ static void wm8904_handle_retune_mobile_pdata(struct snd_soc_codec *codec) | |||
1991 | wm8904->retune_mobile_texts = t; | 1991 | wm8904->retune_mobile_texts = t; |
1992 | } | 1992 | } |
1993 | 1993 | ||
1994 | dev_dbg(codec->dev, "Allocated %d unique ReTune Mobile names\n", | 1994 | dev_dbg(component->dev, "Allocated %d unique ReTune Mobile names\n", |
1995 | wm8904->num_retune_mobile_texts); | 1995 | wm8904->num_retune_mobile_texts); |
1996 | 1996 | ||
1997 | wm8904->retune_mobile_enum.items = wm8904->num_retune_mobile_texts; | 1997 | wm8904->retune_mobile_enum.items = wm8904->num_retune_mobile_texts; |
1998 | wm8904->retune_mobile_enum.texts = wm8904->retune_mobile_texts; | 1998 | wm8904->retune_mobile_enum.texts = wm8904->retune_mobile_texts; |
1999 | 1999 | ||
2000 | ret = snd_soc_add_codec_controls(codec, &control, 1); | 2000 | ret = snd_soc_add_component_controls(component, &control, 1); |
2001 | if (ret != 0) | 2001 | if (ret != 0) |
2002 | dev_err(codec->dev, | 2002 | dev_err(component->dev, |
2003 | "Failed to add ReTune Mobile control: %d\n", ret); | 2003 | "Failed to add ReTune Mobile control: %d\n", ret); |
2004 | } | 2004 | } |
2005 | 2005 | ||
2006 | static void wm8904_handle_pdata(struct snd_soc_codec *codec) | 2006 | static void wm8904_handle_pdata(struct snd_soc_component *component) |
2007 | { | 2007 | { |
2008 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 2008 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
2009 | struct wm8904_pdata *pdata = wm8904->pdata; | 2009 | struct wm8904_pdata *pdata = wm8904->pdata; |
2010 | int ret, i; | 2010 | int ret, i; |
2011 | 2011 | ||
2012 | if (!pdata) { | 2012 | if (!pdata) { |
2013 | snd_soc_add_codec_controls(codec, wm8904_eq_controls, | 2013 | snd_soc_add_component_controls(component, wm8904_eq_controls, |
2014 | ARRAY_SIZE(wm8904_eq_controls)); | 2014 | ARRAY_SIZE(wm8904_eq_controls)); |
2015 | return; | 2015 | return; |
2016 | } | 2016 | } |
2017 | 2017 | ||
2018 | dev_dbg(codec->dev, "%d DRC configurations\n", pdata->num_drc_cfgs); | 2018 | dev_dbg(component->dev, "%d DRC configurations\n", pdata->num_drc_cfgs); |
2019 | 2019 | ||
2020 | if (pdata->num_drc_cfgs) { | 2020 | if (pdata->num_drc_cfgs) { |
2021 | struct snd_kcontrol_new control = | 2021 | struct snd_kcontrol_new control = |
@@ -2034,28 +2034,28 @@ static void wm8904_handle_pdata(struct snd_soc_codec *codec) | |||
2034 | wm8904->drc_enum.items = pdata->num_drc_cfgs; | 2034 | wm8904->drc_enum.items = pdata->num_drc_cfgs; |
2035 | wm8904->drc_enum.texts = wm8904->drc_texts; | 2035 | wm8904->drc_enum.texts = wm8904->drc_texts; |
2036 | 2036 | ||
2037 | ret = snd_soc_add_codec_controls(codec, &control, 1); | 2037 | ret = snd_soc_add_component_controls(component, &control, 1); |
2038 | if (ret != 0) | 2038 | if (ret != 0) |
2039 | dev_err(codec->dev, | 2039 | dev_err(component->dev, |
2040 | "Failed to add DRC mode control: %d\n", ret); | 2040 | "Failed to add DRC mode control: %d\n", ret); |
2041 | 2041 | ||
2042 | wm8904_set_drc(codec); | 2042 | wm8904_set_drc(component); |
2043 | } | 2043 | } |
2044 | 2044 | ||
2045 | dev_dbg(codec->dev, "%d ReTune Mobile configurations\n", | 2045 | dev_dbg(component->dev, "%d ReTune Mobile configurations\n", |
2046 | pdata->num_retune_mobile_cfgs); | 2046 | pdata->num_retune_mobile_cfgs); |
2047 | 2047 | ||
2048 | if (pdata->num_retune_mobile_cfgs) | 2048 | if (pdata->num_retune_mobile_cfgs) |
2049 | wm8904_handle_retune_mobile_pdata(codec); | 2049 | wm8904_handle_retune_mobile_pdata(component); |
2050 | else | 2050 | else |
2051 | snd_soc_add_codec_controls(codec, wm8904_eq_controls, | 2051 | snd_soc_add_component_controls(component, wm8904_eq_controls, |
2052 | ARRAY_SIZE(wm8904_eq_controls)); | 2052 | ARRAY_SIZE(wm8904_eq_controls)); |
2053 | } | 2053 | } |
2054 | 2054 | ||
2055 | 2055 | ||
2056 | static int wm8904_probe(struct snd_soc_codec *codec) | 2056 | static int wm8904_probe(struct snd_soc_component *component) |
2057 | { | 2057 | { |
2058 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 2058 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
2059 | 2059 | ||
2060 | switch (wm8904->devtype) { | 2060 | switch (wm8904->devtype) { |
2061 | case WM8904: | 2061 | case WM8904: |
@@ -2064,33 +2064,33 @@ static int wm8904_probe(struct snd_soc_codec *codec) | |||
2064 | memset(&wm8904_dai.capture, 0, sizeof(wm8904_dai.capture)); | 2064 | memset(&wm8904_dai.capture, 0, sizeof(wm8904_dai.capture)); |
2065 | break; | 2065 | break; |
2066 | default: | 2066 | default: |
2067 | dev_err(codec->dev, "Unknown device type %d\n", | 2067 | dev_err(component->dev, "Unknown device type %d\n", |
2068 | wm8904->devtype); | 2068 | wm8904->devtype); |
2069 | return -EINVAL; | 2069 | return -EINVAL; |
2070 | } | 2070 | } |
2071 | 2071 | ||
2072 | wm8904_handle_pdata(codec); | 2072 | wm8904_handle_pdata(component); |
2073 | 2073 | ||
2074 | wm8904_add_widgets(codec); | 2074 | wm8904_add_widgets(component); |
2075 | 2075 | ||
2076 | return 0; | 2076 | return 0; |
2077 | } | 2077 | } |
2078 | 2078 | ||
2079 | static int wm8904_remove(struct snd_soc_codec *codec) | 2079 | static void wm8904_remove(struct snd_soc_component *component) |
2080 | { | 2080 | { |
2081 | struct wm8904_priv *wm8904 = snd_soc_codec_get_drvdata(codec); | 2081 | struct wm8904_priv *wm8904 = snd_soc_component_get_drvdata(component); |
2082 | 2082 | ||
2083 | kfree(wm8904->retune_mobile_texts); | 2083 | kfree(wm8904->retune_mobile_texts); |
2084 | kfree(wm8904->drc_texts); | 2084 | kfree(wm8904->drc_texts); |
2085 | |||
2086 | return 0; | ||
2087 | } | 2085 | } |
2088 | 2086 | ||
2089 | static const struct snd_soc_codec_driver soc_codec_dev_wm8904 = { | 2087 | static const struct snd_soc_component_driver soc_component_dev_wm8904 = { |
2090 | .probe = wm8904_probe, | 2088 | .probe = wm8904_probe, |
2091 | .remove = wm8904_remove, | 2089 | .remove = wm8904_remove, |
2092 | .set_bias_level = wm8904_set_bias_level, | 2090 | .set_bias_level = wm8904_set_bias_level, |
2093 | .idle_bias_off = true, | 2091 | .use_pmdown_time = 1, |
2092 | .endianness = 1, | ||
2093 | .non_legacy_dai_naming = 1, | ||
2094 | }; | 2094 | }; |
2095 | 2095 | ||
2096 | static const struct regmap_config wm8904_regmap = { | 2096 | static const struct regmap_config wm8904_regmap = { |
@@ -2265,8 +2265,8 @@ static int wm8904_i2c_probe(struct i2c_client *i2c, | |||
2265 | regcache_cache_only(wm8904->regmap, true); | 2265 | regcache_cache_only(wm8904->regmap, true); |
2266 | regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies), wm8904->supplies); | 2266 | regulator_bulk_disable(ARRAY_SIZE(wm8904->supplies), wm8904->supplies); |
2267 | 2267 | ||
2268 | ret = snd_soc_register_codec(&i2c->dev, | 2268 | ret = devm_snd_soc_register_component(&i2c->dev, |
2269 | &soc_codec_dev_wm8904, &wm8904_dai, 1); | 2269 | &soc_component_dev_wm8904, &wm8904_dai, 1); |
2270 | if (ret != 0) | 2270 | if (ret != 0) |
2271 | return ret; | 2271 | return ret; |
2272 | 2272 | ||
@@ -2277,12 +2277,6 @@ err_enable: | |||
2277 | return ret; | 2277 | return ret; |
2278 | } | 2278 | } |
2279 | 2279 | ||
2280 | static int wm8904_i2c_remove(struct i2c_client *client) | ||
2281 | { | ||
2282 | snd_soc_unregister_codec(&client->dev); | ||
2283 | return 0; | ||
2284 | } | ||
2285 | |||
2286 | static const struct i2c_device_id wm8904_i2c_id[] = { | 2280 | static const struct i2c_device_id wm8904_i2c_id[] = { |
2287 | { "wm8904", WM8904 }, | 2281 | { "wm8904", WM8904 }, |
2288 | { "wm8912", WM8912 }, | 2282 | { "wm8912", WM8912 }, |
@@ -2297,7 +2291,6 @@ static struct i2c_driver wm8904_i2c_driver = { | |||
2297 | .of_match_table = of_match_ptr(wm8904_of_match), | 2291 | .of_match_table = of_match_ptr(wm8904_of_match), |
2298 | }, | 2292 | }, |
2299 | .probe = wm8904_i2c_probe, | 2293 | .probe = wm8904_i2c_probe, |
2300 | .remove = wm8904_i2c_remove, | ||
2301 | .id_table = wm8904_i2c_id, | 2294 | .id_table = wm8904_i2c_id, |
2302 | }; | 2295 | }; |
2303 | 2296 | ||