aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_via.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_via.c')
-rw-r--r--sound/pci/hda/patch_via.c74
1 files changed, 41 insertions, 33 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 4ebfbd874c9..431c0d417ee 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -49,6 +49,7 @@
49#include <linux/init.h> 49#include <linux/init.h>
50#include <linux/delay.h> 50#include <linux/delay.h>
51#include <linux/slab.h> 51#include <linux/slab.h>
52#include <linux/module.h>
52#include <sound/core.h> 53#include <sound/core.h>
53#include <sound/asoundef.h> 54#include <sound/asoundef.h>
54#include "hda_codec.h" 55#include "hda_codec.h"
@@ -1506,39 +1507,49 @@ static int via_build_pcms(struct hda_codec *codec)
1506 struct via_spec *spec = codec->spec; 1507 struct via_spec *spec = codec->spec;
1507 struct hda_pcm *info = spec->pcm_rec; 1508 struct hda_pcm *info = spec->pcm_rec;
1508 1509
1509 codec->num_pcms = 1; 1510 codec->num_pcms = 0;
1510 codec->pcm_info = info; 1511 codec->pcm_info = info;
1511 1512
1512 snprintf(spec->stream_name_analog, sizeof(spec->stream_name_analog), 1513 if (spec->multiout.num_dacs || spec->num_adc_nids) {
1513 "%s Analog", codec->chip_name); 1514 snprintf(spec->stream_name_analog,
1514 info->name = spec->stream_name_analog; 1515 sizeof(spec->stream_name_analog),
1516 "%s Analog", codec->chip_name);
1517 info->name = spec->stream_name_analog;
1515 1518
1516 if (!spec->stream_analog_playback) 1519 if (spec->multiout.num_dacs) {
1517 spec->stream_analog_playback = &via_pcm_analog_playback; 1520 if (!spec->stream_analog_playback)
1518 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = 1521 spec->stream_analog_playback =
1519 *spec->stream_analog_playback; 1522 &via_pcm_analog_playback;
1520 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 1523 info->stream[SNDRV_PCM_STREAM_PLAYBACK] =
1521 spec->multiout.dac_nids[0]; 1524 *spec->stream_analog_playback;
1522 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 1525 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
1523 spec->multiout.max_channels; 1526 spec->multiout.dac_nids[0];
1527 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =
1528 spec->multiout.max_channels;
1529 }
1524 1530
1525 if (!spec->stream_analog_capture) { 1531 if (!spec->stream_analog_capture) {
1526 if (spec->dyn_adc_switch) 1532 if (spec->dyn_adc_switch)
1527 spec->stream_analog_capture = 1533 spec->stream_analog_capture =
1528 &via_pcm_dyn_adc_analog_capture; 1534 &via_pcm_dyn_adc_analog_capture;
1529 else 1535 else
1530 spec->stream_analog_capture = &via_pcm_analog_capture; 1536 spec->stream_analog_capture =
1537 &via_pcm_analog_capture;
1538 }
1539 if (spec->num_adc_nids) {
1540 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
1541 *spec->stream_analog_capture;
1542 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
1543 spec->adc_nids[0];
1544 if (!spec->dyn_adc_switch)
1545 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
1546 spec->num_adc_nids;
1547 }
1548 codec->num_pcms++;
1549 info++;
1531 } 1550 }
1532 info->stream[SNDRV_PCM_STREAM_CAPTURE] =
1533 *spec->stream_analog_capture;
1534 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
1535 if (!spec->dyn_adc_switch)
1536 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams =
1537 spec->num_adc_nids;
1538 1551
1539 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 1552 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
1540 codec->num_pcms++;
1541 info++;
1542 snprintf(spec->stream_name_digital, 1553 snprintf(spec->stream_name_digital,
1543 sizeof(spec->stream_name_digital), 1554 sizeof(spec->stream_name_digital),
1544 "%s Digital", codec->chip_name); 1555 "%s Digital", codec->chip_name);
@@ -1562,17 +1573,19 @@ static int via_build_pcms(struct hda_codec *codec)
1562 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 1573 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
1563 spec->dig_in_nid; 1574 spec->dig_in_nid;
1564 } 1575 }
1576 codec->num_pcms++;
1577 info++;
1565 } 1578 }
1566 1579
1567 if (spec->hp_dac_nid) { 1580 if (spec->hp_dac_nid) {
1568 codec->num_pcms++;
1569 info++;
1570 snprintf(spec->stream_name_hp, sizeof(spec->stream_name_hp), 1581 snprintf(spec->stream_name_hp, sizeof(spec->stream_name_hp),
1571 "%s HP", codec->chip_name); 1582 "%s HP", codec->chip_name);
1572 info->name = spec->stream_name_hp; 1583 info->name = spec->stream_name_hp;
1573 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = via_pcm_hp_playback; 1584 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = via_pcm_hp_playback;
1574 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 1585 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
1575 spec->hp_dac_nid; 1586 spec->hp_dac_nid;
1587 codec->num_pcms++;
1588 info++;
1576 } 1589 }
1577 return 0; 1590 return 0;
1578} 1591}
@@ -3688,13 +3701,8 @@ static const struct hda_verb vt1812_init_verbs[] = {
3688static void set_widgets_power_state_vt1812(struct hda_codec *codec) 3701static void set_widgets_power_state_vt1812(struct hda_codec *codec)
3689{ 3702{
3690 struct via_spec *spec = codec->spec; 3703 struct via_spec *spec = codec->spec;
3691 int imux_is_smixer =
3692 snd_hda_codec_read(codec, 0x13, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 3;
3693 unsigned int parm; 3704 unsigned int parm;
3694 unsigned int present; 3705 unsigned int present;
3695 /* MUX10 (1eh) = stereo mixer */
3696 imux_is_smixer =
3697 snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 5;
3698 /* inputs */ 3706 /* inputs */
3699 /* PW 5/6/7 (29h/2ah/2bh) */ 3707 /* PW 5/6/7 (29h/2ah/2bh) */
3700 parm = AC_PWRST_D3; 3708 parm = AC_PWRST_D3;