From: Dimitris Papavasiliou Subject: Re: [PATCH 1/2] ASoC: pcm512x: Implement the set_bclk_ratio interface Date: Sat, 26 Jan 2019 21:00:09 +0200 Message-ID: References: <9b758d09-9b9b-77a1-6651-43755c67e6fd@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ed1-f66.google.com (mail-ed1-f66.google.com [209.85.208.66]) by alsa0.perex.cz (Postfix) with ESMTP id C0BBE26680F for ; Sat, 26 Jan 2019 20:00:12 +0100 (CET) Received: by mail-ed1-f66.google.com with SMTP id y56so9937239edd.11 for ; Sat, 26 Jan 2019 11:00:12 -0800 (PST) In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Peter Rosin , "alsa-devel@alsa-project.org" Cc: Kuninori Morimoto , Takashi Iwai , Liam Girdwood , Matthias Reichl , Mark Brown List-Id: alsa-devel@alsa-project.org On 1/26/19 8:48 PM, Peter Rosin wrote: > On 2019-01-26 14:17, Dimitris Papavasiliou wrote: >> +static int pcm512x_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) >> +{ >> + struct snd_soc_component *component = dai->component; >> + struct pcm512x_priv *pcm512x = snd_soc_component_get_drvdata(component); >> + >> + if (ratio > 256) >> + return -EINVAL; > > ratio == 0 should also generate -EINVAL. Sorry, I forgot to mention in the notes, that I allowed setting a zero ratio on purpose, in order to allow "unsetting" the bclk ratio (since it only takes effect if it is positive). I'm not sure if it will ever be necessary to do that in practice, but I thought I'd allow it, since it has a valid effect.