Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1275349imu; Fri, 21 Dec 2018 16:27:28 -0800 (PST) X-Google-Smtp-Source: ALg8bN7j9+fTsnaeGhSfZkdBT/g4m4A2j0fMrjaAgd36+z3aD7boPD27yc4COh+q8G8K7+dpfNOD X-Received: by 2002:a63:ff62:: with SMTP id s34mr4397167pgk.325.1545438448037; Fri, 21 Dec 2018 16:27:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545438448; cv=none; d=google.com; s=arc-20160816; b=npbCuAlq6jops1FUjBz0mlvNxmjXDvKiBziO7GL5Gw1wsQ3BDwgPEU0n1uHEBzlQD8 9FleZpK8ftwxNzQvMB/St++NjMt+E+4utUARLVTCy7v575n3HrM4aZs8EkTdEa9NbvQb EAfo3gqv0Q7CWgbsbU+EBzHx1ElRlYSkA+OBhdE4WgLEwkbpttPpbvQ8f6wdzLyxUYFj XzXh5HEacYICB0ituXSXIxd6S4jHKUD3yrZNQFOXGB6aUj1AMtb8AmTkVWdL7/WkryMf MHFbjAQk4yNwos3O7sOYKCYgeCOx7RwNvThJ5WBHA3cuG0VYAI4QnkV2GHa+gQSvtvU5 xLNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WaF8AFfF7zchnr6jMRHrk5C2QYC8GMssuw/nTJO62Vo=; b=cpM5q64AqMwZM69HiPqEkVrWpU9yflFOejKMQTX43luWCaC3xCCwdGzjyQrkf6eiEj 5Dy3mdKeMYLaOR5PXnXcShOJ0nrTA98hwwdbovmomBtZliOfUmJmRQ+pWcdhotmzjKlb J89gjpDVPaJSXq6rVQEYDckDThnjeMaJjfjqW051z44pyZNT6VvjXhb22ydaKtjX+V0d ABatumua4UmgOI+P3eCjP7gOzBZPGqZoHcX9u3oSYCPKT8WPQxMm2sBnTPDdh+yH0uFB sLyZI+Nes0oPODdFBlTf7AzR+Us5xANSdYjKUdo93ECgqhK79lgQ7Evg/+w7ftEPXAwD KJ5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=U6qr585s; 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 p4si21971224pgm.342.2018.12.21.16.27.12; Fri, 21 Dec 2018 16:27:27 -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=U6qr585s; 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 S2391011AbeLUPV3 (ORCPT + 99 others); Fri, 21 Dec 2018 10:21:29 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:41532 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390988AbeLUPVY (ORCPT ); Fri, 21 Dec 2018 10:21:24 -0500 Received: by mail-lf1-f67.google.com with SMTP id c16so4157150lfj.8 for ; Fri, 21 Dec 2018 07:21:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WaF8AFfF7zchnr6jMRHrk5C2QYC8GMssuw/nTJO62Vo=; b=U6qr585sBxSIfLRDrNicqGEN9uOJKrt4fr8LvaAGKDSD3SyvethIWfaIaYiDajbcH2 3klFQ8CEJz3MgAXjRXbMvvxMBzbTYrVW/7C283WJG5nE9fMszouSKk61cXVdWlq/XRKg AXzC99PWUUDJ6AZpqCDvtPLVyBamtqWAu3Hea6ZH0ALIZHFpLWUgtsZYkxRGakzEg748 I/2uMhp8fFlizqFGJAyTy6tAbd4JFrL2c6XnXq1zd03R/KNm5O1kBxhjm8qupywToYYr KxVTBH4VZAgM7+YaNPmveC3UxJXfrzPrMu+k7GP6usCZ3qRN7cr4ngLcMI/uS971ae1l KBuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WaF8AFfF7zchnr6jMRHrk5C2QYC8GMssuw/nTJO62Vo=; b=WJ/Td0+zeV21bBuU6ks7jlBBPrFDNWTiXSIrGSJTZ3HafUN7jrVA0g61xQlmq9t7Sk 0zxxz665tjE2qFtoeJKL4o1OB6a00bnl/vTMfqZZeEeJZF0lhSdr9mIhymoFxXZXUq0H YsTS26+Vx0Yr+MfrTA78HjAz5yfvs0zj5hM9bm5ghvz8zLrgpfkl/9mjT1R/3xIV12OV qIQsnUKF+wA1kWbi+k2Q5tCYpQrX7oACQB85uhV+IJaEn7el5LMWQS7kKiggb6M4YTED Reaq3Fw5s1TkUa6rj3vErRB7slwViqjC5s7qofKOVNlJ9tQXXkyt/J3TefltUaL36Ep0 guEA== X-Gm-Message-State: AA+aEWb8G6/Uu7Hj9E7pKILbQYvUvd9GiLIvvMVRaPxXPFdaqANAK8JF AGTI0K5T8btdSm/oVlMOQ6c= X-Received: by 2002:a19:c115:: with SMTP id r21mr1682969lff.144.1545405682998; Fri, 21 Dec 2018 07:21:22 -0800 (PST) Received: from localhost.localdomain (c90-142-43-138.bredband.comhem.se. [90.142.43.138]) by smtp.gmail.com with ESMTPSA id q30sm5005601lfi.94.2018.12.21.07.21.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 21 Dec 2018 07:21:22 -0800 (PST) From: codekipper@gmail.com To: maxime.ripard@free-electrons.com, wens@csie.org, linux-sunxi@googlegroups.com Cc: linux-arm-kernel@lists.infradead.org, lgirdwood@gmail.com, broonie@kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, be17068@iperbole.bo.it, Marcus Cooper Subject: [PATCH v3 8/9] ASoC: sun4i-i2s: Add set_tdm_slot functionality Date: Fri, 21 Dec 2018 16:21:09 +0100 Message-Id: <20181221152110.17982-9-codekipper@gmail.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20181221152110.17982-1-codekipper@gmail.com> References: <20181221152110.17982-1-codekipper@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/sound/soc/sunxi/sun4i-i2s.c b/sound/soc/sunxi/sun4i-i2s.c index 8cec2f42c94e..cfcf427270fd 100644 --- a/sound/soc/sunxi/sun4i-i2s.c +++ b/sound/soc/sunxi/sun4i-i2s.c @@ -196,6 +196,9 @@ struct sun4i_i2s { const struct sun4i_i2s_quirks *variant; bool bit_clk_master; + + unsigned int tdm_slots; + unsigned int slot_width; }; struct sun4i_i2s_clk_div { @@ -385,7 +388,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); @@ -498,7 +501,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) @@ -749,11 +753,25 @@ 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; +} + static const struct snd_soc_dai_ops sun4i_i2s_dai_ops = { .hw_params = sun4i_i2s_hw_params, .set_fmt = sun4i_i2s_set_fmt, .set_sysclk = sun4i_i2s_set_sysclk, .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.20.1