From patchwork Sun Jun 15 23:56:42 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 4355581 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC4E4BEEAA for ; Sun, 15 Jun 2014 23:57:40 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B52D2022D for ; Sun, 15 Jun 2014 23:57:39 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 3CE0B2020E for ; Sun, 15 Jun 2014 23:57:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C765426530B; Mon, 16 Jun 2014 01:57:31 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 74D2E2652E3; Mon, 16 Jun 2014 01:57:21 +0200 (CEST) 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 518032652E6; Mon, 16 Jun 2014 01:57:19 +0200 (CEST) Received: from mail3.ippnet.fi (mail3.ippnet.fi [62.197.168.3]) by alsa0.perex.cz (Postfix) with ESMTP id 4058F2652DA for ; Mon, 16 Jun 2014 01:57:11 +0200 (CEST) Received: from localhost (localhost.localdomain [127.0.0.1]) by mail3.ippnet.fi (Postfix) with ESMTP id 1337D5D8A0; Mon, 16 Jun 2014 02:58:50 +0300 (EEST) X-Virus-Scanned: amavisd-new at kemia.fi Received: from mail3.ippnet.fi ([127.0.0.1]) by localhost (kone16815.ippnet.fi [127.0.0.1]) (amavisd-new, port 10030) with ESMTP id tFEXqHvkK62R; Mon, 16 Jun 2014 02:58:45 +0300 (EEST) Received: from webmail.tpnet.fi (webmail.tpnet.fi [62.106.63.33]) by mail3.ippnet.fi (Postfix) with ESMTP id 77FA05D630; Mon, 16 Jun 2014 02:58:45 +0300 (EEST) Received: from mail.onse.fi (host-109-204-178-176.tp-fne.tampereenpuhelin.net [109.204.178.176]) by webmail.tpnet.fi (Postfix) with ESMTP id AA66A2073D; Mon, 16 Jun 2014 02:57:04 +0300 (EEST) Received: by mail.onse.fi (Postfix, from userid 501) id 8D618403C9; Mon, 16 Jun 2014 02:57:04 +0300 (EEST) From: Anssi Hannula To: Mark Brown Date: Mon, 16 Jun 2014 02:56:42 +0300 Message-Id: <1402876602-2942-2-git-send-email-anssi.hannula@iki.fi> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1402876602-2942-1-git-send-email-anssi.hannula@iki.fi> References: <1402876602-2942-1-git-send-email-anssi.hannula@iki.fi> Cc: alsa-devel@alsa-project.org, Nicolin Chen Subject: [alsa-devel] [PATCH 2/2] ASoC: fsl_spdif: Add support for output sample rates 96kHz and 192kHz 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for the output sample rates 96kHz and 192kHz. Tested with a Cubox-i imx6 system and an Onkyo TX-SR607 receiver. Signed-off-by: Anssi Hannula Cc: Nicolin Chen Acked-by: Nicolin Chen --- Unless there was some special reason to not have this? It seems to work at least. sound/soc/fsl/fsl_spdif.c | 14 +++++++++++--- sound/soc/fsl/fsl_spdif.h | 8 ++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index b912d45a2a4c..71f6a117f46e 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -96,7 +96,7 @@ struct fsl_spdif_priv { struct platform_device *pdev; struct regmap *regmap; bool dpll_locked; - u16 txrate[SPDIF_TXRATE_MAX]; + u32 txrate[SPDIF_TXRATE_MAX]; u8 txclk_df[SPDIF_TXRATE_MAX]; u8 sysclk_df[SPDIF_TXRATE_MAX]; u8 txclk_src[SPDIF_TXRATE_MAX]; @@ -390,6 +390,14 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream, rate = SPDIF_TXRATE_48000; csfs = IEC958_AES3_CON_FS_48000; break; + case 96000: + rate = SPDIF_TXRATE_96000; + csfs = IEC958_AES3_CON_FS_96000; + break; + case 192000: + rate = SPDIF_TXRATE_192000; + csfs = IEC958_AES3_CON_FS_192000; + break; default: dev_err(&pdev->dev, "unsupported sample rate %d\n", sample_rate); return -EINVAL; @@ -1046,7 +1054,7 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, struct clk *clk, u64 savesub, enum spdif_txrate index, bool round) { - const u32 rate[] = { 32000, 44100, 48000 }; + const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; bool is_sysclk = clk == spdif_priv->sysclk; u64 rate_ideal, rate_actual, sub; u32 sysclk_dfmin, sysclk_dfmax; @@ -1105,7 +1113,7 @@ out: static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv, enum spdif_txrate index) { - const u32 rate[] = { 32000, 44100, 48000 }; + const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; struct platform_device *pdev = spdif_priv->pdev; struct device *dev = &pdev->dev; u64 savesub = 100000, ret; diff --git a/sound/soc/fsl/fsl_spdif.h b/sound/soc/fsl/fsl_spdif.h index 16fde4b927d3..5f5a3c41db25 100644 --- a/sound/soc/fsl/fsl_spdif.h +++ b/sound/soc/fsl/fsl_spdif.h @@ -164,8 +164,10 @@ enum spdif_txrate { SPDIF_TXRATE_32000 = 0, SPDIF_TXRATE_44100, SPDIF_TXRATE_48000, + SPDIF_TXRATE_96000, + SPDIF_TXRATE_192000, }; -#define SPDIF_TXRATE_MAX (SPDIF_TXRATE_48000 + 1) +#define SPDIF_TXRATE_MAX (SPDIF_TXRATE_192000 + 1) #define SPDIF_CSTATUS_BYTE 6 @@ -175,7 +177,9 @@ enum spdif_txrate { #define FSL_SPDIF_RATES_PLAYBACK (SNDRV_PCM_RATE_32000 | \ SNDRV_PCM_RATE_44100 | \ - SNDRV_PCM_RATE_48000) + SNDRV_PCM_RATE_48000 | \ + SNDRV_PCM_RATE_96000 | \ + SNDRV_PCM_RATE_192000) #define FSL_SPDIF_RATES_CAPTURE (SNDRV_PCM_RATE_16000 | \ SNDRV_PCM_RATE_32000 | \