Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1977407imm; Thu, 24 May 2018 03:55:51 -0700 (PDT) X-Google-Smtp-Source: AB8JxZowTK2t5vWJDoFQsZwJi22jpgwwTTSksXfnp9u21lqIaSVHUhsnmlFhe6eSE0/xCfNdI0uL X-Received: by 2002:a63:7253:: with SMTP id c19-v6mr4406717pgn.423.1527159351728; Thu, 24 May 2018 03:55:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527159351; cv=none; d=google.com; s=arc-20160816; b=tRo4nw9pxkOnYf8hk4I6ayYuCuvaQOGeBnDLHVyfBBYZ160ElNoKwYaipdmv5Rlpvq ZnaFOXzT1Rnj+wJe/UsMdyeIqJSK+zEclmDK9avlMqSZIogYsKxBVZyxKPMxBnVnbSSJ k96C429b3JEIVgIpsHLHJtFiOORc5lYAv/OK47/CgdFEAvxEmnORs7IDuAP3oWBbcuB6 Dm7Uob/K+wAoYKERsH+MGGZG3x2IyuFVBGWktxwLW41mLkAkS1AeZSzGyLs0ohTgSvv2 jkB9SSXWy9rSfK+qbh69AkDp28+b96/upj3mgRh0Iz2Oe8JYAqjx8R0abA/uGup0A30e /C4g== 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=bR6NKY8XeDqrWk+p4lcZ8ABFAc4Z+NYPYzUJKSrC4s0=; b=vDODAgrKVGKrq71RGbuh8F0hHjjeAwVHnim4AmsTHdTrLJq0aBM2jTaig+FHAg8FxQ Rtzo82KBXljjdBCPj8z4BCB0pXA8kUWNDIKYW9O6pk7cAqe+ZBH0r3SG/TfF6BsyMfD/ KB7EZQu+W5rXiRVll/gMrQuyAQznlwcBVSC6RICWKBFv5Ntd1oaHcYTKC/2d7TTk6Pgr savONghUNswiCaRiGNICUARSyV/mGOSNt4ABi+ykMzUc7PhRXJKxDUAH3z7jMnum1Dys s09qS/I0EEpeJ6HDPqFGrjrZZxPw+aDxLr0f66B+yvIxd9z14YekqK/FcTjvddgzSTq/ +Yog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=yiCaq961; 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 v20-v6si19959272pff.363.2018.05.24.03.55.37; Thu, 24 May 2018 03:55:51 -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=yiCaq961; 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 S1032599AbeEXKzA (ORCPT + 99 others); Thu, 24 May 2018 06:55:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:36550 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968081AbeEXJ4o (ORCPT ); Thu, 24 May 2018 05:56:44 -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 E689A20891; Thu, 24 May 2018 09:56:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155803; bh=RbUwmllI+ki56u+qoAWMIi/M82uz11broZA+r/5J0Ow=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=yiCaq9618QULKjJUlMOeXtYYNv8EPRShLDQEmwiuUSJYWSMThX6GWypJcJrW1Brcz V+pHYuwluREsqhw/WZl6uI6liOkTn/XcG/QBabPYj5GOHKXmyI2KUi52mIMXCkr90f ZS1PwXysA0QNjTntYBghQ27sd/QQTV19q1EVn4dU= 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.14 123/165] ASoC: samsung: odroid: Fix 32000 sample rate handling Date: Thu, 24 May 2018 11:38:49 +0200 Message-Id: <20180524093626.982414470@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093621.979359379@linuxfoundation.org> References: <20180524093621.979359379@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.14-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)