14 #include <linux/module.h>
16 #include <linux/kernel.h>
21 #include <linux/i2c.h>
22 #include <linux/slab.h>
31 #include <asm/div64.h>
139 static const char *isabelle_rx1_texts[] = {
"VRX1",
"ARX1"};
140 static const char *isabelle_rx2_texts[] = {
"VRX2",
"ARX2"};
142 static const struct soc_enum isabelle_rx1_enum[] = {
147 static const struct soc_enum isabelle_rx2_enum[] = {
160 static const char *isabelle_atx_texts[] = {
"AMIC1",
"DMIC"};
161 static const char *isabelle_vtx_texts[] = {
"AMIC2",
"DMIC"};
163 static const struct soc_enum isabelle_atx_enum[] = {
168 static const struct soc_enum isabelle_vtx_enum[] = {
180 static const char *isabelle_amic1_texts[] = {
181 "Main Mic",
"Headset Mic",
"Aux/FM Left"};
184 static const char *isabelle_amic2_texts[] = {
"Sub Mic",
"Aux/FM Right"};
186 static const struct soc_enum isabelle_amic1_enum[] = {
189 isabelle_amic1_texts),
192 static const struct soc_enum isabelle_amic2_enum[] = {
195 isabelle_amic2_texts),
204 static const char *isabelle_st_audio_texts[] = {
"ATX1",
"ATX2"};
206 static const char *isabelle_st_voice_texts[] = {
"VTX1",
"VTX2"};
208 static const struct soc_enum isabelle_st_audio_enum[] = {
210 isabelle_st_audio_texts),
212 isabelle_st_audio_texts),
215 static const struct soc_enum isabelle_st_voice_enum[] = {
217 isabelle_st_voice_texts),
219 isabelle_st_voice_texts),
259 static const struct snd_kcontrol_new isabelle_aux_right_mixer_controls[] = {
264 static const struct snd_kcontrol_new isabelle_dpga1_left_mixer_controls[] = {
270 static const struct snd_kcontrol_new isabelle_dpga1_right_mixer_controls[] = {
276 static const struct snd_kcontrol_new isabelle_dpga2_left_mixer_controls[] = {
285 static const struct snd_kcontrol_new isabelle_dpga2_right_mixer_controls[] = {
292 static const struct snd_kcontrol_new isabelle_dpga3_left_mixer_controls[] = {
298 static const struct snd_kcontrol_new isabelle_dpga3_right_mixer_controls[] = {
354 4, 0, 0xF, 0, dac_tlv),
359 4, 0, 0xF, 0, dac_tlv),
541 isabelle_hs_left_mixer_controls,
544 isabelle_hs_right_mixer_controls,
545 ARRAY_SIZE(isabelle_hs_right_mixer_controls)),
547 isabelle_hf_left_mixer_controls,
550 isabelle_hf_right_mixer_controls,
551 ARRAY_SIZE(isabelle_hf_right_mixer_controls)),
553 isabelle_aux_left_mixer_controls,
554 ARRAY_SIZE(isabelle_aux_left_mixer_controls)),
556 isabelle_aux_right_mixer_controls,
557 ARRAY_SIZE(isabelle_aux_right_mixer_controls)),
559 isabelle_ep_mixer_controls,
563 isabelle_dpga1_left_mixer_controls,
564 ARRAY_SIZE(isabelle_dpga1_left_mixer_controls)),
566 isabelle_dpga1_right_mixer_controls,
567 ARRAY_SIZE(isabelle_dpga1_right_mixer_controls)),
569 isabelle_dpga2_left_mixer_controls,
570 ARRAY_SIZE(isabelle_dpga2_left_mixer_controls)),
572 isabelle_dpga2_right_mixer_controls,
573 ARRAY_SIZE(isabelle_dpga2_right_mixer_controls)),
575 isabelle_dpga3_left_mixer_controls,
576 ARRAY_SIZE(isabelle_dpga3_left_mixer_controls)),
578 isabelle_dpga3_right_mixer_controls,
579 ARRAY_SIZE(isabelle_dpga3_right_mixer_controls)),
582 isabelle_rx1_mixer_controls,
585 isabelle_rx2_mixer_controls,
588 isabelle_rx3_mixer_controls,
591 isabelle_rx4_mixer_controls,
594 isabelle_rx5_mixer_controls,
597 isabelle_rx6_mixer_controls,
634 7, 0, &atx_mux_controls),
636 6, 0, &vtx_mux_controls),
639 &ep_path_enable_control),
661 {
"DL1",
"DL12 Playback Switch",
"INTF1_SDI" },
662 {
"DL2",
"DL12 Playback Switch",
"INTF1_SDI" },
663 {
"DL3",
"DL34 Playback Switch",
"INTF1_SDI" },
664 {
"DL4",
"DL34 Playback Switch",
"INTF1_SDI" },
665 {
"DL5",
"DL56 Playback Switch",
"INTF1_SDI" },
666 {
"DL6",
"DL56 Playback Switch",
"INTF1_SDI" },
668 {
"DL1",
"DL12 Playback Switch",
"INTF2_SDI" },
669 {
"DL2",
"DL12 Playback Switch",
"INTF2_SDI" },
670 {
"DL3",
"DL34 Playback Switch",
"INTF2_SDI" },
671 {
"DL4",
"DL34 Playback Switch",
"INTF2_SDI" },
672 {
"DL5",
"DL56 Playback Switch",
"INTF2_SDI" },
673 {
"DL6",
"DL56 Playback Switch",
"INTF2_SDI" },
676 {
"Sidetone Audio PGA",
NULL,
"Sidetone Audio Playback" },
677 {
"Sidetone Voice PGA",
NULL,
"Sidetone Voice Playback" },
679 {
"RX1 Mixer",
"ST1 Playback Switch",
"Sidetone Audio PGA" },
681 {
"RX1 Mixer",
"ST1 Playback Switch",
"Sidetone Voice PGA" },
682 {
"RX1 Mixer",
"DL1 Playback Switch",
"DL1" },
684 {
"RX2 Mixer",
"ST2 Playback Switch",
"Sidetone Audio PGA" },
686 {
"RX2 Mixer",
"ST2 Playback Switch",
"Sidetone Voice PGA" },
687 {
"RX2 Mixer",
"DL2 Playback Switch",
"DL2" },
689 {
"RX3 Mixer",
"ST1 Playback Switch",
"Sidetone Voice PGA" },
690 {
"RX3 Mixer",
"DL3 Playback Switch",
"DL3" },
692 {
"RX4 Mixer",
"ST2 Playback Switch",
"Sidetone Voice PGA" },
693 {
"RX4 Mixer",
"DL4 Playback Switch",
"DL4" },
695 {
"RX5 Mixer",
"ST1 Playback Switch",
"Sidetone Voice PGA" },
696 {
"RX5 Mixer",
"DL5 Playback Switch",
"DL5" },
698 {
"RX6 Mixer",
"ST2 Playback Switch",
"Sidetone Voice PGA" },
699 {
"RX6 Mixer",
"DL6 Playback Switch",
"DL6" },
702 {
"Analog Left Capture Route",
"Headset Mic",
"HSMIC" },
703 {
"Analog Left Capture Route",
"Main Mic",
"MAINMIC" },
704 {
"Analog Left Capture Route",
"Aux/FM Left",
"LINEIN1" },
706 {
"Analog Right Capture Route",
"Sub Mic",
"SUBMIC" },
707 {
"Analog Right Capture Route",
"Aux/FM Right",
"LINEIN2" },
709 {
"MicAmp1",
NULL,
"Analog Left Capture Route" },
710 {
"MicAmp2",
NULL,
"Analog Right Capture Route" },
712 {
"ADC1",
NULL,
"MicAmp1" },
713 {
"ADC2",
NULL,
"MicAmp2" },
715 {
"ATX Select",
"AMIC1",
"ADC1" },
716 {
"ATX Select",
"DMIC",
"DMICDAT" },
717 {
"ATX Select",
"AMIC2",
"ADC2" },
719 {
"VTX Select",
"AMIC1",
"ADC1" },
720 {
"VTX Select",
"DMIC",
"DMICDAT" },
721 {
"VTX Select",
"AMIC2",
"ADC2" },
723 {
"ULATX1",
"ATX1 Filter Enable Switch",
"ATX Select" },
724 {
"ULATX1",
"ATX1 Filter Bypass Switch",
"ATX Select" },
725 {
"ULATX2",
"ATX2 Filter Enable Switch",
"ATX Select" },
726 {
"ULATX2",
"ATX2 Filter Bypass Switch",
"ATX Select" },
728 {
"ULVTX1",
"VTX1 Filter Enable Switch",
"VTX Select" },
729 {
"ULVTX1",
"VTX1 Filter Bypass Switch",
"VTX Select" },
730 {
"ULVTX2",
"VTX2 Filter Enable Switch",
"VTX Select" },
731 {
"ULVTX2",
"VTX2 Filter Bypass Switch",
"VTX Select" },
733 {
"INTF1_SDO",
"ULATX12 Capture Switch",
"ULATX1" },
734 {
"INTF1_SDO",
"ULATX12 Capture Switch",
"ULATX2" },
735 {
"INTF2_SDO",
"ULATX12 Capture Switch",
"ULATX1" },
736 {
"INTF2_SDO",
"ULATX12 Capture Switch",
"ULATX2" },
738 {
"INTF1_SDO",
NULL,
"ULVTX1" },
739 {
"INTF1_SDO",
NULL,
"ULVTX2" },
740 {
"INTF2_SDO",
NULL,
"ULVTX1" },
741 {
"INTF2_SDO",
NULL,
"ULVTX2" },
744 {
"APGA1",
NULL,
"LINEIN1" },
745 {
"APGA2",
NULL,
"LINEIN2" },
747 {
"RX1 Playback",
"VRX1 Filter Bypass Switch",
"RX1 Mixer" },
748 {
"RX1 Playback",
"ARX1 Filter Bypass Switch",
"RX1 Mixer" },
749 {
"RX1 Playback",
"RX1 Filter Enable Switch",
"RX1 Mixer" },
751 {
"RX2 Playback",
"VRX2 Filter Bypass Switch",
"RX2 Mixer" },
752 {
"RX2 Playback",
"ARX2 Filter Bypass Switch",
"RX2 Mixer" },
753 {
"RX2 Playback",
"RX2 Filter Enable Switch",
"RX2 Mixer" },
755 {
"RX3 Playback",
"ARX3 Filter Bypass Switch",
"RX3 Mixer" },
756 {
"RX3 Playback",
"RX3 Filter Enable Switch",
"RX3 Mixer" },
758 {
"RX4 Playback",
"ARX4 Filter Bypass Switch",
"RX4 Mixer" },
759 {
"RX4 Playback",
"RX4 Filter Enable Switch",
"RX4 Mixer" },
761 {
"RX5 Playback",
"ARX5 Filter Bypass Switch",
"RX5 Mixer" },
762 {
"RX5 Playback",
"RX5 Filter Enable Switch",
"RX5 Mixer" },
764 {
"RX6 Playback",
"ARX6 Filter Bypass Switch",
"RX6 Mixer" },
765 {
"RX6 Playback",
"RX6 Filter Enable Switch",
"RX6 Mixer" },
767 {
"DPGA1L Mixer",
"RX1 Playback Switch",
"RX1 Playback" },
768 {
"DPGA1L Mixer",
"RX3 Playback Switch",
"RX3 Playback" },
769 {
"DPGA1L Mixer",
"RX5 Playback Switch",
"RX5 Playback" },
771 {
"DPGA1R Mixer",
"RX2 Playback Switch",
"RX2 Playback" },
772 {
"DPGA1R Mixer",
"RX4 Playback Switch",
"RX4 Playback" },
773 {
"DPGA1R Mixer",
"RX6 Playback Switch",
"RX6 Playback" },
775 {
"DPGA1L",
NULL,
"DPGA1L Mixer" },
776 {
"DPGA1R",
NULL,
"DPGA1R Mixer" },
778 {
"DAC1L",
NULL,
"DPGA1L" },
779 {
"DAC1R",
NULL,
"DPGA1R" },
781 {
"DPGA2L Mixer",
"RX1 Playback Switch",
"RX1 Playback" },
782 {
"DPGA2L Mixer",
"RX2 Playback Switch",
"RX2 Playback" },
783 {
"DPGA2L Mixer",
"RX3 Playback Switch",
"RX3 Playback" },
784 {
"DPGA2L Mixer",
"RX4 Playback Switch",
"RX4 Playback" },
785 {
"DPGA2L Mixer",
"RX5 Playback Switch",
"RX5 Playback" },
786 {
"DPGA2L Mixer",
"RX6 Playback Switch",
"RX6 Playback" },
788 {
"DPGA2R Mixer",
"RX2 Playback Switch",
"RX2 Playback" },
789 {
"DPGA2R Mixer",
"RX4 Playback Switch",
"RX4 Playback" },
790 {
"DPGA2R Mixer",
"RX6 Playback Switch",
"RX6 Playback" },
792 {
"DPGA2L",
NULL,
"DPGA2L Mixer" },
793 {
"DPGA2R",
NULL,
"DPGA2R Mixer" },
795 {
"DAC2L",
NULL,
"DPGA2L" },
796 {
"DAC2R",
NULL,
"DPGA2R" },
798 {
"DPGA3L Mixer",
"RX1 Playback Switch",
"RX1 Playback" },
799 {
"DPGA3L Mixer",
"RX3 Playback Switch",
"RX3 Playback" },
800 {
"DPGA3L Mixer",
"RX5 Playback Switch",
"RX5 Playback" },
802 {
"DPGA3R Mixer",
"RX2 Playback Switch",
"RX2 Playback" },
803 {
"DPGA3R Mixer",
"RX4 Playback Switch",
"RX4 Playback" },
804 {
"DPGA3R Mixer",
"RX6 Playback Switch",
"RX6 Playback" },
806 {
"DPGA3L",
NULL,
"DPGA3L Mixer" },
807 {
"DPGA3R",
NULL,
"DPGA3R Mixer" },
809 {
"DAC3L",
NULL,
"DPGA3L" },
810 {
"DAC3R",
NULL,
"DPGA3R" },
812 {
"Headset Left Mixer",
"DAC1L Playback Switch",
"DAC1L" },
813 {
"Headset Left Mixer",
"APGA1 Playback Switch",
"APGA1" },
815 {
"Headset Right Mixer",
"DAC1R Playback Switch",
"DAC1R" },
816 {
"Headset Right Mixer",
"APGA2 Playback Switch",
"APGA2" },
818 {
"HS Left Driver",
NULL,
"Headset Left Mixer" },
819 {
"HS Right Driver",
NULL,
"Headset Right Mixer" },
821 {
"HSOL",
NULL,
"HS Left Driver" },
822 {
"HSOR",
NULL,
"HS Right Driver" },
825 {
"Earphone Mixer",
"DAC2L Playback Switch",
"DAC2L" },
826 {
"Earphone Mixer",
"APGA1 Playback Switch",
"APGA1" },
828 {
"Earphone Playback",
"Switch",
"Earphone Mixer" },
829 {
"Earphone Driver",
NULL,
"Earphone Playback" },
830 {
"EP",
NULL,
"Earphone Driver" },
832 {
"Handsfree Left Mixer",
"DAC2L Playback Switch",
"DAC2L" },
833 {
"Handsfree Left Mixer",
"APGA1 Playback Switch",
"APGA1" },
835 {
"Handsfree Right Mixer",
"DAC2R Playback Switch",
"DAC2R" },
836 {
"Handsfree Right Mixer",
"APGA2 Playback Switch",
"APGA2" },
838 {
"HF Left PGA",
NULL,
"Handsfree Left Mixer" },
839 {
"HF Right PGA",
NULL,
"Handsfree Right Mixer" },
841 {
"HF Left Driver",
NULL,
"HF Left PGA" },
842 {
"HF Right Driver",
NULL,
"HF Right PGA" },
844 {
"HFL",
NULL,
"HF Left Driver" },
845 {
"HFR",
NULL,
"HF Right Driver" },
847 {
"LINEOUT1 Mixer",
"DAC3L Playback Switch",
"DAC3L" },
848 {
"LINEOUT1 Mixer",
"APGA1 Playback Switch",
"APGA1" },
850 {
"LINEOUT2 Mixer",
"DAC3R Playback Switch",
"DAC3R" },
851 {
"LINEOUT2 Mixer",
"APGA2 Playback Switch",
"APGA2" },
853 {
"LINEOUT1 Driver",
NULL,
"LINEOUT1 Mixer" },
854 {
"LINEOUT2 Driver",
NULL,
"LINEOUT2 Mixer" },
856 {
"LINEOUT1",
NULL,
"LINEOUT1 Driver" },
857 {
"LINEOUT2",
NULL,
"LINEOUT2 Driver" },
863 BIT(4), (mute ?
BIT(4) : 0));
868 static int isabelle_hf_mute(
struct snd_soc_dai *dai,
int mute)
871 BIT(4), (mute ?
BIT(4) : 0));
876 static int isabelle_line_mute(
struct snd_soc_dai *dai,
int mute)
879 BIT(4), (mute ?
BIT(4) : 0));
916 unsigned int fs_val = 0;
971 static int isabelle_set_dai_fmt(
struct snd_soc_dai *codec_dai,
unsigned int fmt)
974 unsigned int aif_val = 0;
1008 #define ISABELLE_RATES SNDRV_PCM_RATE_8000_48000
1011 #define ISABELLE_FORMATS (SNDRV_PCM_FMTBIT_S20_3LE |\
1012 SNDRV_PCM_FMTBIT_S32_LE)
1015 .hw_params = isabelle_hw_params,
1016 .set_fmt = isabelle_set_dai_fmt,
1017 .digital_mute = isabelle_hs_mute,
1021 .hw_params = isabelle_hw_params,
1022 .set_fmt = isabelle_set_dai_fmt,
1023 .digital_mute = isabelle_hf_mute,
1027 .hw_params = isabelle_hw_params,
1028 .set_fmt = isabelle_set_dai_fmt,
1029 .digital_mute = isabelle_line_mute,
1033 .hw_params = isabelle_hw_params,
1034 .set_fmt = isabelle_set_dai_fmt,
1040 .name =
"isabelle-dl1",
1042 .stream_name =
"Headset Playback",
1048 .ops = &isabelle_hs_dai_ops,
1051 .name =
"isabelle-dl2",
1053 .stream_name =
"Handsfree Playback",
1059 .ops = &isabelle_hf_dai_ops,
1062 .name =
"isabelle-lineout",
1064 .stream_name =
"Lineout Playback",
1070 .ops = &isabelle_line_dai_ops,
1073 .name =
"isabelle-ul",
1075 .stream_name =
"Capture",
1081 .ops = &isabelle_ul_dai_ops,
1093 dev_err(codec->
dev,
"Failed to set cache I/O: %d\n", ret);
1101 .probe = isabelle_probe,
1102 .set_bias_level = isabelle_set_bias_level,
1103 .controls = isabelle_snd_controls,
1104 .num_controls =
ARRAY_SIZE(isabelle_snd_controls),
1105 .dapm_widgets = isabelle_dapm_widgets,
1106 .num_dapm_widgets =
ARRAY_SIZE(isabelle_dapm_widgets),
1107 .dapm_routes = isabelle_intercon,
1108 .num_dapm_routes =
ARRAY_SIZE(isabelle_intercon),
1109 .idle_bias_off =
true,
1112 static const struct regmap_config isabelle_regmap_config = {
1117 .reg_defaults = isabelle_reg_defs,
1118 .num_reg_defaults =
ARRAY_SIZE(isabelle_reg_defs),
1125 struct regmap *isabelle_regmap;
1129 if (IS_ERR(isabelle_regmap)) {
1130 ret = PTR_ERR(isabelle_regmap);
1131 dev_err(&i2c->
dev,
"Failed to allocate register map: %d\n",
1135 i2c_set_clientdata(i2c, isabelle_regmap);
1138 &soc_codec_dev_isabelle, isabelle_dai,
1141 dev_err(&i2c->
dev,
"Failed to register codec: %d\n", ret);
1160 static struct i2c_driver isabelle_i2c_driver = {
1165 .probe = isabelle_i2c_probe,
1167 .id_table = isabelle_i2c_id,