From patchwork Fri May 20 09:48:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9129051 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DBA1B60762 for ; Fri, 20 May 2016 09:48:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CE08C1FF6C for ; Fri, 20 May 2016 09:48:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C2EC225D91; Fri, 20 May 2016 09:48:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 513A81FF6C for ; Fri, 20 May 2016 09:48:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932526AbcETJsN (ORCPT ); Fri, 20 May 2016 05:48:13 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:38949 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932274AbcETJsL (ORCPT ); Fri, 20 May 2016 05:48:11 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 20 May 2016 18:48:10 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 4DBC94E02E; Fri, 20 May 2016 18:48:10 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 33DE61806F; Fri, 20 May 2016 18:48:10 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 2EB941800A; Fri, 20 May 2016 18:48:10 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id UAU01523; Fri, 20 May 2016 18:48:10 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="211713796" Received: from mail-sg2apc01lp0248.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.248]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 20 May 2016 18:48:09 +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=yXRA6lPneo00AVmvgORSDF4i1b/O2OZxecpYuIZ37+c=; b=gDk8ZIBnjEPPxDBr/zJ+EZJj4uQMMvJ2qk6002fTKiX1C2VQvuMEcjgZEMhrDehFPCAKDJdD5EKgXW3OBTRamxBinCA0X2otW+2CoXkUX7/0JvWc7WYWna7ATqzxeqI/D7c+veapYd3JTHTQQU0zab6ACvzHfV6EO6g3q5BZghE= 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 PS1PR06MB1708.apcprd06.prod.outlook.com (10.167.53.18) with Microsoft SMTP Server (TLS) id 15.1.501.7; Fri, 20 May 2016 09:48:07 +0000 Message-ID: <871t4xrrq4.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 14/49] ASoC: simple-card-core: add asoc_simple_card_parse_dpcm() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , In-Reply-To: <87lh35rs8w.wl%kuninori.morimoto.gx@renesas.com> References: <87lh35rs8w.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 20 May 2016 09:48:07 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TYXPR0101CA0007.jpnprd01.prod.outlook.com (10.168.40.145) To PS1PR06MB1708.apcprd06.prod.outlook.com (10.167.53.18) X-MS-Office365-Filtering-Correlation-Id: 37d3e299-437a-4906-8232-08d38093d8e6 X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1708; 2:UZZF+N+796IeGAhfblXZXzTmyC8Gwu4HVsGvWWvy7SB5whFmaZYCTg1WlPw/EVzkOSSZ/8ftqG3q1cXcqrA9GaAqhBzAEWPd4kdM5f0fcZCPJeV7tHajU8Ei0oEMM66/7wlL8RjsdpQqmAXomvb7nUX0FFD+xYLd3YoqSHrBNHsNgMbO7xJ6LtIlHVTHUvYa; 3:bNSoXZJkpIyVEqRuCslgyW11wIn07xbmFRNAl3NSTFk+UhPJyfWN5ljJd6n3JgZ2AZ99wnI+EBAJehCPxOt+tbcpb8jo6EZkF65gguSSW427eI9xQ+8ls5tnbR7wNCs/; 25:BtjmOPUr8kOYRElR00uHzYIkoicAbZVIZAjPt31TKt3pTK48gpkRblTu/Uyf+fc2tx3WszkmVC8ApzdEhpAKXVi8G6bxHW+isajHtNLLRLRFG2UB9qPZ40LER/eehvNJTBudQ0yAS4aDJC6QvDV3G7NnWCe5KEZFDlcwjWKM00HhJ8Kp2UFE3NIu4xy3GF2j2i7t4vrkgCQQEt/8KEubC7J7LkjPg6hyIxKFcxnsIJMr5JVig7w2PuDwFrK9j7Pil4LLAcKEqnnN/Y5gu+bA2XHib93r6OF5eRYZKWzWG2Z3Qj294FdxB+9CTNZJDagTahuO/ltokZoAfdtFItzVnXR+jy6EDzR0k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+DqCFJAK/Rfww== 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)(6055026); SRVR:PS1PR06MB1708; BCL:0; PCL:0; RULEID:; SRVR:PS1PR06MB1708; X-Forefront-PRVS: 09480768F8 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(230783001)(86362001)(53416004)(83506001)(5008740100001)(50986999)(76176999)(8676002)(4326007)(229853001)(81166006)(54356999)(6116002)(23726003)(42186005)(19580405001)(36756003)(19580395003)(47776003)(66066001)(33646002)(3846002)(92566002)(2906002)(586003)(189998001)(110136002)(50466002)(5004730100002)(2950100001)(77096005)(46406003)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:PS1PR06MB1708; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; PS1PR06MB1708; 23:fsSoZicOPO9yyUIJ7HJwld9qbiln3vCVKmXy5ohQKbFOen+P8KGdKKbeH63iWpVE5YAP7OKrVRqt1LGNI4fMwkM31lSLtQfGqAsko3drNE17DP0aZ6aoSmQdP84Ws1A1diyUU3QlLvW0kRtbcOAB1LSOIKjc/PSrHv2EMsa9lFB+GATkvPc00k1iEtWZ9v37eBWuK8APVMK+dUA7Sq/soN+Me0AY2gzq9pL4qmMfCnI6cP0BjiED9ilJhPd4KBEuNNxPsLVrQ/MQBbaCf8x4k5F6Vhtt9CFI/zfaqQeqrKdAA6ItEVEl7ES66WSI6wJ5+QiXxGV8o9s/vF3FUzo/JoBu7oiUFDqLxNnCuSns57ADcStaMHWJnFyB0AhP+UDQa4d2Shw0E7NzazBnFkVyyfC2BvaaErv2WLluabMTJEuqTzxnFA8ieKFs4YLajKBPNVZrh1Fkwu6ijCmWBUubSpMuE/UUBYcQpOcs/wJvaSHBqYpq20hx/ZEsw5Ih7POhR2cVQ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rzWhU4Th9hXLCaC9rg= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2016 09:48:07.3311 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: PS1PR06MB1708 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto simple-card like driver is supporting DPCM FE/BE. This patch makes this method simple style standard. Signed-off-by: Kuninori Morimoto --- include/sound/simple_card_core.h | 7 +++++++ sound/soc/generic/simple-card-core.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/include/sound/simple_card_core.h b/include/sound/simple_card_core.h index 8155001..5e2e824 100644 --- a/include/sound/simple_card_core.h +++ b/include/sound/simple_card_core.h @@ -69,4 +69,11 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np, const char *cells_name, int *is_single_links); +#define asoc_simple_card_parse_dpcm_fe(dai_link) \ + asoc_simple_card_parse_dpcm(dai_link, NULL) +#define asoc_simple_card_parse_dpcm_be(dai_link, fixup) \ + asoc_simple_card_parse_dpcm(dai_link, fixup) +void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link, + int (*be_fixup)(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params)); #endif /* __SIMPLE_CARD_CORE_H */ diff --git a/sound/soc/generic/simple-card-core.c b/sound/soc/generic/simple-card-core.c index d9285df..d3aab6d 100644 --- a/sound/soc/generic/simple-card-core.c +++ b/sound/soc/generic/simple-card-core.c @@ -242,3 +242,32 @@ int asoc_simple_card_parse_endpoint(struct device_node *port_np, return 0; } EXPORT_SYMBOL_GPL(asoc_simple_card_parse_endpoint); + +void asoc_simple_card_parse_dpcm(struct snd_soc_dai_link *dai_link, + int (*be_fixup)(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params)) +{ + if (be_fixup) { + /* FE is dummy */ + dai_link->cpu_of_node = NULL; + dai_link->cpu_dai_name = "snd-soc-dummy-dai"; + dai_link->cpu_name = "snd-soc-dummy"; + + /* BE settings */ + dai_link->no_pcm = 1; + dai_link->be_hw_params_fixup = be_fixup; + } else { + /* BE is dummy */ + dai_link->codec_of_node = NULL; + dai_link->codec_dai_name = "snd-soc-dummy-dai"; + dai_link->codec_name = "snd-soc-dummy"; + + /* FE settings */ + dai_link->dynamic = 1; + dai_link->dpcm_merged_format = 1; + } + + dai_link->dpcm_playback = 1; + dai_link->dpcm_capture = 1; +} +EXPORT_SYMBOL_GPL(asoc_simple_card_parse_dpcm);