From patchwork Sat Oct 21 10:31:50 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 116606 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2625655qgn; Sat, 21 Oct 2017 03:33:14 -0700 (PDT) X-Google-Smtp-Source: ABhQp+QHIe9s5Wmf2zwPhALkWaIa2jOzVWbmXgrkslAMAN6pKQPq8tHxjS+DI1KldQM0h9LeQvHK X-Received: by 10.223.187.131 with SMTP id q3mr3905200wrg.83.1508581994683; Sat, 21 Oct 2017 03:33:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508581994; cv=none; d=google.com; s=arc-20160816; b=bLyr+IbPEbW1NaeshZ1WStrO0Ww2lfjPwA+28+KhHKXWhwWxYZXeUWJDmfk734s63h 3DTpzUgxdJHF0czqEh0GxlBxsxtWoMX3xLRTLekXF7By4xadz1GOn7c41N0Z1FW2Obbo P5CFxLCTGWHHj7LSt+BXiPFmv0LcP8Vq5SKzdPkEWsYl8yXCD2FDW7izAPhajfFWkYTB /6Hm0NCfl1rFU1RGkw71SlIDYC4Pkbt32yV0BLpcXJXAto19czPHUk1riMneCj5elmdu pEzZSAn0cUgZBJomcbk9Q9a5XHCloXNaVDxTtwu7h7WnC/Xdtv0D+0COOuv5lSOqONKp PyKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:cc:date:message-id:in-reply-to:to:from :dkim-signature:delivered-to:arc-authentication-results; bh=fiA3icULSqUrhtKrq8ush/vR6KOZw2YMFvD1uvMe2u0=; b=qwt7CTFhaUD7jf8jZ/eyALRTkTcKcz9gdNJ2qyCoklEwhvyPthKUD7a0EOFEQLJC8W NHn4jq9u2Wds/YCkW5AwfFj50836VtHyIax8D8hS9WLX41MVx4rfS3mLWih0vkyR3ef/ 0V4ct+PF9Wrs5wO7K3n3tA4kjdcSqQM0+FVBhRbZm/T/MZU/roY3nBdUYG0fvCT3Jy8V gvc1A90b3IiLBHzrDBtGN1+WKWyMVALseCPMEJTrzwoEPPgYJ4z37SUQ3ovgd/PotcKx l+GuIFw6g/xTKXGNhkVzAZt8K80xLg+Z3NOiJGVg8waJOaV8ZuLM6+fT3MpwG1fpvm+i u+YQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=jlA6ppli; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Return-Path: Received: from alsa0.perex.cz (alsa0.perex.cz. [77.48.224.243]) by mx.google.com with ESMTP id x65si598981wmd.28.2017.10.21.03.33.14; Sat, 21 Oct 2017 03:33:14 -0700 (PDT) Received-SPF: pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) client-ip=77.48.224.243; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=jlA6ppli; spf=pass (google.com: domain of alsa-devel-bounces@alsa-project.org designates 77.48.224.243 as permitted sender) smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5F34526777E; Sat, 21 Oct 2017 12:32:42 +0200 (CEST) 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 AB52F267794; Sat, 21 Oct 2017 12:32:39 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, RP_MATCHES_RCVD, SPF_PASS autolearn=disabled version=3.4.0 Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 556A9267786 for ; Sat, 21 Oct 2017 12:31:52 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=Date:Message-Id:In-Reply-To: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References: List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner: List-Archive; bh=Gwf3r1h4iOGejeAPeeSlaS7JEsH6X35QxgTxVd2gn94=; b=jlA6ppliMXxd x2vOocBG+xqoqreAaiflwkA77Uoi8grpZbsqHL1CUI0790ef1bv7r6gQfDJ619nEh5wWkPVPxcmt3 XksHoGAEuApTfe3rccJ7+lp9p2IgFuFfDdyB23tFpZAnfxiyw+2oUH30YQuLU055epjDAQucG3Jf8 asK10=; Received: from 188.29.164.97.threembb.co.uk ([188.29.164.97] helo=finisterre.ee.mobilebroadband) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1e5r4J-0003vG-Jb; Sat, 21 Oct 2017 10:31:51 +0000 Received: by finisterre.ee.mobilebroadband (Postfix, from userid 1000) id C26EB440057; Sat, 21 Oct 2017 11:31:50 +0100 (BST) From: Mark Brown To: Olivier Moysan In-Reply-To: Message-Id: <20171021103150.C26EB440057@finisterre.ee.mobilebroadband> Date: Sat, 21 Oct 2017 11:31:50 +0100 (BST) Cc: alsa-devel@alsa-project.org, Mark Brown , olivier moysan Subject: [alsa-devel] Applied "ASoC: stm32: sai: Move static settings to DAI init" to the asoc tree 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: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org The patch ASoC: stm32: sai: Move static settings to DAI init has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark >From 61fb4ff70377cd2c49a3487bdb0156eba6930072 Mon Sep 17 00:00:00 2001 From: Olivier Moysan Date: Thu, 19 Oct 2017 15:03:18 +0200 Subject: [PATCH] ASoC: stm32: sai: Move static settings to DAI init Audio interface direction and protocol settings does not change at runtime. So, these settings are moved from hw_params function to dai_probe and set_fmt. Signed-off-by: olivier moysan Signed-off-by: Mark Brown --- sound/soc/stm/stm32_sai_sub.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) -- 2.14.1 _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index dde8ddf9e777..815ef1036199 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -308,12 +308,15 @@ static int stm32_sai_set_dai_tdm_slot(struct snd_soc_dai *cpu_dai, u32 tx_mask, static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) { struct stm32_sai_sub_data *sai = snd_soc_dai_get_drvdata(cpu_dai); - int cr1 = 0, frcr = 0; - int cr1_mask = 0, frcr_mask = 0; + int cr1, frcr = 0; + int cr1_mask, frcr_mask = 0; int ret; dev_dbg(cpu_dai->dev, "fmt %x\n", fmt); + cr1_mask = SAI_XCR1_PRTCFG_MASK; + cr1 = SAI_XCR1_PRTCFG_SET(SAI_FREE_PROTOCOL); + switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { /* SCK active high for all protocols */ case SND_SOC_DAIFMT_I2S: @@ -340,7 +343,7 @@ static int stm32_sai_set_dai_fmt(struct snd_soc_dai *cpu_dai, unsigned int fmt) return -EINVAL; } - cr1_mask |= SAI_XCR1_PRTCFG_MASK | SAI_XCR1_CKSTR; + cr1_mask |= SAI_XCR1_CKSTR; frcr_mask |= SAI_XFRCR_FSPOL | SAI_XFRCR_FSOFF | SAI_XFRCR_FSDEF; @@ -458,7 +461,7 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai, SAI_XCR2_FTH_SET(STM_SAI_FIFO_TH_HALF)); /* Mode, data format and channel config */ - cr1 = SAI_XCR1_PRTCFG_SET(SAI_FREE_PROTOCOL); + cr1_mask = SAI_XCR1_DS_MASK; switch (params_format(params)) { case SNDRV_PCM_FORMAT_S8: cr1 |= SAI_XCR1_DS_SET(SAI_DATASIZE_8); @@ -473,11 +476,6 @@ static int stm32_sai_set_config(struct snd_soc_dai *cpu_dai, dev_err(cpu_dai->dev, "Data format not supported"); return -EINVAL; } - cr1_mask = SAI_XCR1_DS_MASK | SAI_XCR1_PRTCFG_MASK; - - cr1_mask |= SAI_XCR1_RX_TX; - if (STM_SAI_IS_CAPTURE(sai)) - cr1 |= SAI_XCR1_RX_TX; cr1_mask |= SAI_XCR1_MONO; if ((sai->slots == 2) && (params_channels(params) == 1)) @@ -729,6 +727,7 @@ static void stm32_sai_shutdown(struct snd_pcm_substream *substream, static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) { struct stm32_sai_sub_data *sai = dev_get_drvdata(cpu_dai->dev); + int cr1 = 0, cr1_mask; sai->dma_params.addr = (dma_addr_t)(sai->phys_addr + STM_SAI_DR_REGX); /* @@ -745,7 +744,11 @@ static int stm32_sai_dai_probe(struct snd_soc_dai *cpu_dai) else snd_soc_dai_init_dma_data(cpu_dai, NULL, &sai->dma_params); - return 0; + cr1_mask = SAI_XCR1_RX_TX; + if (STM_SAI_IS_CAPTURE(sai)) + cr1 |= SAI_XCR1_RX_TX; + + return regmap_update_bits(sai->regmap, STM_SAI_CR1_REGX, cr1_mask, cr1); } static const struct snd_soc_dai_ops stm32_sai_pcm_dai_ops = {