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>
67 u8 ctl_cache[TWL4030_REG_PRECKR_CTL - TWL4030_REG_EAR_CTL + 1];
79 twl4030->ctl_cache[i - TWL4030_REG_EAR_CTL] = byte; in tw4030_init_ctl_cache()
89 return -EIO; in twl4030_read()
98 value = twl4030->ctl_cache[reg - TWL4030_REG_EAR_CTL]; in twl4030_read()
116 if (twl4030->earpiece_enabled) in twl4030_can_write_to_chip()
120 if (twl4030->predrivel_enabled) in twl4030_can_write_to_chip()
124 if (twl4030->predriver_enabled) in twl4030_can_write_to_chip()
128 if (twl4030->carkitl_enabled) in twl4030_can_write_to_chip()
132 if (twl4030->carkitr_enabled) in twl4030_can_write_to_chip()
136 if (twl4030->hsl_enabled || twl4030->hsr_enabled) in twl4030_can_write_to_chip()
161 twl4030->ctl_cache[reg - TWL4030_REG_EAR_CTL] = value; in twl4030_write()
186 int mode; in twl4030_codec_enable() local
188 if (enable == twl4030->codec_powered) in twl4030_codec_enable()
192 mode = twl4030_audio_enable_resource(TWL4030_AUDIO_RES_POWER); in twl4030_codec_enable()
194 mode = twl4030_audio_disable_resource(TWL4030_AUDIO_RES_POWER); in twl4030_codec_enable()
196 if (mode >= 0) in twl4030_codec_enable()
197 twl4030->codec_powered = enable; in twl4030_codec_enable()
210 of_property_read_u32(node, "ti,digimic_delay", &board_params->digimic_delay); in twl4030_get_board_param_values()
211 of_property_read_u32(node, "ti,ramp_delay_value", &board_params->ramp_delay_value); in twl4030_get_board_param_values()
212 of_property_read_u32(node, "ti,offset_cncl_path", &board_params->offset_cncl_path); in twl4030_get_board_param_values()
214 board_params->hs_extmute = value; in twl4030_get_board_param_values()
216 board_params->hs_extmute_gpio = of_get_named_gpio(node, "ti,hs_extmute_gpio", 0); in twl4030_get_board_param_values()
217 if (gpio_is_valid(board_params->hs_extmute_gpio)) in twl4030_get_board_param_values()
218 board_params->hs_extmute = 1; in twl4030_get_board_param_values()
227 twl4030_codec_node = of_get_child_by_name(component->dev->parent->of_node, in twl4030_get_board_params()
231 board_params = devm_kzalloc(component->dev, in twl4030_get_board_params()
254 if (board_params && board_params->hs_extmute) { in twl4030_init_chip()
255 if (gpio_is_valid(board_params->hs_extmute_gpio)) { in twl4030_init_chip()
258 if (!board_params->hs_extmute_gpio) in twl4030_init_chip()
259 dev_warn(component->dev, in twl4030_init_chip()
262 ret = gpio_request_one(board_params->hs_extmute_gpio, in twl4030_init_chip()
266 dev_err(component->dev, in twl4030_init_chip()
268 board_params->hs_extmute_gpio = -1; in twl4030_init_chip()
286 /* anti-pop when changing analog gain */ in twl4030_init_chip()
302 twl4030->board_params = board_params; in twl4030_init_chip()
306 reg |= (board_params->ramp_delay_value << 2); in twl4030_init_chip()
314 reg |= board_params->offset_cncl_path; in twl4030_init_chip()
342 twl4030->apll_enabled++; in twl4030_apll_enable()
343 if (twl4030->apll_enabled == 1) in twl4030_apll_enable()
347 twl4030->apll_enabled--; in twl4030_apll_enable()
348 if (!twl4030->apll_enabled) in twl4030_apll_enable()
519 /* Digital bypass gain, mute instead of -30dB */
521 0, 1, TLV_DB_SCALE_ITEM(-3000, 600, 1),
522 2, 3, TLV_DB_SCALE_ITEM(-2400, 0, 0),
523 4, 7, TLV_DB_SCALE_ITEM(-1800, 600, 0)
526 /* Digital bypass left (TX1L -> RX2L) */
532 /* Digital bypass right (TX1R -> RX2R) */
540 * from -51 to -10 dB in 1 dB steps (mute instead of -51 dB)
542 static DECLARE_TLV_DB_SCALE(twl4030_dapm_dbypassv_tlv, -5100, 100, 1);
544 /* Digital bypass voice: sidetone (VUL -> VDL)*/
558 #define TWL4030_OUTPUT_PGA(pin_name, reg, mask) \ argument
562 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); \
567 twl4030->pin_name##_enabled = 1; \
571 twl4030->pin_name##_enabled = 0; \
591 /* HF ramp-up */ in handsfree_ramp()
602 /* HF ramp-down */ in handsfree_ramp()
617 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in handsfreelpga_event()
633 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in handsfreerpga_event()
649 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in vibramux_event()
658 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in apll_event()
674 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in aif_event()
701 struct twl4030_board_params *board_params = twl4030->board_params; in headset_ramp()
702 /* Base values for ramp delay calculation: 2^19 - 2^26 */ in headset_ramp()
712 twl4030->sysclk) + 1; in headset_ramp()
715 * the pop-noise */ in headset_ramp()
716 if (board_params && board_params->hs_extmute) { in headset_ramp()
717 if (gpio_is_valid(board_params->hs_extmute_gpio)) { in headset_ramp()
718 gpio_set_value(board_params->hs_extmute_gpio, 1); in headset_ramp()
726 /* Headset ramp-up according to the TRM */ in headset_ramp()
737 /* Headset ramp-down _not_ according to in headset_ramp()
752 if (board_params && board_params->hs_extmute) { in headset_ramp()
753 if (gpio_is_valid(board_params->hs_extmute_gpio)) { in headset_ramp()
754 gpio_set_value(board_params->hs_extmute_gpio, 0); in headset_ramp()
765 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in headsetlpga_event()
770 /* Do the ramp-up only once */ in headsetlpga_event()
771 if (!twl4030->hsr_enabled) in headsetlpga_event()
774 twl4030->hsl_enabled = 1; in headsetlpga_event()
777 /* Do the ramp-down only if both headsetL/R is disabled */ in headsetlpga_event()
778 if (!twl4030->hsr_enabled) in headsetlpga_event()
781 twl4030->hsl_enabled = 0; in headsetlpga_event()
790 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in headsetrpga_event()
795 /* Do the ramp-up only once */ in headsetrpga_event()
796 if (!twl4030->hsl_enabled) in headsetrpga_event()
799 twl4030->hsr_enabled = 1; in headsetrpga_event()
802 /* Do the ramp-down only if both headsetL/R is disabled */ in headsetrpga_event()
803 if (!twl4030->hsl_enabled) in headsetrpga_event()
806 twl4030->hsr_enabled = 0; in headsetrpga_event()
815 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in digimic_event()
817 struct twl4030_board_params *board_params = twl4030->board_params; in digimic_event()
819 if (board_params && board_params->digimic_delay) in digimic_event()
820 twl4030_wait_ms(board_params->digimic_delay); in digimic_event()
830 * 0x3 : -6 dB
838 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_get_volsw_twl4030()
840 unsigned int reg = mc->reg; in snd_soc_get_volsw_twl4030()
841 unsigned int shift = mc->shift; in snd_soc_get_volsw_twl4030()
842 unsigned int rshift = mc->rshift; in snd_soc_get_volsw_twl4030()
843 int max = mc->max; in snd_soc_get_volsw_twl4030()
844 int mask = (1 << fls(max)) - 1; in snd_soc_get_volsw_twl4030() local
846 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_twl4030()
847 (twl4030_read(component, reg) >> shift) & mask; in snd_soc_get_volsw_twl4030()
848 if (ucontrol->value.integer.value[0]) in snd_soc_get_volsw_twl4030()
849 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_twl4030()
850 max + 1 - ucontrol->value.integer.value[0]; in snd_soc_get_volsw_twl4030()
853 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_twl4030()
854 (twl4030_read(component, reg) >> rshift) & mask; in snd_soc_get_volsw_twl4030()
855 if (ucontrol->value.integer.value[1]) in snd_soc_get_volsw_twl4030()
856 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_twl4030()
857 max + 1 - ucontrol->value.integer.value[1]; in snd_soc_get_volsw_twl4030()
867 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_put_volsw_twl4030()
869 unsigned int reg = mc->reg; in snd_soc_put_volsw_twl4030()
870 unsigned int shift = mc->shift; in snd_soc_put_volsw_twl4030()
871 unsigned int rshift = mc->rshift; in snd_soc_put_volsw_twl4030()
872 int max = mc->max; in snd_soc_put_volsw_twl4030()
873 int mask = (1 << fls(max)) - 1; in snd_soc_put_volsw_twl4030() local
876 val = (ucontrol->value.integer.value[0] & mask); in snd_soc_put_volsw_twl4030()
878 val_mask = mask << shift; in snd_soc_put_volsw_twl4030()
880 val = max + 1 - val; in snd_soc_put_volsw_twl4030()
883 val2 = (ucontrol->value.integer.value[1] & mask); in snd_soc_put_volsw_twl4030()
884 val_mask |= mask << rshift; in snd_soc_put_volsw_twl4030()
886 val2 = max + 1 - val2; in snd_soc_put_volsw_twl4030()
896 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_get_volsw_r2_twl4030()
898 unsigned int reg = mc->reg; in snd_soc_get_volsw_r2_twl4030()
899 unsigned int reg2 = mc->rreg; in snd_soc_get_volsw_r2_twl4030()
900 unsigned int shift = mc->shift; in snd_soc_get_volsw_r2_twl4030()
901 int max = mc->max; in snd_soc_get_volsw_r2_twl4030()
902 int mask = (1<<fls(max))-1; in snd_soc_get_volsw_r2_twl4030() local
904 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_r2_twl4030()
905 (twl4030_read(component, reg) >> shift) & mask; in snd_soc_get_volsw_r2_twl4030()
906 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_r2_twl4030()
907 (twl4030_read(component, reg2) >> shift) & mask; in snd_soc_get_volsw_r2_twl4030()
909 if (ucontrol->value.integer.value[0]) in snd_soc_get_volsw_r2_twl4030()
910 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_r2_twl4030()
911 max + 1 - ucontrol->value.integer.value[0]; in snd_soc_get_volsw_r2_twl4030()
912 if (ucontrol->value.integer.value[1]) in snd_soc_get_volsw_r2_twl4030()
913 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_r2_twl4030()
914 max + 1 - ucontrol->value.integer.value[1]; in snd_soc_get_volsw_r2_twl4030()
923 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_put_volsw_r2_twl4030()
925 unsigned int reg = mc->reg; in snd_soc_put_volsw_r2_twl4030()
926 unsigned int reg2 = mc->rreg; in snd_soc_put_volsw_r2_twl4030()
927 unsigned int shift = mc->shift; in snd_soc_put_volsw_r2_twl4030()
928 int max = mc->max; in snd_soc_put_volsw_r2_twl4030()
929 int mask = (1 << fls(max)) - 1; in snd_soc_put_volsw_r2_twl4030() local
933 val_mask = mask << shift; in snd_soc_put_volsw_r2_twl4030()
934 val = (ucontrol->value.integer.value[0] & mask); in snd_soc_put_volsw_r2_twl4030()
935 val2 = (ucontrol->value.integer.value[1] & mask); in snd_soc_put_volsw_r2_twl4030()
938 val = max + 1 - val; in snd_soc_put_volsw_r2_twl4030()
940 val2 = max + 1 - val2; in snd_soc_put_volsw_r2_twl4030()
968 if (twl4030->configured) { in snd_soc_put_twl4030_opmode_enum_double()
969 dev_err(component->dev, in snd_soc_put_twl4030_opmode_enum_double()
970 "operation mode cannot be changed on-the-fly\n"); in snd_soc_put_twl4030_opmode_enum_double()
971 return -EBUSY; in snd_soc_put_twl4030_opmode_enum_double()
979 * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB)
981 static DECLARE_TLV_DB_SCALE(digital_fine_tlv, -6300, 100, 1);
992 * from -37 to 12 dB in 1 dB steps (mute instead of -37 dB)
994 static DECLARE_TLV_DB_SCALE(digital_voice_downlink_tlv, -3700, 100, 1);
998 * -24 dB to 12 dB in 2 dB steps
1000 static DECLARE_TLV_DB_SCALE(analog_tlv, -2400, 200, 0);
1004 * -6 dB to 6 dB in 6 dB steps (mute instead of -12)
1006 static DECLARE_TLV_DB_SCALE(output_tvl, -1200, 600, 1);
1010 * 0 dB to 12 dB in 6 dB steps (mute instead of -6)
1012 static DECLARE_TLV_DB_SCALE(output_ear_tvl, -600, 600, 1);
1045 /* Vibra H-bridge direction mode */
1047 "Vibra H-bridge direction", "Audio data MSB",
1054 /* Vibra H-bridge direction */
1073 /* Codec operation mode control */
1074 SOC_ENUM_EXT("Codec Operation Mode", twl4030_op_modes_enum,
1107 SOC_SINGLE_TLV("DAC Voice Digital Downlink Volume",
1110 SOC_SINGLE_TLV("DAC Voice Analog Downlink Volume",
1113 SOC_SINGLE("DAC Voice Analog Downlink Switch",
1150 SOC_ENUM("Vibra H-bridge mode", twl4030_vibradirmode_enum),
1151 SOC_ENUM("Vibra H-bridge direction", twl4030_vibradir_enum),
1187 SND_SOC_DAPM_DAC("DAC Right1", NULL, SND_SOC_NOPM, 0, 0),
1188 SND_SOC_DAPM_DAC("DAC Left1", NULL, SND_SOC_NOPM, 0, 0),
1189 SND_SOC_DAPM_DAC("DAC Right2", NULL, SND_SOC_NOPM, 0, 0),
1190 SND_SOC_DAPM_DAC("DAC Left2", NULL, SND_SOC_NOPM, 0, 0),
1191 SND_SOC_DAPM_DAC("DAC Voice", NULL, SND_SOC_NOPM, 0, 0),
1378 /* Stream -> DAC mapping */
1379 {"DAC Right1", NULL, "HiFi Playback"},
1380 {"DAC Left1", NULL, "HiFi Playback"},
1381 {"DAC Right2", NULL, "HiFi Playback"},
1382 {"DAC Left2", NULL, "HiFi Playback"},
1383 {"DAC Voice", NULL, "VAIFIN"},
1385 /* ADC -> Stream mapping */
1394 {"Digital L1 Playback Mixer", NULL, "DAC Left1"},
1395 {"Digital R1 Playback Mixer", NULL, "DAC Right1"},
1396 {"Digital L2 Playback Mixer", NULL, "DAC Left2"},
1397 {"Digital R2 Playback Mixer", NULL, "DAC Right2"},
1398 {"Digital Voice Playback Mixer", NULL, "DAC Voice"},
1403 {"DAC Left1", NULL, "AIF Enable"},
1404 {"DAC Right1", NULL, "AIF Enable"},
1405 {"DAC Left2", NULL, "AIF Enable"},
1406 {"DAC Right1", NULL, "AIF Enable"},
1407 {"DAC Voice", NULL, "VIF Enable"},
1472 {"Vibra Mux", "AudioL1", "DAC Left1"},
1473 {"Vibra Mux", "AudioR1", "DAC Right1"},
1474 {"Vibra Mux", "AudioL2", "DAC Left2"},
1475 {"Vibra Mux", "AudioR2", "DAC Right2"},
1479 {"Virtual HiFi OUT", NULL, "DAC Left1"},
1480 {"Virtual HiFi OUT", NULL, "DAC Right1"},
1481 {"Virtual HiFi OUT", NULL, "DAC Left2"},
1482 {"Virtual HiFi OUT", NULL, "DAC Right2"},
1602 if (mst_substream == twl4030->master_substream) in twl4030_constraints()
1603 slv_substream = twl4030->slave_substream; in twl4030_constraints()
1604 else if (mst_substream == twl4030->slave_substream) in twl4030_constraints()
1605 slv_substream = twl4030->master_substream; in twl4030_constraints()
1610 snd_pcm_hw_constraint_single(slv_substream->runtime, in twl4030_constraints()
1612 twl4030->rate); in twl4030_constraints()
1614 snd_pcm_hw_constraint_single(slv_substream->runtime, in twl4030_constraints()
1616 twl4030->sample_bits); in twl4030_constraints()
1618 snd_pcm_hw_constraint_single(slv_substream->runtime, in twl4030_constraints()
1620 twl4030->channels); in twl4030_constraints()
1623 /* In case of 4 channel mode, the RX1 L/R for playback and the TX2 L/R for
1628 u8 reg, mask; in twl4030_tdm_enable() local
1633 mask = TWL4030_ARXL1_VRX_EN | TWL4030_ARXR1_EN; in twl4030_tdm_enable()
1635 mask = TWL4030_ATXL2_VTXL_EN | TWL4030_ATXR2_VTXR_EN; in twl4030_tdm_enable()
1638 reg |= mask; in twl4030_tdm_enable()
1640 reg &= ~mask; in twl4030_tdm_enable()
1648 struct snd_soc_component *component = dai->component; in twl4030_startup()
1651 if (twl4030->master_substream) { in twl4030_startup()
1652 twl4030->slave_substream = substream; in twl4030_startup()
1656 if (twl4030->configured) in twl4030_startup()
1657 twl4030_constraints(twl4030, twl4030->master_substream); in twl4030_startup()
1664 snd_pcm_hw_constraint_single(substream->runtime, in twl4030_startup()
1668 twl4030->master_substream = substream; in twl4030_startup()
1677 struct snd_soc_component *component = dai->component; in twl4030_shutdown()
1680 if (twl4030->master_substream == substream) in twl4030_shutdown()
1681 twl4030->master_substream = twl4030->slave_substream; in twl4030_shutdown()
1683 twl4030->slave_substream = NULL; in twl4030_shutdown()
1687 if (!twl4030->master_substream) in twl4030_shutdown()
1688 twl4030->configured = 0; in twl4030_shutdown()
1689 else if (!twl4030->master_substream->runtime->channels) in twl4030_shutdown()
1690 twl4030->configured = 0; in twl4030_shutdown()
1693 if (substream->runtime->channels == 4) in twl4030_shutdown()
1694 twl4030_tdm_enable(component, substream->stream, 0); in twl4030_shutdown()
1701 struct snd_soc_component *component = dai->component; in twl4030_hw_params()
1703 u8 mode, old_mode, format, old_format; in twl4030_hw_params() local
1708 mode = twl4030_read(component, TWL4030_REG_CODEC_MODE); in twl4030_hw_params()
1710 /* Safety check: are we in the correct operating mode and in twl4030_hw_params()
1711 * the interface is in TDM mode? */ in twl4030_hw_params()
1712 if ((mode & TWL4030_OPTION_1) && in twl4030_hw_params()
1714 twl4030_tdm_enable(component, substream->stream, 1); in twl4030_hw_params()
1716 return -EINVAL; in twl4030_hw_params()
1719 if (twl4030->configured) in twl4030_hw_params()
1726 mode = old_mode & ~TWL4030_APLL_RATE; in twl4030_hw_params()
1730 mode |= TWL4030_APLL_RATE_8000; in twl4030_hw_params()
1733 mode |= TWL4030_APLL_RATE_11025; in twl4030_hw_params()
1736 mode |= TWL4030_APLL_RATE_12000; in twl4030_hw_params()
1739 mode |= TWL4030_APLL_RATE_16000; in twl4030_hw_params()
1742 mode |= TWL4030_APLL_RATE_22050; in twl4030_hw_params()
1745 mode |= TWL4030_APLL_RATE_24000; in twl4030_hw_params()
1748 mode |= TWL4030_APLL_RATE_32000; in twl4030_hw_params()
1751 mode |= TWL4030_APLL_RATE_44100; in twl4030_hw_params()
1754 mode |= TWL4030_APLL_RATE_48000; in twl4030_hw_params()
1757 mode |= TWL4030_APLL_RATE_96000; in twl4030_hw_params()
1760 dev_err(component->dev, "%s: unknown rate %d\n", __func__, in twl4030_hw_params()
1762 return -EINVAL; in twl4030_hw_params()
1777 dev_err(component->dev, "%s: unsupported bits/sample %d\n", in twl4030_hw_params()
1779 return -EINVAL; in twl4030_hw_params()
1782 if (format != old_format || mode != old_mode) { in twl4030_hw_params()
1783 if (twl4030->codec_powered) { in twl4030_hw_params()
1789 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_hw_params()
1793 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_hw_params()
1800 twl4030->configured = 1; in twl4030_hw_params()
1801 twl4030->rate = params_rate(params); in twl4030_hw_params()
1802 twl4030->sample_bits = hw_param_interval(params, in twl4030_hw_params()
1803 SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min; in twl4030_hw_params()
1804 twl4030->channels = params_channels(params); in twl4030_hw_params()
1809 if (twl4030->slave_substream) in twl4030_hw_params()
1818 struct snd_soc_component *component = codec_dai->component; in twl4030_set_dai_sysclk()
1827 dev_err(component->dev, "Unsupported HFCLKIN: %u\n", freq); in twl4030_set_dai_sysclk()
1828 return -EINVAL; in twl4030_set_dai_sysclk()
1831 if ((freq / 1000) != twl4030->sysclk) { in twl4030_set_dai_sysclk()
1832 dev_err(component->dev, in twl4030_set_dai_sysclk()
1834 freq, twl4030->sysclk * 1000); in twl4030_set_dai_sysclk()
1835 return -EINVAL; in twl4030_set_dai_sysclk()
1843 struct snd_soc_component *component = codec_dai->component; in twl4030_set_dai_fmt()
1861 return -EINVAL; in twl4030_set_dai_fmt()
1874 return -EINVAL; in twl4030_set_dai_fmt()
1878 if (twl4030->codec_powered) { in twl4030_set_dai_fmt()
1896 struct snd_soc_component *component = dai->component; in twl4030_set_tristate()
1907 /* In case of voice mode, the RX1 L(VRX) for downlink and the TX2 L/R
1912 u8 reg, mask; in twl4030_voice_enable() local
1917 mask = TWL4030_ARXL1_VRX_EN; in twl4030_voice_enable()
1919 mask = TWL4030_ATXL2_VTXL_EN | TWL4030_ATXR2_VTXR_EN; in twl4030_voice_enable()
1922 reg |= mask; in twl4030_voice_enable()
1924 reg &= ~mask; in twl4030_voice_enable()
1932 struct snd_soc_component *component = dai->component; in twl4030_voice_startup()
1934 u8 mode; in twl4030_voice_startup() local
1939 if (twl4030->sysclk != 26000) { in twl4030_voice_startup()
1940 dev_err(component->dev, in twl4030_voice_startup()
1942 __func__, twl4030->sysclk); in twl4030_voice_startup()
1943 return -EINVAL; in twl4030_voice_startup()
1946 /* If the codec mode is not option2, the voice PCM interface is not in twl4030_voice_startup()
1949 mode = twl4030_read(component, TWL4030_REG_CODEC_MODE) in twl4030_voice_startup()
1952 if (mode != TWL4030_OPTION_2) { in twl4030_voice_startup()
1953 dev_err(component->dev, "%s: the codec mode is not option2\n", in twl4030_voice_startup()
1955 return -EINVAL; in twl4030_voice_startup()
1964 struct snd_soc_component *component = dai->component; in twl4030_voice_shutdown()
1967 twl4030_voice_enable(component, substream->stream, 0); in twl4030_voice_shutdown()
1974 struct snd_soc_component *component = dai->component; in twl4030_voice_hw_params()
1976 u8 old_mode, mode; in twl4030_voice_hw_params() local
1979 twl4030_voice_enable(component, substream->stream, 1); in twl4030_voice_hw_params()
1984 mode = old_mode; in twl4030_voice_hw_params()
1988 mode &= ~(TWL4030_SEL_16K); in twl4030_voice_hw_params()
1991 mode |= TWL4030_SEL_16K; in twl4030_voice_hw_params()
1994 dev_err(component->dev, "%s: unknown rate %d\n", __func__, in twl4030_voice_hw_params()
1996 return -EINVAL; in twl4030_voice_hw_params()
1999 if (mode != old_mode) { in twl4030_voice_hw_params()
2000 if (twl4030->codec_powered) { in twl4030_voice_hw_params()
2006 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_voice_hw_params()
2009 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_voice_hw_params()
2019 struct snd_soc_component *component = codec_dai->component; in twl4030_voice_set_dai_sysclk()
2023 dev_err(component->dev, in twl4030_voice_set_dai_sysclk()
2026 return -EINVAL; in twl4030_voice_set_dai_sysclk()
2028 if ((freq / 1000) != twl4030->sysclk) { in twl4030_voice_set_dai_sysclk()
2029 dev_err(component->dev, in twl4030_voice_set_dai_sysclk()
2031 freq, twl4030->sysclk * 1000); in twl4030_voice_set_dai_sysclk()
2032 return -EINVAL; in twl4030_voice_set_dai_sysclk()
2040 struct snd_soc_component *component = codec_dai->component; in twl4030_voice_set_dai_fmt()
2056 return -EINVAL; in twl4030_voice_set_dai_fmt()
2068 return -EINVAL; in twl4030_voice_set_dai_fmt()
2072 if (twl4030->codec_powered) { in twl4030_voice_set_dai_fmt()
2090 struct snd_soc_component *component = dai->component; in twl4030_voice_set_tristate()
2124 .name = "twl4030-hifi",
2142 .name = "twl4030-voice",
2163 twl4030 = devm_kzalloc(component->dev, sizeof(struct twl4030_priv), in twl4030_soc_probe()
2166 return -ENOMEM; in twl4030_soc_probe()
2169 twl4030->sysclk = twl4030_audio_get_mclk() / 1000; in twl4030_soc_probe()
2179 struct twl4030_board_params *board_params = twl4030->board_params; in twl4030_soc_remove()
2181 if (board_params && board_params->hs_extmute && in twl4030_soc_remove()
2182 gpio_is_valid(board_params->hs_extmute_gpio)) in twl4030_soc_remove()
2183 gpio_free(board_params->hs_extmute_gpio); in twl4030_soc_remove()
2204 return devm_snd_soc_register_component(&pdev->dev, in twl4030_codec_probe()
2209 MODULE_ALIAS("platform:twl4030-codec");
2214 .name = "twl4030-codec",