Skip to content

Commit

Permalink
ALSA: hda - Add snd_hda_multi_out_dig_cleanup()
Browse files Browse the repository at this point in the history
Added the helper function snd_hda_multi_out_dig_cleanup() to clean up
the digital outputs with multi setup.  This call is needed in cases
the codec supports multiple digital outputs as slaves.  Otherwise the
slave widgets aren't properly cleaned up.

For a single digital output (e.g. in patch_conexant.c), this call isn't
needed.

Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Feb 13, 2009
1 parent 3a08e30 commit 9411e21
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
10 changes: 10 additions & 0 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -3088,6 +3088,16 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
}
EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_prepare);

int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec,
struct hda_multi_out *mout)
{
mutex_lock(&codec->spdif_mutex);
cleanup_dig_out_stream(codec, mout->dig_out_nid);
mutex_unlock(&codec->spdif_mutex);
return 0;
}
EXPORT_SYMBOL_HDA(snd_hda_multi_out_dig_cleanup);

/*
* release the digital out
*/
Expand Down
2 changes: 2 additions & 0 deletions sound/pci/hda/hda_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ int snd_hda_multi_out_dig_prepare(struct hda_codec *codec,
unsigned int stream_tag,
unsigned int format,
struct snd_pcm_substream *substream);
int snd_hda_multi_out_dig_cleanup(struct hda_codec *codec,
struct hda_multi_out *mout);
int snd_hda_multi_out_analog_open(struct hda_codec *codec,
struct hda_multi_out *mout,
struct snd_pcm_substream *substream,
Expand Down
11 changes: 10 additions & 1 deletion sound/pci/hda/patch_analog.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,14 @@ static int ad198x_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
format, substream);
}

static int ad198x_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
struct hda_codec *codec,
struct snd_pcm_substream *substream)
{
struct ad198x_spec *spec = codec->spec;
return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
}

/*
* Analog capture
*/
Expand Down Expand Up @@ -333,7 +341,8 @@ static struct hda_pcm_stream ad198x_pcm_digital_playback = {
.ops = {
.open = ad198x_dig_playback_pcm_open,
.close = ad198x_dig_playback_pcm_close,
.prepare = ad198x_dig_playback_pcm_prepare
.prepare = ad198x_dig_playback_pcm_prepare,
.cleanup = ad198x_dig_playback_pcm_cleanup
},
};

Expand Down
11 changes: 10 additions & 1 deletion sound/pci/hda/patch_sigmatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2442,6 +2442,14 @@ static int stac92xx_dig_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
stream_tag, format, substream);
}

static int stac92xx_dig_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
struct hda_codec *codec,
struct snd_pcm_substream *substream)
{
struct sigmatel_spec *spec = codec->spec;
return snd_hda_multi_out_dig_cleanup(codec, &spec->multiout);
}


/*
* Analog capture callbacks
Expand Down Expand Up @@ -2486,7 +2494,8 @@ static struct hda_pcm_stream stac92xx_pcm_digital_playback = {
.ops = {
.open = stac92xx_dig_playback_pcm_open,
.close = stac92xx_dig_playback_pcm_close,
.prepare = stac92xx_dig_playback_pcm_prepare
.prepare = stac92xx_dig_playback_pcm_prepare,
.cleanup = stac92xx_dig_playback_pcm_cleanup
},
};

Expand Down

0 comments on commit 9411e21

Please sign in to comment.