From patchwork Thu Feb 18 08:19:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 8347231 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3117B9F38B for ; Thu, 18 Feb 2016 08:19:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7FCB620384 for ; Thu, 18 Feb 2016 08:19:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B414D20386 for ; Thu, 18 Feb 2016 08:19:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1425120AbcBRITR (ORCPT ); Thu, 18 Feb 2016 03:19:17 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:26915 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1424759AbcBRITQ (ORCPT ); Thu, 18 Feb 2016 03:19:16 -0500 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 18 Feb 2016 17:19:15 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 810DB48EC1; Thu, 18 Feb 2016 17:19:15 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 7BB962806E; Thu, 18 Feb 2016 17:19:15 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id 752B02806D; Thu, 18 Feb 2016 17:19:15 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac2.idc.renesas.com with ESMTP id TAC20502; Thu, 18 Feb 2016 17:19:15 +0900 X-IronPort-AV: E=Sophos;i="5.22,464,1449500400"; d="scan'";a="205897333" Received: from mail-pu1apc01lp0023.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.23]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 18 Feb 2016 17:19:14 +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=clFdwpcNCtiRgHdk37egCy/Z/deaJ2GO7aERyGJtczQ=; b=pPeZWJNXLHv4GYHsPSOZ6zF1kDGt/7Dcv9sP3rn2bPm6ypNorCpd7n0Cec3qgkCYDqPohIyBxURyIZDgR9tLAQOtqN95QUYdGSNAwUJAm6YgzxobtVHJmJnBihS1hvoXJdgRJZEFVPfIQCHUDd1C3VZNunathMLeHT06QjMHrFw= 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 SG2PR06MB1018.apcprd06.prod.outlook.com (10.161.9.26) with Microsoft SMTP Server (TLS) id 15.1.409.15; Thu, 18 Feb 2016 08:19:12 +0000 Message-ID: <87d1rutoxq.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 11/11] ASoC: rsnd: judge work SSI in runtime User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , In-Reply-To: <87si0qtp8x.wl%kuninori.morimoto.gx@renesas.com> References: <87si0qtp8x.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 18 Feb 2016 08:19:12 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS1PR01CA0023.jpnprd01.prod.outlook.com (25.161.225.161) To SG2PR06MB1018.apcprd06.prod.outlook.com (25.161.9.26) X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1018; 2:bvADuduUhby6CdqV+7wMG/ORZS+70ZQDpD3p6gqbufJo7EkJqfrXx3Wdpwwk1ubdph9Fx5LF1yQLBo2+w4mbzgJcsFf9VLJrnCLsFWfFh0KDXBC3h6s/BnxwFpiBMQa4IpzRy8R24g58DenV2ys73A==; 3:aaQsblXmb1QXv9wk+6t7hra1X3f2HDIKMZYFa36sG8/A3e0F1JzbUZscDhbjSwlECBnlaYQU6DbDFEdJYXhKQWUpeNLbhpUAaM1liDLQk1CJL0D32taB08kmHZiERmDx; 25:EbkARCx8uCNekgWCLsVlpaR6MWYCFeUwswCbZKZpnFjVE09AuV8dK3fnQQWPl5rqO9MVjN29sZqs73KIJ3Jbo6Zbq6pL16fLClYtGcmYZ/aSVmtV27IbR/wgRdQT7e4YVcz/SVGk9WdEASz3iYVh5T6Jwu6Z24IfJPT1NGK0uhLyVHe6NuYZ2c7hfL3sYHyTtPFafXMHP9Vc9BrCrKEw2NE3qnaLxlNrH3xFemU6w0jGNFYTJ9k4hqvAb++X7tYCEStZuS2BncY716fE2+iNt5/kP08KUAvkWMNpBcnWNq/LULM0KTqfMagw1p7m6aFg X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB1018; X-MS-Office365-Filtering-Correlation-Id: bda8fa67-8d49-4de4-8b28-08d3383c2f11 X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1018; 20:gt1UUcO2TAD+Mh8xNht2nifOg8wWgma11QSOQWxzgNcD3rcHiqLGn9aeZ0KhXm4b3ZWcHIuANErsPQn/TlO5qiyi/DyYK1ZN7XsQCO2e+AL6Jb9wWrvK+pNi8e975mW7vfG6dTd8dg9UTLN4BiGvPbhCTWLhwsFYQ3MUtgzct+5E+FGhaOSRLEgSpGuodxJXTQS7vTdHEgcx0qaBobZ7hoeBjybU5EFHZKGxK35bPuxMTTf/44vqHB0VRxW87sh3me1zmMKvWZczpgYl30AliTOxoMcSNRNXgk8s7b/uGb+PkolsHWGaptnrBSY6S8JY14zGr27g6TiwnIB7uFIrzTBB7iVv7xDGHoaEEStDvg/rkfaN1nPIZrBQUcjQU9TWf4B2eZf5L7vuYQlgJaSnEq3XVIe4Xag3GVIs6SjHyEHq4Sp/Qp+xDbkNE1oafgmyTEqJ9GzZk7R8guJ9/6DwrqEYb9ZO5wiQjNDq+Z2wRWlNCAurldJuEDBwtoxLMZia; 4:XD93UPHzqztjfVGI/OqORrmupd+Ao5LCXOfEeOnEBZH9cqADsx6RllD1d93tIit5PM7nY46jAekM5xSiUkrx961dmnTd2Wp5jFKCUVAP+igEyiqpabrpK/LeikN4NKmebhL9keYY6bQjb4RkqSTwpofdr5TeNxRyUVLbl1xwzmqy+UfZ+/AumUdIXNNcZ6SU59mkxe5KNixvMd1E2GKnQWXEZGjw2sJdIia0MzVCQeXiHv3JZzQn6tUaAqKMSQiQ2qycOs7wiHpm59UR8ppkCPQfQkFrqDLFBdkq8fkuc8+Ezo9foAulj+BssAV10IGY4baYYRgvvKTjGii20zf3r+RseWqIXcqxwjnCo3yiYEVw2KA9+wZM5SJrqNxZLJ90 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001); SRVR:SG2PR06MB1018; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB1018; X-Forefront-PRVS: 085634EFF4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(92566002)(2906002)(50986999)(23726003)(5008740100001)(4001350100001)(122386002)(36756003)(76176999)(3846002)(40100003)(586003)(4326007)(189998001)(5001960100002)(50466002)(5004730100002)(110136002)(33646002)(53416004)(229853001)(83506001)(1096002)(77096005)(19580395003)(87976001)(42186005)(2950100001)(46406003)(47776003)(86362001)(575784001)(19580405001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB1018; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SG2PR06MB1018; 23:f0f4hnrUXVWDAFn+U6pRStBC5xPw/lp1GEqdpC3vA?= =?us-ascii?Q?1F/2oo5wutbVjCWI4ZKix+znBkbCyVhNgFbV3JW39GYOV8brNXKrv0HUIc3M?= =?us-ascii?Q?a0InlCdf9HwvhbduTW2SAA91Xv1UU8sjqOAErCPPJbokTljkBJ34WTv5iEqO?= =?us-ascii?Q?fM3gexnM7DbWWMW4w5iGGLZNffme69pYWGhO5ldlzd/ujK406Ak89v8Gvjby?= =?us-ascii?Q?CSBwRQhwMGAIVzSEq1SIq7Sv+N2eov+dLK0qfSiKh8RQ57zu+rlwu/WOHLyx?= =?us-ascii?Q?WXIxJtp24R5h3N8QrGN8xcriH5jbijJHetG7fI3C8NAcZUPwweXS6zhZRxy2?= =?us-ascii?Q?KMyNVNDyWLZTMPQFiIKOFEe81Cf2pGHOZ3ir101xOYZTXn3Fq6QFNxwUGsZi?= =?us-ascii?Q?3oEinu+Iqfrem1g+IKKgviCDV6fgm34Pe8dKjSlN0SqPTxib+QSBaJsI3COe?= =?us-ascii?Q?OSJoqwJ679hNFlV72AdDmM6/vCOI26AyZKZ1v384KL5c7Knpty+8xzgCQFGk?= =?us-ascii?Q?GsRTsGRW3+QMZY3vhOFkmBa8kjfIc16QF5+hwL0gf8OUOpTn99v2HlX9pAY4?= =?us-ascii?Q?wlIBMZVy4LxZh1ubmE3G1ma/PaEB401+qp3hjEvFxXnsMzA/K8OEngf7dy0B?= =?us-ascii?Q?BC2SufuMQOIZwnTj0cFer6Tn9Y71Zot11nlXkYLs3GMMperLgDQQgpmNWlHW?= =?us-ascii?Q?ekA7/rRlXwKBnzuSIWrBeXsbHH8W6pmEqYOGbJx2cbzTLbmIjNHWoDAU/zKZ?= =?us-ascii?Q?kBMMYwEIqiT4dSgZyu6WPgjFjG9PaMKXClvLwYGGEMk8NyUxoBolnvti07Dp?= =?us-ascii?Q?CA4SqCRgvEjgbkQwth+fotLHnfz+cHd3kW8lnb1Zf5S0yuzwzhNqFbgdyZqp?= =?us-ascii?Q?CjGxMDdN+3XqHoOHZM7CbSAgLgklFQwZXK6I1aIjRRC4pfez4dOrVBd9jc1T?= =?us-ascii?Q?EO2b3PXoeHjVYx8smlu3aH3l0VNeNHjGWAI1izLYQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1018; 5:DetjJpDLYV6XeTcMwBbtCg3pySbBQqQtinedmrx/hj3n6XTuD/gOXqC71FT+iWh4JXXI8iJ9bCJ7DT7Iw2ybypWP2fGIWB/XunNF3dc1P1Ef4ynEtfQOM3SYE1ntmKuPWfcwcCJa2TPhPH1/c3KW2g==; 24:bvHs7hB3y+Q4rjahRFngV0UrUquL08WB3U5Kns+0V9FDPPXDJT6bnEJYWo1smSbox+zjEfOLmDew9pqExTdMqr0JGeuqrQNBp8cKVgKzTpE=; 20:mRKsd2rVLjIlBr5FapG8nf2byEEiRrNMhfYHGrCEbrop/tyb79ta2esMzPA2fT6VsSFekB9Am1KD042RbRbcVQxNA3Ank+Q2JmYWDpNyucGqu6wfcseDN/XTsAm9c6+gWsvNiAr8S2MWCjEG2FZfhVjg2cfOyNj/XeTcnVDs9kU= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2016 08:19:12.1681 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB1018 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=-6.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,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 rsnd supports multi SSI (maximum 4 SSI for 8ch), and, it should determine whether using each SSI or not in runtime. All SSIs are not used even if there are 4 SSI in case of stereo. Current driver setups un-used SSI in such case. It is no problem, but not needed. This patch judges it. Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/ssi.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 32f1f5f..0979db8 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -96,6 +96,8 @@ struct rsnd_ssi { #define rsnd_ssi_is_parent(ssi, io) ((ssi) == rsnd_io_to_mod_ssip(io)) #define rsnd_ssi_is_multi_slave(mod, io) \ (rsnd_ssi_multi_slaves(io) & (1 << rsnd_mod_id(mod))) +#define rsnd_ssi_is_run_mods(mod, io) \ + (rsnd_ssi_run_mods(io) & (1 << rsnd_mod_id(mod))) int rsnd_ssi_use_busif(struct rsnd_dai_stream *io) { @@ -166,6 +168,16 @@ static u32 rsnd_ssi_multi_slaves(struct rsnd_dai_stream *io) return mask; } +static u32 rsnd_ssi_run_mods(struct rsnd_dai_stream *io) +{ + struct rsnd_mod *ssi_mod = rsnd_io_to_mod_ssi(io); + struct rsnd_mod *ssi_parent_mod = rsnd_io_to_mod_ssip(io); + + return rsnd_ssi_multi_slaves_runtime(io) | + 1 << rsnd_mod_id(ssi_mod) | + 1 << rsnd_mod_id(ssi_parent_mod); +} + u32 rsnd_ssi_multi_slaves_runtime(struct rsnd_dai_stream *io) { struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); @@ -348,6 +360,9 @@ static int rsnd_ssi_init(struct rsnd_mod *mod, struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); int ret; + if (!rsnd_ssi_is_run_mods(mod, io)) + return 0; + ssi->usrcnt++; rsnd_mod_power_on(mod); @@ -374,6 +389,9 @@ static int rsnd_ssi_quit(struct rsnd_mod *mod, struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct device *dev = rsnd_priv_to_dev(priv); + if (!rsnd_ssi_is_run_mods(mod, io)) + return 0; + if (!ssi->usrcnt) { dev_err(dev, "%s[%d] usrcnt error\n", rsnd_mod_name(mod), rsnd_mod_id(mod)); @@ -422,6 +440,9 @@ static int rsnd_ssi_start(struct rsnd_mod *mod, struct rsnd_dai_stream *io, struct rsnd_priv *priv) { + if (!rsnd_ssi_is_run_mods(mod, io)) + return 0; + /* * EN will be set via SSIU :: SSI_CONTROL * if Multi channel mode @@ -441,6 +462,9 @@ static int rsnd_ssi_stop(struct rsnd_mod *mod, struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); u32 cr; + if (!rsnd_ssi_is_run_mods(mod, io)) + return 0; + /* * don't stop if not last user * see also @@ -483,6 +507,9 @@ static int rsnd_ssi_irq(struct rsnd_mod *mod, if (rsnd_ssi_is_parent(mod, io)) return 0; + if (!rsnd_ssi_is_run_mods(mod, io)) + return 0; + if (enable) val = rsnd_ssi_is_dma_mode(mod) ? 0x0e000000 : 0x0f000000;