From patchwork Mon Mar 16 04:45:38 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6015371 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 B9C2E9F318 for ; Mon, 16 Mar 2015 04:47:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA584203E3 for ; Mon, 16 Mar 2015 04:47:50 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9E7BC20353 for ; Mon, 16 Mar 2015 04:47:49 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C87A02605B8; Mon, 16 Mar 2015 05:47:48 +0100 (CET) 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 A96D6260580; Mon, 16 Mar 2015 05:46:33 +0100 (CET) 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 0AE87260594; Mon, 16 Mar 2015 05:46:32 +0100 (CET) Received: from relmlie1.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa0.perex.cz (Postfix) with ESMTP id 27598260580 for ; Mon, 16 Mar 2015 05:45:40 +0100 (CET) Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie1.idc.renesas.com with ESMTP; 16 Mar 2015 13:45:40 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id A35973FB4C; Mon, 16 Mar 2015 13:45:40 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 82EBF1806F; Mon, 16 Mar 2015 13:45:40 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 7739C1800A; Mon, 16 Mar 2015 13:45:40 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id PAA16498; Mon, 16 Mar 2015 13:45:40 +0900 X-IronPort-AV: E=Sophos;i="5.11,407,1422889200"; d="scan'208";a="183126409" Received: from mail-hk1lp0121.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.121]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 16 Mar 2015 13:45:39 +0900 Received: from morimoto-PC.renesas.com (211.11.155.132) by HKNPR06MB307.apcprd06.prod.outlook.com (10.141.37.27) with Microsoft SMTP Server (TLS) id 15.1.112.19; Mon, 16 Mar 2015 04:45:38 +0000 Message-ID: <878uexk0tf.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: <87egopk13d.wl%kuninori.morimoto.gx@renesas.com> References: <87egopk13d.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Mon, 16 Mar 2015 04:45:38 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: TY1PR0201CA0004.apcprd02.prod.outlook.com (25.164.90.142) To HKNPR06MB307.apcprd06.prod.outlook.com (10.141.37.27) Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKNPR06MB307; X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(42186005)(122386002)(46406003)(36756003)(40100003)(110136001)(50466002)(77156002)(62966003)(87976001)(229853001)(66066001)(54356999)(76176999)(50986999)(53416004)(83506001)(33646002)(46102003)(92566002)(77096005)(2950100001)(86362001)(230783001)(19580405001)(19580395003); DIR:OUT; SFP:1102; SCL:1; SRVR:HKNPR06MB307; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5002010)(5005006); SRVR:HKNPR06MB307; BCL:0; PCL:0; RULEID:; SRVR:HKNPR06MB307; X-Forefront-PRVS: 05177D47DC X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Mar 2015 04:45:38.8315 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKNPR06MB307 Cc: Linux-ALSA , Simon , shiiba , Liam Girdwood , Das Biju Subject: [alsa-devel] [PATCH 04/12 v2] ASoC: rsnd-dpcm-card: add .be_hw_params_fixup support for convert rate 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 Current rsnd-dpcm-card is supporting DPCM FE/BE sound card. This patch adds .be_hw_params_fixup and enabled sampling convert rate. Signed-off-by: Kuninori Morimoto --- v1 -> v2 - no change .../bindings/sound/renesas,rsnd-dpcm-card.txt | 1 + sound/soc/sh/rcar/rsnd-dpcm-card.c | 27 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd-dpcm-card.txt b/Documentation/devicetree/bindings/sound/renesas,rsnd-dpcm-card.txt index c79fe72..23b45d7 100644 --- a/Documentation/devicetree/bindings/sound/renesas,rsnd-dpcm-card.txt +++ b/Documentation/devicetree/bindings/sound/renesas,rsnd-dpcm-card.txt @@ -30,6 +30,7 @@ Optional subnode properties: dai-link uses bit clock inversion. - frame-inversion : bool property. Add this if the dai-link uses frame clock inversion. +- convert-rate : platform specified sampling rate convert Required CPU/CODEC subnodes properties: diff --git a/sound/soc/sh/rcar/rsnd-dpcm-card.c b/sound/soc/sh/rcar/rsnd-dpcm-card.c index 3381b9e..c2f2a3c 100644 --- a/sound/soc/sh/rcar/rsnd-dpcm-card.c +++ b/sound/soc/sh/rcar/rsnd-dpcm-card.c @@ -38,6 +38,7 @@ struct rdpcm_card_data { } dai_props[RDPCM_FB_NUM]; struct snd_soc_codec_conf codec_conf; struct snd_soc_dai_link dai_link[RDPCM_FB_NUM]; + u32 convert_rate; }; #define rdpcm_priv_to_dev(priv) ((priv)->snd_card.dev) @@ -128,6 +129,21 @@ static int rdpcm_card_dai_init(struct snd_soc_pcm_runtime *rtd) return 0; } +static int rdpcm_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) +{ + struct rdpcm_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + struct snd_interval *rate = hw_param_interval(params, + SNDRV_PCM_HW_PARAM_RATE); + + if (!priv->convert_rate) + return 0; + + rate->min = rate->max = priv->convert_rate; + + return 0; +} + static int rdpcm_card_sub_parse_of(struct rdpcm_card_data *priv, struct device_node *np, @@ -322,6 +338,9 @@ static int rdpcm_card_dai_link_of(struct device_node *node, dai_link->ops = &rdpcm_card_ops; dai_link->init = rdpcm_card_dai_init; + if (idx == IDX_CODEC) + dai_link->be_hw_params_fixup = rdpcm_card_be_hw_params_fixup; + dev_dbg(dev, "\tname : %s\n", dai_link->stream_name); dev_dbg(dev, "\tcpu : %s / %04x / %d\n", dai_link->cpu_dai_name, @@ -372,8 +391,12 @@ static int rdpcm_card_parse_of(struct device_node *node, return ret; } - dev_dbg(dev, "New rsnd-dpcm-card: %s\n", priv->snd_card.name ? - priv->snd_card.name : ""); + /* sampling rate convert */ + of_property_read_u32(node, "convert-rate", &priv->convert_rate); + + dev_dbg(dev, "New rsnd-dpcm-card: %s (%d)\n", + priv->snd_card.name ? priv->snd_card.name : "", + priv->convert_rate); /* FE/BE */ for (i = 0; i < RDPCM_FB_NUM; i++) {