diff options
| -rw-r--r-- | sound/pci/hda/patch_ca0132.c | 66 |
1 files changed, 7 insertions, 59 deletions
diff --git a/sound/pci/hda/patch_ca0132.c b/sound/pci/hda/patch_ca0132.c index 54d14793725a..0aa72ee38d03 100644 --- a/sound/pci/hda/patch_ca0132.c +++ b/sound/pci/hda/patch_ca0132.c | |||
| @@ -2662,60 +2662,6 @@ static bool dspload_wait_loaded(struct hda_codec *codec) | |||
| 2662 | } | 2662 | } |
| 2663 | 2663 | ||
| 2664 | /* | 2664 | /* |
| 2665 | * PCM stuffs | ||
| 2666 | */ | ||
| 2667 | static void ca0132_setup_stream(struct hda_codec *codec, hda_nid_t nid, | ||
| 2668 | u32 stream_tag, | ||
| 2669 | int channel_id, int format) | ||
| 2670 | { | ||
| 2671 | unsigned int oldval, newval; | ||
| 2672 | |||
| 2673 | if (!nid) | ||
| 2674 | return; | ||
| 2675 | |||
| 2676 | snd_printdd( | ||
| 2677 | "ca0132_setup_stream: NID=0x%x, stream=0x%x, " | ||
| 2678 | "channel=%d, format=0x%x\n", | ||
| 2679 | nid, stream_tag, channel_id, format); | ||
| 2680 | |||
| 2681 | /* update the format-id if changed */ | ||
| 2682 | oldval = snd_hda_codec_read(codec, nid, 0, | ||
| 2683 | AC_VERB_GET_STREAM_FORMAT, | ||
| 2684 | 0); | ||
| 2685 | if (oldval != format) { | ||
| 2686 | msleep(20); | ||
| 2687 | snd_hda_codec_write(codec, nid, 0, | ||
| 2688 | AC_VERB_SET_STREAM_FORMAT, | ||
| 2689 | format); | ||
| 2690 | } | ||
| 2691 | |||
| 2692 | oldval = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); | ||
| 2693 | newval = (stream_tag << 4) | channel_id; | ||
| 2694 | if (oldval != newval) { | ||
| 2695 | snd_hda_codec_write(codec, nid, 0, | ||
| 2696 | AC_VERB_SET_CHANNEL_STREAMID, | ||
| 2697 | newval); | ||
| 2698 | } | ||
| 2699 | } | ||
| 2700 | |||
| 2701 | static void ca0132_cleanup_stream(struct hda_codec *codec, hda_nid_t nid) | ||
| 2702 | { | ||
| 2703 | unsigned int val; | ||
| 2704 | |||
| 2705 | if (!nid) | ||
| 2706 | return; | ||
| 2707 | |||
| 2708 | snd_printdd(KERN_INFO "ca0132_cleanup_stream: NID=0x%x\n", nid); | ||
| 2709 | |||
| 2710 | val = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0); | ||
| 2711 | if (!val) | ||
| 2712 | return; | ||
| 2713 | |||
| 2714 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_STREAM_FORMAT, 0); | ||
| 2715 | snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CHANNEL_STREAMID, 0); | ||
| 2716 | } | ||
| 2717 | |||
| 2718 | /* | ||
| 2719 | * PCM callbacks | 2665 | * PCM callbacks |
| 2720 | */ | 2666 | */ |
| 2721 | static int ca0132_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | 2667 | static int ca0132_playback_pcm_prepare(struct hda_pcm_stream *hinfo, |
| @@ -2726,7 +2672,7 @@ static int ca0132_playback_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
| 2726 | { | 2672 | { |
| 2727 | struct ca0132_spec *spec = codec->spec; | 2673 | struct ca0132_spec *spec = codec->spec; |
| 2728 | 2674 | ||
| 2729 | ca0132_setup_stream(codec, spec->dacs[0], stream_tag, 0, format); | 2675 | snd_hda_codec_setup_stream(codec, spec->dacs[0], stream_tag, 0, format); |
| 2730 | 2676 | ||
| 2731 | return 0; | 2677 | return 0; |
| 2732 | } | 2678 | } |
| @@ -2745,7 +2691,7 @@ static int ca0132_playback_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
| 2745 | if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) | 2691 | if (spec->effects_switch[PLAY_ENHANCEMENT - EFFECT_START_NID]) |
| 2746 | msleep(50); | 2692 | msleep(50); |
| 2747 | 2693 | ||
| 2748 | ca0132_cleanup_stream(codec, spec->dacs[0]); | 2694 | snd_hda_codec_cleanup_stream(codec, spec->dacs[0]); |
| 2749 | 2695 | ||
| 2750 | return 0; | 2696 | return 0; |
| 2751 | } | 2697 | } |
| @@ -2824,8 +2770,8 @@ static int ca0132_capture_pcm_prepare(struct hda_pcm_stream *hinfo, | |||
| 2824 | { | 2770 | { |
| 2825 | struct ca0132_spec *spec = codec->spec; | 2771 | struct ca0132_spec *spec = codec->spec; |
| 2826 | 2772 | ||
| 2827 | ca0132_setup_stream(codec, spec->adcs[substream->number], | 2773 | snd_hda_codec_setup_stream(codec, spec->adcs[substream->number], |
| 2828 | stream_tag, 0, format); | 2774 | stream_tag, 0, format); |
| 2829 | 2775 | ||
| 2830 | return 0; | 2776 | return 0; |
| 2831 | } | 2777 | } |
| @@ -2839,7 +2785,7 @@ static int ca0132_capture_pcm_cleanup(struct hda_pcm_stream *hinfo, | |||
| 2839 | if (spec->dsp_state == DSP_DOWNLOADING) | 2785 | if (spec->dsp_state == DSP_DOWNLOADING) |
| 2840 | return 0; | 2786 | return 0; |
| 2841 | 2787 | ||
| 2842 | ca0132_cleanup_stream(codec, hinfo->nid); | 2788 | snd_hda_codec_cleanup_stream(codec, hinfo->nid); |
| 2843 | return 0; | 2789 | return 0; |
| 2844 | } | 2790 | } |
| 2845 | 2791 | ||
| @@ -4742,6 +4688,8 @@ static int patch_ca0132(struct hda_codec *codec) | |||
| 4742 | return err; | 4688 | return err; |
| 4743 | 4689 | ||
| 4744 | codec->patch_ops = ca0132_patch_ops; | 4690 | codec->patch_ops = ca0132_patch_ops; |
| 4691 | codec->pcm_format_first = 1; | ||
| 4692 | codec->no_sticky_stream = 1; | ||
| 4745 | 4693 | ||
| 4746 | return 0; | 4694 | return 0; |
| 4747 | } | 4695 | } |
