Lines Matching +full:switch +full:- +full:mode
1 // SPDX-License-Identifier: GPL-2.0-only
13 #include <linux/mfd/twl4030-audio.h>
64 u8 ctl_cache[TWL4030_REG_PRECKR_CTL - TWL4030_REG_EAR_CTL + 1];
76 twl4030->ctl_cache[i - TWL4030_REG_EAR_CTL] = byte; in tw4030_init_ctl_cache()
86 return -EIO; in twl4030_read()
88 switch (reg) { in twl4030_read()
95 value = twl4030->ctl_cache[reg - TWL4030_REG_EAR_CTL]; in twl4030_read()
111 switch (reg) { in twl4030_can_write_to_chip()
113 if (twl4030->earpiece_enabled) in twl4030_can_write_to_chip()
117 if (twl4030->predrivel_enabled) in twl4030_can_write_to_chip()
121 if (twl4030->predriver_enabled) in twl4030_can_write_to_chip()
125 if (twl4030->carkitl_enabled) in twl4030_can_write_to_chip()
129 if (twl4030->carkitr_enabled) in twl4030_can_write_to_chip()
133 if (twl4030->hsl_enabled || twl4030->hsr_enabled) in twl4030_can_write_to_chip()
151 switch (reg) { in twl4030_write()
158 twl4030->ctl_cache[reg - TWL4030_REG_EAR_CTL] = value; in twl4030_write()
183 int mode; in twl4030_codec_enable() local
185 if (enable == twl4030->codec_powered) in twl4030_codec_enable()
189 mode = twl4030_audio_enable_resource(TWL4030_AUDIO_RES_POWER); in twl4030_codec_enable()
191 mode = twl4030_audio_disable_resource(TWL4030_AUDIO_RES_POWER); in twl4030_codec_enable()
193 if (mode >= 0) in twl4030_codec_enable()
194 twl4030->codec_powered = enable; in twl4030_codec_enable()
207 of_property_read_u32(node, "ti,digimic_delay", &board_params->digimic_delay); in twl4030_get_board_param_values()
208 of_property_read_u32(node, "ti,ramp_delay_value", &board_params->ramp_delay_value); in twl4030_get_board_param_values()
209 of_property_read_u32(node, "ti,offset_cncl_path", &board_params->offset_cncl_path); in twl4030_get_board_param_values()
211 board_params->hs_extmute = value; in twl4030_get_board_param_values()
214 board_params->hs_extmute = 1; in twl4030_get_board_param_values()
223 twl4030_codec_node = of_get_child_by_name(component->dev->parent->of_node, in twl4030_get_board_params()
227 board_params = devm_kzalloc(component->dev, in twl4030_get_board_params()
250 if (board_params && board_params->hs_extmute) { in twl4030_init_chip()
251 board_params->hs_extmute_gpio = devm_gpiod_get_optional(component->dev, in twl4030_init_chip()
254 if (IS_ERR(board_params->hs_extmute_gpio)) in twl4030_init_chip()
255 return dev_err_probe(component->dev, PTR_ERR(board_params->hs_extmute_gpio), in twl4030_init_chip()
258 if (board_params->hs_extmute_gpio) { in twl4030_init_chip()
259 gpiod_set_consumer_name(board_params->hs_extmute_gpio, "hs_extmute"); in twl4030_init_chip()
263 dev_info(component->dev, "use TWL4030 GPIO6\n"); in twl4030_init_chip()
278 /* anti-pop when changing analog gain */ in twl4030_init_chip()
294 twl4030->board_params = board_params; in twl4030_init_chip()
298 reg |= (board_params->ramp_delay_value << 2); in twl4030_init_chip()
306 reg |= board_params->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()
413 SOC_DAPM_SINGLE_VIRT("Switch", 1);
428 SOC_DAPM_SINGLE_VIRT("Switch", 1);
455 SOC_DAPM_SINGLE("Main Mic Capture Switch",
457 SOC_DAPM_SINGLE("Headset Mic Capture Switch",
459 SOC_DAPM_SINGLE("AUXL Capture Switch",
461 SOC_DAPM_SINGLE("Carkit Mic Capture Switch",
467 SOC_DAPM_SINGLE("Sub Mic Capture Switch", TWL4030_REG_ANAMICR, 0, 1, 0),
468 SOC_DAPM_SINGLE("AUXR Capture Switch", TWL4030_REG_ANAMICR, 2, 1, 0),
495 SOC_DAPM_SINGLE("Switch", TWL4030_REG_ARXR1_APGA_CTL, 2, 1, 0);
499 SOC_DAPM_SINGLE("Switch", TWL4030_REG_ARXL1_APGA_CTL, 2, 1, 0);
503 SOC_DAPM_SINGLE("Switch", TWL4030_REG_ARXR2_APGA_CTL, 2, 1, 0);
507 SOC_DAPM_SINGLE("Switch", TWL4030_REG_ARXL2_APGA_CTL, 2, 1, 0);
511 SOC_DAPM_SINGLE("Switch", TWL4030_REG_VDL_APGA_CTL, 2, 1, 0);
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)*/
556 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); \
559 switch (event) { \
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()
613 switch (event) { in handsfreelpga_event()
627 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in handsfreerpga_event()
629 switch (event) { 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()
654 switch (event) { in apll_event()
668 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in aif_event()
672 switch (event) { in aif_event()
695 struct twl4030_board_params *board_params = twl4030->board_params; in headset_ramp()
696 /* Base values for ramp delay calculation: 2^19 - 2^26 */ in headset_ramp()
706 twl4030->sysclk) + 1; in headset_ramp()
709 * the pop-noise */ in headset_ramp()
710 if (board_params && board_params->hs_extmute) { in headset_ramp()
711 if (board_params->hs_extmute_gpio) { in headset_ramp()
712 gpiod_set_value(board_params->hs_extmute_gpio, 1); in headset_ramp()
720 /* Headset ramp-up according to the TRM */ in headset_ramp()
731 /* Headset ramp-down _not_ according to in headset_ramp()
746 if (board_params && board_params->hs_extmute) { in headset_ramp()
747 if (board_params->hs_extmute_gpio) { in headset_ramp()
748 gpiod_set_value(board_params->hs_extmute_gpio, 0); in headset_ramp()
759 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in headsetlpga_event()
762 switch (event) { in headsetlpga_event()
764 /* Do the ramp-up only once */ in headsetlpga_event()
765 if (!twl4030->hsr_enabled) in headsetlpga_event()
768 twl4030->hsl_enabled = 1; in headsetlpga_event()
771 /* Do the ramp-down only if both headsetL/R is disabled */ in headsetlpga_event()
772 if (!twl4030->hsr_enabled) in headsetlpga_event()
775 twl4030->hsl_enabled = 0; in headsetlpga_event()
784 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in headsetrpga_event()
787 switch (event) { in headsetrpga_event()
789 /* Do the ramp-up only once */ in headsetrpga_event()
790 if (!twl4030->hsl_enabled) in headsetrpga_event()
793 twl4030->hsr_enabled = 1; in headsetrpga_event()
796 /* Do the ramp-down only if both headsetL/R is disabled */ in headsetrpga_event()
797 if (!twl4030->hsl_enabled) in headsetrpga_event()
800 twl4030->hsr_enabled = 0; in headsetrpga_event()
809 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in digimic_event()
811 struct twl4030_board_params *board_params = twl4030->board_params; in digimic_event()
813 if (board_params && board_params->digimic_delay) in digimic_event()
814 twl4030_wait_ms(board_params->digimic_delay); in digimic_event()
824 * 0x3 : -6 dB
832 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_get_volsw_twl4030()
834 unsigned int reg = mc->reg; in snd_soc_get_volsw_twl4030()
835 unsigned int shift = mc->shift; in snd_soc_get_volsw_twl4030()
836 unsigned int rshift = mc->rshift; in snd_soc_get_volsw_twl4030()
837 int max = mc->max; in snd_soc_get_volsw_twl4030()
838 int mask = (1 << fls(max)) - 1; in snd_soc_get_volsw_twl4030()
840 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_twl4030()
842 if (ucontrol->value.integer.value[0]) in snd_soc_get_volsw_twl4030()
843 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_twl4030()
844 max + 1 - ucontrol->value.integer.value[0]; in snd_soc_get_volsw_twl4030()
847 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_twl4030()
849 if (ucontrol->value.integer.value[1]) in snd_soc_get_volsw_twl4030()
850 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_twl4030()
851 max + 1 - ucontrol->value.integer.value[1]; in snd_soc_get_volsw_twl4030()
861 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_put_volsw_twl4030()
863 unsigned int reg = mc->reg; in snd_soc_put_volsw_twl4030()
864 unsigned int shift = mc->shift; in snd_soc_put_volsw_twl4030()
865 unsigned int rshift = mc->rshift; in snd_soc_put_volsw_twl4030()
866 int max = mc->max; in snd_soc_put_volsw_twl4030()
867 int mask = (1 << fls(max)) - 1; in snd_soc_put_volsw_twl4030()
870 val = (ucontrol->value.integer.value[0] & mask); in snd_soc_put_volsw_twl4030()
874 val = max + 1 - val; in snd_soc_put_volsw_twl4030()
877 val2 = (ucontrol->value.integer.value[1] & mask); in snd_soc_put_volsw_twl4030()
880 val2 = max + 1 - val2; in snd_soc_put_volsw_twl4030()
890 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_get_volsw_r2_twl4030()
892 unsigned int reg = mc->reg; in snd_soc_get_volsw_r2_twl4030()
893 unsigned int reg2 = mc->rreg; in snd_soc_get_volsw_r2_twl4030()
894 unsigned int shift = mc->shift; in snd_soc_get_volsw_r2_twl4030()
895 int max = mc->max; in snd_soc_get_volsw_r2_twl4030()
896 int mask = (1<<fls(max))-1; in snd_soc_get_volsw_r2_twl4030()
898 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_r2_twl4030()
900 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_r2_twl4030()
903 if (ucontrol->value.integer.value[0]) in snd_soc_get_volsw_r2_twl4030()
904 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_r2_twl4030()
905 max + 1 - ucontrol->value.integer.value[0]; in snd_soc_get_volsw_r2_twl4030()
906 if (ucontrol->value.integer.value[1]) in snd_soc_get_volsw_r2_twl4030()
907 ucontrol->value.integer.value[1] = in snd_soc_get_volsw_r2_twl4030()
908 max + 1 - ucontrol->value.integer.value[1]; in snd_soc_get_volsw_r2_twl4030()
917 (struct soc_mixer_control *)kcontrol->private_value; in snd_soc_put_volsw_r2_twl4030()
919 unsigned int reg = mc->reg; in snd_soc_put_volsw_r2_twl4030()
920 unsigned int reg2 = mc->rreg; in snd_soc_put_volsw_r2_twl4030()
921 unsigned int shift = mc->shift; in snd_soc_put_volsw_r2_twl4030()
922 int max = mc->max; in snd_soc_put_volsw_r2_twl4030()
923 int mask = (1 << fls(max)) - 1; in snd_soc_put_volsw_r2_twl4030()
928 val = (ucontrol->value.integer.value[0] & mask); in snd_soc_put_volsw_r2_twl4030()
929 val2 = (ucontrol->value.integer.value[1] & mask); in snd_soc_put_volsw_r2_twl4030()
932 val = max + 1 - val; in snd_soc_put_volsw_r2_twl4030()
934 val2 = max + 1 - val2; in snd_soc_put_volsw_r2_twl4030()
962 if (twl4030->configured) { in snd_soc_put_twl4030_opmode_enum_double()
963 dev_err(component->dev, in snd_soc_put_twl4030_opmode_enum_double()
964 "operation mode cannot be changed on-the-fly\n"); in snd_soc_put_twl4030_opmode_enum_double()
965 return -EBUSY; in snd_soc_put_twl4030_opmode_enum_double()
973 * from -62 to 0 dB in 1 dB steps (mute instead of -63 dB)
975 static DECLARE_TLV_DB_SCALE(digital_fine_tlv, -6300, 100, 1);
986 * from -37 to 12 dB in 1 dB steps (mute instead of -37 dB)
988 static DECLARE_TLV_DB_SCALE(digital_voice_downlink_tlv, -3700, 100, 1);
992 * -24 dB to 12 dB in 2 dB steps
994 static DECLARE_TLV_DB_SCALE(analog_tlv, -2400, 200, 0);
998 * -6 dB to 6 dB in 6 dB steps (mute instead of -12)
1000 static DECLARE_TLV_DB_SCALE(output_tvl, -1200, 600, 1);
1004 * 0 dB to 12 dB in 6 dB steps (mute instead of -6)
1006 static DECLARE_TLV_DB_SCALE(output_ear_tvl, -600, 600, 1);
1039 /* Vibra H-bridge direction mode */
1041 "Vibra H-bridge direction", "Audio data MSB",
1048 /* Vibra H-bridge direction */
1067 /* Codec operation mode control */
1068 SOC_ENUM_EXT("Codec Operation Mode", twl4030_op_modes_enum,
1093 SOC_DOUBLE_R("DAC1 Analog Playback Switch",
1096 SOC_DOUBLE_R("DAC2 Analog Playback Switch",
1107 SOC_SINGLE("DAC Voice Analog Downlink Switch",
1144 SOC_ENUM("Vibra H-bridge mode", twl4030_vibradirmode_enum),
1145 SOC_ENUM("Vibra H-bridge direction", twl4030_vibradir_enum),
1202 /* Master analog loopback switch */
1372 /* Stream -> DAC mapping */
1379 /* ADC -> Stream mapping */
1456 {"HandsfreeL", "Switch", "HandsfreeL Mux"},
1463 {"HandsfreeR", "Switch", "HandsfreeR Mux"},
1499 {"Analog Left", "Main Mic Capture Switch", "MAINMIC"},
1500 {"Analog Left", "Headset Mic Capture Switch", "HSMIC"},
1501 {"Analog Left", "AUXL Capture Switch", "AUXL"},
1502 {"Analog Left", "Carkit Mic Capture Switch", "CARKITMIC"},
1504 {"Analog Right", "Sub Mic Capture Switch", "SUBMIC"},
1505 {"Analog Right", "AUXR Capture Switch", "AUXR"},
1540 {"Right1 Analog Loopback", "Switch", "Analog Right"},
1541 {"Left1 Analog Loopback", "Switch", "Analog Left"},
1542 {"Right2 Analog Loopback", "Switch", "Analog Right"},
1543 {"Left2 Analog Loopback", "Switch", "Analog Left"},
1544 {"Voice Analog Loopback", "Switch", "Analog Left"},
1573 switch (level) { in twl4030_set_bias_level()
1596 if (mst_substream == twl4030->master_substream) in twl4030_constraints()
1597 slv_substream = twl4030->slave_substream; in twl4030_constraints()
1598 else if (mst_substream == twl4030->slave_substream) in twl4030_constraints()
1599 slv_substream = twl4030->master_substream; in twl4030_constraints()
1604 snd_pcm_hw_constraint_single(slv_substream->runtime, in twl4030_constraints()
1606 twl4030->rate); in twl4030_constraints()
1608 snd_pcm_hw_constraint_single(slv_substream->runtime, in twl4030_constraints()
1610 twl4030->sample_bits); in twl4030_constraints()
1612 snd_pcm_hw_constraint_single(slv_substream->runtime, in twl4030_constraints()
1614 twl4030->channels); in twl4030_constraints()
1617 /* In case of 4 channel mode, the RX1 L/R for playback and the TX2 L/R for
1642 struct snd_soc_component *component = dai->component; in twl4030_startup()
1645 if (twl4030->master_substream) { in twl4030_startup()
1646 twl4030->slave_substream = substream; in twl4030_startup()
1650 if (twl4030->configured) in twl4030_startup()
1651 twl4030_constraints(twl4030, twl4030->master_substream); in twl4030_startup()
1658 snd_pcm_hw_constraint_single(substream->runtime, in twl4030_startup()
1662 twl4030->master_substream = substream; in twl4030_startup()
1671 struct snd_soc_component *component = dai->component; in twl4030_shutdown()
1674 if (twl4030->master_substream == substream) in twl4030_shutdown()
1675 twl4030->master_substream = twl4030->slave_substream; in twl4030_shutdown()
1677 twl4030->slave_substream = NULL; in twl4030_shutdown()
1681 if (!twl4030->master_substream) in twl4030_shutdown()
1682 twl4030->configured = 0; in twl4030_shutdown()
1683 else if (!twl4030->master_substream->runtime->channels) in twl4030_shutdown()
1684 twl4030->configured = 0; in twl4030_shutdown()
1687 if (substream->runtime->channels == 4) in twl4030_shutdown()
1688 twl4030_tdm_enable(component, substream->stream, 0); in twl4030_shutdown()
1695 struct snd_soc_component *component = dai->component; in twl4030_hw_params()
1697 u8 mode, old_mode, format, old_format; in twl4030_hw_params() local
1702 mode = twl4030_read(component, TWL4030_REG_CODEC_MODE); in twl4030_hw_params()
1704 /* Safety check: are we in the correct operating mode and in twl4030_hw_params()
1705 * the interface is in TDM mode? */ in twl4030_hw_params()
1706 if ((mode & TWL4030_OPTION_1) && in twl4030_hw_params()
1708 twl4030_tdm_enable(component, substream->stream, 1); in twl4030_hw_params()
1710 return -EINVAL; in twl4030_hw_params()
1713 if (twl4030->configured) in twl4030_hw_params()
1720 mode = old_mode & ~TWL4030_APLL_RATE; in twl4030_hw_params()
1722 switch (params_rate(params)) { in twl4030_hw_params()
1724 mode |= TWL4030_APLL_RATE_8000; in twl4030_hw_params()
1727 mode |= TWL4030_APLL_RATE_11025; in twl4030_hw_params()
1730 mode |= TWL4030_APLL_RATE_12000; in twl4030_hw_params()
1733 mode |= TWL4030_APLL_RATE_16000; in twl4030_hw_params()
1736 mode |= TWL4030_APLL_RATE_22050; in twl4030_hw_params()
1739 mode |= TWL4030_APLL_RATE_24000; in twl4030_hw_params()
1742 mode |= TWL4030_APLL_RATE_32000; in twl4030_hw_params()
1745 mode |= TWL4030_APLL_RATE_44100; in twl4030_hw_params()
1748 mode |= TWL4030_APLL_RATE_48000; in twl4030_hw_params()
1751 mode |= TWL4030_APLL_RATE_96000; in twl4030_hw_params()
1754 dev_err(component->dev, "%s: unknown rate %d\n", __func__, in twl4030_hw_params()
1756 return -EINVAL; in twl4030_hw_params()
1763 switch (params_width(params)) { in twl4030_hw_params()
1771 dev_err(component->dev, "%s: unsupported bits/sample %d\n", in twl4030_hw_params()
1773 return -EINVAL; in twl4030_hw_params()
1776 if (format != old_format || mode != old_mode) { in twl4030_hw_params()
1777 if (twl4030->codec_powered) { in twl4030_hw_params()
1783 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_hw_params()
1787 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_hw_params()
1794 twl4030->configured = 1; in twl4030_hw_params()
1795 twl4030->rate = params_rate(params); in twl4030_hw_params()
1796 twl4030->sample_bits = hw_param_interval(params, in twl4030_hw_params()
1797 SNDRV_PCM_HW_PARAM_SAMPLE_BITS)->min; in twl4030_hw_params()
1798 twl4030->channels = params_channels(params); in twl4030_hw_params()
1803 if (twl4030->slave_substream) in twl4030_hw_params()
1812 struct snd_soc_component *component = codec_dai->component; in twl4030_set_dai_sysclk()
1815 switch (freq) { in twl4030_set_dai_sysclk()
1821 dev_err(component->dev, "Unsupported HFCLKIN: %u\n", freq); in twl4030_set_dai_sysclk()
1822 return -EINVAL; in twl4030_set_dai_sysclk()
1825 if ((freq / 1000) != twl4030->sysclk) { in twl4030_set_dai_sysclk()
1826 dev_err(component->dev, in twl4030_set_dai_sysclk()
1828 freq, twl4030->sysclk * 1000); in twl4030_set_dai_sysclk()
1829 return -EINVAL; in twl4030_set_dai_sysclk()
1837 struct snd_soc_component *component = codec_dai->component; in twl4030_set_dai_fmt()
1845 switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { in twl4030_set_dai_fmt()
1855 return -EINVAL; in twl4030_set_dai_fmt()
1860 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { in twl4030_set_dai_fmt()
1868 return -EINVAL; in twl4030_set_dai_fmt()
1872 if (twl4030->codec_powered) { in twl4030_set_dai_fmt()
1890 struct snd_soc_component *component = dai->component; in twl4030_set_tristate()
1901 /* In case of voice mode, the RX1 L(VRX) for downlink and the TX2 L/R
1926 struct snd_soc_component *component = dai->component; in twl4030_voice_startup()
1928 u8 mode; in twl4030_voice_startup() local
1933 if (twl4030->sysclk != 26000) { in twl4030_voice_startup()
1934 dev_err(component->dev, in twl4030_voice_startup()
1936 __func__, twl4030->sysclk); in twl4030_voice_startup()
1937 return -EINVAL; in twl4030_voice_startup()
1940 /* If the codec mode is not option2, the voice PCM interface is not in twl4030_voice_startup()
1943 mode = twl4030_read(component, TWL4030_REG_CODEC_MODE) in twl4030_voice_startup()
1946 if (mode != TWL4030_OPTION_2) { in twl4030_voice_startup()
1947 dev_err(component->dev, "%s: the codec mode is not option2\n", in twl4030_voice_startup()
1949 return -EINVAL; in twl4030_voice_startup()
1958 struct snd_soc_component *component = dai->component; in twl4030_voice_shutdown()
1961 twl4030_voice_enable(component, substream->stream, 0); in twl4030_voice_shutdown()
1968 struct snd_soc_component *component = dai->component; in twl4030_voice_hw_params()
1970 u8 old_mode, mode; in twl4030_voice_hw_params() local
1973 twl4030_voice_enable(component, substream->stream, 1); in twl4030_voice_hw_params()
1978 mode = old_mode; in twl4030_voice_hw_params()
1980 switch (params_rate(params)) { in twl4030_voice_hw_params()
1982 mode &= ~(TWL4030_SEL_16K); in twl4030_voice_hw_params()
1985 mode |= TWL4030_SEL_16K; in twl4030_voice_hw_params()
1988 dev_err(component->dev, "%s: unknown rate %d\n", __func__, in twl4030_voice_hw_params()
1990 return -EINVAL; in twl4030_voice_hw_params()
1993 if (mode != old_mode) { in twl4030_voice_hw_params()
1994 if (twl4030->codec_powered) { in twl4030_voice_hw_params()
2000 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_voice_hw_params()
2003 twl4030_write(component, TWL4030_REG_CODEC_MODE, mode); in twl4030_voice_hw_params()
2013 struct snd_soc_component *component = codec_dai->component; in twl4030_voice_set_dai_sysclk()
2017 dev_err(component->dev, in twl4030_voice_set_dai_sysclk()
2020 return -EINVAL; in twl4030_voice_set_dai_sysclk()
2022 if ((freq / 1000) != twl4030->sysclk) { in twl4030_voice_set_dai_sysclk()
2023 dev_err(component->dev, in twl4030_voice_set_dai_sysclk()
2025 freq, twl4030->sysclk * 1000); in twl4030_voice_set_dai_sysclk()
2026 return -EINVAL; in twl4030_voice_set_dai_sysclk()
2034 struct snd_soc_component *component = codec_dai->component; in twl4030_voice_set_dai_fmt()
2042 switch (fmt & SND_SOC_DAIFMT_CLOCK_PROVIDER_MASK) { in twl4030_voice_set_dai_fmt()
2050 return -EINVAL; in twl4030_voice_set_dai_fmt()
2054 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 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()
2185 return devm_snd_soc_register_component(&pdev->dev, in twl4030_codec_probe()
2190 MODULE_ALIAS("platform:twl4030-codec");
2195 .name = "twl4030-codec",