From patchwork Mon Sep 3 13:45:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 10585941 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4BBBB14E0 for ; Mon, 3 Sep 2018 13:45:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3BD3829813 for ; Mon, 3 Sep 2018 13:45:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F93C2982A; Mon, 3 Sep 2018 13:45:55 +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=-2.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A84829813 for ; Mon, 3 Sep 2018 13:45:54 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 5FBD72676C9; Mon, 3 Sep 2018 15:45:53 +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 7F84B26789B; Mon, 3 Sep 2018 15:45:51 +0200 (CEST) Received: from heliosphere.sirena.org.uk (heliosphere.sirena.org.uk [172.104.155.198]) by alsa0.perex.cz (Postfix) with ESMTP id 92BA32678CB for ; Mon, 3 Sep 2018 15:45:45 +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=navbP5hx5ttcVyHAMHh4vi7k3afiwck+FZh4qmRRkf0=; b=NGudbZnbYWQI TipZC75BqekIMncbZJcIa7jpi19VCTIQWXIGiMHeAkhj/A7skhBloSd4wa1AcRwHyAguRlCosXd9+ TELdWntCsFdqPBunjRDQtxB4bJZVKMrnwEdxHBqCKpGKLcvHcKWpCjcAzPSdzPrODD9DgGT4bOGEe deMfI=; Received: from cpc102320-sgyl38-2-0-cust46.18-2.cable.virginm.net ([82.37.168.47] helo=debutante.sirena.org.uk) by heliosphere.sirena.org.uk with esmtpa (Exim 4.89) (envelope-from ) id 1fwpAn-0000HN-EJ; Mon, 03 Sep 2018 13:45:45 +0000 Received: by debutante.sirena.org.uk (Postfix, from userid 1000) id 354BF11227AE; Mon, 3 Sep 2018 14:45:45 +0100 (BST) From: Mark Brown To: Jiada Wang In-Reply-To: <8736urf4ks.wl-kuninori.morimoto.gx@renesas.com> Message-Id: <20180903134545.354BF11227AE@debutante.sirena.org.uk> Date: Mon, 3 Sep 2018 14:45:45 +0100 (BST) Cc: Dragos Tarcatu , Timo Wischer , alsa-devel@alsa-project.org, Kuninori Morimoto , Mark Brown , Hiroyuki Yokoyama Subject: [alsa-devel] Applied "ASoC: rsnd: ssi: Check runtime channel number rather than hw_params" 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 X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: rsnd: ssi: Check runtime channel number rather than hw_params has been applied to the asoc tree at https://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 599da084e041b877ef89211dcbb4c7bd8380049d Mon Sep 17 00:00:00 2001 From: Jiada Wang Date: Mon, 3 Sep 2018 07:07:26 +0000 Subject: [PATCH] ASoC: rsnd: ssi: Check runtime channel number rather than hw_params The number of channel handled by SSI maybe differs from the one set in hw_params, currently SSI checks hw_params's channel number, and constrains to use same channel number, when it is being used by multiple clients. This patch corrects to check runtime channel number rather than channel number set in hw_params. Signed-off-by: Jiada Wang Signed-off-by: Timo Wischer [kuninori: adjust to upstreaming] Signed-off-by: Kuninori Morimoto Tested-by: Hiroyuki Yokoyama Signed-off-by: Mark Brown --- sound/soc/sh/rcar/ssi.c | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index 89cc433e2fc9..3f6dd9f07bc6 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -307,6 +307,11 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, return -EINVAL; } + if (ssi->chan != chan) { + dev_err(dev, "SSI parent/child should use same chan\n"); + return -EINVAL; + } + return 0; } @@ -334,6 +339,7 @@ static int rsnd_ssi_master_clk_start(struct rsnd_mod *mod, SCKD | SWSD | CKDV(idx); ssi->wsr = CONT; ssi->rate = rate; + ssi->chan = chan; dev_dbg(dev, "%s[%d] outputs %u Hz\n", rsnd_mod_name(mod), @@ -359,6 +365,7 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_mod *mod, ssi->cr_clk = 0; ssi->rate = 0; + ssi->chan = 0; rsnd_adg_ssi_clk_stop(mod); } @@ -511,9 +518,7 @@ static int rsnd_ssi_hw_params(struct rsnd_mod *mod, struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { - struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod); struct rsnd_dai *rdai = rsnd_io_to_rdai(io); - int chan = params_channels(params); unsigned int fmt_width = snd_pcm_format_width(params_format(params)); if (fmt_width > rdai->chan_width) { @@ -524,24 +529,6 @@ static int rsnd_ssi_hw_params(struct rsnd_mod *mod, return -EINVAL; } - /* - * snd_pcm_ops::hw_params will be called *before* - * snd_soc_dai_ops::trigger. Thus, ssi->usrcnt is 0 - * in 1st call. - */ - if (ssi->usrcnt) { - /* - * Already working. - * It will happen if SSI has parent/child connection. - * it is error if child <-> parent SSI uses - * different channels. - */ - if (ssi->chan != chan) - return -EIO; - } - - ssi->chan = chan; - return 0; }