From patchwork Mon Jun 15 06:24:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6606371 Return-Path: X-Original-To: patchwork-alsa-devel@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 9AF5DC0020 for ; Mon, 15 Jun 2015 06:30:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B11A720532 for ; Mon, 15 Jun 2015 06:30:38 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 6EA1D20531 for ; Mon, 15 Jun 2015 06:30:37 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 35C1E26158C; Mon, 15 Jun 2015 08:30:36 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 92F852610A1; Mon, 15 Jun 2015 08:27:15 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 4C1BF2610A1; Mon, 15 Jun 2015 08:27:14 +0200 (CEST) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 99FC62614AC for ; Mon, 15 Jun 2015 08:24:37 +0200 (CEST) Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie2.idc.renesas.com with ESMTP; 15 Jun 2015 15:24:36 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 4675046523; Mon, 15 Jun 2015 15:24:36 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 3AD941800A; Mon, 15 Jun 2015 15:24:36 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 285BB18070; Mon, 15 Jun 2015 15:24:36 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id RAR18207; Mon, 15 Jun 2015 15:24:36 +0900 X-IronPort-AV: E=Sophos;i="5.13,617,1427727600"; d="scan'";a="188302231" Received: from mail-hk1lp0118.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.118]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Jun 2015 15:24:35 +0900 Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; Received: from morimoto-PC.renesas.com (211.11.155.132) by HKXPR06MB312.apcprd06.prod.outlook.com (10.141.135.155) with Microsoft SMTP Server (TLS) id 15.1.190.14; Mon, 15 Jun 2015 06:24:34 +0000 Message-ID: <87egldv6cp.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown In-Reply-To: <87twu9v6kn.wl%kuninori.morimoto.gx@renesas.com> References: <87twu9v6kn.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Mon, 15 Jun 2015 06:24:34 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: OS1PR01CA0009.jpnprd01.prod.outlook.com (25.161.225.147) To HKXPR06MB312.apcprd06.prod.outlook.com (10.141.135.155) X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB312; 2:I0Ant2ntX8/ZwrZtvS5IJfTf9DsTOcJt7oNrGJiY8XuOBmjg5Ns8rFhcaz0jWGZH; 2:KW1trOk/JwW9Uq2Wvgq8tXXxoaaDNITcpBr8tk8WanUCrmEjnNaIOkId1ZCcBon0SL+jv9dqcitCpdnatA3D5cSHJAQH3rMui+RJE6NaTYg6TwvzvcZj5onrMvfWitmLd8OeeX6YyLfG6TVADU2UHQ==; 6:Wppbkd4MfoaLCBwwWC+ncm47dsjEGszdudIfHah+3eW+42MphQ8nXMgSfPvlX8sXPUE885WSZgJOSdO+Gb6Gxv4QmPzs78V/99oXhRdB8FIBCw+qpBaI6O0jWdYFcdJjeIUmidOLRhfzhDK7Ovt/5XvNoq5L/79f2K4BfzD/6Qc7hCOPH19h7oFEbrhoItpsM3/Ai+9EoG18oNM424NZwzHKZWkSQWbjsFKvDsp9TT8G3XDiFQwLg7uCIjc1MEBSCHAHLGUl59J56a9v2acKIowFiIEGKKPUYC43cogNp4FWCdTp4TucQ6Mmbb3ZhwskeOYUtIgfhGsnS6kp/suQF9AUCnjp43MKLahvlKCBivNPs6IQjrYNEFZXQhAkHAeRA3ccf/T5HeQKRSMedgzmmNhmJHxTOOzBFR1MDBp46kT+P0zP9+VdujDTs7dR8YmnLvDzDM/i/d/qPoTxYgyII6shW6ui3PELtLmEyPYqufFvW8Ez+5utLoEs1oDbGTHI X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB312; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(520003)(5005006)(3002001); SRVR:HKXPR06MB312; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB312; X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB312; 3:KOdDqFMnO2QQ318k/mPTqiM0tTx4KxIVE40Lu3S5HxyIe/LKy2KrUgWX19+lU+T762YQVxg0iKmbSZ5/XFqp7jbJ9eTCsUjVoCwC0FAAs16RKbGPsplbsC1eURMADYkCTlCt5FFc5mS+ushwO/yIpNnybRThtdQAKuDP+YJV1bacNlP+BSV5cspvAkcA5x0KrFA28CHPJ0AXwC+v9IvtoXqRtyQlmIXZIRZR23jIwHav8odw/aw7aKRJ3n0jDNXPMwMWevcBhObiRHkd8IbooDT3mugPTB9GSaQvVYV2rSJshY55RJyCJ4l1UpEJid8l X-Forefront-PRVS: 0608DEDB67 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(40100003)(33646002)(46406003)(122386002)(50986999)(229853001)(86362001)(77096005)(23726002)(46102003)(189998001)(2950100001)(77156002)(62966003)(4001350100001)(47776003)(87976001)(66066001)(5001960100002)(50466002)(92566002)(53416004)(83506001)(76176999)(42186005)(19580405001)(54356999)(19580395003)(36756003)(110136002); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB312; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB312; 9:HTSHllTgUMwEsZheg7alSB4DWTmDblNyF8kQLlGISdKZ59O9HbSQuobzFHYW7CdPz4Q0p8FJMTKW6gMBrT6Bw3GA07AI4gVolyWvJbqOFJfQXpj+1bugOP07od8ZNeeDWeLTvh1mJk9idPczkhrVT8wpWgbm7tHwTTUhVGIbRyCVE8P0StrY+uTRrlxlwvbn1UE+w8zO3GXVpIxYOpwG9nDn+1M0OkEggGc8OJ2fWcHsjq1PL4NSdgoIdZAsqCEhVjIeRa+ds3/U47Cak8HdBZyMrWTx6V2zYTF0hwosqLMdyfuRy2AYLFU5MY/Ck9tjq+kyhXt/cMxIPrN2T7lCkbXpbsiKw7LkvS/7XK7eh/8trx+mn9OIbfTRfAliBDulIg8nbVNqIGvQWjpEAHhzCMFqrBsrYn5HofzHGvy3m540njT+sslDilQvtz6JcdJSSPHX/WBz48abVViSHH14OFlq/c5tenIraIPEJ7onnqtXku0Te250ypgyp34wrBfsN49VOoTs90UzgBizE2MHxvgT4Hv8K3PYHruZSthmHyhz8MDyZUDfDXG0ZoQ1rWr35L/bmYCYNoxvJUI4ajXFu0oBmTuqP9uKYX+0id1xeFzN3mm95/GNEy+qJWcFBXjqw6cd4BqSrTDeaLr7yzG7LpM1NDow8CyC4Sc5B43ArRIdc/Ej52CAu1fferQBQ2zF4rTMIpDsrAciPYM0dzcrDV8w1EdMa/PehLX6I3t9OfY0+eB49hElZJSpCRBqJ7W6EyZoSSW0nV74hXserTCUr6IX84DelIAgL6L4rpvB+rHTrg7xo0CqMxlA1BP8AUZ2moPMvNf1DSbHhXkd9q2Rp0YpblnKGoHfS03Ii/8CHT0= X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB312; 3:zCsmoNVeR9rdEDuux5nVqeoVg1WW6D6DdqznbUVBk1WzlYheQgBrjDIWPuljWB900qE+goB6LNwm5xfU/V3/hhEMZov26t0YUaL6Qm3V7isUgz6Mrt/hAdnZaazbkYSE5hJqZWRk0BKalbc+qsHX7g==; 10:gX6trbxbmBuUh20mWrZUfx+lcV9fJCgRQ6lpxTKKem3gjfoIFGXgFHsuPrBoUkbW03A/Se0C3+Pl3b4agDXl7jCVvWpjFPg9n2HwkhnVg6w=; 6:eL8UqNwpGX3NiCVWHCb7xMEWRKu3yQGd2Yz0TDkwnydoUmZIJ5I8BuykGAGDT8sexemZy2r1WqUDG/FObK2VxehUV+fBgiSztjRMfIxGH8ekQ7KeL1oJ4Xr4ZGv1+XKqPcQlSBmZDnnJYkXFa5mURg== X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2015 06:24:34.4424 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB312 Cc: Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 11/21] ASoC: rsnd: count each mod (SSI/SRC/DVC) X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Each Renesas sound mod (= SSI/SRC/DVC) might be called from many paths if it supports MIXer. Then, we don't need to re-call each mod function that had been called. This patch count each mod status. Signed-off-by: Kuninori Morimoto Tested-by: Keita Kobayashi --- sound/soc/sh/rcar/core.c | 17 +++++++++++------ sound/soc/sh/rcar/rsnd.h | 41 ++++++++++++++++++++++++++--------------- 2 files changed, 37 insertions(+), 21 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 027b043..50ec28c 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -211,15 +211,20 @@ u32 rsnd_get_adinr(struct rsnd_mod *mod) ({ \ struct rsnd_priv *priv = rsnd_mod_to_priv(mod); \ struct device *dev = rsnd_priv_to_dev(priv); \ - u32 mask = (1 << __rsnd_mod_shift_##func) & ~(1 << 31); \ - u32 call = __rsnd_mod_call_##func << __rsnd_mod_shift_##func; \ + u32 mask = 0xF << __rsnd_mod_shift_##func; \ + u8 val = (mod->status >> __rsnd_mod_shift_##func) & 0xF; \ + u8 add = ((val + __rsnd_mod_add_##func) & 0xF); \ int ret = 0; \ - if ((mod->status & mask) == call) { \ - dev_dbg(dev, "%s[%d] %s\n", \ - rsnd_mod_name(mod), rsnd_mod_id(mod), #func); \ + int called = 0; \ + if (val == __rsnd_mod_call_##func) { \ + called = 1; \ ret = (mod)->ops->func(mod, param); \ - mod->status = (mod->status & ~mask) | (~call & mask); \ + mod->status = (mod->status & ~mask) + \ + (add << __rsnd_mod_shift_##func); \ } \ + dev_dbg(dev, "%s[%d] 0x%08x %s\n", \ + rsnd_mod_name(mod), rsnd_mod_id(mod), mod->status, \ + called ? #func : ""); \ ret; \ }) diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index e37234e..8a114cb 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -259,25 +259,36 @@ struct rsnd_mod { /* * status * - * bit - * 0 0: probe 1: remove - * 1 0: init 1: quit - * 2 0: start 1: stop - * 3 0: pcm_new - * 4 0: fallback + * 0xH0000CBA * - * 31 bit is always called (see __rsnd_mod_call) - * 31 0: hw_params + * A 0: probe 1: remove + * B 0: init 1: quit + * C 0: start 1: stop + * + * H is always called (see __rsnd_mod_call) + * H 0: pcm_new + * H 0: fallback + * H 0: hw_params */ #define __rsnd_mod_shift_probe 0 #define __rsnd_mod_shift_remove 0 -#define __rsnd_mod_shift_init 1 -#define __rsnd_mod_shift_quit 1 -#define __rsnd_mod_shift_start 2 -#define __rsnd_mod_shift_stop 2 -#define __rsnd_mod_shift_pcm_new 3 -#define __rsnd_mod_shift_fallback 4 -#define __rsnd_mod_shift_hw_params 31 /* always called */ +#define __rsnd_mod_shift_init 4 +#define __rsnd_mod_shift_quit 4 +#define __rsnd_mod_shift_start 8 +#define __rsnd_mod_shift_stop 8 +#define __rsnd_mod_shift_pcm_new 28 /* always called */ +#define __rsnd_mod_shift_fallback 28 /* always called */ +#define __rsnd_mod_shift_hw_params 28 /* always called */ + +#define __rsnd_mod_add_probe 1 +#define __rsnd_mod_add_remove -1 +#define __rsnd_mod_add_init 1 +#define __rsnd_mod_add_quit -1 +#define __rsnd_mod_add_start 1 +#define __rsnd_mod_add_stop -1 +#define __rsnd_mod_add_pcm_new 0 +#define __rsnd_mod_add_fallback 0 +#define __rsnd_mod_add_hw_params 0 #define __rsnd_mod_call_probe 0 #define __rsnd_mod_call_remove 1