Received: by 10.223.176.5 with SMTP id f5csp2550317wra; Sun, 28 Jan 2018 23:34:42 -0800 (PST) X-Google-Smtp-Source: AH8x227uBqrskfuXR2Q20X82L09E0YJkv4dFEs8d18IsgXBDjTWuq07gLj4NM08/q1/eBTQssLiF X-Received: by 2002:a17:902:25ab:: with SMTP id y40-v6mr21956597pla.140.1517211282579; Sun, 28 Jan 2018 23:34:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517211282; cv=none; d=google.com; s=arc-20160816; b=TFNJHPmyJIUfns+aT09wnampOd7GhupYblxxfxjNfTcfNiiPT7tfx7Nh4t00LMv7bl 8r5ghr8iD8S13TS1mrXtvS7y8I2aipeAoqJtaJl4+lMBkvF6ri7HF86Z1OpBBr3pcSA8 hVmbrkmb5qkulEcJa8DIxwX0FL0YKR+G2YqV//SozKmyHdQW1ZYEKWTi42b0CYdKlus/ pDJhZbD74aHyWR91o9qdakgFNMraZEYNXLRwUWevqeMwXNTw3hj42wpn65IS3aCtRVLC OjzhZ2X8JmiALJBnTcURp6ozF/6MBCBESZsLgq/0Y5slVoV3+O/8VqRUJjn0TYoRA1BW QT4w== 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:dkim-signature :arc-authentication-results; bh=gkBA1j+uVv+euVqVlLmg7gIisUbfc5kOJuuFKFKA8LI=; b=kpjxXyq6Z16eGuSSay4Z14sEHR7OMzH1q1dqLG4q57lpi1uLFgdaiY1Ee4dwcxatxi CYw+bYxaXt5VU0Jd/3fFjvrVESOH0u7Kt9xgyhrw0Sbmc8jhuOmD+WaK2sFmBrWFfAed yCjZ9vVJHZZFxHeoRLxn8RKF7bxcd9fFd6hVNvdR2LLfs/e7O6Y9SuV2BEnb3TWrzr5x vBolRfeFGPccHkcPhefl3t3ZTAXJSZcjcwEZ/8WSXy5EBw0dr03gszt1BlE6yp1xMrct qVYzIYHJ8jKCs5Xfghecc6bCseodRwsm0VGT/CDJN+OhTqPo4IO267ODLG2feUpOktmc c+ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PaHJ/JHu; 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=NONE 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 u4-v6si487117plz.115.2018.01.28.23.34.28; Sun, 28 Jan 2018 23:34:42 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=PaHJ/JHu; 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=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751397AbeA2HeC (ORCPT + 99 others); Mon, 29 Jan 2018 02:34:02 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:55327 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751042AbeA2HeB (ORCPT ); Mon, 29 Jan 2018 02:34:01 -0500 Received: by mail-it0-f67.google.com with SMTP id c16so7152559itc.5 for ; Sun, 28 Jan 2018 23:34:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gkBA1j+uVv+euVqVlLmg7gIisUbfc5kOJuuFKFKA8LI=; b=PaHJ/JHuiA38S++fwYiZCJ6PEtT7BGeZWdKsuHNiwZFZ2t+18ZH9i++Rvmpzdu3LUp gP7XodP3Lzd2PC2UHGU0QzCM8OdO2loJBAMhrzwRP08dplpigaDDbTBcg0B03ufo3B0c qVxz6j3AvnhL5qsP1sgW6W7BXdD7zABa7/SbyUD1UZTwTlNw85fZTPIbUo8mjDUgYnYn f/RBVhsi4QDBbSHuUmVgfhxkyxXc5WENAKVkWp+YRYsK8Wbkwi9nASUeA70i30hYTBVk Mcv4mrWRNYJeapWfaiqfulGeQBpJFP/kFFyjtsY1xyPLq8ftriXrL8lG0HTP49HDXzit d8Kw== 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=gkBA1j+uVv+euVqVlLmg7gIisUbfc5kOJuuFKFKA8LI=; b=BagaXR0+jUBnT5JR1LmuW/O2+TXOjp7awAwtKNgU5LaeBTzrrqpEMlVzLD9TuzuEIj QEDToHEuS+4g753OH73BX3fY1y4hqcg+v+Kz7f+U6Jc5bH10iOTdAqk0snFNvK2bjz3n pOH4WQ3nIBCa++X5nkJGcjSP0fKvAn7nbAGyjVk4Ad1ZpNwD1xfJOWiTPg2Z+JAJJLUb BiFbg5yMGaLyubfJ6Gl70Q1OWD0xW5E3+5UXSXGXp8FXfneGFdEI9c/vQ30y1Ir0hoRk C1j55HzzvnqpOVKqEvOlCUbgjJu6yxEe5UfXBo/lkZyKlwU/9bT5LstlmM53NCar8/xB +5gw== X-Gm-Message-State: AKwxytfEV3JuFbXmRQHOs3q7c+DsESM0j8VS+uljls3Qx3+WvTHx6eet kxfBJkOJ17GEznr/p/clIC0KDcQWXz4zMOch0M8= X-Received: by 10.36.152.139 with SMTP id n133mr26016206itd.137.1517211240729; Sun, 28 Jan 2018 23:34:00 -0800 (PST) MIME-Version: 1.0 Received: by 10.79.213.129 with HTTP; Sun, 28 Jan 2018 23:34:00 -0800 (PST) In-Reply-To: References: <20180124141101.12867-1-codekipper@gmail.com> <20180124141101.12867-2-codekipper@gmail.com> From: Code Kipper Date: Mon, 29 Jan 2018 08:34:00 +0100 Message-ID: Subject: Re: [linux-sunxi] [PATCH 1/3] ASoC: sun4i-i2s: Add set_tdm_slot functionality To: Chen-Yu Tsai 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 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, 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.