Received: by 10.223.176.5 with SMTP id f5csp2554090wra; Sun, 28 Jan 2018 23:39:43 -0800 (PST) X-Google-Smtp-Source: AH8x2278bbnsdfhR4VmdPyUS/pAAxyLjobZMr/k3i0Fii8rJYjZ8qpNuqgR9e5Hi1QtJ/gxlhnyp X-Received: by 10.99.61.205 with SMTP id k196mr19417587pga.370.1517211583157; Sun, 28 Jan 2018 23:39:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517211583; cv=none; d=google.com; s=arc-20160816; b=o68J63z7LOb6emSL9XYQ8IP1XnD7h1M7DW4QMRljpNREdG22Wq3egtQULs/hEsmQ1o 5Ov2rZXvv+BJNk58BFuIdgJ8f56Ae0tHwHZHbn3EY905EWUosqhrEegafrJaWK9svNQ3 16HOryqeRJ/gt39TblN2iPFpRPbv2PN+T+nps6gv8OZ8ZJzagNHrItDr6OsP1//apMv9 9VtxTbf8dJBhfu9ho2NeA+iyu2B4KCl5y7oEeq+7xDpuOeBGgoRPd/EWF0EGEifLWsw+ BTGeqNv0Nc6+N0ZCFD+q2cwE9+WxTib4mTb8ZINytoDgP3nFkQkvrin/62eM/bDeeC5i x5jw== 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=VE/apnlMmkDQ34fy7rP+ZLtlKfjRl0mTNddQP/EpLkI=; b=jskFfbITIsQDRi4DB7u8o9GrPnfFkVmJAmV9mvcwGhmVLroBaARurdKe5Mdvagohjj OwAoAM7XQiOfpwVR51rTDbExFnPcb8KraYd/E39X5PkF3EGP9ZQV4I9HAxChz2ia9a1y GkQcwSemavhWEUA7a9z3DQMf5B8dvYdHY03/bgrwn9RtGRbk6zUc2BBKUMtQRMb3asKM lpKnekkvJ6/nnk1ebtUnn5ZJ0xjVFIPtS9JxNRsjabP+SloM1Yigsp0+1ipoYbp/T3Vf dNdp/QtTLi0XYka+WNUYNlxGNTlqmB6HnKpUtOtSlh04uFk55vDjqhTNfOGzXcg4juoI KhdQ== 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 h9si6936888pgq.683.2018.01.28.23.39.27; Sun, 28 Jan 2018 23:39:43 -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 S1751363AbeA2HjE (ORCPT + 99 others); Mon, 29 Jan 2018 02:39:04 -0500 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37885 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042AbeA2HjD (ORCPT ); Mon, 29 Jan 2018 02:39:03 -0500 Received: by mail-wm0-f66.google.com with SMTP id v71so31705275wmv.2 for ; Sun, 28 Jan 2018 23:39:02 -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=VE/apnlMmkDQ34fy7rP+ZLtlKfjRl0mTNddQP/EpLkI=; b=taqGTR3E2fmyYF2E15Fc+Y6QXu8F0FuJU0PahNXbyKDsW4ht64T3PuZoPhzW1iF8xY x4oi8Hkf0LP20gay6v15GJQ4nTMTlbW1mi7wdxScICugYW5bW844l7TQhWwIuEUFJoXc e8Rejm8jYLRzZnvc62Tg5cR6v3maGrR9lSvqRx9MPS797+GEiw02m80+my4HXfw0LeMA V7z2Vy3f6kiC/dXzTP3LwBwRg8BfmVpJ6LU7mArvpHto0HMxyLD8HldAwIa+g1QVfQQJ gtzy56ADEuUPa3jSgZTMMoLawNQKyp5hq4suMGWQJWir9bKq/Zt2ygqmDCpW19CT/gEg UXow== X-Gm-Message-State: AKwxytfIj66PEq2RBGD9KnVcMJNK10hx+RPw7aAaqKsb0hOq08zCrR/P be2YENizoc38K1cxjUvDTuAqqpk1 X-Received: by 10.80.244.211 with SMTP id v19mr46247757edm.278.1517211541560; Sun, 28 Jan 2018 23:39:01 -0800 (PST) Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com. [209.85.128.171]) by smtp.gmail.com with ESMTPSA id d60sm5872530edc.40.2018.01.28.23.39.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 28 Jan 2018 23:39:01 -0800 (PST) Received: by mail-wr0-f171.google.com with SMTP id 16so6001510wry.12 for ; Sun, 28 Jan 2018 23:39:01 -0800 (PST) X-Received: by 10.223.187.20 with SMTP id r20mr19689924wrg.115.1517211541022; Sun, 28 Jan 2018 23:39:01 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.160.88 with HTTP; Sun, 28 Jan 2018 23:38:40 -0800 (PST) In-Reply-To: References: <20180124141101.12867-1-codekipper@gmail.com> <20180124141101.12867-2-codekipper@gmail.com> From: Chen-Yu Tsai Date: Mon, 29 Jan 2018 15:38:40 +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 Mon, Jan 29, 2018 at 3:34 PM, Code Kipper wrote: > On 29 January 2018 at 02:50, Chen-Yu Tsai wrote: >> 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? > > Hi Wens, > I'm not sure..I was looking for a clean example of being able to > override the number of bclks in the lrclk width and some other > devices(Rpi) were doing it this way. I open to suggestions, I'm not familiar with the issue either. If Mark doesn't have any objections, we could merge it for now, and fix it later if there are any complications. BTW, you didn't provide a device tree example (if any) for how to use this. ChenYu > BR, > CK >> >> 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.