Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp634604ybe; Fri, 6 Sep 2019 05:08:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7IG4Udp0+UJzzBURDMvPDYCVgmBRdmNRwdaor9O3mmtA8JwANHG95XvRk0tRvIRW2G7/u X-Received: by 2002:a17:902:6b88:: with SMTP id p8mr8591919plk.95.1567771687389; Fri, 06 Sep 2019 05:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567771687; cv=none; d=google.com; s=arc-20160816; b=lyBmq0SKoQq29lcvsvHb4afUiMifiGVzQfo4nLxYioGkuQyKfeBtCDk9RaDrc1kOw5 FcCidqTOiAfLc1sQYwr0L8TIlkTue3odN0VG6dmxt5uuunigSZDgOlvbHkUVnfI1tQPZ KUh7lILQ/O6p+6//Bf0hNCAeIDRLmz1TgUEFfdaMXrYvwlf8lO4MEz02b0NT3L8/U+pc AhRJo/GBR6YF/D4xphihkeKx/2gHIFibcW1Zpu20E8j/bfnYfXVb/T9muBLzJcO31o+J +E6l9MD7CCXpEEQu0ZQBKdYKKKCNUYI47lDc8b9X1yps3fI/bGnnJWsTpE90i9kwYdLK iIoA== 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=sEoTtCVr37b7oXmy+gvoKkzJJnuSTqH0meQQ6053Wm4=; b=QbiQ8Caap+AdA5te7ZWypc3P3S2u/tt/6Ut47ulY2jHJCNYpUYmpXwrDunbYToHLJx iZyTQGv60ghnTY9aq3nUPlPRH8UXyqco9rdGtAvxTG8bIgiDBN5JnWGnRCU9V+pCB44z 4D0W2m018Poqn2M6vQg/b193NRxhB408564s8S3WUKjhsMLHoIqR23xcxW6xj8hhExiT vY4z9AOk31sXQ1Wvu2jIcFIRBZRkCrSqJrsqKMPZfGOLPvR3OsVDhcbmGBKyjTKw4urT znaBQKWwrjn1gEXAYYBplx3UEeY1fsnQIm4Ei0RH86j+T/1DNazO+TVXWw5ic2tC8spz 6O+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LLxnr0JE; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z26si4184540pgl.562.2019.09.06.05.07.51; Fri, 06 Sep 2019 05:08:07 -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=@gmail.com header.s=20161025 header.b=LLxnr0JE; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391894AbfIFB3e (ORCPT + 99 others); Thu, 5 Sep 2019 21:29:34 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:40683 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732000AbfIFB3e (ORCPT ); Thu, 5 Sep 2019 21:29:34 -0400 Received: by mail-pg1-f194.google.com with SMTP id w10so2490282pgj.7 for ; Thu, 05 Sep 2019 18:29:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=sEoTtCVr37b7oXmy+gvoKkzJJnuSTqH0meQQ6053Wm4=; b=LLxnr0JE4Z4CWrSnhcqlNRIC2d8xEpNueechntqus1WAPdfNrw5vi3KN8zSMRtZ9E7 aiTRmWCIcAcaTcaXfN4XbZ6EZrXp4zlDDTiWQOjZsQweSHyJzpkHAi+Ao2GvyXunQbN1 Kk7/QAmX0s5sR0H7znd19wpx1vXZb8JaMW/juvG7WTA9XhpCY3FUMDvzizXjkmq0kPuc Hkpd7MNdtnidTUxu9nttF4wZB3fIbKAqGk2eKY47VYtYOwXkiM+vPA3kglKUjcDWiM2j mw7Iy+MOWOwIGrpmJGXgafZE/6w+xV2uwWRS4azhU2JRux5BwJd4zwmAgpdydGabvwbq 1u+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=sEoTtCVr37b7oXmy+gvoKkzJJnuSTqH0meQQ6053Wm4=; b=pnZLKpeHINzNt55CiGPt1fooXImSVdrv0DYJwXRetIGwWHx7paJhu8otR9rlzTt9e5 VI43QY9d9u+FnnGjYymvJP6MC1T6k+YZmjSa7rmfK4Cn8W6C65X/B7Wu1/3nBWFdvH96 HJuLuhE1GBYASsfKN2Njrie8x5wE+7EqTpKf4ob0YjqdLECF0S9DYjcSEHygiGHO/ySz vJ6T+b06GUkM5il1ln0UAMJpBPRx35f64ZgWL8WdgPHDpiln+bRif9TKmKRSscz0f/Yu Pw+rEakVCivoVFm7Gczk4PYGg1OrnunNv3ksBnlvypE9id3XlVlZgPZC+IccgxZXB/66 fY7w== X-Gm-Message-State: APjAAAU0GtfNCjlUTLcOxAoqYDbA+UTEGj8ibPHzt0KCWDSQ6uIafQA1 6cW1iMpFVqYrm4kOUWsPqX4= X-Received: by 2002:a17:90a:3acf:: with SMTP id b73mr6434716pjc.88.1567733373322; Thu, 05 Sep 2019 18:29:33 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id f188sm3327847pfa.170.2019.09.05.18.29.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 05 Sep 2019 18:29:32 -0700 (PDT) Date: Thu, 5 Sep 2019 18:29:39 -0700 From: Nicolin Chen To: Daniel Baluta Cc: broonie@kernel.org, festevam@gmail.com, shengjiu.wang@nxp.com, Xiubo.Lee@gmail.com, timur@kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Viorel Suman , NXP Linux Team Subject: Re: [PATCH] ASoC: fsl_sai: Implement set_bclk_ratio Message-ID: <20190906012938.GB17926@Asurada-Nvidia.nvidia.com> References: <20190830215910.31590-1-daniel.baluta@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190830215910.31590-1-daniel.baluta@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Aug 31, 2019 at 12:59:10AM +0300, Daniel Baluta wrote: > From: Viorel Suman > > This is to allow machine drivers to set a certain bitclk rate > which might not be exactly rate * frame size. Just a quick thought of mine: slot_width and slots could be set via set_dai_tdm_slot() actually, while set_bclk_ratio() would override that one with your change. I'm not sure which one could be more important...so would you mind elaborating your use case? Thanks Nicolin > > Cc: NXP Linux Team > Signed-off-by: Viorel Suman > Signed-off-by: Daniel Baluta > --- > sound/soc/fsl/fsl_sai.c | 21 +++++++++++++++++++-- > sound/soc/fsl/fsl_sai.h | 1 + > 2 files changed, 20 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/fsl/fsl_sai.c b/sound/soc/fsl/fsl_sai.c > index fe126029f4e3..e896b577b1f7 100644 > --- a/sound/soc/fsl/fsl_sai.c > +++ b/sound/soc/fsl/fsl_sai.c > @@ -137,6 +137,16 @@ static int fsl_sai_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask, > return 0; > } > > +static int fsl_sai_set_dai_bclk_ratio(struct snd_soc_dai *dai, > + unsigned int ratio) > +{ > + struct fsl_sai *sai = snd_soc_dai_get_drvdata(dai); > + > + sai->bclk_ratio = ratio; > + > + return 0; > +} > + > static int fsl_sai_set_dai_sysclk_tr(struct snd_soc_dai *cpu_dai, > int clk_id, unsigned int freq, int fsl_dir) > { > @@ -423,8 +433,14 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, > slot_width = sai->slot_width; > > if (!sai->is_slave_mode) { > - ret = fsl_sai_set_bclk(cpu_dai, tx, > - slots * slot_width * params_rate(params)); > + if (sai->bclk_ratio) > + ret = fsl_sai_set_bclk(cpu_dai, tx, > + sai->bclk_ratio * > + params_rate(params)); > + else > + ret = fsl_sai_set_bclk(cpu_dai, tx, > + slots * slot_width * > + params_rate(params)); > if (ret) > return ret; > > @@ -640,6 +656,7 @@ static void fsl_sai_shutdown(struct snd_pcm_substream *substream, > } > > static const struct snd_soc_dai_ops fsl_sai_pcm_dai_ops = { > + .set_bclk_ratio = fsl_sai_set_dai_bclk_ratio, > .set_sysclk = fsl_sai_set_dai_sysclk, > .set_fmt = fsl_sai_set_dai_fmt, > .set_tdm_slot = fsl_sai_set_dai_tdm_slot, > diff --git a/sound/soc/fsl/fsl_sai.h b/sound/soc/fsl/fsl_sai.h > index 3a3f6f8e5595..f96f8d97489d 100644 > --- a/sound/soc/fsl/fsl_sai.h > +++ b/sound/soc/fsl/fsl_sai.h > @@ -177,6 +177,7 @@ struct fsl_sai { > unsigned int mclk_streams; > unsigned int slots; > unsigned int slot_width; > + unsigned int bclk_ratio; > > const struct fsl_sai_soc_data *soc_data; > struct snd_dmaengine_dai_dma_data dma_params_rx; > -- > 2.17.1 >