From patchwork Thu Feb 25 05:54:58 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 8419401 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DB8EBC0553 for ; Thu, 25 Feb 2016 05:55:50 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31D1C20253 for ; Thu, 25 Feb 2016 05:55:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 53BE820225 for ; Thu, 25 Feb 2016 05:55:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759740AbcBYFzI (ORCPT ); Thu, 25 Feb 2016 00:55:08 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:55795 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759957AbcBYFzE (ORCPT ); Thu, 25 Feb 2016 00:55:04 -0500 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 25 Feb 2016 14:55:02 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id CA2DD50F6D; Thu, 25 Feb 2016 14:55:02 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id AC1F11806F; Thu, 25 Feb 2016 14:55:02 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 8F0C41800A; Thu, 25 Feb 2016 14:55:02 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id QAR24306; Thu, 25 Feb 2016 14:55:02 +0900 X-IronPort-AV: E=Sophos;i="5.22,496,1449500400"; d="scan'";a="205149797" Received: from mail-hk2apc01lp0210.outbound.protection.outlook.com (HELO APC01-HK2-obe.outbound.protection.outlook.com) ([65.55.88.210]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 25 Feb 2016 14:55:01 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=T3kjPTbld/feovs2T6P+WPmviEwdXIrlwAK+e7ZcKpw=; b=P+7C32BpxhwxJzqovic2xx6f5AwSyzQ+gF6/npRdMkOnj0izm2mDxHAJn9mTROeuyZbpsCBI2nOPhj86vybJ7S7ULpF3hkSrysfbwpBtXTx+B87bYBB8+bGWN5ssfWnesI0edX4TZ5kdFtuyFONKuzEeqJboRprDsm02VLTM3po= Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; kernel.org; dmarc=none action=none header.from=renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by SIXPR06MB1023.apcprd06.prod.outlook.com (10.160.240.28) with Microsoft SMTP Server (TLS) id 15.1.409.15; Thu, 25 Feb 2016 05:54:58 +0000 Message-ID: <87ziup5oer.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 5/6] ASoC: rsnd: add rsnd_runtime_channel_xxx() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown CC: Simon , Linux-Renesas , Linux-ALSA , Liam Girdwood , Laurent In-Reply-To: <877fht7376.wl%kuninori.morimoto.gx@renesas.com> References: <877fht7376.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 25 Feb 2016 05:54:58 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0047.jpnprd01.prod.outlook.com (25.164.162.29) To SIXPR06MB1023.apcprd06.prod.outlook.com (25.160.240.28) X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB1023; 2:fZtrJn9Zcp+thHWD3REuTqJqV6NaEKpVbGs+tcHup8RWnqHbCFRw/8wyVMd8ftyW/FkJP3BQxBHkltIV41cOQTZhsOsREa/tbhWJ8xQkXBJqoKumSwpJIj5h7xQdSIaBeBCCM4MqZPLM+gjGBeYDrA==; 3:BEO97K4JidS+lPf6UH+DGWR/V+blXpRXvamf87PpkEEJ28WNF/AMgCpkm4Rw2aDaTwDIrxSvndxVDVdXK1AcAXutzjcnrVImLSFnN/COFEFu2iEOr0dM3hNimtRM3H5w; 25:4QugjrR0WifAcUKfLDRPmj0H4unX+QfyIkeW/P6+StB6iS7ZL8WeIQerQRqrJ3iElxtt6sfOBUarhLPZO6A/dpBgeGBfK9lCIz9nHMqhK45VqT6EscToROUk04ZSMaiadyarp7VqN01z8DrmiaH7DDLmR+aZson6AIMp0A21+s+7LsZBfuHpO+aa5Ehi2JPeR5JHz2GzPNFy66e7j3kHJxjqAaNqj7Oh58sjTD7AYCABdA9i1Jj7ZmkO69fYNQMKS1Z+8VWgB2lW55urCrDq7X4gtBM6e9QdxKuOpuJTn89cBeBqtRWpxHGxwYDZP/Ax X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SIXPR06MB1023; X-MS-Office365-Filtering-Correlation-Id: 779e4db3-7800-436a-8f62-08d33da83251 X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB1023; 20:IcxqnwCN3WQpv+W/m46yhjqGFRQd8RQly/8jEAZTOHBgnTHIFbBVH2JYk+C2Nm1OrdXtyv1Jjk85WAuuM43Yg55BFlRoswMZgCkDm+j7PszN/gmZwcNpmuwasxDkCH0pkQBfDxoVv8CQ/ckLBSs91Q3pvocMVa4DpRbL6NiAvboF4kdcXEwwL99wfR+pKBZT64jZYYZkgU/0qABKgDRSLwkRiNbIb1GTgkrI0vWf/ONhu5JseCQq0bRIQB+M0KT1Hh6W8eGrq3LsXxPS4n1wamF4f2latoF3ShZsevDc+kbkzWtrLySZq7iCCF1U8vLAma+Mzgv5s3rXX3HVd9gnT2HnbBTt6H6/eu/YG/+zwOc6YzbcqtNj5ax1nvB3T0+a0FQo6ALcUwqxH5sTbhpH487lAJE7/8n3lvvP2vyE7idednosP5ObX3+oIWkUi77r1B4xyqlvtz+twd/8oA1tn0H/FgdV4+OIJkG3fpIJRx0y1r8oxZgz65JMvxQCR2w/; 4:9hvMkqfuXJ4dI7g7ok9AiIPJxngBIQFdL9HhT+hTpzDpFqhtTMq8uXfguaRF/Qf+fYfYnOnHd+3YgmFHjiB5FUUqkLteA4TN4l+8KU+qYltcP9DYL/KlfOQzkntWi/JGwevoR1TIiAadt6VIrojMWVA9JXRfBXL7xvhm6ES0JrR01y38T3mygyH4sn1zrSdRCN1isaUMdVSWvOOV5CFwxuZ6q1+L6ti8q1LmFN/AgtruCPFm+XLbqXQODC1/VCyWWeoy9Y5thDKhsGE82UeBxvcp+8ISNQmy+VUDtcj4mSag1G6HDcRyCHF6ohsDy97p1TczZEVyHt5JDg5yIfJOkVb4txS8XcVndE9uXK76mGbFOMbRLaZVVpVmyU0BL9pK X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:SIXPR06MB1023; BCL:0; PCL:0; RULEID:; SRVR:SIXPR06MB1023; X-Forefront-PRVS: 08635C03D4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(23726003)(92566002)(229853001)(83506001)(40100003)(50466002)(19580395003)(77096005)(19580405001)(46406003)(33646002)(6116002)(2950100001)(122386002)(4001350100001)(54356999)(42186005)(4326007)(53416004)(110136002)(189998001)(50986999)(87976001)(3846002)(2906002)(86362001)(1096002)(575784001)(47776003)(5004730100002)(5008740100001)(586003)(36756003)(76176999)(5001960100002)(66066001)(21314002); DIR:OUT; SFP:1102; SCL:1; SRVR:SIXPR06MB1023; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SIXPR06MB1023; 23:9wadJhTigvzFZFhY0+Y99qWV4APsr8gaKM/pwgiFJ?= =?us-ascii?Q?WtQhucQOaKerDFEJSUA1DJrOKsTXW4mAtWaP7AKFto4nNxg6ElsvXmFzlgnF?= =?us-ascii?Q?zJEDaAytLnPaRf8OjfcxCZWGT0Tvzjh/XB8ZMhtCzE86BzbS1wo1cHBrtCqQ?= =?us-ascii?Q?Sq0CNzSaEGumjz/Pq8OcOZOwj76wYNRoGCthCPmncG/TiqdG48BfBJwVqb2H?= =?us-ascii?Q?D56QEpKOU3aJrc4rJS9ZN2/Qh2QqiI4npr09wCD/QMkiWDlKd3Rasuy4anuA?= =?us-ascii?Q?/04PiDLZp2AY51cYTkpwHsjfGaGwIRJGiRfiBtCD8VHpqQmKTvPZCGimIlas?= =?us-ascii?Q?tHWHOZJL1b1xhooT91/x4lDz1JcC79xc3Vzmy7KsEdyIsXAH9+5n/XRSMqsl?= =?us-ascii?Q?jPaZRSQZW/hmPrA5/UWT0pex4FlYoUF2uzUQVa80D14gGEaRgJzDQJgaJMtp?= =?us-ascii?Q?wDnna/k6YIzwhIz0N89TKY5IYDGLQaJgY9I07RW/sPIs0kkQMVXYUAR1Xawu?= =?us-ascii?Q?TGjYo9O2N94EcYcwbX9096UsIRShKSpJEHaouiqLlJeZQ50pRC+oAgFfhoz9?= =?us-ascii?Q?gWISyEHdoIlIAbnS18jIOQC/2T40KfXojnx6iT1tDNA7rUnqTITFO4F1iwtB?= =?us-ascii?Q?iSMm7T9NWNp50BzOjbjUAsIJC+SMJEZoEbtg93C59OypaRYOcvcQ7NsNxNsT?= =?us-ascii?Q?wR2P2l76/A4FJ3nGQVzrr/ZEO3lCdCT6tKKUa5zJxVunlQPoy3r0UzVF9FVd?= =?us-ascii?Q?XJe0oTCjJJJ4uRfu3OIwsnLf3UPbVRmdR4pEsBlA/I6KSn/t3Htf0qiJuyQx?= =?us-ascii?Q?aj3U58T6ZCAcTSZUbuuBB8oFcaBGKnRI/S9B/Ef7D5a/NrQehnKUbsym0Hd4?= =?us-ascii?Q?iBI8b7tl+jt3nui3nOukbAnsytb6d76ioEzLxQwyzPU1ak4yjQ/PYXOzbFR2?= =?us-ascii?Q?Np04E2RoxMnHTCM4JtSEuuKX84gDmUgwoy8hR0WcaN+fsJdLtjz1Q8d3UE0T?= =?us-ascii?Q?8Yp0WRE7Mq/KzlkpJz/JoaEWLkSmBqBgJ4ZRzKuMoL8Z73b78s6PuYcNI9j3?= =?us-ascii?Q?fiXfEI=3D?= X-Microsoft-Exchange-Diagnostics: 1; SIXPR06MB1023; 5:zk2ybl8xpSPIIvMALPl3XJ8SrvmIqXUg4PE5DseFhI6Vv2hvn0qGRkaJv3G5L7fbTmiVWDMAtvUg6REVkuJT1SzXEgex1qi0kke3Q1DH/XUxNKQ19TXGlhTQrSANOcIJmqRFPmtYwGWU2gHz0PtImA==; 24:Z8FAdixVQez2um3nMQEeTjU6RBaUacrLbjBdY7s/Z8Nwi4evSlXioBPX8gyoxg3d0yY0HGrRirQ1GhCTDE9GRDrfmNv7/mkg+bcUXRKGoxk=; 20:pAMhwr5RfJy189hfmGWKBwzfcxGkkRk7ieh5i1FfnC89Fi0DNBPjBUTlpO6doRYrjPdIr7RW0gL+aBGYrP85Stxz7wZ1mk1zB1pZDocr5aQRdxhxZPobSZJ/xozs79AxWrU5ucgcRPP6uTH6MQpaWvY/+JLV4P/DhwrWZG9T3AA= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2016 05:54:58.9877 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SIXPR06MB1023 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Current SSI is supporting Normal SSI/Multi mode SSI/TDM mode SSI and its behavior is based on input channels. This input channel might be converted by CTU, and SSI needs to be Multi SSI mode / TDM SSI mode if 6ch input EX) 6ch input, CTU for 2ch, playback 6ch 6ch 2ch 2ch 2ch 2ch -> SRC -> CTU -> MIX -> DVC -> SSIU -> SSI EX) 6ch input, no CTU, Multi SSI, playback 6ch 6ch 6ch 6ch 6ch 2ch -> SRC -> CTU -> MIX -> DVC -> SSIU -> SSI0/SSI1/SSI2 Current driver is using rsnd_get_adinr_chan() / rsnd_get_slot_width() for this purpose, but it is complicated enough without meaning. This patch adds new rsnd_runtime_channel_xxx() which is caring CTU/Multi SSI. Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/core.c | 69 +++++++++++++++++++++++++++++------------------- sound/soc/sh/rcar/ctu.c | 2 +- sound/soc/sh/rcar/dvc.c | 2 +- sound/soc/sh/rcar/mix.c | 2 +- sound/soc/sh/rcar/rsnd.h | 8 ++++-- sound/soc/sh/rcar/src.c | 2 +- sound/soc/sh/rcar/ssi.c | 15 +++++------ sound/soc/sh/rcar/ssiu.c | 6 +++-- 8 files changed, 62 insertions(+), 44 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 769d34c..2481b8f 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -224,13 +224,36 @@ int rsnd_get_slot_num(struct rsnd_dai_stream *io) return rdai->slots_num; } -int rsnd_get_slot_width(struct rsnd_dai_stream *io) +int rsnd_runtime_channel_original(struct rsnd_dai_stream *io) { struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); - int chan = runtime->channels; - /* Multi channel Mode */ - if (rsnd_ssi_multi_slaves_runtime(io)) + return runtime->channels; +} + +int rsnd_runtime_channel_after_ctu(struct rsnd_dai_stream *io) +{ + int chan = rsnd_runtime_channel_original(io); + struct rsnd_mod *ctu_mod = rsnd_io_to_mod_ctu(io); + + if (ctu_mod) { + u32 converted_chan = rsnd_ctu_converted_channel(ctu_mod); + + if (converted_chan) + return converted_chan; + } + + return chan; +} + +int rsnd_runtime_channel_for_ssi(struct rsnd_dai_stream *io) +{ + int chan = rsnd_io_is_play(io) ? + rsnd_runtime_channel_after_ctu(io) : + rsnd_runtime_channel_original(io); + + /* Use Multi SSI */ + if (rsnd_runtime_is_ssi_multi(io)) chan /= rsnd_get_slot_num(io); /* TDM Extend Mode needs 8ch */ @@ -240,6 +263,21 @@ int rsnd_get_slot_width(struct rsnd_dai_stream *io) return chan; } +int rsnd_runtime_is_ssi_multi(struct rsnd_dai_stream *io) +{ + int slots = rsnd_get_slot_num(io); + int chan = rsnd_io_is_play(io) ? + rsnd_runtime_channel_after_ctu(io) : + rsnd_runtime_channel_original(io); + + return (chan >= 6) && (slots > 1); +} + +int rsnd_runtime_is_ssi_tdm(struct rsnd_dai_stream *io) +{ + return rsnd_runtime_channel_for_ssi(io) >= 6; +} + /* * ADINR function */ @@ -261,29 +299,6 @@ u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io) return 0; } -u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io) -{ - struct rsnd_priv *priv = rsnd_mod_to_priv(mod); - struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); - struct device *dev = rsnd_priv_to_dev(priv); - u32 chan = runtime->channels; - - switch (chan) { - case 1: - case 2: - case 4: - case 6: - case 8: - break; - default: - dev_warn(dev, "not supported channel\n"); - chan = 0; - break; - } - - return chan; -} - /* * DALIGN function */ diff --git a/sound/soc/sh/rcar/ctu.c b/sound/soc/sh/rcar/ctu.c index 784515a..b326966 100644 --- a/sound/soc/sh/rcar/ctu.c +++ b/sound/soc/sh/rcar/ctu.c @@ -60,7 +60,7 @@ static void rsnd_ctu_value_init(struct rsnd_dai_stream *io, { rsnd_mod_write(mod, CTU_CTUIR, 1); - rsnd_mod_write(mod, CTU_ADINR, rsnd_get_adinr_chan(mod, io)); + rsnd_mod_write(mod, CTU_ADINR, rsnd_runtime_channel_original(io)); rsnd_mod_write(mod, CTU_CPMDR, 0); rsnd_mod_write(mod, CTU_SCMDR, 0); diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index d757f13..93b11e1 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c @@ -116,7 +116,7 @@ static void rsnd_dvc_volume_init(struct rsnd_dai_stream *io, u32 vrdbr = 0; adinr = rsnd_get_adinr_bit(mod, io) | - rsnd_get_adinr_chan(mod, io); + rsnd_runtime_channel_after_ctu(io); /* Enable Digital Volume, Zero Cross Mute Mode */ dvucr |= 0x101; diff --git a/sound/soc/sh/rcar/mix.c b/sound/soc/sh/rcar/mix.c index e0e337a..195fc7b 100644 --- a/sound/soc/sh/rcar/mix.c +++ b/sound/soc/sh/rcar/mix.c @@ -51,7 +51,7 @@ static void rsnd_mix_volume_init(struct rsnd_dai_stream *io, rsnd_mod_write(mod, MIX_MIXIR, 1); /* General Information */ - rsnd_mod_write(mod, MIX_ADINR, rsnd_get_adinr_chan(mod, io)); + rsnd_mod_write(mod, MIX_ADINR, rsnd_runtime_channel_after_ctu(io)); /* volume step */ rsnd_mod_write(mod, MIX_MIXMR, 0); diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index bbc89bd..ff53f96 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -193,7 +193,6 @@ void rsnd_force_write(struct rsnd_priv *priv, struct rsnd_mod *mod, void rsnd_bset(struct rsnd_priv *priv, struct rsnd_mod *mod, enum rsnd_reg reg, u32 mask, u32 data); u32 rsnd_get_adinr_bit(struct rsnd_mod *mod, struct rsnd_dai_stream *io); -u32 rsnd_get_adinr_chan(struct rsnd_mod *mod, struct rsnd_dai_stream *io); u32 rsnd_get_dalign(struct rsnd_mod *mod, struct rsnd_dai_stream *io); /* @@ -356,9 +355,14 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai, void rsnd_set_slot(struct rsnd_dai *rdai, int slots, int slots_total); int rsnd_get_slot(struct rsnd_dai_stream *io); -int rsnd_get_slot_width(struct rsnd_dai_stream *io); int rsnd_get_slot_num(struct rsnd_dai_stream *io); +int rsnd_runtime_channel_original(struct rsnd_dai_stream *io); +int rsnd_runtime_channel_after_ctu(struct rsnd_dai_stream *io); +int rsnd_runtime_channel_for_ssi(struct rsnd_dai_stream *io); +int rsnd_runtime_is_ssi_multi(struct rsnd_dai_stream *io); +int rsnd_runtime_is_ssi_tdm(struct rsnd_dai_stream *io); + /* * R-Car sound DAI */ diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 03c6314..8e1177a 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -205,7 +205,7 @@ static void rsnd_src_set_convert_rate(struct rsnd_dai_stream *io, * SRC_ADINR */ adinr = rsnd_get_adinr_bit(mod, io) | - rsnd_get_adinr_chan(mod, io); + rsnd_runtime_channel_original(io); /* * SRC_IFSCR / SRC_IFSVR diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 0979db8..5404897 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -180,11 +180,8 @@ static u32 rsnd_ssi_run_mods(struct rsnd_dai_stream *io) u32 rsnd_ssi_multi_slaves_runtime(struct rsnd_dai_stream *io) { - struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); - u32 mask = rsnd_ssi_multi_slaves(io); - - if (mask && (runtime->channels >= 6)) - return mask; + if (rsnd_runtime_is_ssi_multi(io)) + return rsnd_ssi_multi_slaves(io); return 0; } @@ -198,7 +195,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, struct rsnd_dai *rdai = rsnd_io_to_rdai(io); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io); - int slots = rsnd_get_slot_width(io); + int chan = rsnd_runtime_channel_for_ssi(io); int j, ret; int ssi_clk_mul_table[] = { 1, 2, 4, 8, 16, 6, 12, @@ -231,10 +228,10 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, /* * this driver is assuming that - * system word is 32bit x slots + * system word is 32bit x chan * see rsnd_ssi_init() */ - main_rate = rate * 32 * slots * ssi_clk_mul_table[j]; + main_rate = rate * 32 * chan * ssi_clk_mul_table[j]; ret = rsnd_adg_ssi_clk_try_start(mod, main_rate); if (0 == ret) { @@ -289,7 +286,7 @@ static void rsnd_ssi_config_init(struct rsnd_mod *mod, u32 wsr; int is_tdm; - is_tdm = (rsnd_get_slot_width(io) >= 6) ? 1 : 0; + is_tdm = rsnd_runtime_is_ssi_tdm(io); /* * always use 32bit system word. diff --git a/sound/soc/sh/rcar/ssiu.c b/sound/soc/sh/rcar/ssiu.c index 0d964a0..6f9b388 100644 --- a/sound/soc/sh/rcar/ssiu.c +++ b/sound/soc/sh/rcar/ssiu.c @@ -105,7 +105,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, if (ret < 0) return ret; - if (rsnd_get_slot_width(io) >= 6) { + if (rsnd_runtime_is_ssi_tdm(io)) { /* * TDM Extend Mode * see @@ -117,7 +117,9 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, if (rsnd_ssi_use_busif(io)) { rsnd_mod_write(mod, SSI_BUSIF_ADINR, rsnd_get_adinr_bit(mod, io) | - rsnd_get_adinr_chan(mod, io)); + (rsnd_io_is_play(io) ? + rsnd_runtime_channel_after_ctu(io) : + rsnd_runtime_channel_original(io))); rsnd_mod_write(mod, SSI_BUSIF_MODE, 1); rsnd_mod_write(mod, SSI_BUSIF_DALIGN, rsnd_get_dalign(mod, io));