diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-03-18 04:02:04 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2014-04-14 12:22:43 -0400 |
commit | ea53bf77d147e7e560ac007fdaa30fb98c37c712 (patch) | |
tree | fb5917764aa5b2c0f4122708097446c3110541a0 /sound/soc/codecs/wm8958-dsp2.c | |
parent | c9eaa447e77efe77b7fa4c953bd62de8297fd6c5 (diff) |
ASoC: Add snd_soc_kcontrol_codec() helper function
For CODEC controls snd_kcontrol_chip() currently returns a pointer to the
CODEC that registered the control. With the upcoming consolidation of
platform and CODEC controls this will change. Prepare for this by introducing
the snd_soc_kcontrol_codec() helper function that will hide the implementation
details of how the CODEC for a control can be obtained. This will allow us to
change this easily in the future.
The patch also updates all CODEC drivers to use the new helper function.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'sound/soc/codecs/wm8958-dsp2.c')
-rw-r--r-- | sound/soc/codecs/wm8958-dsp2.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c index 7ac2e511403c..b2ebb104d879 100644 --- a/sound/soc/codecs/wm8958-dsp2.c +++ b/sound/soc/codecs/wm8958-dsp2.c | |||
@@ -456,7 +456,7 @@ static int wm8958_dsp2_busy(struct wm8994_priv *wm8994, int aif) | |||
456 | static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol, | 456 | static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol, |
457 | struct snd_ctl_elem_value *ucontrol) | 457 | struct snd_ctl_elem_value *ucontrol) |
458 | { | 458 | { |
459 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 459 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
460 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 460 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
461 | struct wm8994 *control = wm8994->wm8994; | 461 | struct wm8994 *control = wm8994->wm8994; |
462 | int value = ucontrol->value.integer.value[0]; | 462 | int value = ucontrol->value.integer.value[0]; |
@@ -478,7 +478,7 @@ static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol, | |||
478 | static int wm8958_get_mbc_enum(struct snd_kcontrol *kcontrol, | 478 | static int wm8958_get_mbc_enum(struct snd_kcontrol *kcontrol, |
479 | struct snd_ctl_elem_value *ucontrol) | 479 | struct snd_ctl_elem_value *ucontrol) |
480 | { | 480 | { |
481 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 481 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
482 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 482 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
483 | 483 | ||
484 | ucontrol->value.enumerated.item[0] = wm8994->mbc_cfg; | 484 | ucontrol->value.enumerated.item[0] = wm8994->mbc_cfg; |
@@ -500,7 +500,7 @@ static int wm8958_mbc_get(struct snd_kcontrol *kcontrol, | |||
500 | struct snd_ctl_elem_value *ucontrol) | 500 | struct snd_ctl_elem_value *ucontrol) |
501 | { | 501 | { |
502 | int mbc = kcontrol->private_value; | 502 | int mbc = kcontrol->private_value; |
503 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 503 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
504 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 504 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
505 | 505 | ||
506 | ucontrol->value.integer.value[0] = wm8994->mbc_ena[mbc]; | 506 | ucontrol->value.integer.value[0] = wm8994->mbc_ena[mbc]; |
@@ -512,7 +512,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol, | |||
512 | struct snd_ctl_elem_value *ucontrol) | 512 | struct snd_ctl_elem_value *ucontrol) |
513 | { | 513 | { |
514 | int mbc = kcontrol->private_value; | 514 | int mbc = kcontrol->private_value; |
515 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 515 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
516 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 516 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
517 | 517 | ||
518 | if (wm8994->mbc_ena[mbc] == ucontrol->value.integer.value[0]) | 518 | if (wm8994->mbc_ena[mbc] == ucontrol->value.integer.value[0]) |
@@ -546,7 +546,7 @@ static int wm8958_mbc_put(struct snd_kcontrol *kcontrol, | |||
546 | static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol, | 546 | static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol, |
547 | struct snd_ctl_elem_value *ucontrol) | 547 | struct snd_ctl_elem_value *ucontrol) |
548 | { | 548 | { |
549 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 549 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
550 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 550 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
551 | struct wm8994 *control = wm8994->wm8994; | 551 | struct wm8994 *control = wm8994->wm8994; |
552 | int value = ucontrol->value.integer.value[0]; | 552 | int value = ucontrol->value.integer.value[0]; |
@@ -568,7 +568,7 @@ static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol, | |||
568 | static int wm8958_get_vss_enum(struct snd_kcontrol *kcontrol, | 568 | static int wm8958_get_vss_enum(struct snd_kcontrol *kcontrol, |
569 | struct snd_ctl_elem_value *ucontrol) | 569 | struct snd_ctl_elem_value *ucontrol) |
570 | { | 570 | { |
571 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 571 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
572 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 572 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
573 | 573 | ||
574 | ucontrol->value.enumerated.item[0] = wm8994->vss_cfg; | 574 | ucontrol->value.enumerated.item[0] = wm8994->vss_cfg; |
@@ -579,7 +579,7 @@ static int wm8958_get_vss_enum(struct snd_kcontrol *kcontrol, | |||
579 | static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol, | 579 | static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol, |
580 | struct snd_ctl_elem_value *ucontrol) | 580 | struct snd_ctl_elem_value *ucontrol) |
581 | { | 581 | { |
582 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 582 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
583 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 583 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
584 | struct wm8994 *control = wm8994->wm8994; | 584 | struct wm8994 *control = wm8994->wm8994; |
585 | int value = ucontrol->value.integer.value[0]; | 585 | int value = ucontrol->value.integer.value[0]; |
@@ -601,7 +601,7 @@ static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol, | |||
601 | static int wm8958_get_vss_hpf_enum(struct snd_kcontrol *kcontrol, | 601 | static int wm8958_get_vss_hpf_enum(struct snd_kcontrol *kcontrol, |
602 | struct snd_ctl_elem_value *ucontrol) | 602 | struct snd_ctl_elem_value *ucontrol) |
603 | { | 603 | { |
604 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 604 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
605 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 605 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
606 | 606 | ||
607 | ucontrol->value.enumerated.item[0] = wm8994->vss_hpf_cfg; | 607 | ucontrol->value.enumerated.item[0] = wm8994->vss_hpf_cfg; |
@@ -623,7 +623,7 @@ static int wm8958_vss_get(struct snd_kcontrol *kcontrol, | |||
623 | struct snd_ctl_elem_value *ucontrol) | 623 | struct snd_ctl_elem_value *ucontrol) |
624 | { | 624 | { |
625 | int vss = kcontrol->private_value; | 625 | int vss = kcontrol->private_value; |
626 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 626 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
627 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 627 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
628 | 628 | ||
629 | ucontrol->value.integer.value[0] = wm8994->vss_ena[vss]; | 629 | ucontrol->value.integer.value[0] = wm8994->vss_ena[vss]; |
@@ -635,7 +635,7 @@ static int wm8958_vss_put(struct snd_kcontrol *kcontrol, | |||
635 | struct snd_ctl_elem_value *ucontrol) | 635 | struct snd_ctl_elem_value *ucontrol) |
636 | { | 636 | { |
637 | int vss = kcontrol->private_value; | 637 | int vss = kcontrol->private_value; |
638 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 638 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
639 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 639 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
640 | 640 | ||
641 | if (wm8994->vss_ena[vss] == ucontrol->value.integer.value[0]) | 641 | if (wm8994->vss_ena[vss] == ucontrol->value.integer.value[0]) |
@@ -684,7 +684,7 @@ static int wm8958_hpf_get(struct snd_kcontrol *kcontrol, | |||
684 | struct snd_ctl_elem_value *ucontrol) | 684 | struct snd_ctl_elem_value *ucontrol) |
685 | { | 685 | { |
686 | int hpf = kcontrol->private_value; | 686 | int hpf = kcontrol->private_value; |
687 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 687 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
688 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 688 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
689 | 689 | ||
690 | if (hpf < 3) | 690 | if (hpf < 3) |
@@ -699,7 +699,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol, | |||
699 | struct snd_ctl_elem_value *ucontrol) | 699 | struct snd_ctl_elem_value *ucontrol) |
700 | { | 700 | { |
701 | int hpf = kcontrol->private_value; | 701 | int hpf = kcontrol->private_value; |
702 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 702 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
703 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 703 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
704 | 704 | ||
705 | if (hpf < 3) { | 705 | if (hpf < 3) { |
@@ -746,7 +746,7 @@ static int wm8958_hpf_put(struct snd_kcontrol *kcontrol, | |||
746 | static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol, | 746 | static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol, |
747 | struct snd_ctl_elem_value *ucontrol) | 747 | struct snd_ctl_elem_value *ucontrol) |
748 | { | 748 | { |
749 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 749 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
750 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 750 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
751 | struct wm8994 *control = wm8994->wm8994; | 751 | struct wm8994 *control = wm8994->wm8994; |
752 | int value = ucontrol->value.integer.value[0]; | 752 | int value = ucontrol->value.integer.value[0]; |
@@ -768,7 +768,7 @@ static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol, | |||
768 | static int wm8958_get_enh_eq_enum(struct snd_kcontrol *kcontrol, | 768 | static int wm8958_get_enh_eq_enum(struct snd_kcontrol *kcontrol, |
769 | struct snd_ctl_elem_value *ucontrol) | 769 | struct snd_ctl_elem_value *ucontrol) |
770 | { | 770 | { |
771 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 771 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
772 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 772 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
773 | 773 | ||
774 | ucontrol->value.enumerated.item[0] = wm8994->enh_eq_cfg; | 774 | ucontrol->value.enumerated.item[0] = wm8994->enh_eq_cfg; |
@@ -790,7 +790,7 @@ static int wm8958_enh_eq_get(struct snd_kcontrol *kcontrol, | |||
790 | struct snd_ctl_elem_value *ucontrol) | 790 | struct snd_ctl_elem_value *ucontrol) |
791 | { | 791 | { |
792 | int eq = kcontrol->private_value; | 792 | int eq = kcontrol->private_value; |
793 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 793 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
794 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 794 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
795 | 795 | ||
796 | ucontrol->value.integer.value[0] = wm8994->enh_eq_ena[eq]; | 796 | ucontrol->value.integer.value[0] = wm8994->enh_eq_ena[eq]; |
@@ -802,7 +802,7 @@ static int wm8958_enh_eq_put(struct snd_kcontrol *kcontrol, | |||
802 | struct snd_ctl_elem_value *ucontrol) | 802 | struct snd_ctl_elem_value *ucontrol) |
803 | { | 803 | { |
804 | int eq = kcontrol->private_value; | 804 | int eq = kcontrol->private_value; |
805 | struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); | 805 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); |
806 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); | 806 | struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); |
807 | 807 | ||
808 | if (wm8994->enh_eq_ena[eq] == ucontrol->value.integer.value[0]) | 808 | if (wm8994->enh_eq_ena[eq] == ucontrol->value.integer.value[0]) |