From patchwork Mon Jun 15 06:27:28 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6606441 Return-Path: X-Original-To: patchwork-alsa-devel@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 786269F1C1 for ; Mon, 15 Jun 2015 06:36:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4425220569 for ; Mon, 15 Jun 2015 06:36:42 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id B0F802024C for ; Mon, 15 Jun 2015 06:36:40 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id B68BB2606FF; Mon, 15 Jun 2015 08:36:39 +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 BAFB62606BF; Mon, 15 Jun 2015 08:31:09 +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 60E28264FE3; Mon, 15 Jun 2015 08:31:08 +0200 (CEST) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 0B18D26068D for ; Mon, 15 Jun 2015 08:27:33 +0200 (CEST) Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 15 Jun 2015 15:27:32 +0900 Received: from relmlac2.idc.renesas.com (relmlac2.idc.renesas.com [10.200.69.22]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id AC859454E1; Mon, 15 Jun 2015 15:27:32 +0900 (JST) Received: by relmlac2.idc.renesas.com (Postfix, from userid 0) id 973D62806E; Mon, 15 Jun 2015 15:27:31 +0900 (JST) Received: from relmlac2.idc.renesas.com (localhost [127.0.0.1]) by relmlac2.idc.renesas.com (Postfix) with ESMTP id BB8792806D; Mon, 15 Jun 2015 15:27:31 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac2.idc.renesas.com with ESMTP id RAA23737; Mon, 15 Jun 2015 15:27:31 +0900 X-IronPort-AV: E=Sophos;i="5.13,617,1427727600"; d="scan'";a="188302451" Received: from mail-sg1lp0088.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.88]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Jun 2015 15:27:30 +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:27:28 +0000 Message-ID: <87381tv67v.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:27:28 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: KAWPR01CA0026.jpnprd01.prod.outlook.com (25.165.48.136) To HKXPR06MB312.apcprd06.prod.outlook.com (10.141.135.155) X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB312; 2:hddbqbFnk/05fL14zB8yFK03MfwGgbLIaAcEP1ap71kRChguvHi7dpyrfs7I+q/A; 2:Eg4Z8tsHWAo8TsXyrOmZceZ52iCNac1AL10v/POLIv2vHk6lZyLXB8+qgWju5qcA76MCnRhC+em33YKycW+7qVXM0j+x+hLFb13fKESk5BXa83LQ3/s4XanI8orlGnW1wHkt4xWvnc66WJlHjYKE2g==; 6:CdFJ+IpjG7LoToc4rqmepjfX8ahdvDOTUJGlTIoR/DttCWNZmgHLPxN2cisliHn2/LNvYwOuqYYbEGXgk0B6SJkNscHVVLC4mYhR8/2d080g7B3lq5unX4PZXSNy0G3iFn+Ho9FWDsw+XBqFs5/pbFscZLdeOUO9KpduV3j8yeP7orqxFawRAulYcOTgOwdL5O5JIqd4jlMaAXpizx2RmMG3oUCMI4msfMRz2PuwhoBra3f5Wd1A2BChMG6JkQ9/IyTy9FnBLAdEpcwcGKb70rQR+8JznHZC+jmtgR9b9/KEiFMbSaAJ6SS5p7vkne4mDzrztIXaVAcLTrKXP2q2gyoS1RQUs2zPwdzcU9etvbveHmWyLLBepbeq28Wm0oD9aKrDix1LUr7erLLMs55A0ZnLcC4dx0DroYUghs/l4Yb4yxaTB93Dm6iM3JonKHaQ1zlCtC5Z4db/XwVbtG5/0l6tlcEXvGqmf5rY8+uP8rMZCt3oHN4lq7cEwZgO1TzY 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:FAnuQee9bYJ2m9aeCdcjSMsPDFsRo+EPURCyFC+ImKebuqFXfaFx785YbeVHDpCi+XxnUyoOLI4npMEtCR9aMD1+nLzieTBsLlZeN//QPknH1lB5h67RT9M5/CYNz2kl9ihVwEGYmTwBiKF1UP3thsyvB+rQgXj6bJggxOehJqrK/4OLuRmnfNaW36gwFkTUBRxSZiE+MbEWdwSzIc5P+B0uHjaLYCjFE4JrUA4l4YXjjxxRfuQQ7QeF5b8nCAHvvkN27374zUdjn7VwhCXgLQXphlUDRtkIiut5xGZzcWHpI09nUOQpf1nxB7kLgnpm 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:MnrgxfSwMIV3wsnbb8wqmBIBB9u0abKPQHZi4aq3F8DzRH830gvv2Ndyo+lxMstMIWqkripBVEYOiv4FmstqLyMpZRJCsoQKqZI1tIqtkJricedgBLEr1AZGMtOK62gAmitKcmTucxYAUkYttSG56WTSUXGKdTppfCJfkDYkSVEMilmdUCkWsnT19655ma/TiTptqa+GmbzZ2jUzF2RoggeBX2m/2FvhITVa+b+AuZW3KMS4cvOZYDFBakQ6xuOrffmvWR4p7dfhScJpCpLzecuX6c03BkfbZ8EKCtfdG6sOzORMgU+9wkRCNcGrlnODfXyU1hLqjFeR+l/wrRoXtBFVC6bZG53YNZz1GTEQpRJMGRvzgZmtFPAjj9ghNZepWW9/e3PkdaUW3hiC+oZPTssKcdkZIEtGOQQF8VyS6Nmov/jgZfh1e/w/k1ma/n0ZWdEIq2ooq5536xYiAxJ3wzakHYQsY1YF/IWFga1fSSdIKWeN9GelfXHGCwWxmYZjQWNm+ZjKI1jRgLgBKyWFdAHwfXvdzOEpUrpL+wOtVLEPk+BrcOF728bbWwLt1hI6u1HozblA7kIDFs7UEyKjK1BAuL0FDm3u+SG4N92yLjiQHtULNjOsaGmJZKoo6NmfiS2FO8VT+8Ir0fU5WI6YoAglsd7T1IvuaE0IBc1R8pAxh+kGPpH0x5ND4agCyfT/RXHH6vkwOi2aDOfi8vdaIuOosCs3a+mRwhHIfytkV3AtXlD7qhg9uoMcIzKJhaFm0fBuX9l2G9Lsqq82RFeVJXFiAhnQor/QT5i2lyjSk1cP1iNvuuJFSfirMliW5LBICixCgtveOLADJofvkUosjnrX9HjCMf+BNgAShYEUY1I= X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB312; 3:UbXOJs0YBU0O3Nplo/gsYc9dq5fnJb9spx2AngnaftqgwZL5CkweaUXvAahU1GfvX7ALIoR3XU7JvfZ00K2ElEaMed8qjeehcyr2quqxhE2raHlSGPTED7CFl1GXY46b9xtHjBAELzWCsVo4r5r5Nw==; 10:wZC53jQDuUiVwv5JLeU80TceBp8iHCzN/egpY4COMuvz6B7It+X2c2qP9o3OIF51fNKsmF2ZRMcpgLZPJZvWRCCEqYhx9CcxK6PK121JmO0=; 6:OeBa5H3VTyZhleeMcrmmlKSxDXGLTufv491FdYmRxKyZ/plITPmNMCzzcw70xGEMJEfyz0UUu0f+tZ1daHcZRDNQ9uopL9zXkzcF29VdoUhOEdZPj8T3URJzh0pYAFVVfQUQy9vKPyiIanVnjuq2BQ== X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2015 06:27:28.1932 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB312 Cc: Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 19/21] ASoC: rsnd: don't use rsnd_mod_to_io() on snd_kcontrol 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. In such case, mod <-> io is no longer 1:1 relationship. This patch removes rsnd_mod_to_io() from snd_kcontrol and related function. Signed-off-by: Kuninori Morimoto Tested-by: Keita Kobayashi --- sound/soc/sh/rcar/core.c | 25 +++++++++++++++++-------- sound/soc/sh/rcar/dvc.c | 15 ++++++++------- sound/soc/sh/rcar/rsnd.h | 15 +++++++++++---- sound/soc/sh/rcar/src.c | 8 ++++---- 4 files changed, 40 insertions(+), 23 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index daa01e2..266b24a 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -880,16 +880,18 @@ static int rsnd_kctrl_put(struct snd_kcontrol *kctrl, } if (change) - cfg->update(mod); + cfg->update(cfg->io, mod); return change; } static int __rsnd_kctrl_new(struct rsnd_mod *mod, + struct rsnd_dai_stream *io, struct snd_soc_pcm_runtime *rtd, const unsigned char *name, struct rsnd_kctrl_cfg *cfg, - void (*update)(struct rsnd_mod *mod)) + void (*update)(struct rsnd_dai_stream *io, + struct rsnd_mod *mod)) { struct snd_soc_card *soc_card = rtd->card; struct snd_card *card = rtd->card->snd_card; @@ -918,6 +920,7 @@ static int __rsnd_kctrl_new(struct rsnd_mod *mod, cfg->update = update; cfg->card = card; cfg->kctrl = kctrl; + cfg->io = io; return 0; } @@ -928,36 +931,42 @@ void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg) } int rsnd_kctrl_new_m(struct rsnd_mod *mod, + struct rsnd_dai_stream *io, struct snd_soc_pcm_runtime *rtd, const unsigned char *name, - void (*update)(struct rsnd_mod *mod), + void (*update)(struct rsnd_dai_stream *io, + struct rsnd_mod *mod), struct rsnd_kctrl_cfg_m *_cfg, u32 max) { _cfg->cfg.max = max; _cfg->cfg.size = RSND_DVC_CHANNELS; _cfg->cfg.val = _cfg->val; - return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update); + return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update); } int rsnd_kctrl_new_s(struct rsnd_mod *mod, + struct rsnd_dai_stream *io, struct snd_soc_pcm_runtime *rtd, const unsigned char *name, - void (*update)(struct rsnd_mod *mod), + void (*update)(struct rsnd_dai_stream *io, + struct rsnd_mod *mod), struct rsnd_kctrl_cfg_s *_cfg, u32 max) { _cfg->cfg.max = max; _cfg->cfg.size = 1; _cfg->cfg.val = &_cfg->val; - return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update); + return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update); } int rsnd_kctrl_new_e(struct rsnd_mod *mod, + struct rsnd_dai_stream *io, struct snd_soc_pcm_runtime *rtd, const unsigned char *name, struct rsnd_kctrl_cfg_s *_cfg, - void (*update)(struct rsnd_mod *mod), + void (*update)(struct rsnd_dai_stream *io, + struct rsnd_mod *mod), const char * const *texts, u32 max) { @@ -965,7 +974,7 @@ int rsnd_kctrl_new_e(struct rsnd_mod *mod, _cfg->cfg.size = 1; _cfg->cfg.val = &_cfg->val; _cfg->cfg.texts = texts; - return __rsnd_kctrl_new(mod, rtd, name, &_cfg->cfg, update); + return __rsnd_kctrl_new(mod, io, rtd, name, &_cfg->cfg, update); } /* diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 3aac7905..36fc020 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c @@ -63,7 +63,8 @@ static const char * const dvc_ramp_rate[] = { "0.125 dB/8192 steps", /* 10111 */ }; -static void rsnd_dvc_volume_update(struct rsnd_mod *mod) +static void rsnd_dvc_volume_update(struct rsnd_dai_stream *io, + struct rsnd_mod *mod) { struct rsnd_dvc *dvc = rsnd_mod_to_dvc(mod); u32 val[RSND_DVC_CHANNELS]; @@ -172,7 +173,7 @@ static int rsnd_dvc_init(struct rsnd_mod *dvc_mod, rsnd_mod_write(dvc_mod, DVC_ADINR, rsnd_get_adinr(dvc_mod, io)); /* ch0/ch1 Volume */ - rsnd_dvc_volume_update(dvc_mod); + rsnd_dvc_volume_update(io, dvc_mod); rsnd_mod_write(dvc_mod, DVC_DVUIR, 0); @@ -217,7 +218,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, int ret; /* Volume */ - ret = rsnd_kctrl_new_m(mod, rtd, + ret = rsnd_kctrl_new_m(mod, io, rtd, is_play ? "DVC Out Playback Volume" : "DVC In Capture Volume", rsnd_dvc_volume_update, @@ -226,7 +227,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, return ret; /* Mute */ - ret = rsnd_kctrl_new_m(mod, rtd, + ret = rsnd_kctrl_new_m(mod, io, rtd, is_play ? "DVC Out Mute Switch" : "DVC In Mute Switch", rsnd_dvc_volume_update, @@ -235,7 +236,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, return ret; /* Ramp */ - ret = rsnd_kctrl_new_s(mod, rtd, + ret = rsnd_kctrl_new_s(mod, io, rtd, is_play ? "DVC Out Ramp Switch" : "DVC In Ramp Switch", rsnd_dvc_volume_update, @@ -243,7 +244,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, if (ret < 0) return ret; - ret = rsnd_kctrl_new_e(mod, rtd, + ret = rsnd_kctrl_new_e(mod, io, rtd, is_play ? "DVC Out Ramp Up Rate" : "DVC In Ramp Up Rate", &dvc->rup, @@ -252,7 +253,7 @@ static int rsnd_dvc_pcm_new(struct rsnd_mod *mod, if (ret < 0) return ret; - ret = rsnd_kctrl_new_e(mod, rtd, + ret = rsnd_kctrl_new_e(mod, io, rtd, is_play ? "DVC Out Ramp Down Rate" : "DVC In Ramp Down Rate", &dvc->rdown, diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index ac03d20..fdb443b 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -487,7 +487,8 @@ struct rsnd_kctrl_cfg { unsigned int size; u32 *val; const char * const *texts; - void (*update)(struct rsnd_mod *mod); + void (*update)(struct rsnd_dai_stream *io, struct rsnd_mod *mod); + struct rsnd_dai_stream *io; struct snd_card *card; struct snd_kcontrol *kctrl; }; @@ -507,22 +508,28 @@ void _rsnd_kctrl_remove(struct rsnd_kctrl_cfg *cfg); #define rsnd_kctrl_remove(_cfg) _rsnd_kctrl_remove(&((_cfg).cfg)) int rsnd_kctrl_new_m(struct rsnd_mod *mod, + struct rsnd_dai_stream *io, struct snd_soc_pcm_runtime *rtd, const unsigned char *name, - void (*update)(struct rsnd_mod *mod), + void (*update)(struct rsnd_dai_stream *io, + struct rsnd_mod *mod), struct rsnd_kctrl_cfg_m *_cfg, u32 max); int rsnd_kctrl_new_s(struct rsnd_mod *mod, + struct rsnd_dai_stream *io, struct snd_soc_pcm_runtime *rtd, const unsigned char *name, - void (*update)(struct rsnd_mod *mod), + void (*update)(struct rsnd_dai_stream *io, + struct rsnd_mod *mod), struct rsnd_kctrl_cfg_s *_cfg, u32 max); int rsnd_kctrl_new_e(struct rsnd_mod *mod, + struct rsnd_dai_stream *io, struct snd_soc_pcm_runtime *rtd, const unsigned char *name, struct rsnd_kctrl_cfg_s *_cfg, - void (*update)(struct rsnd_mod *mod), + void (*update)(struct rsnd_dai_stream *io, + struct rsnd_mod *mod), const char * const *texts, u32 max); diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index bc122ed..67db696 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -876,9 +876,9 @@ static int rsnd_src_stop_gen2(struct rsnd_mod *mod, return ret; } -static void rsnd_src_reconvert_update(struct rsnd_mod *mod) +static void rsnd_src_reconvert_update(struct rsnd_dai_stream *io, + struct rsnd_mod *mod) { - struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); struct rsnd_src *src = rsnd_mod_to_src(mod); u32 convert_rate = rsnd_src_convert_rate(io, src); @@ -931,7 +931,7 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod, /* * enable sync convert */ - ret = rsnd_kctrl_new_s(mod, rtd, + ret = rsnd_kctrl_new_s(mod, io, rtd, rsnd_io_is_play(io) ? "SRC Out Rate Switch" : "SRC In Rate Switch", @@ -940,7 +940,7 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod, if (ret < 0) return ret; - ret = rsnd_kctrl_new_s(mod, rtd, + ret = rsnd_kctrl_new_s(mod, io, rtd, rsnd_io_is_play(io) ? "SRC Out Rate" : "SRC In Rate",