Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2785752ybx; Fri, 8 Nov 2019 09:17:11 -0800 (PST) X-Google-Smtp-Source: APXvYqyzUYtqb40PiC2+DLVOLC2rIc4KZn/uAmdqey5nO5UaYwcaL7B8sQxAb6rxG5UvTGOd7zpw X-Received: by 2002:a50:8e43:: with SMTP id 3mr11334455edx.217.1573233431587; Fri, 08 Nov 2019 09:17:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573233431; cv=none; d=google.com; s=arc-20160816; b=DwUfo2i/X+8/wmMs+siBu40DvXvkFWqKLFZ1Jthgw16AaR/2KUM8S+HURhNQb3z4yX s2p5fwmGMGPQpgpGo/s9+gnHfcpe3333pHN3XE5yMsmc7wrt7cdIrU3ji24DEGUz48Qb 4z/BwXHnAABPFd0IZwgGUG0B6bo2EMG/tQXSLTGjzMSyXtQ8eC834P8WFXCYYGRINHhG zn5WuP/rjqV0wTEy2lOJWVtY4jwBydA9sihY+JtD59qfgZhmLf+K49MFYZ/tg2Zn0hDB yYbw5EYO5ea8SoppQESQCAqxVLjHCakQBrSDyAacHU99Wg4eh1XyA+td9Yudl0B9Seay 62Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:message-id:references :in-reply-to:subject:cc:to:from:date:content-transfer-encoding :mime-version:dkim-signature; bh=xz7VneuhDNhyAxfNOVJ8pZ6Cwxs/reD73VEhmpLDF3g=; b=FGpGJXW6nkMtu6y7V+50FKOjMxc4pjmzHOBVydRSAT/2uTGXdvmEcaBWlE0fYOOVA4 M5m5dip8fK6tnmmikJ3skGKp+a5ezX0Ue1WVIsFKcP/BQQF1jRS8QCfPIgBAEHSl0cdy 83NtQqtOkEBXQSOonbXz2PUp6sAckfWKDGbfqZfu1f7sQ5u5JcgAZm04Ski6WvANqIr7 hIrZv3eQhuNbkX2Lp3sKgaR6HTYS9uFFaJTwpGB2JrPHhufjr0A58AznSzl2UezGcBTV KhcCmcbyTQHsnWkjUb8wooXETzQysLTLeUfWTKjfsUR6OVLZ0cCs8snNvluW4iZWp8NC Sv+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=babhKa+H; 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 n12si4441196edr.448.2019.11.08.09.16.44; Fri, 08 Nov 2019 09:17:11 -0800 (PST) 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=@walle.cc header.s=mail2016061301 header.b=babhKa+H; 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 S1726349AbfKHROR (ORCPT + 99 others); Fri, 8 Nov 2019 12:14:17 -0500 Received: from ssl.serverraum.org ([176.9.125.105]:33763 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726049AbfKHROR (ORCPT ); Fri, 8 Nov 2019 12:14:17 -0500 Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 6F442232FE; Fri, 8 Nov 2019 18:14:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1573233255; bh=xz7VneuhDNhyAxfNOVJ8pZ6Cwxs/reD73VEhmpLDF3g=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=babhKa+HTcaMZkgBuuNaR3ZSqe/1/lPEH1pezi5o5Z4QQeJcF0IiBA/fbsFPsFHC9 paTz4ex+4+eodTwv5AOP1XhGaJ7nNbfys2LItBQVK72GWq0xbOSiZynvO8B01NLG+u a2Afb4Mag8fthrFsoaqk/f1PUdgNK2aD4NCV5HRU= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 08 Nov 2019 18:14:15 +0100 From: Michael Walle To: Charles Keepax Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , patches@opensource.cirrus.com Subject: Re: [PATCH] ASoC: wm8904: configure sysclk/FLL automatically In-Reply-To: <20191108160704.GA10439@ediswmail.ad.cirrus.com> References: <20191107231548.17454-1-michael@walle.cc> <20191108160704.GA10439@ediswmail.ad.cirrus.com> Message-ID: <1ce127111686a80fe1461d49bac50f86@walle.cc> X-Sender: michael@walle.cc User-Agent: Roundcube Webmail/1.2.3 X-Virus-Scanned: clamav-milter 0.101.4 at web X-Virus-Status: Clean Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 2019-11-08 17:07, schrieb Charles Keepax: > On Fri, Nov 08, 2019 at 12:15:48AM +0100, Michael Walle wrote: >> This adds a new mode WM8904_CLK_AUTO which automatically enables the >> FLL >> if a frequency different than the MCLK is set. >> >> These additions make the codec work with the simple-card driver in >> general and especially in systems where the MCLK doesn't match the >> requested clock. >> >> Signed-off-by: Michael Walle >> --- >> +static int wm8904_set_sysclk(struct snd_soc_dai *dai, int clk_id, >> + unsigned int freq, int dir) >> +{ >> + struct snd_soc_component *component = dai->component; >> + struct wm8904_priv *priv = snd_soc_component_get_drvdata(component); >> + unsigned long mclk_freq; >> + int ret; >> + >> + switch (clk_id) { >> + case WM8904_CLK_AUTO: >> + mclk_freq = clk_get_rate(priv->mclk); >> + /* enable FLL if a different sysclk is desired */ >> + if (mclk_freq != freq) { >> + priv->sysclk_src = WM8904_CLK_FLL; >> + ret = wm8904_set_fll(dai, WM8904_FLL_MCLK, >> + WM8904_FLL_MCLK, >> + clk_get_rate(priv->mclk), freq); > > minor nit, might as well use mclk_freq rather than calling > clk_get_rate again, other than that though I think this looks > good. whoops, I was too tired then. That was the whole intention of using the mclk_freq variable.. so yes, I'll fix that. -michael