From patchwork Sat Aug 24 20:26:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= X-Patchwork-Id: 11113127 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D91191399 for ; Sat, 24 Aug 2019 20:32:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6D14021897 for ; Sat, 24 Aug 2019 20:32:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="l/WsPj1f"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="GadtC0t8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6D14021897 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=rere.qmqm.pl Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id A848F1679; Sat, 24 Aug 2019 22:31:24 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A848F1679 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1566678734; bh=NjThZc/obsmDR2jxooUceUkOmXEoDZSdqKJx/G0my48=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=l/WsPj1fh8nMH5QePUxkBAtmRNIF7HT+aCUDvdcX0kKlQGFOlVRLD+8wbvFRd+5ij FHWe1ofBFtnrb4GSH2hkLSMxoz975J2f6lRySnm93YSaNIOsWxIH/B0Vnje/1OIARU 8gHSAVPdIWahpVdJwkYy4nkOhsTKOoH93ffkvCQc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 95CAAF8063A; Sat, 24 Aug 2019 22:27:21 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1FEFBF805E1; Sat, 24 Aug 2019 22:27:08 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,PRX_BODY_30,SPF_HELO_PASS,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from rere.qmqm.pl (rere.qmqm.pl [91.227.64.183]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 2BB8FF803D5 for ; Sat, 24 Aug 2019 22:26:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2BB8FF803D5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=rere.qmqm.pl header.i=@rere.qmqm.pl header.b="GadtC0t8" Received: from remote.user (localhost [127.0.0.1]) by rere.qmqm.pl (Postfix) with ESMTPSA id 46G8sG3RHFzhv; Sat, 24 Aug 2019 22:25:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rere.qmqm.pl; s=1; t=1566678322; bh=VMADLsNAb53KqJMxEINzewk+gjFvVaLwVHUb8Ct9D+Y=; h=Date:In-Reply-To:References:From:Subject:To:Cc:From; b=GadtC0t8GZJA/lhACGRFEtRl8Z69pZTr7VwbIJv7I5uAhvVM7V/Ea7mtmClXGF+WH X21adHNbfwNw0YI+mHhPDWXdhDkZERVvSjuc/InEx1JEyK08hE6AuII3LfnpRMvieR Ym54Z211qnXPqi9zWGF3QWHHWdOyGEv+4VMYXvp445EXOFsRwhk2uyQuyAhHwpAf0j fs9jsMo7IrTHip65QLCfhxrWi3yG7oVxt+wse75vpEhY3Z/i64Xn6ucteb1cLGmOEA wusM19TMVgygdapkBgu0woqjRFbG/AwK2VOxV5OzJgahPjjRhKv67+TZG9LaQbl2RX OHGJAkxUIW0eQ== X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.101.2 at mail Date: Sat, 24 Aug 2019 22:26:57 +0200 Message-Id: In-Reply-To: References: From: =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= MIME-Version: 1.0 To: alsa-devel@alsa-project.org, devicetree@vger.kernel.org Cc: Mark Rutland , Alexandre Belloni , Arnd Bergmann , Greg Kroah-Hartman , Nicolas Ferre , Takashi Iwai , Liam Girdwood , Ludovic Desroches , Mark Brown , Chas Williams <3chas3@gmail.com>, Rob Herring , Codrin Ciubotariu , linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH v2 6/6] ASoC: atmel_ssc_dai: Enable shared FSYNC source in frame-slave mode X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" SSC driver allows only synchronous TX and RX. In slave mode for BCLK it uses only one of TK or RK pin, but for LRCLK it configured separate inputs from TF and RF pins. Allow configuration with common FS signal. Signed-off-by: Michał Mirosław --- v2: use alternate DT binding split DT and drivers/misc changes --- sound/soc/atmel/atmel_ssc_dai.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index 48e9eef34c0f..035d4da58f2b 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c @@ -605,14 +605,32 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, return -EINVAL; } - if (!atmel_ssc_cfs(ssc_p)) { + if (atmel_ssc_cfs(ssc_p)) { + /* + * SSC provides LRCLK + * + * Both TF and RF are generated, so use them directly. + */ + rcmr |= SSC_BF(RCMR_START, fs_edge); + tcmr |= SSC_BF(TCMR_START, fs_edge); + } else { fslen = fslen_ext = 0; rcmr_period = tcmr_period = 0; fs_osync = SSC_FSOS_NONE; - } - rcmr |= SSC_BF(RCMR_START, fs_edge); - tcmr |= SSC_BF(TCMR_START, fs_edge); + if (ssc->lrclk_from_tf_pin) { + rcmr |= SSC_BF(RCMR_START, SSC_START_TX_RX); + tcmr |= SSC_BF(TCMR_START, fs_edge); + } else if (ssc->lrclk_from_rf_pin) { + /* assume RF is to be used when RK is used as BCLK input */ + /* Note: won't work correctly on SAMA5D2 due to errata */ + rcmr |= SSC_BF(RCMR_START, fs_edge); + tcmr |= SSC_BF(TCMR_START, SSC_START_TX_RX); + } else { + rcmr |= SSC_BF(RCMR_START, fs_edge); + tcmr |= SSC_BF(TCMR_START, fs_edge); + } + } if (atmel_ssc_cbs(ssc_p)) { /*