Skip to content

Commit

Permalink
ALSA: hda: document state machine for hdac_streams
Browse files Browse the repository at this point in the history
The code in this library is far from self-explanatory, hopefully this
state diagram reverse-engineered from the code will help others
understand the expected transitions.

Signed-off-by: Pierre-Louis Bossart <[email protected]>
Reviewed-by: Bard Liao <[email protected]>
Reviewed-by: Péter Ujfalusi <[email protected]>
Reviewed-by: Kai Vehmanen <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
plbossart authored and tiwai committed Sep 20, 2022
1 parent 2ea13c8 commit ea2ddd2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions sound/hda/hdac_stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,39 @@
#include <sound/hda_register.h>
#include "trace.h"

/*
* the hdac_stream library is intended to be used with the following
* transitions. The states are not formally defined in the code but loosely
* inspired by boolean variables. Note that the 'prepared' field is not used
* in this library but by the callers during the hw_params/prepare transitions
*
* |
* stream_init() |
* v
* +--+-------+
* | unused |
* +--+----+--+
* | ^
* stream_assign() | | stream_release()
* v |
* +--+----+--+
* | opened |
* +--+----+--+
* | ^
* stream_reset() | |
* stream_setup() | | stream_cleanup()
* v |
* +--+----+--+
* | prepared |
* +--+----+--+
* | ^
* stream_start() | | stream_stop()
* v |
* +--+----+--+
* | running |
* +----------+
*/

/**
* snd_hdac_get_stream_stripe_ctl - get stripe control value
* @bus: HD-audio core bus
Expand Down

0 comments on commit ea2ddd2

Please sign in to comment.