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: 11633551 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 215F1739 for ; Tue, 30 Jun 2020 09:16:38 +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 EE71420675 for ; Tue, 30 Jun 2020 09:16:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="oGVmAn/B"; 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 EE71420675 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-rockchip-bounces+patchwork-linux-rockchip=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=hJaINsGJUoWNgY1zFgVSiKFRgavQj2BqodwbLdBMO+I=; b=oGVmAn/Bop53S9KpJk5peSxPSV CBaTuTvuVJsfgBIVSVXcWi4OY/oWTbyWLVlpIgA63vTOEsHRXi2TMafC9VWZaqexaWByh+bpTXSdp IkT2Bo5+gbK6HiLhZ6lMmLLh5lt+EIdTLVG4Mno6oN43pggz5/dXOWIRqenWHTX1CAlYKs0LBZFPS 63LOR3mTX4i0uG5yuriFyy09PLiSR1pmF7EJ0iBW5bqhvZHD5Rz+0uKCu0MqW3c/bNGHJ38vVKVqO V6PkJ/zNwqqpUbihQGyD3/2Fz2/O34FNQD68WSkhS/HabuTMWwwOBhY1JXN73YEq5UWuJfnh62JA1 3zGrQYnw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqCNU-0003u3-BT; Tue, 30 Jun 2020 09:16:32 +0000 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jqCNP-0003sv-Hw for linux-rockchip@lists.infradead.org; Tue, 30 Jun 2020 09:16:28 +0000 Received: by mail-pf1-x444.google.com with SMTP id a14so4591603pfi.2 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=hk1fM5w0n6YetmoyqIcy6SfPzHrrweSHBAftwUlCx1J3mcaGfrA2exz6t1sRFrcwfK tcQay4I3vRswV4DwO7MJINdfQqJ+SX5fOibzw+/2KTPocXTBHbmOKP07JEcnlJdUgsOo W3YUTcUV/hmOd3wXKlM1LKQGfFwSYz8v+A3QJcDu3pwVGtZIw1u5HOBPBRtMzYV/HWET JtNAy+HeDBpFv2ZF4ctMt5q6rMyrUi4LCxbOjpxjbCKAN1F03aPZq+QZrLqRO2z4r5iE nDGZGLX6DLioLpYRX5Ze/1/y2jThFWTfuaSo0Lde+lP00A5H6Bu6vwy9pUofdE/qBCzL koHg== X-Gm-Message-State: AOAM5333avvcKve9kUXYHzu6H/U+F9oQQ10Rzevzxprl2zmL5GnXmDs1 lVV+Com2XPp8kR1h4GQUpT13GA== 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:444 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-rockchip@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Upstream kernel work for Rockchip platforms 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-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=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, };