Lines Matching +full:tx1 +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-only
28 #include <linux/mfd/twl4030-audio.h>
35 #define TWL4030_CACHEREGNUM (TWL4030_REG_MISC_SET_2 + 1)
41 unsigned int hs_extmute:1;
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()
188 if (enable == twl4030->codec_powered) 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()
310 twl4030_codec_enable(component, 1); 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()
356 SOC_DAPM_SINGLE("Voice", TWL4030_REG_EAR_CTL, 0, 1, 0),
357 SOC_DAPM_SINGLE("AudioL1", TWL4030_REG_EAR_CTL, 1, 1, 0),
358 SOC_DAPM_SINGLE("AudioL2", TWL4030_REG_EAR_CTL, 2, 1, 0),
359 SOC_DAPM_SINGLE("AudioR1", TWL4030_REG_EAR_CTL, 3, 1, 0),
364 SOC_DAPM_SINGLE("Voice", TWL4030_REG_PREDL_CTL, 0, 1, 0),
365 SOC_DAPM_SINGLE("AudioL1", TWL4030_REG_PREDL_CTL, 1, 1, 0),
366 SOC_DAPM_SINGLE("AudioL2", TWL4030_REG_PREDL_CTL, 2, 1, 0),
367 SOC_DAPM_SINGLE("AudioR2", TWL4030_REG_PREDL_CTL, 3, 1, 0),
372 SOC_DAPM_SINGLE("Voice", TWL4030_REG_PREDR_CTL, 0, 1, 0),
373 SOC_DAPM_SINGLE("AudioR1", TWL4030_REG_PREDR_CTL, 1, 1, 0),
374 SOC_DAPM_SINGLE("AudioR2", TWL4030_REG_PREDR_CTL, 2, 1, 0),
375 SOC_DAPM_SINGLE("AudioL2", TWL4030_REG_PREDR_CTL, 3, 1, 0),
380 SOC_DAPM_SINGLE("Voice", TWL4030_REG_HS_SEL, 0, 1, 0),
381 SOC_DAPM_SINGLE("AudioL1", TWL4030_REG_HS_SEL, 1, 1, 0),
382 SOC_DAPM_SINGLE("AudioL2", TWL4030_REG_HS_SEL, 2, 1, 0),
387 SOC_DAPM_SINGLE("Voice", TWL4030_REG_HS_SEL, 3, 1, 0),
388 SOC_DAPM_SINGLE("AudioR1", TWL4030_REG_HS_SEL, 4, 1, 0),
389 SOC_DAPM_SINGLE("AudioR2", TWL4030_REG_HS_SEL, 5, 1, 0),
394 SOC_DAPM_SINGLE("Voice", TWL4030_REG_PRECKL_CTL, 0, 1, 0),
395 SOC_DAPM_SINGLE("AudioL1", TWL4030_REG_PRECKL_CTL, 1, 1, 0),
396 SOC_DAPM_SINGLE("AudioL2", TWL4030_REG_PRECKL_CTL, 2, 1, 0),
401 SOC_DAPM_SINGLE("Voice", TWL4030_REG_PRECKR_CTL, 0, 1, 0),
402 SOC_DAPM_SINGLE("AudioR1", TWL4030_REG_PRECKR_CTL, 1, 1, 0),
403 SOC_DAPM_SINGLE("AudioR2", TWL4030_REG_PRECKR_CTL, 2, 1, 0),
419 SOC_DAPM_SINGLE_VIRT("Switch", 1);
434 SOC_DAPM_SINGLE_VIRT("Switch", 1);
462 TWL4030_REG_ANAMICL, 0, 1, 0),
464 TWL4030_REG_ANAMICL, 1, 1, 0),
466 TWL4030_REG_ANAMICL, 2, 1, 0),
468 TWL4030_REG_ANAMICL, 3, 1, 0),
473 SOC_DAPM_SINGLE("Sub Mic Capture Switch", TWL4030_REG_ANAMICR, 0, 1, 0),
474 SOC_DAPM_SINGLE("AUXR Capture Switch", TWL4030_REG_ANAMICR, 2, 1, 0),
477 /* TX1 L/R Analog/Digital microphone selection */
501 SOC_DAPM_SINGLE("Switch", TWL4030_REG_ARXR1_APGA_CTL, 2, 1, 0);
505 SOC_DAPM_SINGLE("Switch", TWL4030_REG_ARXL1_APGA_CTL, 2, 1, 0);
509 SOC_DAPM_SINGLE("Switch", TWL4030_REG_ARXR2_APGA_CTL, 2, 1, 0);
513 SOC_DAPM_SINGLE("Switch", TWL4030_REG_ARXL2_APGA_CTL, 2, 1, 0);
517 SOC_DAPM_SINGLE("Switch", TWL4030_REG_VDL_APGA_CTL, 2, 1, 0);
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)*/
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()
621 handsfree_ramp(component, TWL4030_REG_HFL_CTL, 1); in handsfreelpga_event()
633 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in handsfreerpga_event()
637 handsfree_ramp(component, TWL4030_REG_HFR_CTL, 1); 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()
662 twl4030_apll_enable(component, 1); in apll_event()
674 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); in aif_event()
682 twl4030_apll_enable(component, 1); 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()
734 /* Wait ramp delay time + 1, so the VMID can settle */ in headset_ramp()
737 /* Headset ramp-down _not_ according to in headset_ramp()
741 /* Wait ramp delay time + 1, so the VMID can settle */ 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()
772 headset_ramp(component, 1); 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()
797 headset_ramp(component, 1); 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()
846 ucontrol->value.integer.value[0] = 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()
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()
876 val = (ucontrol->value.integer.value[0] & mask); 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()
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()
904 ucontrol->value.integer.value[0] = in snd_soc_get_volsw_r2_twl4030()
906 ucontrol->value.integer.value[1] = 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()
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()
955 "Option 2 (voice/audio)", "Option 1 (audio)"
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);
1016 * from 0 dB to 31 dB in 1 dB steps
1045 /* Vibra H-bridge direction mode */
1047 "Vibra H-bridge direction", "Audio data MSB",
1054 /* Vibra H-bridge direction */
1060 TWL4030_REG_VIBRA_CTL, 1,
1095 3, 0x12, 1, analog_tlv),
1098 3, 0x12, 1, analog_tlv),
1101 1, 1, 0),
1104 1, 1, 0),
1111 TWL4030_REG_VDL_APGA_CTL, 3, 0x12, 1, analog_tlv),
1114 TWL4030_REG_VDL_APGA_CTL, 1, 1, 0),
1136 SOC_DOUBLE_R_TLV("TX1 Digital Capture Volume",
1150 SOC_ENUM("Vibra H-bridge mode", twl4030_vibradirmode_enum),
1151 SOC_ENUM("Vibra H-bridge direction", twl4030_vibradir_enum),
1224 TWL4030_REG_AVDAC_CTL, 1, 0, NULL, 0),
1332 TX1 Left/Right: either analog Left/Right or Digimic0
1334 SND_SOC_DAPM_MUX("TX1 Capture Route", SND_SOC_NOPM, 0, 0,
1352 TWL4030_REG_AVADC_CTL, 1, 0, NULL, 0),
1355 TWL4030_REG_ADCMICSEL, 1, 0, NULL, 0,
1367 SND_SOC_DAPM_SUPPLY("Mic Bias 1",
1370 TWL4030_REG_MICBIAS_CTL, 1, 0, NULL, 0),
1378 /* Stream -> DAC mapping */
1385 /* ADC -> Stream mapping */
1522 /* TX1 Left capture path */
1523 {"TX1 Capture Route", "Analog", "ADC Physical Left"},
1524 {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"},
1525 /* TX1 Right capture path */
1526 {"TX1 Capture Route", "Analog", "ADC Physical Right"},
1527 {"TX1 Capture Route", "Digimic0", "Digimic0 Enable"},
1535 {"ADC Virtual Left1", NULL, "TX1 Capture Route"},
1536 {"ADC Virtual Right1", NULL, "TX1 Capture Route"},
1566 {"Right Digital Loopback", "Volume", "TX1 Capture Route"},
1567 {"Left Digital Loopback", "Volume", "TX1 Capture Route"},
1586 twl4030_codec_enable(component, 1); in twl4030_set_bias_level()
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()
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()
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()
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()
1783 if (twl4030->codec_powered) { in twl4030_hw_params()
1791 twl4030_codec_enable(component, 1); 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()
1885 twl4030_codec_enable(component, 1); in twl4030_set_dai_fmt()
1896 struct snd_soc_component *component = dai->component; in twl4030_set_tristate()
1932 struct snd_soc_component *component = dai->component; in twl4030_voice_startup()
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()
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()
1979 twl4030_voice_enable(component, substream->stream, 1); 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()
2000 if (twl4030->codec_powered) { in twl4030_voice_hw_params()
2007 twl4030_codec_enable(component, 1); 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()
2079 twl4030_codec_enable(component, 1); 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",
2145 .channels_min = 1,
2146 .channels_max = 1,
2151 .channels_min = 1,
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()
2198 .use_pmdown_time = 1,
2199 .endianness = 1,
2204 return devm_snd_soc_register_component(&pdev->dev, in twl4030_codec_probe()
2209 MODULE_ALIAS("platform:twl4030-codec");
2214 .name = "twl4030-codec",