Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp538484ybl; Thu, 15 Aug 2019 23:29:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqw83nf8f1wgs/LenMXVpMC4jFnZ/1KfzFZAqWW1dy9WsqPPioVKzAQZDeoObCXhceDf3L9S X-Received: by 2002:aa7:81ca:: with SMTP id c10mr9310008pfn.185.1565936997976; Thu, 15 Aug 2019 23:29:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565936997; cv=none; d=google.com; s=arc-20160816; b=t3cslkzjSSRE3Te8lsCT345omx0j8ElFaxZhzyW3s/XyKKzjJ6ESaRIMvsTUN9yxQX TJLI1NnP6JCKhdz/6aEObayXhpyfnBgvqd27eYx+BZ+0iTbwY5480T0GcQh1U5PRCTau YuvDXpk/OEjyWtzll7CXHQ1OUVATHHgVJvkf7opmL9G8kP8P9NVwbGBnNp6LJne/nEh6 /bAHp2msoptW6Xpfyxvk0WIHQPti+WEk5ksDVnsTyI4wlH6mHwO83wnSPE3Lx3Et7XZC ZoPhHuv5eC2MFG2NPs6ZEZnUXT685ShcbMjNKB01ljD1GVgzbsuHN0H07LMIEG8vAHgZ WIrw== 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 :in-reply-to:references:mime-version:dkim-signature; bh=+lm26ypr1HFcyJ7hZ74u9revSRfSoVfoTCtYpt3Woco=; b=EJOFZ+DfmpfUsupIE7ARRlNl6kMtP7IXySCk+/vT/m/9kW5TcQcU1EryvX8Xt6X1hL Z8j3m6Q9YMYM596x3rTciWkrma+upgjIyRLPzOtu1MMsB/iu8Vi0L/KUrgmHT4XVyQyn 0WRx5iAdWwCNdloNZ3P418kyF3U7zcWOkqVXUAG8FOZ1ioh21Yj009ZucVeUruhLGRTq Cn/o5iHUCkTqg/OMsVsHgfZPYsXcQhNXW/ddMwgwYoug1/eYHZu782K2848PGOM6PGLK 85I4k7C0R6W1183sTxe6dP3SyQ4k0tzNSFJAcEQkAXg2mpz3ubN++Thc6dNjftlyymxP BV3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=GDQS3E3w; 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 h3si3438431pld.32.2019.08.15.23.29.42; Thu, 15 Aug 2019 23:29:57 -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=GDQS3E3w; 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 S1726814AbfHPG1S (ORCPT + 99 others); Fri, 16 Aug 2019 02:27:18 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:42625 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725945AbfHPG1S (ORCPT ); Fri, 16 Aug 2019 02:27:18 -0400 Received: by mail-lf1-f65.google.com with SMTP id s19so3295346lfb.9 for ; Thu, 15 Aug 2019 23:27:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+lm26ypr1HFcyJ7hZ74u9revSRfSoVfoTCtYpt3Woco=; b=GDQS3E3wgsOcpEmUdh/7FrM+PIwG363gn6bd/2WcIDTYecvOS6uKIzzZah8q/y++LL JAPEsMUEGYHVt/cJCJ5RH4/KRZVEZ5zHs1HjqBD4Lh8P+yeCfaGzm/qZNWcwRr5klPFP gXkGm26epRrNG7drbO05XPe6GKCVNb2zU9wlzDMI/y2bi0BCxZvj4P4PKKQO/e4Yq1cj PL/z1F1uN+BlT8QbNG3TZ35AKbl35qDVdizIf6yQ8DE5/3XDtXBHeQ/NulYnxZt288Su +3D9HTDceHmk6mPD/4ZZXrjPfd/p2H5DtdIGAfhXjLoiv0yPkL3TGoclyQgG0hDjF5l7 6lbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+lm26ypr1HFcyJ7hZ74u9revSRfSoVfoTCtYpt3Woco=; b=sEDfMb9znplQ6VI2PWaRRoNCWPuu+fdT2T+cimKNFK7W0GQ/2h1ZljVauUX2aJKYTU HeJA2Cyzgy1Ps3sZTaHK5UmAEEqZ/WxYEnFlVftUi0iU2xPoM71nl4h0PyCoFDGE+gjs YtczgXCkZaU67XrBq/7GcE27m57u5DRB0goPWzjdfMItYTBD59LWniCagYGBB1wAeFA6 SzBVXHxDHf1sfQWBMQM7QtvAhqGuWe77fpl2eyUHUgmQJ0YHH4lcQsQkmCcArw8X8cO2 Wt4kbw7T/bndE1JLlh/uDiTNRbegQJvDUd5leiu2KpMCxqIfS2vwWQ/m7Gxj86lM/mva 0S5w== X-Gm-Message-State: APjAAAWY7Tkx4TAdqoFhT21Dt2jkvhP7pw4oqyEDFeOYEUagTNrE2SZF rCKhYvMb18WzbWjXqiUiaMPke3fntSD1LOiXXc8= X-Received: by 2002:ac2:465e:: with SMTP id s30mr4431231lfo.19.1565936836466; Thu, 15 Aug 2019 23:27:16 -0700 (PDT) MIME-Version: 1.0 References: <20190814060854.26345-1-codekipper@gmail.com> <20190814060854.26345-3-codekipper@gmail.com> <20190814070923.wwkw7hybjvy3p4br@flea> In-Reply-To: <20190814070923.wwkw7hybjvy3p4br@flea> From: Code Kipper Date: Fri, 16 Aug 2019 08:27:05 +0200 Message-ID: Subject: Re: [PATCH v5 02/15] ASoC: sun4i-i2s: Add set_tdm_slot functionality To: Maxime Ripard Cc: Chen-Yu Tsai , linux-sunxi , linux-arm-kernel , 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, 14 Aug 2019 at 13:08, Maxime Ripard wrote: > > Hi, > > On Wed, Aug 14, 2019 at 08:08:41AM +0200, codekipper@gmail.com wrote: > > From: Marcus Cooper > > > > Codecs without a control connection such as i2s based HDMI audio and > > the Pine64 DAC require a different amount of 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 8201334a059b..7c37b6291df0 100644 > > --- a/sound/soc/sunxi/sun4i-i2s.c > > +++ b/sound/soc/sunxi/sun4i-i2s.c > > @@ -195,6 +195,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 { > > @@ -346,7 +349,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)); > > > > > > /* Set sign extension to pad out LSB with 0 */ > > regmap_field_write(i2s->field_fmt_sext, 0); > > @@ -450,7 +453,8 @@ static int sun4i_i2s_hw_params(struct snd_pcm_substream *substream, > > regmap_field_write(i2s->field_fmt_sr, sr); > > > > return sun4i_i2s_set_clk_rate(dai, params_rate(params), > > - params_width(params)); > > + i2s->tdm_slots ? > > + i2s->slot_width : params_width(params)); > > This is slightly more complicated than that. At this point we're only supporting 2 channels with fixed slot settings. I've added a comment to state that we're using the tdm_slot at the moment as an indicator to override the slot width. Do you think that is enough for now?. Thanks, CK > > On the H3 (and all related ones), the CHAN_CFG_TX_SLOT_NUM and > _RX_SLOT_NUM fields in the CHAN_CFG register need to be set to the > number of slots as well. > > Maxime > > -- > Maxime Ripard, Bootlin > Embedded Linux and Kernel engineering > https://bootlin.com