From patchwork Fri Jun 21 15:58:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Enric Balletbo i Serra X-Patchwork-Id: 11010335 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6DEFF13AF for ; Fri, 21 Jun 2019 15:58:26 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5AB9028A70 for ; Fri, 21 Jun 2019 15:58:26 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4ED0128B15; Fri, 21 Jun 2019 15:58:26 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id EE32128B18 for ; Fri, 21 Jun 2019 15:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=F6jxifSNpWFHE07sl/jK/UXfN6rtXrgKJJuD4wp+f+c=; b=VRCUVFPES/3CMT Quzt6bSNaWO24A1x4aCim0eX0X91hf8Tmd6BaRHUMtC3ZnCPPbpSDq6ovQBtrMAmc6CwwApodoYrp eeqnzUbyP2MoaVeBeSrX6+rRP00/m46MkYEaa7ggqqTsLEgEAEa9qUtOJZuM8EhgqQZTi+Scj7JCL BJ7xCymZDLVeAMk6aqZwPx/7uUDhwb260I9yg9is2PFY375nqpDGv2kejlrk5mrvVCCtuNGbWLlU1 Dnp0QyZomnFUErofGVUe7/PWMS5MD48AcWyLwQQQGYnTau0h8crZhSX5KTDrWAg2IcByWQH9EQwiN iVK/q/JyiCR3GnA0e54A==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1heLvh-0005aN-RB; Fri, 21 Jun 2019 15:58:21 +0000 Received: from bhuna.collabora.co.uk ([46.235.227.227]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1heLve-0005Zo-Eb; Fri, 21 Jun 2019 15:58:19 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: eballetbo) with ESMTPSA id E48D9260D87 From: Enric Balletbo i Serra To: linux-kernel@vger.kernel.org Subject: [PATCH v2] ASoC: rk3399_gru_sound: Support 32, 44.1 and 88.2 kHz sample rates Date: Fri, 21 Jun 2019 17:58:08 +0200 Message-Id: <20190621155808.17182-1-enric.balletbo@collabora.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190621_085818_620172_99997F49 X-CRM114-Status: UNSURE ( 9.82 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, Heiko Stuebner , Xing Zheng , Liam Girdwood , Takashi Iwai , Jaroslav Kysela , linux-rockchip@lists.infradead.org, Mark Brown , kernel@collabora.com, Benson Leung , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP According to the datasheet the max98357a also supports 32, 44.1 and 88.2 kHz sample rate. This support was also introduced recently by commit fdf34366d324 ("ASoC: max98357a: add missing supported rates"). Actually the machine driver validates the supported sample rates but this is not really needed because the component driver can all apply whatever constraints are needed and do their own validation. So, remove the checks from the machine driver as are not needed at all. This way, we also support 32, 44.1 and 88.2 kHz sample rates and we get rid of the errors like the below. rk3399-gru-sound sound: rockchip_sound_max98357a_hw_params() doesn't support this sample rate: 44100 rk3399-gru-sound sound: ASoC: machine hw_params failed: -22 Signed-off-by: Enric Balletbo i Serra --- Changes in v2: - Instead of add supported sample rates, relegate the work to the component drivers (Mark) sound/soc/rockchip/rk3399_gru_sound.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index 3d0cc6e90d7b..8cbeeb013a1a 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -55,19 +55,7 @@ static int rockchip_sound_max98357a_hw_params(struct snd_pcm_substream *substrea unsigned int mclk; int ret; - /* max98357a supports these sample rates */ - switch (params_rate(params)) { - case 8000: - case 16000: - case 48000: - case 96000: - mclk = params_rate(params) * SOUND_FS; - break; - default: - dev_err(rtd->card->dev, "%s() doesn't support this sample rate: %d\n", - __func__, params_rate(params)); - return -EINVAL; - } + mclk = params_rate(params) * SOUND_FS; ret = snd_soc_dai_set_sysclk(rtd->cpu_dai, 0, mclk, 0); if (ret) {