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: 11010351 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 367F9112C for ; Fri, 21 Jun 2019 15:59:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2572728AE7 for ; Fri, 21 Jun 2019 15:59:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 19EEB28AF7; Fri, 21 Jun 2019 15:59:17 +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=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 41A8C28B11 for ; Fri, 21 Jun 2019 15:59:16 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 0F4F482A; Fri, 21 Jun 2019 17:58:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0F4F482A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1561132754; bh=eGkrKCGfguY+27YGfgUNCacAkGcBm/lo0+7L+A8FKgA=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=MLvHxBL9Dnl+VH3Pyg0MW69TM7EYy196nADda6s7a3nfM9MD5wTVtBmBFcWM0qhE1 jf6bRm/tKMHNAhgcvangzig9CG0ZF3ENUw9M4Ee/slj8dBYMcasQH75ebPXhGdnSpE xjCw717ResZqxkqbIJyIdo1pPm8effNAMVtch710= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7E3D2F80059; Fri, 21 Jun 2019 17:58:23 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id EDE01F896B8; Fri, 21 Jun 2019 17:58:19 +0200 (CEST) Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1FE39F80059 for ; Fri, 21 Jun 2019 17:58:16 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1FE39F80059 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 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 Cc: alsa-devel@alsa-project.org, Heiko Stuebner , Xing Zheng , Liam Girdwood , Takashi Iwai , linux-rockchip@lists.infradead.org, Mark Brown , kernel@collabora.com, Benson Leung , linux-arm-kernel@lists.infradead.org Subject: [alsa-devel] [PATCH v2] ASoC: rk3399_gru_sound: Support 32, 44.1 and 88.2 kHz sample rates X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" 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) {