• Home
  • Raw
  • Download

Lines Matching +full:dac +full:- +full:mode +full:- +full:mask

1 // SPDX-License-Identifier: GPL-2.0-only
28 #include <linux/mfd/twl4030-audio.h>
59 u8 ctl_cache[TWL4030_REG_PRECKR_CTL - TWL4030_REG_EAR_CTL + 1];
71 twl4030->ctl_cache[i - TWL4030_REG_EAR_CTL] = byte; in tw4030_init_ctl_cache()
81 return -EIO; in twl4030_read()
90 value = twl4030->ctl_cache[reg - TWL4030_REG_EAR_CTL]; in twl4030_read()
108 if (twl4030->earpiece_enabled) in twl4030_can_write_to_chip()
112 if (twl4030->predrivel_enabled) in twl4030_can_write_to_chip()
116 if (twl4030->predriver_enabled) in twl4030_can_write_to_chip()
120 if (twl4030->carkitl_enabled) in twl4030_can_write_to_chip()
124 if (twl4030->carkitr_enabled) in twl4030_can_write_to_chip()
128 if (twl4030->hsl_enabled || twl4030->hsr_enabled) in twl4030_can_write_to_chip()
153 twl4030->ctl_cache[reg - TWL4030_REG_EAR_CTL] = value; in twl4030_write()
178 int mode; in twl4030_codec_enable() local
180 if (enable == twl4030->codec_powered) in twl4030_codec_enable()
184 mode = twl4030_audio_enable_resource(TWL4030_AUDIO_RES_POWER); in twl4030_codec_enable()
186 mode = twl4030_audio_disable_resource(TWL4030_AUDIO_RES_POWER); in twl4030_codec_enable()
188 if (mode >= 0) in twl4030_codec_enable()
189 twl4030->codec_powered = enable; in twl4030_codec_enable()
202 &pdata->digimic_delay); in twl4030_setup_pdata_of()
204 &pdata->ramp_delay_value); in twl4030_setup_pdata_of()
206 &pdata->offset_cncl_path); in twl4030_setup_pdata_of()
208 pdata->hs_extmute = value; in twl4030_setup_pdata_of()
210 pdata->hs_extmute_gpio = of_get_named_gpio(node, in twl4030_setup_pdata_of()
212 if (gpio_is_valid(pdata->hs_extmute_gpio)) in twl4030_setup_pdata_of()
213 pdata->hs_extmute = 1; in twl4030_setup_pdata_of()
218 struct twl4030_codec_data *pdata = dev_get_platdata(component->dev); in twl4030_get_pdata()
221 twl4030_codec_node = of_get_child_by_name(component->dev->parent->of_node, in twl4030_get_pdata()
225 pdata = devm_kzalloc(component->dev, in twl4030_get_pdata()
248 if (pdata && pdata->hs_extmute) { in twl4030_init_chip()
249 if (gpio_is_valid(pdata->hs_extmute_gpio)) { in twl4030_init_chip()
252 if (!pdata->hs_extmute_gpio) in twl4030_init_chip()
253 dev_warn(component->dev, in twl4030_init_chip()
256 ret = gpio_request_one(pdata->hs_extmute_gpio, in twl4030_init_chip()
260 dev_err(component->dev, in twl4030_init_chip()
262 pdata->hs_extmute_gpio = -1; in twl4030_init_chip()
280 /* anti-pop when changing analog gain */ in twl4030_init_chip()
296 twl4030->pdata = pdata; in twl4030_init_chip()
300 reg |= (pdata->ramp_delay_value << 2); in twl4030_init_chip()
308 reg |= pdata->offset_cncl_path; in twl4030_init_chip()
336 twl4030->apll_enabled++; in twl4030_apll_enable()
337 if (twl4030->apll_enabled == 1) in twl4030_apll_enable()
341 twl4030->apll_enabled--; in twl4030_apll_enable()
342 if (!twl4030->apll_enabled) in twl4030_apll_enable()
513 /* Digital bypass gain, mute instead of -30dB */
515 0, 1, TLV_DB_SCALE_ITEM(-3000, 600, 1),
516 2, 3, TLV_DB_SCALE_ITEM(-2400, 0, 0),
517 4, 7, TLV_DB_SCALE_ITEM(-1800, 600, 0)
520 /* Digital bypass left (TX1L -> RX2L) */
526 /* Digital bypass right (TX1R -> RX2R) */
534 * from -51 to -10 dB in 1 dB steps (mute instead of -51 dB)
536 static DECLARE_TLV_DB_SCALE(twl4030_dapm_dbypassv_tlv, -5100, 100, 1);
538 /* Digital bypass voice: sidetone (VUL -> VDL)*/
552 #define TWL4030_OUTPUT_PGA(pin_name, reg, mask) \ argument
556 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); \
561 twl4030->pin_name##_enabled = 1; \
565 twl4030->pin_name##_enabled = 0; \
585 /* HF ramp-up */ in handsfree_ramp()
596 /* HF ramp-down */ in handsfree_ramp()
611 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in handsfreelpga_event()
627 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in handsfreerpga_event()
643 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in vibramux_event()
652 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in apll_event()
668 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in aif_event()
695 struct twl4030_codec_data *pdata = twl4030->pdata; in headset_ramp()
696 /* Base values for ramp delay calculation: 2^19 - 2^26 */ in headset_ramp()
704 twl4030->sysclk) + 1; in headset_ramp()
707 * the pop-noise */ in headset_ramp()
708 if (pdata && pdata->hs_extmute) { in headset_ramp()
709 if (gpio_is_valid(pdata->hs_extmute_gpio)) { in headset_ramp()
710 gpio_set_value(pdata->hs_extmute_gpio, 1); in headset_ramp()
718 /* Headset ramp-up according to the TRM */ in headset_ramp()
729 /* Headset ramp-down _not_ according to in headset_ramp()
744 if (pdata && pdata->hs_extmute) { in headset_ramp()
745 if (gpio_is_valid(pdata->hs_extmute_gpio)) { in headset_ramp()
746 gpio_set_value(pdata->hs_extmute_gpio, 0); in headset_ramp()
757 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in headsetlpga_event()
762 /* Do the ramp-up only once */ in headsetlpga_event()
763 if (!twl4030->hsr_enabled) in headsetlpga_event()
766 twl4030->hsl_enabled = 1; in headsetlpga_event()
769 /* Do the ramp-down only if both headsetL/R is disabled */ in headsetlpga_event()
770 if (!twl4030->hsr_enabled) in headsetlpga_event()
773 twl4030->hsl_enabled = 0; in headsetlpga_event()
782 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in headsetrpga_event()
787 /* Do the ramp-up only once */ in headsetrpga_event()
788 if (!twl4030->hsl_enabled) in headsetrpga_event()
791 twl4030->hsr_enabled = 1; in headsetrpga_event()
794 /* Do the ramp-down only if both headsetL/R is disabled */ in headsetrpga_event()
795 if (!twl4030->hsl_enabled) in headsetrpga_event()
798 twl4030->hsr_enabled = 0; in headsetrpga_event()
807 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in digimic_event()
809 struct twl4030_codec_data *pdata = twl4030->pdata; in digimic_event()
811 if (pdata && pdata->digimic_delay) in digimic_event()
812 twl4030_wait_ms(pdata->digimic_delay); in digimic_event()
822 * 0x3 : -6 dB
830 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_get_volsw_twl4030()
832 unsigned int reg = mc->reg; in snd_soc_get_volsw_twl4030()
833 unsigned int shift = mc->shift; in snd_soc_get_volsw_twl4030()
834 unsigned int rshift = mc->rshift; in snd_soc_get_volsw_twl4030()
835 int max = mc->max; in snd_soc_get_volsw_twl4030()
836 int mask = (1 << fls(max)) - 1; in snd_soc_get_volsw_twl4030() local
838 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_twl4030()
839 (twl4030_read(component, reg) >> shift) & mask; in snd_soc_get_volsw_twl4030()
840 if (ucontrol->value.integer.value[0]) in snd_soc_get_volsw_twl4030()
841 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_twl4030()
842 max + 1 - ucontrol->value.integer.value[0]; in snd_soc_get_volsw_twl4030()
845 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_twl4030()
846 (twl4030_read(component, reg) >> rshift) & mask; in snd_soc_get_volsw_twl4030()
847 if (ucontrol->value.integer.value[1]) in snd_soc_get_volsw_twl4030()
848 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_twl4030()
849 max + 1 - ucontrol->value.integer.value[1]; in snd_soc_get_volsw_twl4030()
859 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_put_volsw_twl4030()
861 unsigned int reg = mc->reg; in snd_soc_put_volsw_twl4030()
862 unsigned int shift = mc->shift; in snd_soc_put_volsw_twl4030()
863 unsigned int rshift = mc->rshift; in snd_soc_put_volsw_twl4030()
864 int max = mc->max; in snd_soc_put_volsw_twl4030()
865 int mask = (1 << fls(max)) - 1; in snd_soc_put_volsw_twl4030() local
868 val = (ucontrol->value.integer.value[0] & mask); in snd_soc_put_volsw_twl4030()
870 val_mask = mask << shift; in snd_soc_put_volsw_twl4030()
872 val = max + 1 - val; in snd_soc_put_volsw_twl4030()
875 val2 = (ucontrol->value.integer.value[1] & mask); in snd_soc_put_volsw_twl4030()
876 val_mask |= mask << rshift; in snd_soc_put_volsw_twl4030()
878 val2 = max + 1 - val2; in snd_soc_put_volsw_twl4030()
888 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_get_volsw_r2_twl4030()
890 unsigned int reg = mc->reg; in snd_soc_get_volsw_r2_twl4030()
891 unsigned int reg2 = mc->rreg; in snd_soc_get_volsw_r2_twl4030()
892 unsigned int shift = mc->shift; in snd_soc_get_volsw_r2_twl4030()
893 int max = mc->max; in snd_soc_get_volsw_r2_twl4030()
894 int mask = (1<<fls(max))-1; in snd_soc_get_volsw_r2_twl4030() local
896 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_r2_twl4030()
897 (twl4030_read(component, reg) >> shift) & mask; in snd_soc_get_volsw_r2_twl4030()
898 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_r2_twl4030()
899 (twl4030_read(component, reg2) >> shift) & mask; in snd_soc_get_volsw_r2_twl4030()
901 if (ucontrol->value.integer.value[0]) in snd_soc_get_volsw_r2_twl4030()
902 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_r2_twl4030()
903 max + 1 - ucontrol->value.integer.value[0]; in snd_soc_get_volsw_r2_twl4030()
904 if (ucontrol->value.integer.value[1]) in snd_soc_get_volsw_r2_twl4030()
905 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_r2_twl4030()
906 max + 1 - ucontrol->value.integer.value[1]; in snd_soc_get_volsw_r2_twl4030()
915 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_put_volsw_r2_twl4030()
917 unsigned int reg = mc->reg; in snd_soc_put_volsw_r2_twl4030()
918 unsigned int reg2 = mc->rreg; in snd_soc_put_volsw_r2_twl4030()
919 unsigned int shift = mc->shift; in snd_soc_put_volsw_r2_twl4030()
920 int max = mc->max; in snd_soc_put_volsw_r2_twl4030()
921 int mask = (1 << fls(max)) - 1; in snd_soc_put_volsw_r2_twl4030() local
925 val_mask = mask << shift; in snd_soc_put_volsw_r2_twl4030()
926 val = (ucontrol->value.integer.value[0] & mask); in snd_soc_put_volsw_r2_twl4030()
927 val2 = (ucontrol->value.integer.value[1] & mask); in snd_soc_put_volsw_r2_twl4030()
930 val = max + 1 - val; in snd_soc_put_volsw_r2_twl4030()
932 val2 = max + 1 - val2; in snd_soc_put_volsw_r2_twl4030()
960 if (twl4030->configured) { in snd_soc_put_twl4030_opmode_enum_double()
961 dev_err(component->dev, in snd_soc_put_twl4030_opmode_enum_double()
962 "operation mode cannot be changed on-the-fly\n"); in snd_soc_put_twl4030_opmode_enum_double()
963 return -EBUSY; in snd_soc_put_twl4030_opmode_enum_double()
971 * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB)
973 static DECLARE_TLV_DB_SCALE(digital_fine_tlv, -6300, 100, 1);
984 * from -37 to 12 dB in 1 dB steps (mute instead of -37 dB)
986 static DECLARE_TLV_DB_SCALE(digital_voice_downlink_tlv, -3700, 100, 1);
990 * -24 dB to 12 dB in 2 dB steps
992 static DECLARE_TLV_DB_SCALE(analog_tlv, -2400, 200, 0);
996 * -6 dB to 6 dB in 6 dB steps (mute instead of -12)
998 static DECLARE_TLV_DB_SCALE(output_tvl, -1200, 600, 1);
1002 * 0 dB to 12 dB in 6 dB steps (mute instead of -6)
1004 static DECLARE_TLV_DB_SCALE(output_ear_tvl, -600, 600, 1);
1037 /* Vibra H-bridge direction mode */
1039 "Vibra H-bridge direction", "Audio data MSB",
1046 /* Vibra H-bridge direction */
1065 /* Codec operation mode control */
1066 SOC_ENUM_EXT("Codec Operation Mode", twl4030_op_modes_enum,
1099 SOC_SINGLE_TLV("DAC Voice Digital Downlink Volume",
1102 SOC_SINGLE_TLV("DAC Voice Analog Downlink Volume",
1105 SOC_SINGLE("DAC Voice Analog Downlink Switch",
1142 SOC_ENUM("Vibra H-bridge mode", twl4030_vibradirmode_enum),
1143 SOC_ENUM("Vibra H-bridge direction", twl4030_vibradir_enum),
1179 SND_SOC_DAPM_DAC("DAC Right1", NULL, SND_SOC_NOPM, 0, 0),
1180 SND_SOC_DAPM_DAC("DAC Left1", NULL, SND_SOC_NOPM, 0, 0),
1181 SND_SOC_DAPM_DAC("DAC Right2", NULL, SND_SOC_NOPM, 0, 0),
1182 SND_SOC_DAPM_DAC("DAC Left2", NULL, SND_SOC_NOPM, 0, 0),
1183 SND_SOC_DAPM_DAC("DAC Voice", NULL, SND_SOC_NOPM, 0, 0),
1370 /* Stream -> DAC mapping */
1371 {"DAC Right1", NULL, "HiFi Playback"},
1372 {"DAC Left1", NULL, "HiFi Playback"},
1373 {"DAC Right2", NULL, "HiFi Playback"},
1374 {"DAC Left2", NULL, "HiFi Playback"},
1375 {"DAC Voice", NULL, "VAIFIN"},
1377 /* ADC -> Stream mapping */
1386 {"Digital L1 Playback Mixer", NULL, "DAC Left1"},
1387 {"Digital R1 Playback Mixer", NULL, "DAC Right1"},
1388 {"Digital L2 Playback Mixer", NULL, "DAC Left2"},
1389 {"Digital R2 Playback Mixer", NULL, "DAC Right2"},
1390 {"Digital Voice Playback Mixer", NULL, "DAC Voice"},
1395 {"DAC Left1", NULL, "AIF Enable"},
1396 {"DAC Right1", NULL, "AIF Enable"},
1397 {"DAC Left2", NULL, "AIF Enable"},
1398 {"DAC Right1", NULL, "AIF Enable"},
1399 {"DAC Voice", NULL, "VIF Enable"},
1464 {"Vibra Mux", "AudioL1", "DAC Left1"},
1465 {"Vibra Mux", "AudioR1", "DAC Right1"},
1466 {"Vibra Mux", "AudioL2", "DAC Left2"},
1467 {"Vibra Mux", "AudioR2", "DAC Right2"},
1471 {"Virtual HiFi OUT", NULL, "DAC Left1"},
1472 {"Virtual HiFi OUT", NULL, "DAC Right1"},
1473 {"Virtual HiFi OUT", NULL, "DAC Left2"},
1474 {"Virtual HiFi OUT", NULL, "DAC Right2"},
1594 if (mst_substream == twl4030->master_substream) in twl4030_constraints()
1595 slv_substream = twl4030->slave_substream; in twl4030_constraints()
1596 else if (mst_substream == twl4030->slave_substream) in twl4030_constraints()
1597 slv_substream = twl4030->master_substream; in twl4030_constraints()
1602 snd_pcm_hw_constraint_single(slv_substream->runtime, in twl4030_constraints()
1604 twl4030->rate); in twl4030_constraints()
1606 snd_pcm_hw_constraint_single(slv_substream->runtime, in twl4030_constraints()
1608 twl4030->sample_bits); in twl4030_constraints()
1610 snd_pcm_hw_constraint_single(slv_substream->runtime, in twl4030_constraints()
1612 twl4030->channels); in twl4030_constraints()
1615 /* In case of 4 channel mode, the RX1 L/R for playback and the TX2 L/R for
1620 u8 reg, mask; in twl4030_tdm_enable() local
1625 mask = TWL4030_ARXL1_VRX_EN | TWL4030_ARXR1_EN; in twl4030_tdm_enable()
1627 mask = TWL4030_ATXL2_VTXL_EN | TWL4030_ATXR2_VTXR_EN; in twl4030_tdm_enable()
1630 reg |= mask; in twl4030_tdm_enable()
1632 reg &= ~mask; in twl4030_tdm_enable()
1640 struct snd_soc_component *component = dai->component; in twl4030_startup()
1643 if (twl4030->master_substream) { in twl4030_startup()
1644 twl4030->slave_substream = substream; in twl4030_startup()
1648 if (twl4030->configured) in twl4030_startup()
1649 twl4030_constraints(twl4030, twl4030->master_substream); in twl4030_startup()
1656 snd_pcm_hw_constraint_single(substream->runtime, in twl4030_startup()
1660 twl4030->master_substream = substream; in twl4030_startup()
1669 struct snd_soc_component *component = dai->component; in twl4030_shutdown()
1672 if (twl4030->master_substream == substream) in twl4030_shutdown()
1673 twl4030->master_substream = twl4030->slave_substream; in twl4030_shutdown()
1675 twl4030->slave_substream = NULL; in twl4030_shutdown()
1679 if (!twl4030->master_substream) in twl4030_shutdown()
1680 twl4030->configured = 0; in twl4030_shutdown()
1681 else if (!twl4030->master_substream->runtime->channels) in twl4030_shutdown()
1682 twl4030->configured = 0; in twl4030_shutdown()
1685 if (substream->runtime->channels == 4) in twl4030_shutdown()
1686 twl4030_tdm_enable(component, substream->stream, 0); in twl4030_shutdown()
1693 struct snd_soc_component *component = dai->component; in twl4030_hw_params()
1695 u8 mode, old_mode, format, old_format; in twl4030_hw_params() local
1700 mode = twl4030_read(component, TWL4030_REG_CODEC_MODE); in twl4030_hw_params()
1702 /* Safety check: are we in the correct operating mode and in twl4030_hw_params()
1703 * the interface is in TDM mode? */ in twl4030_hw_params()
1704 if ((mode & TWL4030_OPTION_1) && in twl4030_hw_params()
1706 twl4030_tdm_enable(component, substream->stream, 1); in twl4030_hw_params()
1708 return -EINVAL; in twl4030_hw_params()
1711 if (twl4030->configured) in twl4030_hw_params()
1718 mode = old_mode & ~TWL4030_APLL_RATE; in twl4030_hw_params()
1722 mode |= TWL4030_APLL_RATE_8000; in twl4030_hw_params()
1725 mode |= TWL4030_APLL_RATE_11025; in twl4030_hw_params()
1728 mode |= TWL4030_APLL_RATE_12000; in twl4030_hw_params()
1731 mode |= TWL4030_APLL_RATE_16000; in twl4030_hw_params()
1734 mode |= TWL4030_APLL_RATE_22050; in twl4030_hw_params()
1737 mode |= TWL4030_APLL_RATE_24000; in twl4030_hw_params()
1740 mode |= TWL4030_APLL_RATE_32000; in twl4030_hw_params()
1743 mode |= TWL4030_APLL_RATE_44100; in twl4030_hw_params()
1746 mode |= TWL4030_APLL_RATE_48000; in twl4030_hw_params()
1749 mode |= TWL4030_APLL_RATE_96000; in twl4030_hw_params()
1752 dev_err(component->dev, "%s: unknown rate %d\n", __func__, in twl4030_hw_params()
1754 return -EINVAL; in twl4030_hw_params()
1769 dev_err(component->dev, "%s: unsupported bits/sample %d\n", in twl4030_hw_params()
1771 return -EINVAL; in twl4030_hw_params()
1774 if (format != old_format || mode != old_mode) { in twl4030_hw_params()
1775 if (twl4030->codec_powered) { in twl4030_hw_params()
1781 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_hw_params()
1785 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_hw_params()
1792 twl4030->configured = 1; in twl4030_hw_params()
1793 twl4030->rate = params_rate(params); in twl4030_hw_params()
1794 twl4030->sample_bits = hw_param_interval(params, in twl4030_hw_params()
1795 SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min; in twl4030_hw_params()
1796 twl4030->channels = params_channels(params); in twl4030_hw_params()
1801 if (twl4030->slave_substream) in twl4030_hw_params()
1810 struct snd_soc_component *component = codec_dai->component; in twl4030_set_dai_sysclk()
1819 dev_err(component->dev, "Unsupported HFCLKIN: %u\n", freq); in twl4030_set_dai_sysclk()
1820 return -EINVAL; in twl4030_set_dai_sysclk()
1823 if ((freq / 1000) != twl4030->sysclk) { in twl4030_set_dai_sysclk()
1824 dev_err(component->dev, in twl4030_set_dai_sysclk()
1826 freq, twl4030->sysclk * 1000); in twl4030_set_dai_sysclk()
1827 return -EINVAL; in twl4030_set_dai_sysclk()
1835 struct snd_soc_component *component = codec_dai->component; in twl4030_set_dai_fmt()
1854 return -EINVAL; in twl4030_set_dai_fmt()
1867 return -EINVAL; in twl4030_set_dai_fmt()
1871 if (twl4030->codec_powered) { in twl4030_set_dai_fmt()
1889 struct snd_soc_component *component = dai->component; in twl4030_set_tristate()
1900 /* In case of voice mode, the RX1 L(VRX) for downlink and the TX2 L/R
1905 u8 reg, mask; in twl4030_voice_enable() local
1910 mask = TWL4030_ARXL1_VRX_EN; in twl4030_voice_enable()
1912 mask = TWL4030_ATXL2_VTXL_EN | TWL4030_ATXR2_VTXR_EN; in twl4030_voice_enable()
1915 reg |= mask; in twl4030_voice_enable()
1917 reg &= ~mask; in twl4030_voice_enable()
1925 struct snd_soc_component *component = dai->component; in twl4030_voice_startup()
1927 u8 mode; in twl4030_voice_startup() local
1932 if (twl4030->sysclk != 26000) { in twl4030_voice_startup()
1933 dev_err(component->dev, in twl4030_voice_startup()
1935 __func__, twl4030->sysclk); in twl4030_voice_startup()
1936 return -EINVAL; in twl4030_voice_startup()
1939 /* If the codec mode is not option2, the voice PCM interface is not in twl4030_voice_startup()
1942 mode = twl4030_read(component, TWL4030_REG_CODEC_MODE) in twl4030_voice_startup()
1945 if (mode != TWL4030_OPTION_2) { in twl4030_voice_startup()
1946 dev_err(component->dev, "%s: the codec mode is not option2\n", in twl4030_voice_startup()
1948 return -EINVAL; in twl4030_voice_startup()
1957 struct snd_soc_component *component = dai->component; in twl4030_voice_shutdown()
1960 twl4030_voice_enable(component, substream->stream, 0); in twl4030_voice_shutdown()
1967 struct snd_soc_component *component = dai->component; in twl4030_voice_hw_params()
1969 u8 old_mode, mode; in twl4030_voice_hw_params() local
1972 twl4030_voice_enable(component, substream->stream, 1); in twl4030_voice_hw_params()
1977 mode = old_mode; in twl4030_voice_hw_params()
1981 mode &= ~(TWL4030_SEL_16K); in twl4030_voice_hw_params()
1984 mode |= TWL4030_SEL_16K; in twl4030_voice_hw_params()
1987 dev_err(component->dev, "%s: unknown rate %d\n", __func__, in twl4030_voice_hw_params()
1989 return -EINVAL; in twl4030_voice_hw_params()
1992 if (mode != old_mode) { in twl4030_voice_hw_params()
1993 if (twl4030->codec_powered) { in twl4030_voice_hw_params()
1999 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_voice_hw_params()
2002 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_voice_hw_params()
2012 struct snd_soc_component *component = codec_dai->component; in twl4030_voice_set_dai_sysclk()
2016 dev_err(component->dev, in twl4030_voice_set_dai_sysclk()
2019 return -EINVAL; in twl4030_voice_set_dai_sysclk()
2021 if ((freq / 1000) != twl4030->sysclk) { in twl4030_voice_set_dai_sysclk()
2022 dev_err(component->dev, in twl4030_voice_set_dai_sysclk()
2024 freq, twl4030->sysclk * 1000); in twl4030_voice_set_dai_sysclk()
2025 return -EINVAL; in twl4030_voice_set_dai_sysclk()
2033 struct snd_soc_component *component = codec_dai->component; in twl4030_voice_set_dai_fmt()
2050 return -EINVAL; in twl4030_voice_set_dai_fmt()
2062 return -EINVAL; in twl4030_voice_set_dai_fmt()
2066 if (twl4030->codec_powered) { in twl4030_voice_set_dai_fmt()
2084 struct snd_soc_component *component = dai->component; in twl4030_voice_set_tristate()
2118 .name = "twl4030-hifi",
2136 .name = "twl4030-voice",
2157 twl4030 = devm_kzalloc(component->dev, sizeof(struct twl4030_priv), in twl4030_soc_probe()
2160 return -ENOMEM; in twl4030_soc_probe()
2163 twl4030->sysclk = twl4030_audio_get_mclk() / 1000; in twl4030_soc_probe()
2173 struct twl4030_codec_data *pdata = twl4030->pdata; in twl4030_soc_remove()
2175 if (pdata && pdata->hs_extmute && gpio_is_valid(pdata->hs_extmute_gpio)) in twl4030_soc_remove()
2176 gpio_free(pdata->hs_extmute_gpio); in twl4030_soc_remove()
2198 return devm_snd_soc_register_component(&pdev->dev, in twl4030_codec_probe()
2203 MODULE_ALIAS("platform:twl4030-codec");
2208 .name = "twl4030-codec",