From patchwork Fri Apr 10 07:15:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 6192281 Return-Path: X-Original-To: patchwork-linux-sh@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 7A88D9F2E9 for ; Fri, 10 Apr 2015 07:15:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 82423203C1 for ; Fri, 10 Apr 2015 07:15:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 65EA4203C0 for ; Fri, 10 Apr 2015 07:15:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751536AbbDJHPL (ORCPT ); Fri, 10 Apr 2015 03:15:11 -0400 Received: from relmlor2.renesas.com ([210.160.252.172]:45709 "EHLO relmlie1.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751300AbbDJHPK (ORCPT ); Fri, 10 Apr 2015 03:15:10 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie1.idc.renesas.com with ESMTP; 10 Apr 2015 16:15:08 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 0BD4D45F48; Fri, 10 Apr 2015 16:15:09 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 05D6E1806F; Fri, 10 Apr 2015 16:15:08 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id F3EF21800A; Fri, 10 Apr 2015 16:15:08 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id SAB21159; Fri, 10 Apr 2015 16:15:08 +0900 X-IronPort-AV: E=Sophos;i="5.11,555,1422889200"; d="scan'208";a="184936623" Received: from mail-sg1lp0088.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.88]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 10 Apr 2015 16:15:07 +0900 Authentication-Results: kernel.org; dkim=none (message not signed) header.d=none; Received: from morimoto-PC.renesas.com (211.11.155.132) by HKNPR06MB306.apcprd06.prod.outlook.com (10.141.37.22) with Microsoft SMTP Server (TLS) id 15.1.136.25; Fri, 10 Apr 2015 07:15:06 +0000 Message-ID: <878ue08ngb.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Mark Brown , Lars-Peter Clausen CC: Simon , Linux-SH , Linux-ALSA , Liam Girdwood Subject: Re: [PATCH 3/3] ASoC: simple-card: Remove support for setting differing DAI formats In-Reply-To: <87bnjj431h.wl%kuninori.morimoto.gx@renesas.com> References: <87fv8v4353.wl%kuninori.morimoto.gx@renesas.com> <87bnjj431h.wl%kuninori.morimoto.gx@renesas.com> User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Date: Fri, 10 Apr 2015 07:15:06 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: OS1PR01CA0005.jpnprd01.prod.outlook.com (25.161.225.143) To HKNPR06MB306.apcprd06.prod.outlook.com (10.141.37.22) X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HKNPR06MB306; X-Microsoft-Antispam-PRVS: X-Forefront-Antispam-Report: BMV:1; SFV:NSPM; SFS:(10019020)(6009001)(51704005)(19580395003)(19580405001)(54356999)(50986999)(76176999)(83506001)(46406003)(87976001)(50466002)(53416004)(42186005)(92566002)(33646002)(40100003)(122386002)(23726002)(46102003)(86362001)(77096005)(2950100001)(36756003)(66066001)(62966003)(77156002)(47776003); DIR:OUT; SFP:1102; SCL:1; SRVR:HKNPR06MB306; H:morimoto-PC.renesas.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006)(5002010); SRVR:HKNPR06MB306; BCL:0; PCL:0; RULEID:; SRVR:HKNPR06MB306; X-Forefront-PRVS: 054231DC40 X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2015 07:15:06.0166 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKNPR06MB306 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Hi Lars, Mark > Having to set different formats on the CPU side and the CODEC side of a DAI > link is usually indication that something is terribly wrong and in most > cases is a result of a broken driver that implements a set_fmt() callback > which does not follow the specification. In the past this feature has been > used to work around broken drivers, rather than fixing them. We don't really > want to encourage this, so remove support for setting different formats on > both ends of the link. > > Along the way switch to static DAI format setup by setting the the dai_fmt > field of the snd_soc_dai_link rather than calling snd_soc_dai_fmt(). > > Signed-off-by: Lars-Peter Clausen > Signed-off-by: Kuninori Morimoto > --- > same as original patch > > include/sound/simple_card.h | 1 - > sound/soc/generic/simple-card.c | 30 ++++++++---------------------- > 2 files changed, 8 insertions(+), 23 deletions(-) > > diff --git a/include/sound/simple_card.h b/include/sound/simple_card.h > index 1255ddb..b9b4f28 100644 > --- a/include/sound/simple_card.h > +++ b/include/sound/simple_card.h > @@ -16,7 +16,6 @@ > > struct asoc_simple_dai { > const char *name; > - unsigned int fmt; > unsigned int sysclk; > int slots; > int slot_width; > diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c > index c49a408..33feee9 100644 > --- a/sound/soc/generic/simple-card.c > +++ b/sound/soc/generic/simple-card.c > @@ -125,14 +125,6 @@ static int __asoc_simple_card_dai_init(struct snd_soc_dai *dai, > { > int ret; > > - if (set->fmt) { > - ret = snd_soc_dai_set_fmt(dai, set->fmt); > - if (ret && ret != -ENOTSUPP) { > - dev_err(dai->dev, "simple-card: set_fmt error\n"); > - goto err; > - } > - } This patch removed above snd_soc_dai_set_fmt() here, and samethings is done in snd_soc_instantiate_card(). But, I noticed it breaks set_fmt() and pcm_new() timing. Before: set_fmt -> pcm_new After: pcm_new -> set_fmt My driver adds kctrl on pcm_new timing, and it refers set_fmt's settings. but now, set_fmt happen *after* pcm_new. (it adds new kctrl if it has SND_SOC_DAIFMT_CBS_CFS) My solution is these 2 pattern1) exchange set_fmt/pcm_new timing. see below pattern2) exchange kctrl assumption (always set kctrl) Maybe I should try pattern2 ? --------------------------------------- --- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 76bfff2..24d6733 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1604,6 +1604,12 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) } } + for (i = 0; i < card->num_links; i++) { + if (card->dai_link[i].dai_fmt) + snd_soc_runtime_set_dai_fmt(&card->rtd[i], + card->dai_link[i].dai_fmt); + } + /* probe all DAI links on this card */ for (order = SND_SOC_COMP_ORDER_FIRST; order <= SND_SOC_COMP_ORDER_LAST; order++) { @@ -1642,12 +1648,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card) snd_soc_dapm_add_routes(&card->dapm, card->of_dapm_routes, card->num_of_dapm_routes); - for (i = 0; i < card->num_links; i++) { - if (card->dai_link[i].dai_fmt) - snd_soc_runtime_set_dai_fmt(&card->rtd[i], - card->dai_link[i].dai_fmt); - } - snprintf(card->snd_card->shortname, sizeof(card->snd_card->shortname), "%s", card->name); snprintf(card->snd_card->longname, sizeof(card->snd_card->longname),