Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1940281imm; Thu, 24 May 2018 03:17:26 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoj/C8+mBX8ujy4KyCxqXKaY3WKApunZ0T6AV10ocJnhhdAkS/jnjI/RL1faI2LKPbL6BQg X-Received: by 2002:a17:902:6847:: with SMTP id f7-v6mr1586662pln.173.1527157046316; Thu, 24 May 2018 03:17:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527157046; cv=none; d=google.com; s=arc-20160816; b=FcfLLfLOba6vnrw5Y2Apw7RZFAtv1sDS/yYRqie8CWPw6MMw5Xg65je+R7DJ/oGfwA 4MFZma1hGL+HEEoizWPN9uNzhwfDHGofEiFwvwfdktsciA33RSYa2aLQXsM0XhnWcTfs JGfi1/FCCIWosk/8NoBlkWyxdfsx9yYm50r5cbeOX+pShwfAjlQ7hMy81lTlCMMgeUpD GDJXoROuN58FaAroqo3FSPY0PVOzIyPw1M9GD3gbK9OcfTZzjf8gE1IwvGhFpnj0yZWJ YzIky1C1DjiLYHvrvPrDKzKYuI34N/VMsWInE/ULyWeLWzjDIexitwpUr/pR4VbiKdHk ziUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=GmhWlfkLT5EvrrstvHSWGC6qFLV+zJ0h98MPL0ImMuQ=; b=NpQ3vW/Wl2THkohLLeR2CxY2bOFm/3wqJ7RRhZ7RpbxSHIN6SVXTFCkYPw1u/TfJQ0 n6XtXABPC3DdSh/5yC53RvcX4C0pPGubwHiq4q54aDCGD7wavHmJ6CHt1+srhzNXzHD5 tfCMiL2vmHOD2PD8/GQEp6tEMsH8Fy+Mwh3Wf0cBbWaJOV451TOWHvzKoIYprimloRRe pKE0hHOBYdPAE9fzvOW6xrQ0eGAGXLTSCe+4v11lRjz6OhUK5F0vjez36nsmGADtG4aL aRcLDOJHrqXImSCPABxEaISJegCoNzomnT8r1t/tIgZt5pbDTcWu8fTaxu++3fuo57YN Qz5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IZB9pgiz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 1-v6si20523852plo.20.2018.05.24.03.17.11; Thu, 24 May 2018 03:17:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IZB9pgiz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031400AbeEXKEO (ORCPT + 99 others); Thu, 24 May 2018 06:04:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:53620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031344AbeEXKEK (ORCPT ); Thu, 24 May 2018 06:04:10 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id BDB8020893; Thu, 24 May 2018 10:04:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156250; bh=tHRQ404fDJb5jnydEap10REGtwZLX8NJ7GM7K6Hf/cc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IZB9pgizXIDkBI3B4bQEnlHgS5pqvkf3HFbjzqYt5LhXfyzNjwwithCfdZhclcHq/ NNiadAlTqXLiB5dNHyseXdj3GtPIaEmPYYP6BBlmls62+9nEyAHGRpdI9ER6V12rzk WSDqiTncWC2wEsuH9Y1PWvfjVCr7eeg1MyoHoN+Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sylwester Nawrocki , Krzysztof Kozlowski , Mark Brown , Sasha Levin Subject: [PATCH 4.16 118/161] ASoC: samsung: odroid: Fix 32000 sample rate handling Date: Thu, 24 May 2018 11:39:03 +0200 Message-Id: <20180524093032.442149893@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093018.331893860@linuxfoundation.org> References: <20180524093018.331893860@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sylwester Nawrocki [ Upstream commit 1d22c337dc8f3a25638f7262e7bcb5729a34d140 ] In case of sample rates lower than 44100 currently there is too low MCLK frequency set for the CODEC. Playback fails with following errors: $ speaker-test -c2 -t sine -f 1500 -l2 -r 32000 Sine wave rate is 1500.0000Hz Rate set to 32000Hz (requested 32000Hz) Buffer size range from 128 to 131072 Period size range from 64 to 65536 Using max buffer size 131072 Periods = 4 Unable to set hw params for playback: Invalid argument Setting of hwparams failed: Invalid argument [ 497.883700] max98090 1-0010: Invalid master clock frequency To fix this the I2S root clock's frequency is increased, depending on sampling rate. Signed-off-by: Sylwester Nawrocki Acked-by: Krzysztof Kozlowski Signed-off-by: Mark Brown Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- sound/soc/samsung/odroid.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/sound/soc/samsung/odroid.c +++ b/sound/soc/samsung/odroid.c @@ -36,23 +36,26 @@ static int odroid_card_hw_params(struct { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct odroid_priv *priv = snd_soc_card_get_drvdata(rtd->card); - unsigned int pll_freq, rclk_freq; + unsigned int pll_freq, rclk_freq, rfs; int ret; switch (params_rate(params)) { - case 32000: case 64000: - pll_freq = 131072006U; + pll_freq = 196608001U; + rfs = 384; break; case 44100: case 88200: case 176400: pll_freq = 180633609U; + rfs = 512; break; + case 32000: case 48000: case 96000: case 192000: pll_freq = 196608001U; + rfs = 512; break; default: return -EINVAL; @@ -67,7 +70,7 @@ static int odroid_card_hw_params(struct * frequency values due to the EPLL output frequency not being exact * multiple of the audio sampling rate. */ - rclk_freq = params_rate(params) * 256 + 1; + rclk_freq = params_rate(params) * rfs + 1; ret = clk_set_rate(priv->sclk_i2s, rclk_freq); if (ret < 0)