From patchwork Tue Jun 30 09:16:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yu-Hsuan Hsu X-Patchwork-Id: 11633557 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8175213BD for ; Tue, 30 Jun 2020 09:18:07 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 55FD020675 for ; Tue, 30 Jun 2020 09:18:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="PmXGlKrZ"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="TGpitUnX" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 55FD020675 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.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=RV6DX21QGmdDokDRO2Ah1JJSt4cWTNu7xCjf4yso/tE=; b=PmXGlKrZFRKsk2bLlCEhMPIni/ QWIQBUlLq7SMclhO+Is9GjOnNhoPPQNU5lnXjc8qoQJnS0898/Ik7onA7Q90PZ8XdzOlQG/7Z93AX 6Hu7iEN5Ce08lo+HBTgy8txQ9QwV7Q3W7JDAnqHr6uXoEW3BBoVC8/A6xjpL2wrSbVir7ru2aQVp+ kj7vnHDYHL4s1TU6dAUwrudeK4a2KFnCBjMxl9bfSGF/ijcaK9wLLaTogcNppHsfzVwqeY4O069HP hZKYotxJeYAxXXOldJDrQ4EHsp8bv/9NcP9ILinElW/Qg0isktngixAr5FK4+LsyfUsBdLD3+h6ik L/1zv9hA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqCNS-0003th-MM; Tue, 30 Jun 2020 09:16:30 +0000 Received: from mail-pg1-x542.google.com ([2607:f8b0:4864:20::542]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqCNP-0003su-7e for linux-arm-kernel@lists.infradead.org; Tue, 30 Jun 2020 09:16:27 +0000 Received: by mail-pg1-x542.google.com with SMTP id j19so2802076pgm.11 for ; Tue, 30 Jun 2020 02:16:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rd5iEUzyhkHEGXF29pak/hhB1EC5ycMxxyjQQksAAqY=; b=TGpitUnXwHKi/7l9y2kirXGLuOu95q2WsJQIWx2gn6HmUOzZRHlv/rlVSHSscwZ8kO AWvctomRCfaXqs2PK7ouUWeHgZg28RgwQSbDk3UoZKVdLm1cSAxnWuNvj0FeTwoFOl2D kHAgkHFtTyvVaIkNA3gVCvEE0SQWezS2ndkoU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=rd5iEUzyhkHEGXF29pak/hhB1EC5ycMxxyjQQksAAqY=; b=J9KVArZfduOafHuvkys14/ltfzz55p2Mk1QfZQZ5qgwHrbF5gWTR80z7eT/oCIuJAK r3UoFZgg9KLO3WlI49rFEScuwRlnpnHtJ3tR/ARBLBcUjop/kQCUGkPtp5oHGopARtaM ttm1NePRUycVJCSrGRfMBInFHEDXNyNOWezkf1bawRDAI7m9weL0zUo5ExnK9pBLtRgi TJ6mImJbQr/iQiW6TNPasez35nfBglSQqJe/JJlu+20ElVIKFzj1lqWwu9C5hcPJbJW7 XQg2dDOGOw6iv3GDj75cZtmypJZLhhQHCt9/yLnZ8uybP6qCwdeBuSmJuWPOnC/+hI3K hQWA== X-Gm-Message-State: AOAM532X/ytFOFadkG57TUQTaFNZIz8mKNJY+5/d0zOPxvmapRYcQsR2 LlseS8TJAG0RikDA3S66UUFBGQ== X-Google-Smtp-Source: ABdhPJzB0kxAs3Rg/ffbxdy/cFXz9S5fvLhyfDQ8RVSkxRv0SuSfKCfoSQnEObJ51pxzQORK5k+Sjg== X-Received: by 2002:a63:5863:: with SMTP id i35mr11672772pgm.390.1593508583749; Tue, 30 Jun 2020 02:16:23 -0700 (PDT) Received: from localhost ([2401:fa00:1:10:845f:e35d:e30c:4b47]) by smtp.gmail.com with ESMTPSA id q13sm2142575pfk.8.2020.06.30.02.16.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Jun 2020 02:16:22 -0700 (PDT) From: Yu-Hsuan Hsu To: linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: rockchip: add format and rate constraints on rk3399 Date: Tue, 30 Jun 2020 17:16:15 +0800 Message-Id: <20200630091615.4020059-1-yuhsuan@chromium.org> X-Mailer: git-send-email 2.27.0.212.ge8ba1cc988-goog MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2607:f8b0:4864:20:0:0:0:542 listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.0 DKIMWL_WL_HIGH DKIMwl.org - Whitelisted High sender 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, Tzung-Bi Shih , Heiko Stuebner , Takashi Iwai , Liam Girdwood , linux-rockchip@lists.infradead.org, Mark Brown , Jaroslav Kysela , Yu-Hsuan Hsu , linux-arm-kernel@lists.infradead.org, Cheng-Yi Chiang Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org S8 and S24 formats does not work on this machine driver so force to use S16_LE instead. In addition, add constraint to limit the max value of rate because the rate higher than 96000(172000, 192000) is not stable either. Signed-off-by: Yu-Hsuan Hsu --- sound/soc/rockchip/rk3399_gru_sound.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/sound/soc/rockchip/rk3399_gru_sound.c b/sound/soc/rockchip/rk3399_gru_sound.c index f45e5aaa4b302..9539b0d024fed 100644 --- a/sound/soc/rockchip/rk3399_gru_sound.c +++ b/sound/soc/rockchip/rk3399_gru_sound.c @@ -219,19 +219,32 @@ static int rockchip_sound_dmic_hw_params(struct snd_pcm_substream *substream, return 0; } +static int rockchip_sound_startup(struct snd_pcm_substream *substream) +{ + struct snd_pcm_runtime *runtime = substream->runtime; + + runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; + return snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_RATE, + 8000, 96000); +} + static const struct snd_soc_ops rockchip_sound_max98357a_ops = { + .startup = rockchip_sound_startup, .hw_params = rockchip_sound_max98357a_hw_params, }; static const struct snd_soc_ops rockchip_sound_rt5514_ops = { + .startup = rockchip_sound_startup, .hw_params = rockchip_sound_rt5514_hw_params, }; static const struct snd_soc_ops rockchip_sound_da7219_ops = { + .startup = rockchip_sound_startup, .hw_params = rockchip_sound_da7219_hw_params, }; static const struct snd_soc_ops rockchip_sound_dmic_ops = { + .startup = rockchip_sound_startup, .hw_params = rockchip_sound_dmic_hw_params, };