alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Moise Gergaud <moise.gergaud@st.com>
To: arnaud.pouliquen@st.com, alsa-devel@alsa-project.org,
	broonie@kernel.org, lgirdwood@gmail.com, tiwai@suse.de
Cc: Moise Gergaud <moise.gergaud@st.com>
Subject: [PATCH 4/4] ASoC: sti: reset iec60958 settings on close
Date: Thu, 19 Nov 2015 14:54:10 +0100	[thread overview]
Message-ID: <1447941250-344-5-git-send-email-moise.gergaud@st.com> (raw)
In-Reply-To: <1447941250-344-1-git-send-email-moise.gergaud@st.com>

Reset IEC 60958 settings for next PCM session.

Signed-off-by: Moise Gergaud <moise.gergaud@st.com>
Acked-by: Arnaud Pouliquen <arnaud.pouliquen@st.com>
---
 sound/soc/sti/uniperif_player.c | 41 ++++++++++++++++++++++++-----------------
 1 file changed, 24 insertions(+), 17 deletions(-)

diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c
index 5c2bc53..b73e348 100644
--- a/sound/soc/sti/uniperif_player.c
+++ b/sound/soc/sti/uniperif_player.c
@@ -64,6 +64,23 @@ static const struct snd_pcm_hardware uni_player_pcm_hw = {
 	.buffer_bytes_max = 256 * PAGE_SIZE
 };
 
+static inline void reset_iec958_settings(struct uniperif *player)
+{
+	struct snd_aes_iec958 *iec958 = &player->stream_settings.iec958;
+
+	memset(iec958->status, 0, sizeof(iec958->status));
+
+	/* Broadcast reception category */
+	iec958->status[1] = IEC958_AES1_CON_GENERAL;
+	/* Do not take into account source or channel number */
+	iec958->status[2] = IEC958_AES2_CON_SOURCE_UNSPEC;
+	/* Sampling frequency not indicated */
+	iec958->status[3] = IEC958_AES3_CON_FS_NOTID;
+	/* Max sample word 24-bit, sample word length not indicated */
+	iec958->status[4] = IEC958_AES4_CON_MAX_WORDLEN_24 |
+			    IEC958_AES4_CON_WORDLEN_24_20;
+}
+
 static inline int reset_player(struct uniperif *player)
 {
 	int count = 10;
@@ -947,6 +964,11 @@ static void uni_player_shutdown(struct snd_pcm_substream *substream,
 {
 	struct sti_uniperiph_data *priv = snd_soc_dai_get_drvdata(dai);
 	struct uniperif *player = priv->dai_data.uni;
+	/*
+	 * Set default iec958 status bits done in close to allow to set
+	 * iec settings before next open pcm session
+	 */
+	reset_iec958_settings(player);
 
 	if (player->state != UNIPERIF_STATE_STOPPED)
 		/* Stop the player */
@@ -1089,23 +1111,8 @@ int uni_player_init(struct platform_device *pdev,
 	SET_UNIPERIF_CONFIG_IDLE_MOD_DISABLE(player);
 
 	if (UNIPERIF_PLAYER_TYPE_IS_IEC958(player)) {
-		/* Set default iec958 status bits  */
-
-		/* Consumer, PCM, copyright, 2ch, mode 0 */
-		player->stream_settings.iec958.status[0] = 0x00;
-		/* Broadcast reception category */
-		player->stream_settings.iec958.status[1] =
-					IEC958_AES1_CON_GENERAL;
-		/* Do not take into account source or channel number */
-		player->stream_settings.iec958.status[2] =
-					IEC958_AES2_CON_SOURCE_UNSPEC;
-		/* Sampling frequency not indicated */
-		player->stream_settings.iec958.status[3] =
-					IEC958_AES3_CON_FS_NOTID;
-		/* Max sample word 24-bit, sample word length not indicated */
-		player->stream_settings.iec958.status[4] =
-					IEC958_AES4_CON_MAX_WORDLEN_24 |
-					IEC958_AES4_CON_WORDLEN_24_20;
+		/* Set default iec958 status bits */
+		reset_iec958_settings(player);
 
 		player->num_ctrls = ARRAY_SIZE(snd_sti_iec_ctl);
 		player->snd_ctrls = snd_sti_iec_ctl[0];
-- 
1.9.1

  parent reply	other threads:[~2015-11-19 13:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-19 13:54 [PATCH 0/4] ASoC sti: corrections Moise Gergaud
2015-11-19 13:54 ` [PATCH 1/4] ASoC: sti: remove wrong error message Moise Gergaud
2015-11-19 19:56   ` Applied "ASoC: sti: remove wrong error message" to the asoc tree Mark Brown
2015-11-19 13:54 ` [PATCH 2/4] ASoC: sti: rename ST proprietary DT properties Moise Gergaud
2015-11-19 19:56   ` Applied "ASoC: sti: rename ST proprietary DT properties" to the asoc tree Mark Brown
2015-11-19 13:54 ` [PATCH 3/4] ASoC: sti: set player private data Moise Gergaud
2015-11-19 19:56   ` Applied "ASoC: sti: set player private data" to the asoc tree Mark Brown
2015-11-19 13:54 ` Moise Gergaud [this message]
2015-11-19 17:50   ` [PATCH 4/4] ASoC: sti: reset iec60958 settings on close Mark Brown
2015-11-20  9:11     ` Moise Gergaud
2015-11-21 12:45       ` Mark Brown
2015-11-23  8:50         ` Moise Gergaud

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1447941250-344-5-git-send-email-moise.gergaud@st.com \
    --to=moise.gergaud@st.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=arnaud.pouliquen@st.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).