Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp2703047ybx; Fri, 8 Nov 2019 08:10:27 -0800 (PST) X-Google-Smtp-Source: APXvYqzTcpYjH1HmuW3mj4NSeVIhjptU+JA8UZFZ1+AT8vmQKJjLcVzsAqv4KQ9iHAIVspU9Oq5j X-Received: by 2002:a17:906:73d4:: with SMTP id n20mr9553443ejl.45.1573229426914; Fri, 08 Nov 2019 08:10:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573229426; cv=none; d=google.com; s=arc-20160816; b=z6p//jWt7nwcobalR/bvf8Rtuh+RPVRm37Cdbola7e9y1cZrSdnv8BMudCdQ80ioJl PujCA7P0yl5G5/H6mc8I8BaoOas+oMInNVFyWGiffmYhLMeIP6BepAPQ5BbRpgkrQSI9 viXXmF9o0ZEaONuPhfJeXnK/ZMmOsT4QLWKWKCxX4iXImG4NJNlc0nlxUnGkVOM/k4z8 8Tssqupv6rSAqOIgWe0xWCnsMC1ZU/JwvlnfeQxqmuXPXu5sUWqyzFezFUu3eazB3dLg eZOpKPskh7BURGX4mKtMlXx8oj9Fmv/7Unahz2Tkt0HlcHDOhslZBzcWTLFTAyUkgzMs 3eVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=8sfSVCnGboedt/b1ZhqJ7bI2jbmOSniGz207iomPpS4=; b=RA2+FsbElTEx+Zmd35sHEjx1tksJlfEB6RFsQMKuwrYnneJpjkSPycmSZf8DcbRlMU jZfFCJkBCTYvPLzYjZYUckWz6sFhtbQrsbHJo5V2MLe2hhdDMo61/JwEQy7GytCmCxx9 KQFZ21qYTBP7byhk6R845x5vBeNWLLjCgN08EDXGrSGpjE3PMoka70s2ntBF51qVeNS4 MksisF51pCCBugEWX+Tfo0PCyRA42RH3gVwvRIApRlD0zitR1DD5hdxPTj7TYoviJwR7 gJn7SWWIvQNLqs6VRgeLb3C89l3rfvNi89Ae+2gjgbR02FZx8vjhWcmBApKle8xZzVZK zD4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=Wowt4+gy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s12si3733527eja.47.2019.11.08.08.10.03; Fri, 08 Nov 2019 08:10:26 -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=@cirrus.com header.s=PODMain02222019 header.b=Wowt4+gy; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=opensource.cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727701AbfKHQJP (ORCPT + 99 others); Fri, 8 Nov 2019 11:09:15 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:46160 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726036AbfKHQJO (ORCPT ); Fri, 8 Nov 2019 11:09:14 -0500 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id xA8G4LnJ006738; Fri, 8 Nov 2019 10:07:06 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=8sfSVCnGboedt/b1ZhqJ7bI2jbmOSniGz207iomPpS4=; b=Wowt4+gy6hEErv+Hrv/3ESKn9QBAXk4FtrZigukHe5fLSbLoIkUkAvcXg29t5BoJX2nB 6SgSxUQDIAaYndZIKvVXS8yWXNhm+2qyNj2yIIyBg5zI8DQusVOhUYm/13ITXvzw569Q co+uuMb6y42zWICCo9yhVfjT5djMr2CiP7AMEBnMhVFoUq7viwkBKU9X0NEkjE7H3Lm/ n2TAkKcVOqLUdACAJjwrHkSPPAKB6Fc4b2fAvzzcItljtNlSToprwBp7VCvun68Iiqfr +qHJ9dZUGTEJk0JHGezzGu7KfNvKkrLnt5hU80I+/g9QjHnx+EkVRFzoomWfqlsKx1mj 4A== Authentication-Results: ppops.net; spf=fail smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 2w41w6udan-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Fri, 08 Nov 2019 10:07:06 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1591.10; Fri, 8 Nov 2019 16:07:04 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1591.10 via Frontend Transport; Fri, 8 Nov 2019 16:07:04 +0000 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 7C5B92A1; Fri, 8 Nov 2019 16:07:04 +0000 (UTC) Date: Fri, 8 Nov 2019 16:07:04 +0000 From: Charles Keepax To: Michael Walle CC: , , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Subject: Re: [PATCH] ASoC: wm8904: configure sysclk/FLL automatically Message-ID: <20191108160704.GA10439@ediswmail.ad.cirrus.com> References: <20191107231548.17454-1-michael@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20191107231548.17454-1-michael@walle.cc> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-SPF-Result: fail X-Proofpoint-SPF-Record: v=spf1 include:spf-001ae601.pphosted.com include:spf.protection.outlook.com -all X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 lowpriorityscore=0 mlxscore=0 phishscore=0 impostorscore=0 bulkscore=0 clxscore=1011 spamscore=0 priorityscore=1501 suspectscore=0 adultscore=0 mlxlogscore=805 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-1910280000 definitions=main-1911080160 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Charles