From patchwork Mon Mar 7 05:08:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 8515571 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 667CA9F7CA for ; Mon, 7 Mar 2016 05:08:43 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD2722012D for ; Mon, 7 Mar 2016 05:08:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CFF9F2010B for ; Mon, 7 Mar 2016 05:08:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751341AbcCGFIl (ORCPT ); Mon, 7 Mar 2016 00:08:41 -0500 Received: from relmlor2.renesas.com ([210.160.252.172]:26456 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750854AbcCGFIk (ORCPT ); Mon, 7 Mar 2016 00:08:40 -0500 Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie1.idc.renesas.com with ESMTP; 07 Mar 2016 14:08:39 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 13A4B490D7; Mon, 7 Mar 2016 14:08:39 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id EACE818077; Mon, 7 Mar 2016 14:08:38 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id E863F18071; Mon, 7 Mar 2016 14:08:38 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac3.idc.renesas.com with ESMTP id QAA12147; Mon, 7 Mar 2016 14:08:38 +0900 X-IronPort-AV: E=Sophos;i="5.22,549,1449500400"; d="scan'";a="205831622" Received: from mail-pu1apc01lp0023.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.23]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 07 Mar 2016 14:08:36 +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=TG8Q2SByCXM3/hhtVpAzdSpqXAShrgDZLzfrkc051Bg=; b=aWYMDz+TX4UyGrGLTm5kCULWk8X6+qoQFw/iFIfuav98cXLXQu+WsjhbxibfNVg6Oq0LVv47a0Lvqj8P2c2ci4gMf3Zp15Yc1Xl9wu5LGxiZ7P8XLNn8wzElawjb/Uz5LiNGMKxsawkXUHxJDp1Ef/s6sX0/2HCHyceMZ4EIhi8= 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 HKXPR06MB1016.apcprd06.prod.outlook.com (10.161.181.156) with Microsoft SMTP Server (TLS) id 15.1.415.20; Mon, 7 Mar 2016 05:08:33 +0000 Message-ID: <87egbmyj43.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 5/7] ASoC: rsnd: add rsnd_src_get_in/out_rate() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , In-Reply-To: <87lh5uyj9a.wl%kuninori.morimoto.gx@renesas.com> References: <87lh5uyj9a.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Mon, 7 Mar 2016 05:08:33 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0041.jpnprd01.prod.outlook.com (25.164.161.151) To HKXPR06MB1016.apcprd06.prod.outlook.com (25.161.181.156) X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1016; 2:7QJsWOO+XjseLTynZih2zMZawVnnIrAvtqt2KqgjaMkc3oEzzt8ce5IhX2hEYhLYlOQvgwQ42bONyg+cpPibFxY5k+Zx9NaS1N21287lAzmR6714ycYqpz2HeYN85bq7ENwlybZXb9rEHethOSn31g==; 3:3qdaDp9PQ2NE+wicMs04O3imjknsYeLaBEXJlI+FevIwrEmfABTbBKP3Fz4ZyexMZ9D8poOL0xHSPkadkdTwZ938PZBDZj7nE208Ln2tfzBW/4V9wrlBu+RqhxEEOuQ0; 25:g5RADBQiulMbLEWrjyQcUJm1gqH1T7Zg0PSvACfGNk2PEkCLhmyjGiLc5JtWWy8AXSHmtvKonSWJCpmOo69tOMSxP6PPUsDlkT3BB5nGwVwMRn1fOPUOQZk1ksZxMLlD4+SkuhqEbFDXIvjm1mGfuiFBLaj9i0aMWq0WFDbFEmuXyfunDLQYyQ6FqRO48NF/znRcmLk5xWi/GPuU+5bFGv0ZiPuOOrpgEDOU/iQ1xBTybJIzT8VzY7IM/KBsxnhMatqncJD5XUTPpQ6oUb5qvWQaeCWv8FYBTSHWK5ZcRi76elpAMAcA2HNYbyYH4q6eiRx7ZPOYS4rEuo/VfQk5bw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB1016; X-MS-Office365-Filtering-Correlation-Id: 0b0b52a6-8537-4219-29e1-08d3464688e2 X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1016; 20:IJ7wh/6+wVOYJWLutWmY+FTWTSGiidqcz61sNrAOp9d3WQMxX9DOVCzDek8XBG5iewEXy6rfI0yIEPR2EF52KFE8KQxZo7VzSvgaLJ6RbeM6afeFZveew98TxC1YSLOj9kdEUqoN8LN8EWTrP46m28tPWiy1Vm5pRdZkbfUKIKZGJvDglrbffwFttpfdaulYJR0SBSOF0TjXiseXrXx7NgGpI6pB6JYyOYC8ZperEU/U36xLeEkfKImqwJIpAbvcOlcul359MYPGUQR82WyEaBBfB0l8+ktm/U63nBNCSWQhnB7Vv8ZKIETeYFJge+YlfK0dirvcZeeS0+MUVAjeJntaYeM+59kjWbASTmWCpnRDogWGMwXcnLwkCNKEv3VWffRtJVWjrXGELocrtCyRRMHDuSxJGsoKJOvMu7WUm9V/OkLOUSPTip7ud6Jiee5jYbtrP1Mc42W/iOC0Oo5qfFur1+rooVKZeWbVq+fXRgPDttRhxcKgNDkMj7XEgAIZ; 4:Z8a+CW8SlQuO2yFiqp0mZVD0UUs4tNO3I2gIx4tbFvqk0IoP49UziqmTiRa/sG3bHD/AEMoEqkIbxUP6JbbsPOta7qOYV4lRqeVLsbZFqfeBGPvDs/C7aFk71jVuHUXgi+nJbiTBmPRS+IEixzYIy3mvy8mFIV4Sb3ObubsGoEqQdrCLfkCmWHB0OAsllNBjwbl5bsQ5Kz2mbnP8M0+gMig6wJkiPBmkUI3yeHpSguiYHqsd8eClDedIfPjI0pbiT8RL0rv/iAtkB+pvtYvUAS1jl2JIhJo5AnlyGlVTnq6XXhg+ruMwHiNzVTeGOKF494R1AJfUBxtr/2jN51L1jN3gSXNS4nN7ZCpDtHR8HsQFFxUymOwtINxOpXFhCy6b 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:HKXPR06MB1016; BCL:0; PCL:0; RULEID:; SRVR:HKXPR06MB1016; X-Forefront-PRVS: 087474FBFA X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(189998001)(229853001)(2950100001)(40100003)(77096005)(86362001)(42186005)(122386002)(87976001)(47776003)(110136002)(50466002)(33646002)(4326007)(46406003)(53416004)(66066001)(83506001)(5004730100002)(23726003)(2906002)(81166005)(586003)(6116002)(3846002)(4001350100001)(1096002)(19580395003)(92566002)(5008740100001)(54356999)(50986999)(76176999)(36756003)(19580405001)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB1016; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HKXPR06MB1016; 23:tELOsJetkhN24lBttuyUa4EFKnyU3dzIC1PyDQVIU?= =?us-ascii?Q?YwBl0OAnX7lFqa2lPYo4zLJxsf8mOdfqJqQ4H9OE47uA2dX5ZQh491P0nbyP?= =?us-ascii?Q?/zyes8wivgEfiaULC2Wytz2WVHhAe9yO26sZqm1Nqb/Pr7YzTOml5BcpBxzk?= =?us-ascii?Q?jGhUhyIMhJtXWjYFaE+F14aYjNJ9DKzRZOgM520P492e0TkmW308QlnhDHeO?= =?us-ascii?Q?/SHE3Bwp+fZ71Trc0yUUcuDytWKmtDdwX5tRazPjpKw7iuf2LkgPovMgi7qy?= =?us-ascii?Q?8nUPyTjGHJ3eQe8fyyIWTfm7AAuAHRavUK2D6o7t/4stdh0VmCsxoEiUbYT/?= =?us-ascii?Q?1b8Iwm6+K8gvNM6hhSIJezRAu6JKv/CXwZs+5n133wNLs/x5Tg9UJtHpyRqM?= =?us-ascii?Q?tON809ste++a5G1qeGzggaIdpDniUZe7ADnLWt58JFV6UCKnXy2ryX8BJ5lW?= =?us-ascii?Q?ZXr5dvV+E2DdOD54ob6WMsFdOQ54gro6dGq3UPEsKEXF8G7Z06+9xQGowB/o?= =?us-ascii?Q?x14ADSWc6TWno4scI865/VPTag7QOB/PU7/T+yX5i8Pke2KBDTppd7TblZIH?= =?us-ascii?Q?NDKtb5biQnVxhMkSuqFHpnQlnywdsdbhjLadQQxjCSXhdmPfOG5IJUKyZvz5?= =?us-ascii?Q?sTzHEy5m+BFXTM21W3RFeB09w0ovuZid38N/gflBcXnxyYPIT1MVMlu7qrRX?= =?us-ascii?Q?tt5zAZJo5miAIbolmJA3ow3oh69HldUZ91zEUDEoNvOSdd8DMjJCEN+Wg8iE?= =?us-ascii?Q?c4yh3MmYoNu26sAXKAgOqfWPb5rKQg7Hhxf9fhpZkj8GuYBlrqF7h31LMHUt?= =?us-ascii?Q?EvjelrLJIzrbdvkqrtyoAEApf8z63jkOgKB8adfj4o0SDi9Gok4zMD33lYWQ?= =?us-ascii?Q?dW6ck0tmVF7QiHzPQPAXuQZMGtffT52DaKGbCeFGVcRgVXQ1aILAALD79T6r?= =?us-ascii?Q?abqKukvUsdzvTgS91vWsyH4gJu7jN4A1FsUYJ7w+B988D62xp21ey6Wqq1rZ?= =?us-ascii?Q?lftijgTQI7cIC7a9bkrGrps8Bzq1DjNcDX2x/2znziQCg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; HKXPR06MB1016; 5:25GYCiPJidKRLGfVxY80SW0EbS7KSVkUeUxfzh87+N2KM0c5X0yfRVSi3XIhjqCUWfdbKMsTWmaj84lk4U89rF01NYNWBLDs3f3X239pI2LMHryta5zfZ11BpJDQh+JQv7jKq6mNX/CFmDxpTmWPHg==; 24:5cYS/vqoX0Zz6XgllgOE8bQpjR1IzucMg85sTvSzcQ5Rt93ADwrqNp0y+bmlqEJjd5+jGKS2NgL5/B1eD9tUAnePkq4TjwVEI5xX4myvB8w=; 20:0zsYE1pnRIpTLoPP4arz2KQ93XE2H2FX2wVf3kuRdzrO2wuFuGebGvV2HuVggoCCcX4C6flVjuf24m8Ff9VH3yPGezvHyoCpecyU9l0t6+sKJjv0WpUJZka3R5HcfvrkNdrzg+JQr77vnm525z/A4rgYTcTNwogGv04EKE7REaE= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Mar 2016 05:08:33.5050 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB1016 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 SRC will convert rate, and then, CMD and SSI want to know its rate (= SRC.in / SRC.out) for each purpose. Current driver is supporting only Playback, but SRC+Capture support needs more flexibility. This patch adds rsnd_src_get_in/out_rate() for it. Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/rsnd.h | 10 +++++++--- sound/soc/sh/rcar/src.c | 20 +++++++++++++++++--- sound/soc/sh/rcar/ssi.c | 5 +++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index ff53f96..4b77f33 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -627,9 +627,13 @@ void rsnd_ssiu_remove(struct rsnd_priv *priv); int rsnd_src_probe(struct rsnd_priv *priv); void rsnd_src_remove(struct rsnd_priv *priv); struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id); -unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv, - struct rsnd_dai_stream *io, - struct snd_pcm_runtime *runtime); + +#define rsnd_src_get_in_rate(priv, io) rsnd_src_get_rate(priv, io, 1) +#define rsnd_src_get_out_rate(priv, io) rsnd_src_get_rate(priv, io, 0) +unsigned int rsnd_src_get_rate(struct rsnd_priv *priv, + struct rsnd_dai_stream *io, + int is_in); + #define rsnd_src_of_node(priv) \ of_get_child_by_name(rsnd_priv_to_dev(priv)->of_node, "rcar_sound,src") #define rsnd_parse_connect_src(rdai, playback, capture) \ diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 1d5aedb..d1a8741 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -116,12 +116,26 @@ static u32 rsnd_src_convert_rate(struct rsnd_dai_stream *io, return convert_rate; } -unsigned int rsnd_src_get_ssi_rate(struct rsnd_priv *priv, - struct rsnd_dai_stream *io, - struct snd_pcm_runtime *runtime) +unsigned int rsnd_src_get_rate(struct rsnd_priv *priv, + struct rsnd_dai_stream *io, + int is_in) { struct rsnd_mod *src_mod = rsnd_io_to_mod_src(io); + struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); unsigned int rate = 0; + int is_play = rsnd_io_is_play(io); + + /* + * + * Playback + * runtime_rate -> [SRC] -> convert_rate + * + * Capture + * convert_rate -> [SRC] -> runtime_rate + */ + + if (is_play == is_in) + return runtime->rate; /* * return convert rate if SRC is used, diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 5404897..5f848f0 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -190,7 +190,6 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, struct rsnd_dai_stream *io) { struct rsnd_priv *priv = rsnd_io_to_priv(io); - struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); struct device *dev = rsnd_priv_to_dev(priv); struct rsnd_dai *rdai = rsnd_io_to_rdai(io); struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); @@ -201,7 +200,9 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, 1, 2, 4, 8, 16, 6, 12, }; unsigned int main_rate; - unsigned int rate = rsnd_src_get_ssi_rate(priv, io, runtime); + unsigned int rate = rsnd_io_is_play(io) ? + rsnd_src_get_out_rate(priv, io) : + rsnd_src_get_in_rate(priv, io); if (!rsnd_rdai_is_clk_master(rdai)) return 0;