diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-04-20 07:45:55 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-05-29 04:04:58 -0400 |
commit | d21b37ea134921f807ebdbd19ae3cd00bb8bf2fc (patch) | |
tree | 741a393951e7ec2767dec695cb0d9f665f28e287 /sound | |
parent | b0c95f514a4057720958c9ea0113229468c94b2b (diff) |
[ALSA] Fix and cleanup of CM9880 auto-configuration
HDA Codec driver
Fix and cleanup of CM9880 automatic PIN configuration.
snd_hda_codec_setup_stream() doesn't do anything when NID is 0.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/hda/hda_codec.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/hda_codec.h | 2 | ||||
-rw-r--r-- | sound/pci/hda/patch_cmedia.c | 31 |
3 files changed, 24 insertions, 12 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c index 890b7566154..44fac2182fc 100644 --- a/sound/pci/hda/hda_codec.c +++ b/sound/pci/hda/hda_codec.c | |||
@@ -549,6 +549,9 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr, | |||
549 | void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, u32 stream_tag, | 549 | void snd_hda_codec_setup_stream(struct hda_codec *codec, hda_nid_t nid, u32 stream_tag, |
550 | int channel_id, int format) | 550 | int channel_id, int format) |
551 | { | 551 | { |
552 | if (! nid) | ||
553 | return; | ||
554 | |||
552 | snd_printdd("hda_codec_setup_stream: NID=0x%x, stream=0x%x, channel=%d, format=0x%x\n", | 555 | snd_printdd("hda_codec_setup_stream: NID=0x%x, stream=0x%x, channel=%d, format=0x%x\n", |
553 | nid, stream_tag, channel_id, format); | 556 | nid, stream_tag, channel_id, format); |
554 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, | 557 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, |
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h index 263f5b698ba..43fc245d9a6 100644 --- a/sound/pci/hda/hda_codec.h +++ b/sound/pci/hda/hda_codec.h | |||
@@ -259,7 +259,9 @@ enum { | |||
259 | /* configuration default - 32bit */ | 259 | /* configuration default - 32bit */ |
260 | #define AC_DEFCFG_SEQUENCE (0xf<<0) | 260 | #define AC_DEFCFG_SEQUENCE (0xf<<0) |
261 | #define AC_DEFCFG_DEF_ASSOC (0xf<<4) | 261 | #define AC_DEFCFG_DEF_ASSOC (0xf<<4) |
262 | #define AC_DEFCFG_ASSOC_SHIFT 4 | ||
262 | #define AC_DEFCFG_MISC (0xf<<8) | 263 | #define AC_DEFCFG_MISC (0xf<<8) |
264 | #define AC_DEFCFG_MISC_SHIFT 8 | ||
263 | #define AC_DEFCFG_COLOR (0xf<<12) | 265 | #define AC_DEFCFG_COLOR (0xf<<12) |
264 | #define AC_DEFCFG_COLOR_SHIFT 12 | 266 | #define AC_DEFCFG_COLOR_SHIFT 12 |
265 | #define AC_DEFCFG_CONN_TYPE (0xf<<16) | 267 | #define AC_DEFCFG_CONN_TYPE (0xf<<16) |
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c index e64e29dac82..087230ca20a 100644 --- a/sound/pci/hda/patch_cmedia.c +++ b/sound/pci/hda/patch_cmedia.c | |||
@@ -365,7 +365,6 @@ static int cmi9880_build_controls(struct hda_codec *codec) | |||
365 | return 0; | 365 | return 0; |
366 | } | 366 | } |
367 | 367 | ||
368 | #define AC_DEFCFG_ASSOC_SHIFT 4 | ||
369 | #define get_defcfg_connect(cfg) ((cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT) | 368 | #define get_defcfg_connect(cfg) ((cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT) |
370 | #define get_defcfg_association(cfg) ((cfg & AC_DEFCFG_DEF_ASSOC) >> AC_DEFCFG_ASSOC_SHIFT) | 369 | #define get_defcfg_association(cfg) ((cfg & AC_DEFCFG_DEF_ASSOC) >> AC_DEFCFG_ASSOC_SHIFT) |
371 | #define get_defcfg_sequence(cfg) (cfg & AC_DEFCFG_SEQUENCE) | 370 | #define get_defcfg_sequence(cfg) (cfg & AC_DEFCFG_SEQUENCE) |
@@ -796,6 +795,7 @@ static int patch_cmi9880(struct hda_codec *codec) | |||
796 | { | 795 | { |
797 | unsigned int port_e, port_f, port_g, port_h; | 796 | unsigned int port_e, port_f, port_g, port_h; |
798 | unsigned int port_spdifi, port_spdifo; | 797 | unsigned int port_spdifi, port_spdifo; |
798 | int max_channels; | ||
799 | /* collect pin default configuration */ | 799 | /* collect pin default configuration */ |
800 | cmi9880_get_pin_def_config(codec); | 800 | cmi9880_get_pin_def_config(codec); |
801 | port_e = cmi9880_get_def_config(codec, 0x0f); | 801 | port_e = cmi9880_get_def_config(codec, 0x0f); |
@@ -805,33 +805,40 @@ static int patch_cmi9880(struct hda_codec *codec) | |||
805 | port_spdifi = cmi9880_get_def_config(codec, 0x13); | 805 | port_spdifi = cmi9880_get_def_config(codec, 0x13); |
806 | port_spdifo = cmi9880_get_def_config(codec, 0x12); | 806 | port_spdifo = cmi9880_get_def_config(codec, 0x12); |
807 | spec->front_panel = 1; | 807 | spec->front_panel = 1; |
808 | if ((get_defcfg_connect(port_e) == AC_JACK_PORT_NONE) | 808 | if (get_defcfg_connect(port_e) == AC_JACK_PORT_NONE || |
809 | || (get_defcfg_connect(port_f) == AC_JACK_PORT_NONE)) { | 809 | get_defcfg_connect(port_f) == AC_JACK_PORT_NONE) { |
810 | spec->surr_switch = 1; | 810 | spec->surr_switch = 1; |
811 | /* no front panel */ | 811 | /* no front panel */ |
812 | if ((get_defcfg_connect(port_g) == AC_JACK_PORT_NONE) | 812 | if (get_defcfg_connect(port_g) == AC_JACK_PORT_NONE || |
813 | || (get_defcfg_connect(port_h) == AC_JACK_PORT_NONE)) { | 813 | get_defcfg_connect(port_h) == AC_JACK_PORT_NONE) { |
814 | /* no optional rear panel */ | 814 | /* no optional rear panel */ |
815 | spec->board_config = CMI_MINIMAL; | 815 | spec->board_config = CMI_MINIMAL; |
816 | spec->front_panel = 0; | 816 | spec->front_panel = 0; |
817 | spec->num_ch_modes = 2; | 817 | spec->num_ch_modes = 2; |
818 | } else | 818 | } else { |
819 | spec->board_config = CMI_MIN_FP; | 819 | spec->board_config = CMI_MIN_FP; |
820 | spec->num_ch_modes = 3; | 820 | spec->num_ch_modes = 3; |
821 | } | ||
821 | spec->channel_modes = cmi9880_channel_modes; | 822 | spec->channel_modes = cmi9880_channel_modes; |
822 | spec->input_mux = &cmi9880_basic_mux; | 823 | spec->input_mux = &cmi9880_basic_mux; |
824 | spec->multiout.max_channels = cmi9880_channel_modes[0].channels; | ||
823 | } else { | 825 | } else { |
824 | spec->input_mux = &cmi9880_basic_mux; | 826 | spec->input_mux = &cmi9880_basic_mux; |
825 | if (get_defcfg_connect(port_spdifo) != 1) | 827 | if (get_defcfg_connect(port_spdifo) != AC_JACK_PORT_NONE) |
826 | spec->multiout.dig_out_nid = CMI_DIG_OUT_NID; | 828 | spec->multiout.dig_out_nid = CMI_DIG_OUT_NID; |
827 | if (get_defcfg_connect(port_spdifi) != 1) | 829 | if (get_defcfg_connect(port_spdifi) != AC_JACK_PORT_NONE) |
828 | spec->dig_in_nid = CMI_DIG_IN_NID; | 830 | spec->dig_in_nid = CMI_DIG_IN_NID; |
831 | spec->multiout.max_channels = 8; | ||
829 | } | 832 | } |
830 | spec->multiout.max_channels = cmi9880_get_multich_pins(codec); | 833 | max_channels = cmi9880_get_multich_pins(codec); |
831 | cmi9880_fill_multi_dac_nids(codec); | 834 | if (max_channels > 0) { |
832 | cmi9880_fill_multi_init(codec); | 835 | spec->multiout.max_channels = max_channels; |
833 | } | 836 | cmi9880_fill_multi_dac_nids(codec); |
837 | cmi9880_fill_multi_init(codec); | ||
838 | } else | ||
839 | snd_printd("patch_cmedia: cannot detect association in defcfg\n"); | ||
834 | break; | 840 | break; |
841 | } | ||
835 | } | 842 | } |
836 | 843 | ||
837 | spec->multiout.num_dacs = 4; | 844 | spec->multiout.num_dacs = 4; |