Received: by 10.223.176.5 with SMTP id f5csp2367886wra; Sun, 28 Jan 2018 19:02:40 -0800 (PST) X-Google-Smtp-Source: AH8x226kBy0XTjSEb1z5VlRc8WqaxYxFgdzM2zB3libf3//GwVsw2WZOvDZewb9jMsFCAHZSTTzj X-Received: by 2002:a17:902:6186:: with SMTP id u6-v6mr20020538plj.390.1517194960215; Sun, 28 Jan 2018 19:02:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517194960; cv=none; d=google.com; s=arc-20160816; b=jd/R2DG6/qKS3PYvfWzipXCP4DB/At3pu8NNcVomgXSlPqYKBF14vOuoCc8mMzPxUy EobIAeSSEYxv0wL3qUJHbEJxJ9bnRvH2LQjU2dka047NJU+kow/dti6j56yqPN4Om8JC +h12Me8/w9E31pUTqbOpX7O2Kyu3yUNPBWbjPH+yBFz/79jNyEUNM1m8egtEs+tM8Z/4 tBPeABGaSmvMj4EW4h7wg3F4y8PlFA7+1scub9abrR7pa7A/BSucT7JCvYUs3np1Tt9J qrYgjS0m3JLfiea5gXwYwNNFaSjzFXCkIy7XFJEuLN5Kbq1K4ithNT0OO3CZOonKgwyW hNaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:arc-authentication-results; bh=dLUCEBlFWEaDid/4khH0WGYm5sDukpvvElziBtgON0o=; b=RkwFgcGKc3FEv42mcitGTLdiIIdbkdiceyTaBsDRdDAuXES4Aqm8LoTnG9sopFWJgk gWbZNx6CGs+8FdtDPLb4c5QcLPzvHMtdIPOEn0QI3mCodTsAcNcQ4njsyCWVaCm9xITZ /9WuegKdiJFJl2I8R/Cd0faXyiZ4dZafMOavwYhKSCel1rZ437cxBAGeo0d/1gF5SyT0 b5hf/qOXvCYjoq4aIVkEYHsWH3onuRTfrfsJMWY7NRKCuzgUscWZmvsmtaZqbvpikFSG f33nMWhnnj6RucJ9uzSnhj5HtYxZ6GFtEaswfe7DKv6T76hkewX6XQS3sOQdHVeJVAFJ oIVA== ARC-Authentication-Results: i=1; mx.google.com; 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 c41-v6si8177321plj.258.2018.01.28.19.02.25; Sun, 28 Jan 2018 19:02:40 -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; 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 S932252AbeA2Bug (ORCPT + 99 others); Sun, 28 Jan 2018 20:50:36 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:39920 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932121AbeA2Buf (ORCPT ); Sun, 28 Jan 2018 20:50:35 -0500 Received: by mail-wm0-f68.google.com with SMTP id b21so30738970wme.4 for ; Sun, 28 Jan 2018 17:50:34 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=dLUCEBlFWEaDid/4khH0WGYm5sDukpvvElziBtgON0o=; b=EbYzfYwoV233RdyG1CIib9Mam64AAjPnOKNWmGET+0LVuFNE0vaOMxMbDdarwDK9ft +iC2f1gry0jmgQ8KhWKKy1An05Ul9oQMuM2TxODsuIShinYDVMnDYaMo9iAYYcF35nFU 00BoLevZl+9PwteiB8L4b5hSnVIYSsn/T5WrpNAgPGQ2kH0AkJi/6ohC10BnDHaYWjxH c4I/ZF8m/BeBwEtZEVF6qpOILXnujX12Mls9Pd5M0FiDd3ClbeCk2Pw8zB0BNJtigGCP AJAcWbgXzIzzbIfWtrv+LESlUjlALSewRBba+1pw538ozhwHMXdlKuVtYKKAu68RggCS HJKA== X-Gm-Message-State: AKwxytcUq5tG5k44DEMXvf7/92Htg1UyCEy3r6bZWZ4lX2zo0dZcXhZK 1JJ2zQZtyU8UTQsUTbJVDU2ccNif X-Received: by 10.80.181.9 with SMTP id y9mr43967604edd.131.1517190633404; Sun, 28 Jan 2018 17:50:33 -0800 (PST) Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com. [209.85.128.176]) by smtp.gmail.com with ESMTPSA id b46sm5894989edd.73.2018.01.28.17.50.32 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Jan 2018 17:50:32 -0800 (PST) Received: by mail-wr0-f176.google.com with SMTP id 36so5467698wrh.1 for ; Sun, 28 Jan 2018 17:50:32 -0800 (PST) X-Received: by 10.223.182.165 with SMTP id j37mr5163633wre.85.1517190632380; Sun, 28 Jan 2018 17:50:32 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.160.88 with HTTP; Sun, 28 Jan 2018 17:50:11 -0800 (PST) In-Reply-To: <20180124141101.12867-2-codekipper@gmail.com> References: <20180124141101.12867-1-codekipper@gmail.com> <20180124141101.12867-2-codekipper@gmail.com> From: Chen-Yu Tsai Date: Mon, 29 Jan 2018 09:50:11 +0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [linux-sunxi] [PATCH 1/3] ASoC: sun4i-i2s: Add set_tdm_slot functionality To: Code Kipper Cc: Maxime Ripard , linux-arm-kernel , linux-sunxi , Liam Girdwood , Mark Brown , linux-kernel , Linux-ALSA , "Andrea Venturi (pers)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 24, 2018 at 10:10 PM, wrote: > From: Marcus Cooper > > Some codecs require a different amount of a bit clocks per frame than > what is calculated by the sample width. Use the tdm slot bindings to > provide this mechanism. > > Signed-off-by: Marcus Cooper > --- > sound/soc/sunxi/sun4i-i2s.c | 23 +++++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > > diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c > index dca1143c1150..d7a9141514cf 100644 > --- a/sound/soc/sunxi/sun4i-i2s.c > +++ b/sound/soc/sunxi/sun4i-i2s.c > @@ -96,6 +96,7 @@ > #define SUN8I_I2S_CTRL_BCLK_OUT BIT(18) > #define SUN8I_I2S_CTRL_LRCK_OUT BIT(17) > > +#define SUN8I_I2S_FMT0_LRCK_MAX_PERIOD (GENMASK(17, 8) >> 8) > #define SUN8I_I2S_FMT0_LRCK_PERIOD_MASK GENMASK(17, 8) > #define SUN8I_I2S_FMT0_LRCK_PERIOD(period) ((period - 1) << 8) > > @@ -193,6 +194,9 @@ struct sun4i_i2s { > struct regmap_field *field_rxchansel; > > const struct sun4i_i2s_quirks *variant; > + > + unsigned int tdm_slots; > + unsigned int slot_width; > }; > > struct sun4i_i2s_clk_div { > @@ -344,7 +348,7 @@ static int sun4i_i2s_set_clk_rate(struct snd_soc_dai *dai, > if (i2s->variant->has_fmt_set_lrck_period) > regmap_update_bits(i2s->regmap, SUN4I_I2S_FMT0_REG, > SUN8I_I2S_FMT0_LRCK_PERIOD_MASK, > - SUN8I_I2S_FMT0_LRCK_PERIOD(32)); > + SUN8I_I2S_FMT0_LRCK_PERIOD(word_size)); > > return 0; > } > @@ -418,7 +422,8 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, > sr + i2s->variant->fmt_offset); > > return sun4i_i2s_set_clk_rate(dai, params_rate(params), > - params_width(params)); > + i2s->tdm_slots ? > + i2s->slot_width : params_width(params)); > } > > static int sun4i_i2s_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) > @@ -691,6 +696,19 @@ static int sun4i_i2s_set_sysclk(struct snd_soc_dai *dai, int clk_id, > return 0; > } > > +static int sun4i_i2s_set_dai_tdm_slot(struct snd_soc_dai *dai, > + unsigned int tx_mask, unsigned int rx_mask, > + int slots, int width) > +{ > + struct sun4i_i2s *i2s = snd_soc_dai_get_drvdata(dai); > + > + i2s->tdm_slots = slots; > + > + i2s->slot_width = width; > + > + return 0; > +} > + IIRC some of the DAI controllers actually support TDM. Would this change conflict with that in the future? Thanks ChenYu > static const struct snd_soc_dai_ops sun4i_i2s_dai_ops = { > .hw_params = sun4i_i2s_hw_params, > .set_fmt = sun4i_i2s_set_fmt, > @@ -698,6 +716,7 @@ static const struct snd_soc_dai_ops sun4i_i2s_dai_ops = { > .shutdown = sun4i_i2s_shutdown, > .startup = sun4i_i2s_startup, > .trigger = sun4i_i2s_trigger, > + .set_tdm_slot = sun4i_i2s_set_dai_tdm_slot, > }; > > static int sun4i_i2s_dai_probe(struct snd_soc_dai *dai) > -- > 2.16.0 > > -- > You received this message because you are subscribed to the Google Groups "linux-sunxi" group. > To unsubscribe from this group and stop receiving emails from it, send an email to linux-sunxi+unsubscribe@googlegroups.com. > For more options, visit https://groups.google.com/d/optout.