diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 21:59:05 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 04:38:55 -0500 |
commit | e5449affbf96cceaa042e33b0d1e5db0bd6ecf3c (patch) | |
tree | 1c03e08b9c0e63954d9fab4ead10047b50b96c08 | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
ASoC: wm2000: 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>
Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/wm2000.c | 78 |
1 files changed, 36 insertions, 42 deletions
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c index abfa052c07d8..c5ae07234a00 100644 --- a/sound/soc/codecs/wm2000.c +++ b/sound/soc/codecs/wm2000.c | |||
@@ -607,8 +607,8 @@ static int wm2000_anc_set_mode(struct wm2000_priv *wm2000) | |||
607 | static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, | 607 | static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, |
608 | struct snd_ctl_elem_value *ucontrol) | 608 | struct snd_ctl_elem_value *ucontrol) |
609 | { | 609 | { |
610 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 610 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
611 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 611 | struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev); |
612 | 612 | ||
613 | ucontrol->value.integer.value[0] = wm2000->anc_active; | 613 | ucontrol->value.integer.value[0] = wm2000->anc_active; |
614 | 614 | ||
@@ -618,8 +618,8 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, | |||
618 | static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, | 618 | static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, |
619 | struct snd_ctl_elem_value *ucontrol) | 619 | struct snd_ctl_elem_value *ucontrol) |
620 | { | 620 | { |
621 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 621 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
622 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 622 | struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev); |
623 | unsigned int anc_active = ucontrol->value.integer.value[0]; | 623 | unsigned int anc_active = ucontrol->value.integer.value[0]; |
624 | int ret; | 624 | int ret; |
625 | 625 | ||
@@ -640,8 +640,8 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, | |||
640 | static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, | 640 | static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, |
641 | struct snd_ctl_elem_value *ucontrol) | 641 | struct snd_ctl_elem_value *ucontrol) |
642 | { | 642 | { |
643 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 643 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
644 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 644 | struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev); |
645 | 645 | ||
646 | ucontrol->value.integer.value[0] = wm2000->spk_ena; | 646 | ucontrol->value.integer.value[0] = wm2000->spk_ena; |
647 | 647 | ||
@@ -651,8 +651,8 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, | |||
651 | static int wm2000_speaker_put(struct snd_kcontrol *kcontrol, | 651 | static int wm2000_speaker_put(struct snd_kcontrol *kcontrol, |
652 | struct snd_ctl_elem_value *ucontrol) | 652 | struct snd_ctl_elem_value *ucontrol) |
653 | { | 653 | { |
654 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 654 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
655 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 655 | struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev); |
656 | unsigned int val = ucontrol->value.integer.value[0]; | 656 | unsigned int val = ucontrol->value.integer.value[0]; |
657 | int ret; | 657 | int ret; |
658 | 658 | ||
@@ -683,8 +683,8 @@ static const struct snd_kcontrol_new wm2000_controls[] = { | |||
683 | static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w, | 683 | static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w, |
684 | struct snd_kcontrol *kcontrol, int event) | 684 | struct snd_kcontrol *kcontrol, int event) |
685 | { | 685 | { |
686 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 686 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
687 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 687 | struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev); |
688 | int ret; | 688 | int ret; |
689 | 689 | ||
690 | mutex_lock(&wm2000->lock); | 690 | mutex_lock(&wm2000->lock); |
@@ -724,16 +724,16 @@ static const struct snd_soc_dapm_route wm2000_audio_map[] = { | |||
724 | }; | 724 | }; |
725 | 725 | ||
726 | #ifdef CONFIG_PM | 726 | #ifdef CONFIG_PM |
727 | static int wm2000_suspend(struct snd_soc_codec *codec) | 727 | static int wm2000_suspend(struct snd_soc_component *component) |
728 | { | 728 | { |
729 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 729 | struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev); |
730 | 730 | ||
731 | return wm2000_anc_transition(wm2000, ANC_OFF); | 731 | return wm2000_anc_transition(wm2000, ANC_OFF); |
732 | } | 732 | } |
733 | 733 | ||
734 | static int wm2000_resume(struct snd_soc_codec *codec) | 734 | static int wm2000_resume(struct snd_soc_component *component) |
735 | { | 735 | { |
736 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 736 | struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev); |
737 | 737 | ||
738 | return wm2000_anc_set_mode(wm2000); | 738 | return wm2000_anc_set_mode(wm2000); |
739 | } | 739 | } |
@@ -782,9 +782,9 @@ static const struct regmap_config wm2000_regmap = { | |||
782 | .readable_reg = wm2000_readable_reg, | 782 | .readable_reg = wm2000_readable_reg, |
783 | }; | 783 | }; |
784 | 784 | ||
785 | static int wm2000_probe(struct snd_soc_codec *codec) | 785 | static int wm2000_probe(struct snd_soc_component *component) |
786 | { | 786 | { |
787 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 787 | struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev); |
788 | 788 | ||
789 | /* This will trigger a transition to standby mode by default */ | 789 | /* This will trigger a transition to standby mode by default */ |
790 | wm2000_anc_set_mode(wm2000); | 790 | wm2000_anc_set_mode(wm2000); |
@@ -792,27 +792,28 @@ static int wm2000_probe(struct snd_soc_codec *codec) | |||
792 | return 0; | 792 | return 0; |
793 | } | 793 | } |
794 | 794 | ||
795 | static int wm2000_remove(struct snd_soc_codec *codec) | 795 | static void wm2000_remove(struct snd_soc_component *component) |
796 | { | 796 | { |
797 | struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); | 797 | struct wm2000_priv *wm2000 = dev_get_drvdata(component->dev); |
798 | 798 | ||
799 | return wm2000_anc_transition(wm2000, ANC_OFF); | 799 | wm2000_anc_transition(wm2000, ANC_OFF); |
800 | } | 800 | } |
801 | 801 | ||
802 | static const struct snd_soc_codec_driver soc_codec_dev_wm2000 = { | 802 | static const struct snd_soc_component_driver soc_component_dev_wm2000 = { |
803 | .probe = wm2000_probe, | 803 | .probe = wm2000_probe, |
804 | .remove = wm2000_remove, | 804 | .remove = wm2000_remove, |
805 | .suspend = wm2000_suspend, | 805 | .suspend = wm2000_suspend, |
806 | .resume = wm2000_resume, | 806 | .resume = wm2000_resume, |
807 | 807 | .controls = wm2000_controls, | |
808 | .component_driver = { | 808 | .num_controls = ARRAY_SIZE(wm2000_controls), |
809 | .controls = wm2000_controls, | 809 | .dapm_widgets = wm2000_dapm_widgets, |
810 | .num_controls = ARRAY_SIZE(wm2000_controls), | 810 | .num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets), |
811 | .dapm_widgets = wm2000_dapm_widgets, | 811 | .dapm_routes = wm2000_audio_map, |
812 | .num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets), | 812 | .num_dapm_routes = ARRAY_SIZE(wm2000_audio_map), |
813 | .dapm_routes = wm2000_audio_map, | 813 | .idle_bias_on = 1, |
814 | .num_dapm_routes = ARRAY_SIZE(wm2000_audio_map), | 814 | .use_pmdown_time = 1, |
815 | }, | 815 | .endianness = 1, |
816 | .non_legacy_dai_naming = 1, | ||
816 | }; | 817 | }; |
817 | 818 | ||
818 | static int wm2000_i2c_probe(struct i2c_client *i2c, | 819 | static int wm2000_i2c_probe(struct i2c_client *i2c, |
@@ -916,7 +917,8 @@ static int wm2000_i2c_probe(struct i2c_client *i2c, | |||
916 | 917 | ||
917 | wm2000_reset(wm2000); | 918 | wm2000_reset(wm2000); |
918 | 919 | ||
919 | ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000, NULL, 0); | 920 | ret = devm_snd_soc_register_component(&i2c->dev, |
921 | &soc_component_dev_wm2000, NULL, 0); | ||
920 | 922 | ||
921 | err_supplies: | 923 | err_supplies: |
922 | regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies); | 924 | regulator_bulk_disable(WM2000_NUM_SUPPLIES, wm2000->supplies); |
@@ -926,13 +928,6 @@ out: | |||
926 | return ret; | 928 | return ret; |
927 | } | 929 | } |
928 | 930 | ||
929 | static int wm2000_i2c_remove(struct i2c_client *i2c) | ||
930 | { | ||
931 | snd_soc_unregister_codec(&i2c->dev); | ||
932 | |||
933 | return 0; | ||
934 | } | ||
935 | |||
936 | static const struct i2c_device_id wm2000_i2c_id[] = { | 931 | static const struct i2c_device_id wm2000_i2c_id[] = { |
937 | { "wm2000", 0 }, | 932 | { "wm2000", 0 }, |
938 | { } | 933 | { } |
@@ -944,7 +939,6 @@ static struct i2c_driver wm2000_i2c_driver = { | |||
944 | .name = "wm2000", | 939 | .name = "wm2000", |
945 | }, | 940 | }, |
946 | .probe = wm2000_i2c_probe, | 941 | .probe = wm2000_i2c_probe, |
947 | .remove = wm2000_i2c_remove, | ||
948 | .id_table = wm2000_i2c_id, | 942 | .id_table = wm2000_i2c_id, |
949 | }; | 943 | }; |
950 | 944 | ||