Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1920296imm; Thu, 24 May 2018 02:57:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp/Y8dmrDNiSiRRybxeInxlVJLsBroHY5GuvHF5vUNdSeKvmlI7reX+Cn1dv6YcHNGHcqYv X-Received: by 2002:a63:7c12:: with SMTP id x18-v6mr1395062pgc.220.1527155876261; Thu, 24 May 2018 02:57:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527155876; cv=none; d=google.com; s=arc-20160816; b=nlWY67/DMFKB/mUSpJdPtr+43kmVKJ5g1HC6sLIwVTgshV0647nHKJZ85m9xYUz65D ETBA1oEggMPZROUdkNXfeTvkxeMfbtOQTm6AX6mLcJ/rZUwUZd+p7FQ1o/jLd7rp78CC den1CmP8kRUzil9PKIwx4JNRk7Dj1Q74OWRd+EB8wOHaQBToaRFQgHzpsO/C2mCMU11J 7uMwk1lVheir+ZD7Ex0D5eNyn85uqPTSzqmLO0vu/in6WY/Jb2SH/fEBtMc+JwysJTpU hsjvX9WwhRNXHUbgDfj41FIuwfvsU4H/4lulTBi53JRdjyl8l9WBnk2lfYKwYawbgSuR OmPw== 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=Lqn7W+qMXgLaa5rSp1od/gPubTaZ284yG5kQ191KGx4=; b=FpOTArADJW5mq7PmRAbmr4iR+usAw5SS6VZG43ykQaqCQxW/YRHT/JfVuaVZ4PKJyv JWQTrbl++jnb+AjR8VEbVxqqf52KmRuQpLkX17/OYk8MARup/8QGykMqxUh2kffSYK5l jqTc+j3gHXXsahy5NKl8kFZwrFDbfR3qMl3d5pnT1ZyUfQSyuOboSpraL+puDDu05bl5 a0Ye9DOtMtnawoS5yWAI7uh7qcgGlbB41eBF3t60ybfbzfy5mVVjrLEJy0HVJIdZ1JUY h75Cr0b6Tb66qvD94BZbu0GX6pjEzksDU3VlYgq4c+nkVks7XgYcjAbcehWT0HJ8A6i5 8vsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DE69RmCD; 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 k127-v6si16207842pgk.256.2018.05.24.02.57.41; Thu, 24 May 2018 02:57:56 -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=DE69RmCD; 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 S1030359AbeEXJ44 (ORCPT + 99 others); Thu, 24 May 2018 05:56:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:36624 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S968435AbeEXJ4t (ORCPT ); Thu, 24 May 2018 05:56:49 -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 3EC6C20891; Thu, 24 May 2018 09:56:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155808; bh=KWtSofmXhuEjIWjDnoKSftVteNy27TswiBG4z/pK0zY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DE69RmCDuEHkybusB3sOd8Nvt5VSOBtLgyU5uRgD9B30kCSVkKZQrTV47VuhpAeHF J2nzrbC5sqyO9yg0d5moIJ2+xNvSxndeG1aKnJpHqu9zzERgC+mNEwUXCiL28KTB8w h84rQRV1Mm+B4j1dr4aqpGwd+mwJsmPhoT/76J08= 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 125/165] ASoC: samsung: i2s: Ensure the RCLK rate is properly determined Date: Thu, 24 May 2018 11:38:51 +0200 Message-Id: <20180524093627.065824943@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 647d04f8e07afc7c3b7a42b3ee01a8b28db29631 ] If the RCLK mux clock configuration is specified in DT and no set_sysclk() callback is used in the sound card driver the sclk_srcrate field will remain set to 0, leading to an incorrect PSR divider setting. To fix this the frequency value is retrieved from the CLK_I2S_RCLK_SRC clock, so the actual RCLK mux selection is taken into account. 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/i2s.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) --- a/sound/soc/samsung/i2s.c +++ b/sound/soc/samsung/i2s.c @@ -653,8 +653,12 @@ static int i2s_set_fmt(struct snd_soc_da tmp |= mod_slave; break; case SND_SOC_DAIFMT_CBS_CFS: - /* Set default source clock in Master mode */ - if (i2s->rclk_srcrate == 0) + /* + * Set default source clock in Master mode, only when the + * CLK_I2S_RCLK_SRC clock is not exposed so we ensure any + * clock configuration assigned in DT is not overwritten. + */ + if (i2s->rclk_srcrate == 0 && i2s->clk_data.clks == NULL) i2s_set_sysclk(dai, SAMSUNG_I2S_RCLKSRC_0, 0, SND_SOC_CLOCK_IN); break; @@ -878,6 +882,11 @@ static int config_setup(struct i2s_dai * return 0; if (!(i2s->quirks & QUIRK_NO_MUXPSR)) { + struct clk *rclksrc = i2s->clk_table[CLK_I2S_RCLK_SRC]; + + if (i2s->rclk_srcrate == 0 && rclksrc && !IS_ERR(rclksrc)) + i2s->rclk_srcrate = clk_get_rate(rclksrc); + psr = i2s->rclk_srcrate / i2s->frmclk / rfs; writel(((psr - 1) << 8) | PSR_PSREN, i2s->addr + I2SPSR); dev_dbg(&i2s->pdev->dev,