From patchwork Wed Dec 2 14:22:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Moise Gergaud X-Patchwork-Id: 7747421 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 85E1E9F350 for ; Wed, 2 Dec 2015 14:23:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C017A20571 for ; Wed, 2 Dec 2015 14:23:45 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 36D2220631 for ; Wed, 2 Dec 2015 14:23:39 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C7F3C266662; Wed, 2 Dec 2015 15:23:37 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,FUZZY_AMBIEN, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 94A51261B0A; Wed, 2 Dec 2015 15:22:35 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4E6B2265091; Wed, 2 Dec 2015 15:22:34 +0100 (CET) Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by alsa0.perex.cz (Postfix) with ESMTP id 806CD261B0A for ; Wed, 2 Dec 2015 15:22:29 +0100 (CET) Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx08-00178001.pphosted.com (8.14.5/8.14.5) with SMTP id tB2EJhTx010107; Wed, 2 Dec 2015 15:22:29 +0100 Received: from beta.dmz-ap.st.com (beta.dmz-ap.st.com [138.198.100.35]) by mx08-00178001.pphosted.com with ESMTP id 1yh4j6j00f-1 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 02 Dec 2015 15:22:29 +0100 Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 46FB122; Wed, 2 Dec 2015 14:22:24 +0000 (GMT) Received: from Webmail-ap.st.com (eapex1hubcas1.st.com [10.80.176.8]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id DB52D217; Wed, 2 Dec 2015 14:22:22 +0000 (GMT) Received: from localhost (10.201.23.28) by Webmail-ap.st.com (10.80.176.7) with Microsoft SMTP Server (TLS) id 8.3.389.2; Wed, 2 Dec 2015 22:22:21 +0800 From: Moise Gergaud To: , , , , , Date: Wed, 2 Dec 2015 15:22:06 +0100 Message-ID: <1449066126-19431-4-git-send-email-moise.gergaud@st.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1449066126-19431-1-git-send-email-moise.gergaud@st.com> References: <1449066126-19431-1-git-send-email-moise.gergaud@st.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.15.21, 1.0.33, 0.0.0000 definitions=2015-12-02_09:2015-12-02, 2015-12-02, 1970-01-01 signatures=0 Cc: Moise Gergaud Subject: [alsa-devel] [PATCH 3/3] ASoC: sti: correction for HBRA (High Bit Rate Audio) support X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Detect HBRA based on rate and channels used in the pcm session In case of HBRA: - CH_STS repeat is disabled - channel status sampling freq is not set if already set (because it can be a multiple of the runtime rate) Signed-off-by: Moise Gergaud Acked-by: Arnaud Pouliquen --- sound/soc/sti/uniperif_player.c | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/sound/soc/sti/uniperif_player.c b/sound/soc/sti/uniperif_player.c index b55e412..cf99dee 100644 --- a/sound/soc/sti/uniperif_player.c +++ b/sound/soc/sti/uniperif_player.c @@ -246,16 +246,39 @@ static void uni_player_set_channel_status(struct uniperif *player, int n; unsigned int status; unsigned char *aes = player->stream_settings.iec958.status; + const unsigned int cs_rate[] = { + 44100, 0, 48000, 32000, 22050, 24000, + 88200, 768000, 176400, 192000 + }; /* * Some AVRs and TVs require the channel status to contain a correct - * sampling frequency. If no sample rate is already specified, then - * set one. + * sampling freq. + * In case of HBRA is not detected: + * set the channel status sampling freq + * In case of HBRA is detected: + * channel status sampling freq is already set; it can be a multiple + * of runtime rate + * + * HBRA is detected when: + * runtime channels is 8 and runtime->rate < channel status rate */ + mutex_lock(&player->ctrl_lock); - /* update channel status sampling freq */ - snd_pcm_update_iec958_consumer(runtime, aes, 4); + if ((runtime->channels == 8) && + (runtime->rate < cs_rate[aes[3] & IEC958_AES3_CON_FS])) { + /* + * Consecutive frames repetition of Z preamble needs to be + * disabled in case of HBRA + */ + SET_UNIPERIF_CONFIG_REPEAT_CHL_STS_DISABLE(player); + } else { + SET_UNIPERIF_CONFIG_REPEAT_CHL_STS_ENABLE(player); + + /* update channel status sampling freq */ + snd_pcm_update_iec958_consumer(runtime, aes, 4); + } /* Audio mode: * Use audio mode status to select PCM or encoded mode @@ -358,9 +381,6 @@ static int uni_player_prepare_iec958(struct uniperif *player, /* Disable one-bit audio mode */ SET_UNIPERIF_CONFIG_ONE_BIT_AUD_DISABLE(player); - /* Enable consecutive frames repetition of Z preamble (not for HBRA) */ - SET_UNIPERIF_CONFIG_REPEAT_CHL_STS_ENABLE(player); - /* Change to SUF0_SUBF1 and left/right channels swap! */ SET_UNIPERIF_CONFIG_SUBFRAME_SEL_SUBF1_SUBF0(player);