From patchwork Thu Jun 30 06:02:46 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 9206651 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 97B31607D6 for ; Thu, 30 Jun 2016 06:03:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89578285B7 for ; Thu, 30 Jun 2016 06:03:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7D0CA28673; Thu, 30 Jun 2016 06:03:43 +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 D084F285C3 for ; Thu, 30 Jun 2016 06:03:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751052AbcF3GDm (ORCPT ); Thu, 30 Jun 2016 02:03:42 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:40382 "EHLO relmlie4.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751034AbcF3GDl (ORCPT ); Thu, 30 Jun 2016 02:03:41 -0400 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie4.idc.renesas.com with ESMTP; 30 Jun 2016 15:02:49 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 342214FA45; Thu, 30 Jun 2016 15:02:49 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 29E831806F; Thu, 30 Jun 2016 15:02:49 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 1DFA31800A; Thu, 30 Jun 2016 15:02:49 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id RAD04185; Thu, 30 Jun 2016 15:02:49 +0900 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="214579381" Received: from mail-sg2apc01lp0239.outbound.protection.outlook.com (HELO APC01-SG2-obe.outbound.protection.outlook.com) ([65.55.88.239]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 30 Jun 2016 15:02:48 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=lVsMVTcKUyMJDsLCo2tFITNXzHJB1AlQ0mS+4mnALYE=; b=giCk4suKsNF0ZeD1mVx+b00xkCPeKIjebl3E0mMImmRJ3iykq2dgrCbj6Glj+7GUxuzXsXiU20+qIRmH5KY2X32ZhBM7lYMbLCOHtNzFJLmovBYJKSVtbhfFiZAwc73GycrG50168xSkrBYnjQt8h1DbLTxic0HesydgrfVZPYw= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Received: from morimoto-PC.renesas.com (211.11.155.144) by SG2PR06MB1709.apcprd06.prod.outlook.com (10.167.82.139) with Microsoft SMTP Server (TLS) id 15.1.523.12; Thu, 30 Jun 2016 06:02:46 +0000 Message-ID: <87vb0r9q5f.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 1/6] ASoC: simple-card: use asoc_simple_card_parse_daifmt() User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , In-Reply-To: <87wpl79q79.wl%kuninori.morimoto.gx@renesas.com> References: <87wpl79q79.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Thu, 30 Jun 2016 06:02:46 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OSXPR01CA0042.jpnprd01.prod.outlook.com (10.167.143.174) To SG2PR06MB1709.apcprd06.prod.outlook.com (10.167.82.139) X-MS-Office365-Filtering-Correlation-Id: a9b7c971-ca00-4046-ff17-08d3a0ac28c9 X-Microsoft-Exchange-Diagnostics: 1; SG2PR06MB1709; 2:JOpcT4CLcU7GfSBs7ofuOxohdpMyXG98xgvHKgMxeIy3ynsng+ic9pYP6qK908wL9lfznwvrtGGMFWjykq3PvkwEojJcEu5nYrRKX1pV+8e6FU+mrLg+6vuz/pOWxH1tUx8upU+qJqbrhfrFZ++dq7ErwNUk72Qc09GqcAJj+d08uSg96bJokby6jENqVKIV; 3:0KTk+o+DgvsN/dgJ6StDPWHvZ9kMpnK980BHTi0DThL69ifETml0H4ktPkXxJodBQzpYzpX/KIA9eITFHCOQU3nhRiQgD9GlM8LNzOmkpapz0ORBK9w4HSysgQTunB17; 25:bkMPQ7QRrIbwe3vJUJjZ68nIXgZd3zzojd/E+ZL6cXBBtEbTBaD5zZdT8GyRieNBW1TrwQJrKw3Z58jJhaOd2t8gM8Lur/55RN2DDZrIJs6465O/3DKPhkSphs3RgJ1qXIw4v+KFRSAPXeDgJvpfmOeIiMJGg/MY6kh0K2Uox6FEfmGQMze2YvfL6vG3RilWKEbLM3Gw5C1vfGAvKwhh4BdgoMFeSJDXovIe3zP6PciZkypcejB8U3XO03ljkbRPiasFPUkKPvTWkB0+io7mksVHvRtv4VmGLkf1SYfPhVSzP5WTcV2jwHK7DQrhek459eRCw9dBSZ+6h4UjEVmSRig344IzfVu9bi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r8PwxVWh5gCt/mRXaSpAPOVhw== 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)(10201501046)(3002001)(6055026); SRVR:SG2PR06MB1709; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB1709; X-Forefront-PRVS: 0989A7979C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(69596002)(4001350100001)(110136002)(54356999)(97736004)(229853001)(19580395003)(92566002)(189998001)(68736007)(33646002)(7846002)(50986999)(46406003)(47776003)(36756003)(76176999)(19580405001)(586003)(50466002)(77096005)(8676002)(7736002)(106356001)(2906002)(305945005)(53416004)(2950100001)(101416001)(86362001)(23726003)(83506001)(105586002)(81156014)(6116002)(3846002)(66066001)(81166006)(42186005)(4326007)(16060500001); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB1709; H:morimoto-PC.renesas.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SG2PR06MB1709; 23:FopgwuXtpOPjhcR+J7S4UlnWi+BPEXxzzH4uu/SQM?= =?us-ascii?Q?gsmZMbgYPqlUk+uEBHlcxDvKu5saCLvSmpW+qf5xMdL68VC5obgXN6Y+mWlK?= =?us-ascii?Q?tmXGcKSKJgJP/I6yB9kx/5kRC14t2a9Rm+LxaDiZm8FEpJYZJwhH0PxXEnJl?= =?us-ascii?Q?9l29Y5B2gWMXMTB3DJKDYHC2KBtXr1wJH4yorNLzuplVZajAp5/f4f6djsfB?= =?us-ascii?Q?9jaHeNcCYCGR3pF/jG+cNUrTsIVRmhqdnMYgoQ1DkTPz+nh/8DNUoWCgqGD/?= =?us-ascii?Q?iWzOhtkW2pv9iyRWTPM6fES2mVJe3k5lBL8UZkqGKYyVD0zDKHB4VgM0sM/X?= =?us-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JGTBMjOq34HBblSV6oT+BMA7KaWfLu1c/RsSEkZvYdyIE/+KprFF25fXolXqz2bg6JGViNM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jun 2016 06:02:46.1832 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB1709 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 We can use simpel utils asoc_simple_card_parse_daifmt(). Let's use it Signed-off-by: Kuninori Morimoto --- include/sound/simple_card.h | 11 +--------- include/sound/simple_card_utils.h | 10 +++++++++ sound/soc/generic/Kconfig | 1 + sound/soc/generic/simple-card.c | 46 ++------------------------------------- 4 files changed, 14 insertions(+), 54 deletions(-) diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h index 0399352..a6a2e15 100644 --- a/include/sound/simple_card.h +++ b/include/sound/simple_card.h @@ -13,16 +13,7 @@ #define __SIMPLE_CARD_H #include - -struct asoc_simple_dai { - const char *name; - unsigned int sysclk; - int slots; - int slot_width; - unsigned int tx_slot_mask; - unsigned int rx_slot_mask; - struct clk *clk; -}; +#include struct asoc_simple_card_info { const char *name; diff --git a/include/sound/simple_card_utils.h b/include/sound/simple_card_utils.h index 7acc798..50aa7b2 100644 --- a/include/sound/simple_card_utils.h +++ b/include/sound/simple_card_utils.h @@ -12,6 +12,16 @@ #include +struct asoc_simple_dai { + const char *name; + unsigned int sysclk; + int slots; + int slot_width; + unsigned int tx_slot_mask; + unsigned int rx_slot_mask; + struct clk *clk; +}; + int asoc_simple_card_parse_daifmt(struct device *dev, struct device_node *node, struct device_node *codec, diff --git a/sound/soc/generic/Kconfig b/sound/soc/generic/Kconfig index 26c2fe6..c01c5dd 100644 --- a/sound/soc/generic/Kconfig +++ b/sound/soc/generic/Kconfig @@ -3,5 +3,6 @@ config SND_SIMPLE_CARD_UTILS config SND_SIMPLE_CARD tristate "ASoC Simple sound card support" + select SND_SIMPLE_CARD_UTILS help This option enables generic simple sound card support diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 8d0311c..e3a32d3 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -308,48 +308,6 @@ asoc_simple_card_sub_parse_of(struct device_node *np, return 0; } -static int asoc_simple_card_parse_daifmt(struct device_node *node, - struct simple_card_data *priv, - struct device_node *codec, - char *prefix, int idx) -{ - struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, idx); - struct device *dev = simple_priv_to_dev(priv); - struct device_node *bitclkmaster = NULL; - struct device_node *framemaster = NULL; - unsigned int daifmt; - - daifmt = snd_soc_of_parse_daifmt(node, prefix, - &bitclkmaster, &framemaster); - daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; - - if (strlen(prefix) && !bitclkmaster && !framemaster) { - /* - * No dai-link level and master setting was not found from - * sound node level, revert back to legacy DT parsing and - * take the settings from codec node. - */ - dev_dbg(dev, "Revert to legacy daifmt parsing\n"); - - daifmt = snd_soc_of_parse_daifmt(codec, NULL, NULL, NULL) | - (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK); - } else { - if (codec == bitclkmaster) - daifmt |= (codec == framemaster) ? - SND_SOC_DAIFMT_CBM_CFM : SND_SOC_DAIFMT_CBM_CFS; - else - daifmt |= (codec == framemaster) ? - SND_SOC_DAIFMT_CBS_CFM : SND_SOC_DAIFMT_CBS_CFS; - } - - dai_link->dai_fmt = daifmt; - - of_node_put(bitclkmaster); - of_node_put(framemaster); - - return 0; -} - static int asoc_simple_card_dai_link_of(struct device_node *node, struct simple_card_data *priv, int idx, @@ -386,8 +344,8 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, goto dai_link_of_err; } - ret = asoc_simple_card_parse_daifmt(node, priv, - codec, prefix, idx); + ret = asoc_simple_card_parse_daifmt(dev, node, codec, + prefix, &dai_link->dai_fmt); if (ret < 0) goto dai_link_of_err;