Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4666230pxu; Tue, 13 Oct 2020 04:22:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxXM+EQIsczmD5oRPis6ecwhVMa1NyiHjxi6EMSIFGG/bql+/4wVLYtpbzidlX069JDA1kn X-Received: by 2002:a17:906:9394:: with SMTP id l20mr33073812ejx.40.1602588156090; Tue, 13 Oct 2020 04:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602588156; cv=none; d=google.com; s=arc-20160816; b=V4jop9b/LtYzDfUehtHSlbkfRiinNoL0nvYg89S1B8JIS40TkUldfA8/RcVYV3QnST duXGd7ZpuL50OsmE1sraQryHRpD69WyxATsGRcdS4eSHHzKtWmFtoi5ktRNj4F/S4bdc hQIW4WJiQQtTTfL9byMSvYJBSHcw1F2oCsp+g/UvEBDolyjT3cNLzZhsR9O92kZhGavZ d/cEtpO3eqCLxyXrZpBQhhsrzcOvvWwlcS6DLbgxWONkiWaJCOJ0a7o/9LtToktJXGtY WjvQAFmllzJg0/N7K78sxlmIjyLiXVY3/YoIHQIy4xG5VW+Jz6TvEHOLPb5Mdi7QDtfm ETMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=sTc5SKlOF1v2HN2D8DTDiA4ZUomHFci1BdHQUFYPwwU=; b=w8164TlUrDjvYb2QkQvfFmibegpeLa8Gk9bMi3EwkFkAqDn75OLReFuAi1wgmcDhTs VpVk3SNexo1AzqTG8y3vv2LWWfIKtnreoOY3KqSjN43y25jYk/Y4j+aQgP9J8vmL3AUJ NpbbyTG1jpE7kX+HNZVTrtY/k+wBk73vEHRf36XO8eQBCRfo0m4LRTNgpUjcsZqhQbWb RmLPkK5n66GjjomwcNFlxjQhVYu10+Dm4ddMM1YOeYywbNHLhTxuuIm+4Wcjuox56ug8 yola6GogGQs7Wo4q/ItsUUl9li2PtQpbarw4ucRIH7itvWHX4CSxIH62uBESXdKgH4iJ ZDxw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dp7si14016231ejc.115.2020.10.13.04.22.13; Tue, 13 Oct 2020 04:22:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728276AbgJMCyM (ORCPT + 99 others); Mon, 12 Oct 2020 22:54:12 -0400 Received: from inva020.nxp.com ([92.121.34.13]:56606 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728051AbgJMCyL (ORCPT ); Mon, 12 Oct 2020 22:54:11 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id A759C1A1507; Tue, 13 Oct 2020 04:54:09 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 69EA91A1516; Tue, 13 Oct 2020 04:54:05 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 19B7F40332; Tue, 13 Oct 2020 04:53:58 +0200 (CEST) From: Shengjiu Wang To: timur@kernel.org, nicoleotsuka@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ASoC: fsl_spdif: Add support for higher sample rates Date: Tue, 13 Oct 2020 10:49:20 +0800 Message-Id: <1602557360-18795-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add 88200Hz and 176400Hz sample rates support for TX. Add 88200Hz, 176400Hz, 192000Hz sample rates support for RX. Signed-off-by: Viorel Suman Signed-off-by: Shengjiu Wang Acked-by: Nicolin Chen --- changes in v2 - reorder the signed-off - add acked-by Nicolin sound/soc/fsl/fsl_spdif.c | 16 +++++++++++++--- sound/soc/fsl/fsl_spdif.h | 9 ++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/sound/soc/fsl/fsl_spdif.c b/sound/soc/fsl/fsl_spdif.c index 4d14f4076ead..1c030142556a 100644 --- a/sound/soc/fsl/fsl_spdif.c +++ b/sound/soc/fsl/fsl_spdif.c @@ -459,10 +459,18 @@ static int spdif_set_sample_rate(struct snd_pcm_substream *substream, rate = SPDIF_TXRATE_48000; csfs = IEC958_AES3_CON_FS_48000; break; + case 88200: + rate = SPDIF_TXRATE_88200; + csfs = IEC958_AES3_CON_FS_88200; + break; case 96000: rate = SPDIF_TXRATE_96000; csfs = IEC958_AES3_CON_FS_96000; break; + case 176400: + rate = SPDIF_TXRATE_176400; + csfs = IEC958_AES3_CON_FS_176400; + break; case 192000: rate = SPDIF_TXRATE_192000; csfs = IEC958_AES3_CON_FS_192000; @@ -857,7 +865,7 @@ static int fsl_spdif_rxrate_info(struct snd_kcontrol *kcontrol, uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 1; uinfo->value.integer.min = 16000; - uinfo->value.integer.max = 96000; + uinfo->value.integer.max = 192000; return 0; } @@ -1175,7 +1183,8 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, struct clk *clk, u64 savesub, enum spdif_txrate index, bool round) { - static const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; + static const u32 rate[] = { 32000, 44100, 48000, 88200, 96000, 176400, + 192000, }; bool is_sysclk = clk_is_match(clk, spdif_priv->sysclk); u64 rate_ideal, rate_actual, sub; u32 arate; @@ -1235,7 +1244,8 @@ static u32 fsl_spdif_txclk_caldiv(struct fsl_spdif_priv *spdif_priv, static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv, enum spdif_txrate index) { - static const u32 rate[] = { 32000, 44100, 48000, 96000, 192000 }; + static const u32 rate[] = { 32000, 44100, 48000, 88200, 96000, 176400, + 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 e6c61e07bc1a..d5f1dfd58740 100644 --- a/sound/soc/fsl/fsl_spdif.h +++ b/sound/soc/fsl/fsl_spdif.h @@ -163,7 +163,9 @@ enum spdif_txrate { SPDIF_TXRATE_32000 = 0, SPDIF_TXRATE_44100, SPDIF_TXRATE_48000, + SPDIF_TXRATE_88200, SPDIF_TXRATE_96000, + SPDIF_TXRATE_176400, SPDIF_TXRATE_192000, }; #define SPDIF_TXRATE_MAX (SPDIF_TXRATE_192000 + 1) @@ -177,15 +179,20 @@ enum spdif_txrate { #define FSL_SPDIF_RATES_PLAYBACK (SNDRV_PCM_RATE_32000 | \ SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | \ + SNDRV_PCM_RATE_88200 | \ SNDRV_PCM_RATE_96000 | \ + SNDRV_PCM_RATE_176400 | \ SNDRV_PCM_RATE_192000) #define FSL_SPDIF_RATES_CAPTURE (SNDRV_PCM_RATE_16000 | \ SNDRV_PCM_RATE_32000 | \ SNDRV_PCM_RATE_44100 | \ SNDRV_PCM_RATE_48000 | \ + SNDRV_PCM_RATE_88200 | \ SNDRV_PCM_RATE_64000 | \ - SNDRV_PCM_RATE_96000) + SNDRV_PCM_RATE_96000 | \ + SNDRV_PCM_RATE_176400 | \ + SNDRV_PCM_RATE_192000) #define FSL_SPDIF_FORMATS_PLAYBACK (SNDRV_PCM_FMTBIT_S16_LE | \ SNDRV_PCM_FMTBIT_S20_3LE | \ -- 2.27.0