Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1928651imm; Thu, 24 May 2018 03:05:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoNiF0NGyasQMvN49/CfVZolJFhDG/qjGy8YYUoGaosM0zLZXLZ+RSvk79q5+Mn1zRHRJpb X-Received: by 2002:a63:b144:: with SMTP id g4-v6mr5294934pgp.253.1527156330892; Thu, 24 May 2018 03:05:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527156330; cv=none; d=google.com; s=arc-20160816; b=Bri1xiDkAMHaNdUp6gnEF77l3o8RgxqGIg1QAx32jLBnNc73EZWHCjM/cG5qdaOoTl 2muhZgJVL1seRYIkyXFakADe1GGm2j15TpdsNCus6EBNNuMCAkfn+Rdpt2hYMy/XkYCj PwjKjGGIBToOiO3RAKyMH3ByhUwSU/hphd3lSrt7gkGAryILERwoP9PIjxkqjOZ9oLwp saBIcsPOximtv0ks7GxRiznC7Y3ZjlUaLa8i5RbG4PI0Dfu/EMwByb61WE+T9szXiPdh C6BreFEhvOIi1ehYjPwu+m0enRV8bemaXscc8L93F7CcpR2ibGpv6pF2qjfC/HTV/vCU GPdg== 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=d3mtSsfdcc+GnIsOaZcPs53/MRE2xg6DCipr9kuqQKY=; b=KmWtvcHE3yW+5YMhncOwReFfQm5JBxo1imYi8dhZhMDL1rX8A8wStVqnN82VgOOrtr kMDTfhDjN7+z0wlkAMXI07BFFJ12P4jQKunA8B4m96blZWQi8nCIhyyJWnXOWdX3Ojw3 qjYssqbmzR9HJ9mmom8reVcYSx96qnyrQZcBH7BL2LWrVNTx11TBWxEl+vIrxmOFlanb Q3LNJpR5DSPMfqo6LMzbD7zTOpfGeUnZ/Y14oc8Y91kygirQmYmKd7eABRs0y2G2q7dt Jsb8mPXKUcOYUarnjT4NN9D/AovMxm6+PgFvphg75H+z3ecLAGvMNdLh9ot4KmLDB6TU A4rQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bvw18X50; 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 f9-v6si7030121pgo.250.2018.05.24.03.05.14; Thu, 24 May 2018 03:05:30 -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=bvw18X50; 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 S1031411AbeEXKET (ORCPT + 99 others); Thu, 24 May 2018 06:04:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:53696 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030517AbeEXKEQ (ORCPT ); Thu, 24 May 2018 06:04:16 -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 3BFDC20896; Thu, 24 May 2018 10:04:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527156255; bh=w6WB0yNPmgiSEZSxK3ZGp+K1G9mu1dZqFPQyJil2lX4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bvw18X5096hCZA39Mszc9xcDI62kmrbdSGEJJItuZVecHb4/RAij6p5Fz89bpeP7X GosoI0GNTi+2+Ke5haxgE99auFJfPjH3HMg0MHnet++117792Pw0IH2IIHNH5TSDwk miSHPILvnmQsuvLVc3wUr4Ij6ZvdqbDGW5R5MGFE= 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 120/161] ASoC: samsung: i2s: Ensure the RCLK rate is properly determined Date: Thu, 24 May 2018 11:39:05 +0200 Message-Id: <20180524093032.679486639@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 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 @@ -656,8 +656,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; @@ -881,6 +885,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,