Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752459AbdCOJST (ORCPT ); Wed, 15 Mar 2017 05:18:19 -0400 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:32791 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752297AbdCOJSO (ORCPT ); Wed, 15 Mar 2017 05:18:14 -0400 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.wolfsonmicro.com Date: Wed, 15 Mar 2017 09:19:01 +0000 From: Charles Keepax To: Daniel Baluta CC: , , , , , , , , Subject: Re: [RFC PATCH] ASoC: wm8960: Use physical width for bclk Message-ID: <20170315091901.GF6986@localhost.localdomain> References: <1489510622-30981-1-git-send-email-daniel.baluta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <1489510622-30981-1-git-send-email-daniel.baluta@nxp.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=2 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1703150073 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1486 Lines: 38 On Tue, Mar 14, 2017 at 06:57:02PM +0200, Daniel Baluta wrote: > bclk is derived from sysclk with the help of bclk_divs. Anyhow, for > S20_3LE format there is no bclk_divs that could be used to derive > an exact bclk. > > We can fix this by using storage size instead the exact > number of bits of the sample when computing bclk. > > With this approach we can play S20_3LE encoded files at the cost of > some unused BCLK cycles for S20_3LE and S24_LE. > > Signed-off-by: Daniel Baluta > --- > sound/soc/codecs/wm8960.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c > index e1429e3..18ca5fc 100644 > --- a/sound/soc/codecs/wm8960.c > +++ b/sound/soc/codecs/wm8960.c > @@ -722,7 +722,8 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream, > bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; > int i; > > - wm8960->bclk = snd_soc_params_to_bclk(params); > + wm8960->bclk = params_physical_width(params) * > + params_channels(params) * params_rate(params); > if (params_channels(params) == 1) > wm8960->bclk *= 2; Would quite like to see Mark's thoughts on this. Feels a bit to me (although I am not certain) like we are solving the problem in the wrong place, isn't this really setting the desired BCLK and then in wm8960_configure_clocking we should set the lowest BCLK we can that is greater than or equal to the desired. Thanks, Charles