aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorIan Minett <ian_minett@creativelabs.com>2012-12-20 21:53:40 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-15 11:01:01 -0500
commit441aa6a016f66f2d20a95d1afafe3e47254a666f (patch)
tree831e3cf2d4086cd8deda3c8e564de1e384ffe672 /sound/pci
parente90f29e44273867392d9d1e0fd94bbe7bffe0335 (diff)
ALSA: hda/ca0132: Shuffle to group together related code
Signed-off-by: Ian Minett <ian_minett@creativelabs.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/patch_ca0132.c152
1 files changed, 76 insertions, 76 deletions
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c
index 77903a398289..4c9b95e56567 100644
--- a/sound/pci/hda/patch_ca0132.c
+++ b/sound/pci/hda/patch_ca0132.c
@@ -673,43 +673,6 @@ enum ca0132_sample_rate {
673 SR_RATE_UNKNOWN = 0x1F 673 SR_RATE_UNKNOWN = 0x1F
674}; 674};
675 675
676static void init_output(struct hda_codec *codec, hda_nid_t pin, hda_nid_t dac)
677{
678 if (pin) {
679 snd_hda_codec_write(codec, pin, 0,
680 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
681 if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)
682 snd_hda_codec_write(codec, pin, 0,
683 AC_VERB_SET_AMP_GAIN_MUTE,
684 AMP_OUT_UNMUTE);
685 }
686 if (dac && (get_wcaps(codec, dac) & AC_WCAP_OUT_AMP))
687 snd_hda_codec_write(codec, dac, 0,
688 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO);
689}
690
691static void init_input(struct hda_codec *codec, hda_nid_t pin, hda_nid_t adc)
692{
693 if (pin) {
694 snd_hda_codec_write(codec, pin, 0,
695 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80);
696 if (get_wcaps(codec, pin) & AC_WCAP_IN_AMP)
697 snd_hda_codec_write(codec, pin, 0,
698 AC_VERB_SET_AMP_GAIN_MUTE,
699 AMP_IN_UNMUTE(0));
700 }
701 if (adc && (get_wcaps(codec, adc) & AC_WCAP_IN_AMP)) {
702 snd_hda_codec_write(codec, adc, 0, AC_VERB_SET_AMP_GAIN_MUTE,
703 AMP_IN_UNMUTE(0));
704
705 /* init to 0 dB and unmute. */
706 snd_hda_codec_amp_stereo(codec, adc, HDA_INPUT, 0,
707 HDA_AMP_VOLMASK, 0x5a);
708 snd_hda_codec_amp_stereo(codec, adc, HDA_INPUT, 0,
709 HDA_AMP_MUTE, 0);
710 }
711}
712
713enum dsp_download_state { 676enum dsp_download_state {
714 DSP_DOWNLOAD_FAILED = -1, 677 DSP_DOWNLOAD_FAILED = -1,
715 DSP_DOWNLOAD_INIT = 0, 678 DSP_DOWNLOAD_INIT = 0,
@@ -4115,6 +4078,43 @@ static int ca0132_build_pcms(struct hda_codec *codec)
4115 return 0; 4078 return 0;
4116} 4079}
4117 4080
4081static void init_output(struct hda_codec *codec, hda_nid_t pin, hda_nid_t dac)
4082{
4083 if (pin) {
4084 snd_hda_codec_write(codec, pin, 0,
4085 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
4086 if (get_wcaps(codec, pin) & AC_WCAP_OUT_AMP)
4087 snd_hda_codec_write(codec, pin, 0,
4088 AC_VERB_SET_AMP_GAIN_MUTE,
4089 AMP_OUT_UNMUTE);
4090 }
4091 if (dac && (get_wcaps(codec, dac) & AC_WCAP_OUT_AMP))
4092 snd_hda_codec_write(codec, dac, 0,
4093 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO);
4094}
4095
4096static void init_input(struct hda_codec *codec, hda_nid_t pin, hda_nid_t adc)
4097{
4098 if (pin) {
4099 snd_hda_codec_write(codec, pin, 0,
4100 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80);
4101 if (get_wcaps(codec, pin) & AC_WCAP_IN_AMP)
4102 snd_hda_codec_write(codec, pin, 0,
4103 AC_VERB_SET_AMP_GAIN_MUTE,
4104 AMP_IN_UNMUTE(0));
4105 }
4106 if (adc && (get_wcaps(codec, adc) & AC_WCAP_IN_AMP)) {
4107 snd_hda_codec_write(codec, adc, 0, AC_VERB_SET_AMP_GAIN_MUTE,
4108 AMP_IN_UNMUTE(0));
4109
4110 /* init to 0 dB and unmute. */
4111 snd_hda_codec_amp_stereo(codec, adc, HDA_INPUT, 0,
4112 HDA_AMP_VOLMASK, 0x5a);
4113 snd_hda_codec_amp_stereo(codec, adc, HDA_INPUT, 0,
4114 HDA_AMP_MUTE, 0);
4115 }
4116}
4117
4118static void ca0132_init_unsol(struct hda_codec *codec) 4118static void ca0132_init_unsol(struct hda_codec *codec)
4119{ 4119{
4120 snd_hda_jack_detect_enable(codec, UNSOL_TAG_HP, UNSOL_TAG_HP); 4120 snd_hda_jack_detect_enable(codec, UNSOL_TAG_HP, UNSOL_TAG_HP);
@@ -4380,45 +4380,6 @@ static void ca0132_download_dsp(struct hda_codec *codec)
4380 ca0132_set_dsp_msr(codec, true); 4380 ca0132_set_dsp_msr(codec, true);
4381} 4381}
4382 4382
4383static void ca0132_config(struct hda_codec *codec)
4384{
4385 struct ca0132_spec *spec = codec->spec;
4386 struct auto_pin_cfg *cfg = &spec->autocfg;
4387
4388 spec->dacs[0] = 0x2;
4389 spec->dacs[1] = 0x3;
4390 spec->dacs[2] = 0x4;
4391
4392 spec->multiout.dac_nids = spec->dacs;
4393 spec->multiout.num_dacs = 3;
4394 spec->multiout.max_channels = 2;
4395
4396 spec->num_outputs = 2;
4397 spec->out_pins[0] = 0x0b; /* speaker out */
4398 spec->out_pins[1] = 0x10; /* headphone out */
4399 spec->shared_out_nid = 0x2;
4400
4401 spec->num_inputs = 3;
4402 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */
4403 spec->adcs[1] = 0x8; /* analog mic2 */
4404 spec->adcs[2] = 0xa; /* what u hear */
4405 spec->shared_mic_nid = 0x7;
4406
4407 spec->input_pins[0] = 0x12;
4408 spec->input_pins[1] = 0x11;
4409 spec->input_pins[2] = 0x13;
4410
4411 /* SPDIF I/O */
4412 spec->dig_out = 0x05;
4413 spec->multiout.dig_out_nid = spec->dig_out;
4414 cfg->dig_out_pins[0] = 0x0c;
4415 cfg->dig_outs = 1;
4416 cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF;
4417 spec->dig_in = 0x09;
4418 cfg->dig_in_pin = 0x0e;
4419 cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
4420}
4421
4422static void ca0132_process_dsp_response(struct hda_codec *codec) 4383static void ca0132_process_dsp_response(struct hda_codec *codec)
4423{ 4384{
4424 struct ca0132_spec *spec = codec->spec; 4385 struct ca0132_spec *spec = codec->spec;
@@ -4640,6 +4601,45 @@ static struct hda_codec_ops ca0132_patch_ops = {
4640 .unsol_event = ca0132_unsol_event, 4601 .unsol_event = ca0132_unsol_event,
4641}; 4602};
4642 4603
4604static void ca0132_config(struct hda_codec *codec)
4605{
4606 struct ca0132_spec *spec = codec->spec;
4607 struct auto_pin_cfg *cfg = &spec->autocfg;
4608
4609 spec->dacs[0] = 0x2;
4610 spec->dacs[1] = 0x3;
4611 spec->dacs[2] = 0x4;
4612
4613 spec->multiout.dac_nids = spec->dacs;
4614 spec->multiout.num_dacs = 3;
4615 spec->multiout.max_channels = 2;
4616
4617 spec->num_outputs = 2;
4618 spec->out_pins[0] = 0x0b; /* speaker out */
4619 spec->out_pins[1] = 0x10; /* headphone out */
4620 spec->shared_out_nid = 0x2;
4621
4622 spec->num_inputs = 3;
4623 spec->adcs[0] = 0x7; /* digital mic / analog mic1 */
4624 spec->adcs[1] = 0x8; /* analog mic2 */
4625 spec->adcs[2] = 0xa; /* what u hear */
4626 spec->shared_mic_nid = 0x7;
4627
4628 spec->input_pins[0] = 0x12;
4629 spec->input_pins[1] = 0x11;
4630 spec->input_pins[2] = 0x13;
4631
4632 /* SPDIF I/O */
4633 spec->dig_out = 0x05;
4634 spec->multiout.dig_out_nid = spec->dig_out;
4635 cfg->dig_out_pins[0] = 0x0c;
4636 cfg->dig_outs = 1;
4637 cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF;
4638 spec->dig_in = 0x09;
4639 cfg->dig_in_pin = 0x0e;
4640 cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
4641}
4642
4643static int patch_ca0132(struct hda_codec *codec) 4643static int patch_ca0132(struct hda_codec *codec)
4644{ 4644{
4645 struct ca0132_spec *spec; 4645 struct ca0132_spec *spec;