Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2018457imm; Thu, 24 May 2018 04:36:21 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrLuKoAZict0Azg7NEeDdSUPwO6qD2ZAm1mLQb968LXGv1PIQZ+ikHJ9UfRv5nozW8cboM5 X-Received: by 2002:a65:65d2:: with SMTP id y18-v6mr5428834pgv.186.1527161781801; Thu, 24 May 2018 04:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527161781; cv=none; d=google.com; s=arc-20160816; b=roqMbwOzOdpZKk204Ihe1VxM842lyrK1Y7OImi8vZs1Lsy6EYDlSLU1Je8Dw+GIJP8 cYEfenHM2u4jmQzh+oFraHOLWbhHJVMXZa7kh+HG4DpKAJkHCQdfKemYbxG+oqdjaZWq VelsqLeCxMdmTJOB0F2IjGDMGhpY2johEHvX5xpkkd7Scyja4OzxKtrBOyKQ2vdce6Nm HcFl1xDAsYngVr9RvaUkfJJLOCQBilbk4LG/9l94rYagMU6gY1y7W4mOdsPbZC5eltjl vnUwVNb2nrPulEnISpZZtEUe5Eb4wOVTm0JWIABq39V1icsxiEY85zmV8whGHgyFYFJH xpGQ== 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=1sGIykLM9AzyP/9HBtSlkZ7xtNgQ3QcaNKhOBRs/pC4=; b=kp0bwUcid39EmBHbpKu2/U6gHESBHdMdisSPp0hIZv1r3x7sNRDTH0oI/RQcbSxYaJ F3sXGM4NVVKNwgw9HKJPDXZYTpffpPvJh6K5bJmU9zf9ZJ7Ttq06TxGXvua0JDO7OCxt 9VAiJQgeIovaPH7h9c4MQU79OHiuPoZ2y74E510iN3FjGIpKc8Ru5EXo4dWaOsVsSDb2 486MfOqhEklM+7U7bc1v7nyLx7VrDr5ud+5xoe6qmB0JIcAhavvhL2IJCJK1RhHQeW38 U9m8s5cetDvv/nLa5YNTaNI51RAHxGdbKmsCD2SNQLwoWNrO9LHypQF/qjOdgc91IEda v02g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Rx4KQdxF; 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 x12-v6si16471714pgv.556.2018.05.24.04.36.07; Thu, 24 May 2018 04:36:21 -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=Rx4KQdxF; 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 S967479AbeEXJuE (ORCPT + 99 others); Thu, 24 May 2018 05:50:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:39506 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967462AbeEXJtx (ORCPT ); Thu, 24 May 2018 05:49:53 -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 0F6562089E; Thu, 24 May 2018 09:49:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155391; bh=+iG+b/BeM2EqrTEpoGGeBoju2Ip78/K7LyT4Sh2ULnY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Rx4KQdxFEfUvd233T+kkG80ZtVPjpHquQtBasiQIQC2EhI79haTLLjBLdp+BUkSUD rCvT4Mgs1SCQgIMvV/COIP4vMdBJiDAOtLGiAKgNK0oTVp42rB+ELXENfMkWyweuLM Nt88PBoi9Mbzr21tQZSqMBceTttJN6pVrCLeCGsE= 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.9 69/96] ASoC: samsung: i2s: Ensure the RCLK rate is properly determined Date: Thu, 24 May 2018 11:38:52 +0200 Message-Id: <20180524093609.372400913@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093605.602125311@linuxfoundation.org> References: <20180524093605.602125311@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.9-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 @@ -642,8 +642,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; @@ -858,6 +862,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,