From patchwork Thu Feb 25 05:51:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 8419021 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-renesas-soc@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 BD0AFC0555 for ; Thu, 25 Feb 2016 05:52:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 276DF20253 for ; Thu, 25 Feb 2016 05:52:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 726F22037C for ; Thu, 25 Feb 2016 05:52:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759821AbcBYFwF (ORCPT ); Thu, 25 Feb 2016 00:52:05 -0500 Received: from relmlor4.renesas.com ([210.160.252.174]:64697 "EHLO relmlie3.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759772AbcBYFvt (ORCPT ); Thu, 25 Feb 2016 00:51:49 -0500 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie3.idc.renesas.com with ESMTP; 25 Feb 2016 14:51:47 +0900 Received: from relmlac1.idc.renesas.com (relmlac1.idc.renesas.com [10.200.69.21]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 685E950E3B; Thu, 25 Feb 2016 14:51:47 +0900 (JST) Received: by relmlac1.idc.renesas.com (Postfix, from userid 0) id 4DAA68002E; Thu, 25 Feb 2016 14:51:47 +0900 (JST) Received: from relmlac1.idc.renesas.com (localhost [127.0.0.1]) by relmlac1.idc.renesas.com (Postfix) with ESMTP id 45FA78002D; Thu, 25 Feb 2016 14:51:47 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac1.idc.renesas.com with ESMTP id QAE30293; Thu, 25 Feb 2016 14:51:47 +0900 X-IronPort-AV: E=Sophos;i="5.22,496,1449500400"; d="scan'";a="206421066" Received: from mail-pu1apc01lp0017.outbound.protection.outlook.com (HELO APC01-PU1-obe.outbound.protection.outlook.com) ([65.55.88.17]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 25 Feb 2016 14:51:46 +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=93npRGh+17dE9HSDDB585RpFFisbsdYZgoVGHRPCT4Y=; b=aUlnzQdjiT5acxKFCIehTT4dUzPKYCqbEQaI7agZRlOMtcAMS9A4zT+R4wdBoC/2ElIkk9G6SxusmcDvQR+I3Ij72P5KNLKOmCv7krVtT9oI5cncOxM8USkO2rfgz0L3/2i06IrXlQl5nhy7Z5V0/0bVn5UzsZ9f9t3zhMZt4o0= 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 HK2PR06MB1011.apcprd06.prod.outlook.com (10.161.187.28) with Microsoft SMTP Server (TLS) id 15.1.409.15; Thu, 25 Feb 2016 05:51:44 +0000 Message-ID: <874mcx734l.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Mark Brown CC: Simon , Linux-Renesas , Linux-DT , Linux-ALSA , Liam Girdwood , Laurent Subject: [PATCH 2/6] ASoC: rsrc-card: add convert channels support User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 In-Reply-To: <877fht7376.wl%kuninori.morimoto.gx@renesas.com> References: <877fht7376.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 25 Feb 2016 05:51:44 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0014.jpnprd01.prod.outlook.com (25.161.74.152) To HK2PR06MB1011.apcprd06.prod.outlook.com (25.161.187.28) X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1011; 2:W69PLPZkUD4T8UWZPbcTSZCFNzIJNpQ3reePTjo99B7yBl9RiWth/ihFasc9aUyuUW+470qcRIIp3wyA6BIAz+5DMEFWLGAcLuehyD63QfUgxbreBq7yZoPyc9jbG/IXgeuHfuIzxJV4Qp5rDIAfNQ==; 3:rArWuQE9IIe3BmBEI+MXpc6CdvpcjHrNz92MXSTtx8BeHO+eWLGp/taHlfHXrLJLgkoCQFaC5i3fJhS8pq5wvRirw+PCDf41EXH+WkV7rZM9oKkQrEBOtjp+2weCefas; 25:xMIsUapFP7q7uKgGuTjQvHmeGEsgHWsE/MsWkItNVfPVFGrEM9LO8nyt+09g845NEMlfe4SAnXLttY+t30+3k+tPF4YheL1ntCOonFjPkc73b7EhmhqSM3SPHeyDhKAXWoq0csdPDYIuaRcSoFInmP8b2QEcwz6sSYXia0WWWRNYoteIv0wa40g//nhByJrCCGuIGGQcs5saCG/dM+lEgDDM/6QVRO6b5dyUpuAAB7APWxK+UOJHNmqG3N/us86c5BuT6ghecPXcVxK9cK1RRt2tOkumtvUZyaJpQuKtQwyCuVuPwfCunXqTvADM8ute X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HK2PR06MB1011; X-MS-Office365-Filtering-Correlation-Id: a29778ee-dfe4-46b1-e936-08d33da7be6a X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1011; 20:zJLYxiYG0u51LAFu/LJJO89Zgx/t6liKScUM3KDS2s2crsfMgQGwnyz8qVWwiF5VrmQIDaxYdEW+mKRAePuch+WEAMnuJFPet/CTZbiIg9KkJ5Asx7VKH/d1x8USLnsMHzyTYdd9eWtiMz3QXHXGhaQHs+W1b5WWoBAIGXbNi4ZzXK4Pq/09jitFZo5FpnNNPBOFEldAKyyZbxFijGwQ0+82MWnDzKj7zBuJJwxjvEvAJ4P48m9Y3bB5Cz2rEop/TeowfU/HgpeBm3BIljk89Jbd0WMpwssgp59/EbR0VWCuajp03YhEbsXzNI+7Cf5jVYdcC4LVwhSHVQYTt3rjQInzPFkpOz7alBXCT7lAw+wNNGtF7i0LBnqDTmyBUv964lPhGdtIIkoH3XBB89pF9ivuPtECdd4WlFnj7XTd5eIkVMlgoI00ptPH6AXjnQwGo5l7CzoyfDU9he1GBBDkeupuRBH3ss3ukKPROV78EcSFuqg7harPbamNHLqOf372; 4:lZRBygs+ObRmwQONQ8UKEK1w2xar+rmKy93vs5UMsMgsIZhouMWkFGdDAaButeLZgVkyoFdXFcR2x4JeuVksAvuPzrCl+A6kxvRsUUA5k4X3hwrJRfDRQUwLr1PCjIm+bRcUFjtj+H3FBaqDMJVJWJTwzr1BDXUFaARxKiIEYEnWkVvUHb0dQUadefP0bCGuIv2a0VER9ia7Z1+eBz65WSoMg9ItdWPesZxhn5u5IBIrgtMXHHqW+AHWYLvt+LdePCSe9QniKw6SiJcEcC7uwSF9L20N1XoDiEJh+tjcyHW2ccqzP2t5QkkvGcfrzP3Bkhb57hGjMBFbl95MyGfMICmCCyUXCoRliV/49SkGdcu41SYu4dWAb5y3Up+V1d4b 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:HK2PR06MB1011; BCL:0; PCL:0; RULEID:; SRVR:HK2PR06MB1011; X-Forefront-PRVS: 08635C03D4 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(83506001)(229853001)(87976001)(76176999)(53416004)(42186005)(110136002)(36756003)(92566002)(189998001)(4001350100001)(86362001)(54356999)(5001960100002)(50986999)(66066001)(6116002)(47776003)(19580395003)(586003)(19580405001)(40100003)(5004730100002)(50466002)(33646002)(23726003)(122386002)(2906002)(2950100001)(77096005)(4326007)(5008740100001)(1096002)(3846002)(46406003); DIR:OUT; SFP:1102; SCL:1; SRVR:HK2PR06MB1011; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HK2PR06MB1011; 23:TF9l2uGZrYTZSp4g2JI+KRNmKFsrQ5nFBRNt8FWz+?= =?us-ascii?Q?A0jmQbsds1716T2xgumnJM7Yuj+DS2gqAEbeQeMuz0ky66zihua2PN+usTg2?= =?us-ascii?Q?TQ1vRJhrMdWy/XNKEYJefeqkNRNPUW921pvj2I6hMtcTjWvXd23A9PTMOYZ1?= =?us-ascii?Q?YvS/7gIW/F/5Nx+6C77tsTma3O9TQWGXx3z1O80+aHwpF1isXtkeWAWqLybR?= =?us-ascii?Q?Im2tOQRaOls/UXY1KZySd5xwmL4bjsmCcL3JWYDaYeSEHypfk6Jm9gkiKS2B?= =?us-ascii?Q?8QqKsf27bYviv5l7k9hsyqDKN+yl6ueNRrOU1zJMm0fo5vmwmu/TY6N/LUpQ?= =?us-ascii?Q?8qCtMlabRKrlkiUs52oqTpUoS0Ln9pOYhL3d9QY7IAgVkqhBD+l67QZU8ta5?= =?us-ascii?Q?y6tSdw2u1RbxCSbfzHU6bQ8ZnqqFgP/gioDN7ggNgjV2o+qgMY303Bvdrh/h?= =?us-ascii?Q?iaORZ+cuF9/OdXz1dk0+3ZrGQuLZAXxjrs46YqifgMm6I8/+sICDKjMhfFx4?= =?us-ascii?Q?3alLWeLf7hpdCaJDevKWSJmCsgrW2ZP50Ui1JeUKRPIqBx8hLJ30FBoRk7iN?= =?us-ascii?Q?KhlK5iEUN4UoqSJDp3NgOffw3rFZMEm3MdklPe3Bvs7yOc6N6tYqNQ0Dqi25?= =?us-ascii?Q?DA9VN6lXdKMEDo1BL6lgjUaXSc6cFTclDI8BpHGYY7bI3ViaqXYfcmvDsOXa?= =?us-ascii?Q?NmgTroI/ivrXISRJeVMNHB3AdXo9Z0F5Tf7s9En2lpejsJixDFE7N8elEwsE?= =?us-ascii?Q?4VfWOzfsgP8qi/R57JaPGuM2zI40WE8LjQH8L5Bt/5pJnPrjPw1JU0oIqm4X?= =?us-ascii?Q?0dtu3Awky955jWpBt9EQXwexVBUtj2rHHujjXmR4H6AWORxnoQfE028WUSwG?= =?us-ascii?Q?NyrVovCuw/r4xic+VzsdLCw0aBpP6PbBe8JsET0Poz8yQCV0ndaABAJKQoN9?= =?us-ascii?Q?Wg+J4AgLvuRD9z6Ed0nvTRFPbOmvVNrVGMh7a4T21AKNKB3FstgEzH5CtrHW?= =?us-ascii?Q?r3+oL4vc6aBiF57SitK4Dsz?= X-Microsoft-Exchange-Diagnostics: 1; HK2PR06MB1011; 5:uPYZh9iHJFqNZN4Lnw9fwoLa7CgdW0PHZgTm1djlggflfAsShD+1lu7gyUhj/0E42+ao68Lz8+5QikQqHeSLuc+bEgNoPaBPUPdoLpc/gqQfZh457ZUYxn7PweY4qjMGvFTgRnXeY7so1+w4G/VNWQ==; 24:elkS+znGleaj4X24UKDuJI3z5q2XJTo2L1aJZrvaXqYAUSJSL4g+LrYYqMVRmbwODbcIw7HFaRImaqKAktwrP3/4Psj6+FJTWxAIeoOQpBw=; 20:wIgDT8X6FBZ94mFEFxfqYEFewpO1P5+3opr/96LzYpQl8xtBY0wW1qE6FQe5ufNamBqUZfhUKpwIZFnITiNcixzA8PsvxwGtPBVRg29FPOlA+wQjrNCStG1U1x14F8SsXYqjYNPhZ45g9SFgaXNIGF5CQDMG4doQan0pJTiv2iI= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2016 05:51:44.5850 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR06MB1011 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=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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 Renesas sound device has CTU (= Channel Transfer Unit), and sound card needs its support. Signed-off-by: Kuninori Morimoto --- .../bindings/sound/renesas,rsrc-card.txt | 1 + sound/soc/sh/rcar/rsrc-card.c | 22 ++++++++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt index 2b2caa2..5abebf7 100644 --- a/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt +++ b/Documentation/devicetree/bindings/sound/renesas,rsrc-card.txt @@ -30,6 +30,7 @@ Optional subnode properties: - frame-inversion : bool property. Add this if the dai-link uses frame clock inversion. - convert-rate : platform specified sampling rate convert +- convert-channels : platform specified channel size convert - audio-prefix : see audio-routing - audio-routing : A list of the connections between audio components. Each entry is a pair of strings, the first being the connection's sink, diff --git a/sound/soc/sh/rcar/rsrc-card.c b/sound/soc/sh/rcar/rsrc-card.c index 8a357fd..ecf5d47 100644 --- a/sound/soc/sh/rcar/rsrc-card.c +++ b/sound/soc/sh/rcar/rsrc-card.c @@ -66,6 +66,7 @@ struct rsrc_card_priv { struct snd_soc_dai_link *dai_link; int dai_num; u32 convert_rate; + u32 convert_channels; }; #define rsrc_priv_to_dev(priv) ((priv)->snd_card.dev) @@ -145,11 +146,16 @@ static int rsrc_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, struct rsrc_card_priv *priv = snd_soc_card_get_drvdata(rtd->card); struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); + struct snd_interval *channels = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_CHANNELS); - if (!priv->convert_rate) - return 0; + if (priv->convert_rate) + rate->min = + rate->max = priv->convert_rate; - rate->min = rate->max = priv->convert_rate; + if (priv->convert_channels) + channels->min = + channels->max = priv->convert_channels; return 0; } @@ -437,9 +443,13 @@ static int rsrc_card_parse_of(struct device_node *node, /* sampling rate convert */ of_property_read_u32(node, "convert-rate", &priv->convert_rate); - dev_dbg(dev, "New rsrc-audio-card: %s (%d)\n", - priv->snd_card.name ? priv->snd_card.name : "", - priv->convert_rate); + /* channels transfer */ + of_property_read_u32(node, "convert-channels", &priv->convert_channels); + + dev_dbg(dev, "New rsrc-audio-card: %s\n", + priv->snd_card.name ? priv->snd_card.name : ""); + dev_dbg(dev, "SRC : convert_rate %d\n", priv->convert_rate); + dev_dbg(dev, "CTU : convert_channels %d\n", priv->convert_channels); ret = rsrc_card_dai_link_of(node, priv); if (ret < 0)