From patchwork Mon Jun 15 06:27:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6606451 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 ADAF1C0020 for ; Mon, 15 Jun 2015 06:37:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 92C4020570 for ; Mon, 15 Jun 2015 06:37:12 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 0819D2053F for ; Mon, 15 Jun 2015 06:37:11 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 0F932264F4B; Mon, 15 Jun 2015 08:37:10 +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 8715E264FF6; Mon, 15 Jun 2015 08:31:10 +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 C1019264FDF; Mon, 15 Jun 2015 08:31:08 +0200 (CEST) Received: from relmlie3.idc.renesas.com (relmlor4.renesas.com [210.160.252.174]) by alsa0.perex.cz (Postfix) with ESMTP id 77E372606BF for ; Mon, 15 Jun 2015 08:27:16 +0200 (CEST) Received: from unknown (HELO relmlir1.idc.renesas.com) ([10.200.68.151]) by relmlie3.idc.renesas.com with ESMTP; 15 Jun 2015 15:27:15 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir1.idc.renesas.com (Postfix) with ESMTP id 2704E4A72E; Mon, 15 Jun 2015 15:27:15 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 1B1C48002E; Mon, 15 Jun 2015 15:27:15 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 147F48002D; Mon, 15 Jun 2015 15:27:15 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id RBL06242; Mon, 15 Jun 2015 15:27:14 +0900 X-IronPort-AV: E=Sophos;i="5.13,616,1427727600"; d="scan'";a="189472676" Received: from mail-hk1lp0124.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.124]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Jun 2015 15:27:14 +0900 Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; Received: from morimoto-PC.renesas.com (211.11.155.132) by HKNPR06MB308.apcprd06.prod.outlook.com (10.141.37.28) with Microsoft SMTP Server (TLS) id 15.1.190.14; Mon, 15 Jun 2015 06:27:13 +0000 Message-ID: <874mm9v68a.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:13 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: TY1PR06CA0015.apcprd06.prod.outlook.com (25.164.91.25) To HKNPR06MB308.apcprd06.prod.outlook.com (10.141.37.28) X-Microsoft-Exchange-Diagnostics: 1; HKNPR06MB308; 2:hVIwZVmW0c4DoGzVVJ6Z2EIWDii8JEy/6Qttqp3AQFl3c/E8PrAwO+1hSNktm+BQ; 2:KZDD/VZdtFPcdAgR/1KjonztMQCxboGRf2pt8IYk0j1v/aUaQdA3l2eMBBNZJqYhk1Vkzpabr9ycj7RgvK6FuaCL/Vw66sdOvWNNE7j/+Tc4hgtyYGlDFZB3z8+n2yWx45u3BqL6klloxnsOnTMc6A==; 6:RUtHEJKcsOUlqkao5wGfquow5GL7JAk8vxl1Cfhac/wqhCOYBksIjGQivslSeFeicCOqe6WMFaf+TT4vHJxAEQZOK5m79ci15cvYuokITs8M6bgtRrWNFNjBa1O37RXFrbChUrmtAa8WHi4D1TVy9u4krR2p2v6JU2frT3g9krCYxKbzrNw02ndU4zN1pQqMdRfDYfqwRGXvjbTz8Na7JWXf0olNjnzLf1AoE4HG0oWv6FqrL8L2dBUyynU0ClHZyEG48KEZY+Al0Yhab2E1JE+7+p/z9KHcTIL4CPBKiryo6BLRaDNI1k5nZXukE7bJS78ysgG83jWgGSK2DLw/s4dLOi0mg/OuqjF8AF1xlZbg/ftiMk0xrJeEbNu6qDxOdvG3qrH5eEdNVl9FhguajqtExWeFIUmuVecLtHQj4UVJYgYu4u0YH53D2ChVZhBncjJoITyDSQkIjEpF6b4bDnNCjzf4SwbR6wQqDIGZIhoxqmCEnxH1zNmuPUir4JII X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKNPR06MB308; 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:HKNPR06MB308; BCL:0; PCL:0; RULEID:; SRVR:HKNPR06MB308; X-Microsoft-Exchange-Diagnostics: 1; HKNPR06MB308; 3:SujeiMqgB8Nkk4aJiMX+FR0jncXrbba/kjyxtPMtBKMBmZo2hWA0l0gWYmTl1ISrvoJIhRizRBRbzBY77vDj/dYPkcsMU6o5xC6B8+43LQYJSvMDqNo9lWRH388H5DSmkqX7rvu2UAKNi1jeDw/kXuvRAjY4FJUmRRzL0IV/pYMIPZHhHeNBq7d2GPyry1lUzHGANCDH2lcY5oJfriFVUHnx3JAiG51Ll5LkzCNJhxMJdzZ2thcIZMIsSCTW8O8/hkG+peDzYzzZt6wZ9mL1rq96xhHbGF8hq9mEFFDfZdt+s0VEgMR1QEmJqC3NIgR0 X-Forefront-PRVS: 0608DEDB67 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(2950100001)(77096005)(77156002)(62966003)(4001350100001)(122386002)(40100003)(110136002)(86362001)(5001960100002)(36756003)(53416004)(42186005)(189998001)(229853001)(47776003)(50986999)(66066001)(76176999)(46102003)(92566002)(33646002)(46406003)(83506001)(19580405001)(19580395003)(54356999)(50466002)(23726002)(87976001)(21314002); DIR:OUT; SFP:1102; SCL:1; SRVR:HKNPR06MB308; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; HKNPR06MB308; 9:dast1Wpos4tDpAlEzrKd7+CNdEIHA3iahjbOid6ihy3fhQRO7DJ7IVrFK151jZtFzV5d9s1nFeC0wmslgeMiLjQ4ZOgK06n5BeG9q6sv/rlWtE3BfDus0HE0KREjFpS/o8OICYl7Kp32rGGB8yMePCkbb+oCYFu3xRYXHx86Ik7WMg1VZTq/ZhQWva9OYhUU4NL2ziEceIkK+KaU1OT0CQ/G8/qN9HKzFWXqa/WKOAnHaVCsDBQjFagEOE2Ro14+9rwebFIadYq85CU7LQseidA/NIfUfZz1dqxHF5G6laE2JQQUpkd9pSjYh4o/QlxBzptOaH6jirykIny8bk6UdL8VOzRFq+MojxeDAHMzOQpW+ZSbdmMPXoLg6H/EveAPYGIQcwkcw/24+1gZfRUGJbBuUyiOw8FyFbWkMsS/tPZqr9x/GQUQnjATnO8oDFUp5JdhgpN7UJVZFbRessqHvLxnZCaU3TKeoxzH/r+6p6sO+VIHiBQ+pQ5Vz4426RlVLjVOd06TzeXySN+C1i4xx7rJ4bqhibhssSsGQ1ekjpJnRYdmpn+aZ5TXWIdtXhlZmaf/1rdjmjO8aSYh/pISbD+1pmmQochSVsDJr4BkRirx41YnHBc1sYf7XCTyCDIF1uudNTWJrucq4LFUVVlB8+FW7WTpDeEab0u9kNS0T7xY9vtqJ00eOxFXw5Zs1lTGRskd3wXhok5pmSvZrciCSJtYOjRND4OLP7VbTzjDJTaZjtZfFWPzNjbJewITiwmYM9i56ZK7TfXHVYAqZqVoQ2+KZlQb/z4Bx0aFXXWtzwZwObd8dQwjBhemR5EkxyAwr9xY/vrBHmSw7GO0glNqdoH9mYxy3Sc4TbtbTUMoB7H4reEy+th2YJEKZ5+vLCUX X-Microsoft-Exchange-Diagnostics: 1; HKNPR06MB308; 3:SyTee+vNnEJJLWjA5nh4swB9nvwuEuAhbpjrKYtYJPATsd0vOPz2WrjZDncBnlAbEz6Zxd0ZA+wy1mJett8jzZSRzGKutGgJZHIvq0ljnou6lTaF9x/+R6HdLvJvMI0KxiIgHt3jJi3fE+5Qltchqg==; 10:fYZR+aZPw6amZPZAWNF9HPAs/y9I2qDH0oqpL89yolzW54srVlSPOK2mN2yFHZn9Uno2z5dec3Aj/M990HxeMHtzWRBWy4d9fTCTGpjw1yM=; 6:DLfbMQ0gN+38rfkFUffxlhYjNlQ2F4nVgHhQ6NyTvjggP25v/StRT2VZTG2H7ayIvHR0XpzHXSmUOtfl1Dat85cUR0uGEYLZp3enIbZqKEAL78A2Hrv5VFjglOGfK9MnxN1Ba/MSnRfs2c0vO2d2jw== X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jun 2015 06:27:13.5080 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKNPR06MB308 Cc: Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 18/21] ASoC: rsnd: don't use rsnd_mod_to_io() on rsnd_src_xxx() 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 rsnd_src_xxx() and related function. Signed-off-by: Kuninori Morimoto Tested-by: Keita Kobayashi --- sound/soc/sh/rcar/src.c | 57 +++++++++++++++++++++++++++---------------------- 1 file changed, 32 insertions(+), 25 deletions(-) diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 6221619..bc122ed 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -236,10 +236,9 @@ int rsnd_src_ssi_irq_disable(struct rsnd_mod *ssi_mod) return 0; } -static u32 rsnd_src_convert_rate(struct rsnd_src *src) +static u32 rsnd_src_convert_rate(struct rsnd_dai_stream *io, + struct rsnd_src *src) { - struct rsnd_mod *mod = &src->mod; - struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); u32 convert_rate; @@ -275,7 +274,7 @@ unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv, * return convert rate if SRC is used, * otherwise, return runtime->rate as usual */ - rate = rsnd_src_convert_rate(src); + rate = rsnd_src_convert_rate(io, src); } if (!rate) @@ -289,7 +288,7 @@ static int rsnd_src_set_convert_rate(struct rsnd_mod *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(src); + u32 convert_rate = rsnd_src_convert_rate(io, src); u32 fsrate = 0; if (convert_rate) @@ -414,9 +413,9 @@ static int rsnd_src_stop(struct rsnd_mod *mod) /* * Gen1 functions */ -static int rsnd_src_set_route_gen1(struct rsnd_mod *mod) +static int rsnd_src_set_route_gen1(struct rsnd_dai_stream *io, + struct rsnd_mod *mod) { - struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); struct src_route_config { u32 mask; int shift; @@ -451,13 +450,13 @@ static int rsnd_src_set_route_gen1(struct rsnd_mod *mod) return 0; } -static int rsnd_src_set_convert_timing_gen1(struct rsnd_mod *mod) +static int rsnd_src_set_convert_timing_gen1(struct rsnd_dai_stream *io, + struct rsnd_mod *mod) { - struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); struct rsnd_priv *priv = rsnd_mod_to_priv(mod); struct rsnd_src *src = rsnd_mod_to_src(mod); struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); - u32 convert_rate = rsnd_src_convert_rate(src); + u32 convert_rate = rsnd_src_convert_rate(io, src); u32 mask; u32 val; int shift; @@ -527,7 +526,7 @@ static int rsnd_src_set_convert_rate_gen1(struct rsnd_mod *mod, rsnd_mod_read(mod, SRC_IFSVR) / 100 * 98); /* Gen1/Gen2 are not compatible */ - if (rsnd_src_convert_rate(src)) + if (rsnd_src_convert_rate(io, src)) rsnd_mod_write(mod, SRC_ROUTE_MODE0, 1); /* no SRC_BFSSR settings, since SRC_SRCCR::BUFMD is 0 */ @@ -545,7 +544,7 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod, if (ret < 0) return ret; - ret = rsnd_src_set_route_gen1(mod); + ret = rsnd_src_set_route_gen1(io, mod); if (ret < 0) return ret; @@ -553,7 +552,7 @@ static int rsnd_src_init_gen1(struct rsnd_mod *mod, if (ret < 0) return ret; - ret = rsnd_src_set_convert_timing_gen1(mod); + ret = rsnd_src_set_convert_timing_gen1(io, mod); if (ret < 0) return ret; @@ -650,9 +649,9 @@ static bool rsnd_src_error_record_gen2(struct rsnd_mod *mod) return ret; } -static int _rsnd_src_start_gen2(struct rsnd_mod *mod) +static int _rsnd_src_start_gen2(struct rsnd_mod *mod, + struct rsnd_dai_stream *io) { - struct rsnd_dai_stream *io = rsnd_mod_to_io(mod); u32 val = rsnd_io_to_mod_dvc(io) ? 0x01 : 0x11; rsnd_mod_write(mod, SRC_CTRL, val); @@ -677,9 +676,9 @@ static int _rsnd_src_stop_gen2(struct rsnd_mod *mod) return rsnd_src_stop(mod); } -static irqreturn_t rsnd_src_interrupt_gen2(int irq, void *data) +static void __rsnd_src_interrupt_gen2(struct rsnd_mod *mod, + struct rsnd_dai_stream *io) { - struct rsnd_mod *mod = data; struct rsnd_priv *priv = rsnd_mod_to_priv(mod); spin_lock(&priv->lock); @@ -698,12 +697,20 @@ static irqreturn_t rsnd_src_interrupt_gen2(int irq, void *data) _rsnd_src_stop_gen2(mod); if (src->err < 1024) - _rsnd_src_start_gen2(mod); + _rsnd_src_start_gen2(mod, io); else dev_warn(dev, "no more SRC restart\n"); } + rsnd_src_interrupt_gen2_out: spin_unlock(&priv->lock); +} + +static irqreturn_t rsnd_src_interrupt_gen2(int irq, void *data) +{ + struct rsnd_mod *mod = data; + + rsnd_mod_interrupt(mod, __rsnd_src_interrupt_gen2); return IRQ_HANDLED; } @@ -715,7 +722,7 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod, struct device *dev = rsnd_priv_to_dev(priv); 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(src); + u32 convert_rate = rsnd_src_convert_rate(io, src); u32 cr, route; uint ratio; int ret; @@ -769,12 +776,12 @@ static int rsnd_src_set_convert_rate_gen2(struct rsnd_mod *mod, return 0; } -static int rsnd_src_set_convert_timing_gen2(struct rsnd_mod *mod) +static int rsnd_src_set_convert_timing_gen2(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(src); + u32 convert_rate = rsnd_src_convert_rate(io, src); int ret; if (convert_rate) @@ -840,7 +847,7 @@ static int rsnd_src_init_gen2(struct rsnd_mod *mod, if (ret < 0) return ret; - ret = rsnd_src_set_convert_timing_gen2(mod); + ret = rsnd_src_set_convert_timing_gen2(io, mod); if (ret < 0) return ret; @@ -853,7 +860,7 @@ static int rsnd_src_start_gen2(struct rsnd_mod *mod, { rsnd_dma_start(io, rsnd_mod_to_dma(mod)); - return _rsnd_src_start_gen2(mod); + return _rsnd_src_start_gen2(mod, io); } static int rsnd_src_stop_gen2(struct rsnd_mod *mod, @@ -874,7 +881,7 @@ static void rsnd_src_reconvert_update(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(src); + u32 convert_rate = rsnd_src_convert_rate(io, src); u32 fsrate; if (!runtime)