From patchwork Wed Nov 8 15:47:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 118288 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5448621qgn; Wed, 8 Nov 2017 07:47:26 -0800 (PST) X-Google-Smtp-Source: ABhQp+SIzDc9dYkQCUkm8hfvXiHtVwusU/Hee6HsvVb4EwVcEodq7GiAn4J9G7KR+rs0NC6TTwbG X-Received: by 10.98.237.5 with SMTP id u5mr921684pfh.209.1510156046873; Wed, 08 Nov 2017 07:47:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510156046; cv=none; d=google.com; s=arc-20160816; b=YH27M4jb5ssFn+5myW4zUq1KmuIS4tfhx/aYSPNEofMedOwinrMOWPjpeokY0JuAdK uOgsvbJ/jlX8foez3yDraflOQpce1mjJdA/zPt0bb4dEQOJH/envc1Vm4yqC7fkwwgKb xcjeZBP+/N5+3uuciz3mhLl3WaHXPI6BUEKS1U03q09BHNACExzhiv9Vess5PUnZSD/7 bZHlTtP52R3qW6VgCZwGrFE28xlH+n251oZyNaNISQ5O2jhT+rpViGl5iH8+tKkvSflj 3+FAiIuV+18YsII5y3b/zX1/sIAjXzHd22DWsfVEF00Hy6KJOsFSuRTxcKYNMg2yZ7vi TGYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=FfGhoLTskpKqE6sbI8l06Xfrd5MOA4ZwGPVlR4/6RT0=; b=v6CWrRf65lgMYZyfLeS+YqoACVMRz82L64Emw3xLoURZ+X8Z7aL1zVRTamXJ2O515y 2TirJQO8a6o9BgOrycCcVUXFJBaoxBvCK6J0NCANO6aDzG7nky/9mfzyNRFzpOB5DyRH FN4iy+YvN3abwhkxKHfQ8Dru46JBSbPYnAkYimZ93p8aEFSk01uPensP7NvgNedcG/ie I/PPchapPX3zcoTUf2WUE7pFow1rAz+y3GkEdoA3imAaZhQ1dmlyCJkkselLMK3eNZS6 Of7A2Q0S6yhM3PD8D5eioz2NXH0mcVTjI1r1rIC2V6izZcDvX950mTzF/ZguW/YmbDrk BHZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m6si4025896pgu.691.2017.11.08.07.47.26; Wed, 08 Nov 2017 07:47:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752690AbdKHPrX (ORCPT + 9 others); Wed, 8 Nov 2017 10:47:23 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:44582 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752491AbdKHPrU (ORCPT ); Wed, 8 Nov 2017 10:47:20 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 70D23208C0; Wed, 8 Nov 2017 16:47:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 472092068C; Wed, 8 Nov 2017 16:47:18 +0100 (CET) From: Maxime Ripard To: broonie@kernel.org, lgirdwood@gmail.com, Chen-Yu Tsai , Maxime Ripard Cc: Mylene Josserand , linux-arm-kernel@lists.infradead.org, alsa-devel@alsa-project.org, Thomas Petazzoni , codekipper@gmail.com, stable@vger.kernel.org Subject: [PATCH 1/3] ASoC: sun8i-codec: Invert Master / Slave condition Date: Wed, 8 Nov 2017 16:47:08 +0100 Message-Id: <20171108154710.16407-2-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171108154710.16407-1-maxime.ripard@free-electrons.com> References: <20171108154710.16407-1-maxime.ripard@free-electrons.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The current code had the condition backward when checking if the codec should be running in slave or master mode. Fix it, and make the comment a bit more readable. Fixes: 36c684936fae ("ASoC: Add sun8i digital audio codec") Cc: Signed-off-by: Maxime Ripard --- sound/soc/sunxi/sun8i-codec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.14.3 Reviewed-by: Chen-Yu Tsai diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c index abfb710df7cb..038107baf414 100644 --- a/sound/soc/sunxi/sun8i-codec.c +++ b/sound/soc/sunxi/sun8i-codec.c @@ -170,11 +170,11 @@ static int sun8i_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) /* clock masters */ switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { - case SND_SOC_DAIFMT_CBS_CFS: /* DAI Slave */ - value = 0x0; /* Codec Master */ + case SND_SOC_DAIFMT_CBS_CFS: /* Codec slave, DAI master */ + value = 0x1; break; - case SND_SOC_DAIFMT_CBM_CFM: /* DAI Master */ - value = 0x1; /* Codec Slave */ + case SND_SOC_DAIFMT_CBM_CFM: /* Codec Master, DAI slave */ + value = 0x0; break; default: return -EINVAL; From patchwork Wed Nov 8 15:47:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 118285 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5448605qgn; Wed, 8 Nov 2017 07:47:26 -0800 (PST) X-Google-Smtp-Source: ABhQp+TddvqHFein4w+QB7wZvrXuTGJWmtC53A60q2zZntxNktJrYqg5erTQPuo9f4Y7XkZ6bf75 X-Received: by 10.101.100.24 with SMTP id a24mr900775pgv.316.1510156046279; Wed, 08 Nov 2017 07:47:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510156046; cv=none; d=google.com; s=arc-20160816; b=1DKDjjwOD67tokFMe1Zqwtijk1JzPa6jVXDSKz7nim3jADw3ibmjn7GOl9kRJFu2RB tz0rciMiiSMkZMrfig/1W5wdjDy+OZMcNobxUbZQfBU8qbVGC9D7uijdGoDbBIP+of/+ UnnrinAMNlvp4CSqXqq6Clgm2p6UZyE0qKFRSKOf6+JJT8SFpokhTGWSQoUe5708CtmN 26lfv8e4ByfBoGKt1wYDfa51a0cI6vANRUGZTJTicIECGIVvt3g8cU14n/T1tZ9dXex4 1GDYoI8qZhXE48/iKg1CI0tHOocMnlT9KxkNiignN7cexQyLD4aGt7yz2eo5r173At7t xUUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=tO3aKou+3UZ5gXuM0NtVRJsCUhGBKMKpQxE88gb3rFw=; b=sMx5lr1EpIYn6iorE4iUeizoINvJwGRl6eNw+LgGAnL1SQeL0ZoulK9AMcGjFFIPtp 9CZSxa7oHQtoWyrpoGFB7VvcHLgxgLpZUg5TAOmtpHYXtnF/kb6lmOfaaVCLqSc8zds7 LfktvBOZB0sxFdSWdhrZF+T5KBE+YiWwZYem2PC2809TMotv7ce1zNIqyEPe49h7DOlQ PNfWGl1gsUlB9RoD9/PyOeVH6/fgu/MxU7y8pLqD/8sef8H/o3f+LMgTl9gDDpTuRYB0 HZh3OUITjyP0yf7bxXsvghQk+bxDMGY648AGAV9/upKskZ7i5WmO5YPDgUQOSoVOh5A+ +Flg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m6si4025896pgu.691.2017.11.08.07.47.24; Wed, 08 Nov 2017 07:47:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752692AbdKHPrX (ORCPT + 9 others); Wed, 8 Nov 2017 10:47:23 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:44589 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752690AbdKHPrU (ORCPT ); Wed, 8 Nov 2017 10:47:20 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id D14FC208CF; Wed, 8 Nov 2017 16:47:18 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id A68C62068C; Wed, 8 Nov 2017 16:47:18 +0100 (CET) From: Maxime Ripard To: broonie@kernel.org, lgirdwood@gmail.com, Chen-Yu Tsai , Maxime Ripard Cc: Mylene Josserand , linux-arm-kernel@lists.infradead.org, alsa-devel@alsa-project.org, Thomas Petazzoni , codekipper@gmail.com, stable@vger.kernel.org Subject: [PATCH 2/3] ASoC: sun8i-codec: Set the BCLK divider Date: Wed, 8 Nov 2017 16:47:09 +0100 Message-Id: <20171108154710.16407-3-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171108154710.16407-1-maxime.ripard@free-electrons.com> References: <20171108154710.16407-1-maxime.ripard@free-electrons.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org While the current code was reporting to be able to work in master mode, it failed to do so because the BCLK divider wasn't programmed, meaning that the BCLK would run at the PLL's frequency no matter the sample rate. It was obviously a bit too fast. Add support to retrieve the divider to use, and set it. Since our PLL is not always able to generate a perfect multiple of the sample rate, we'll have to choose the closest divider that matches our setup. Fixes: 36c684936fae ("ASoC: Add sun8i digital audio codec") Cc: Signed-off-by: Maxime Ripard --- sound/soc/sunxi/sun8i-codec.c | 53 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) -- 2.14.3 Reviewed-by: Chen-Yu Tsai diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c index 038107baf414..522546e6b153 100644 --- a/sound/soc/sunxi/sun8i-codec.c +++ b/sound/soc/sunxi/sun8i-codec.c @@ -73,6 +73,7 @@ #define SUN8I_SYS_SR_CTRL_AIF2_FS_MASK GENMASK(11, 8) #define SUN8I_AIF1CLK_CTRL_AIF1_WORD_SIZ_MASK GENMASK(5, 4) #define SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_MASK GENMASK(8, 6) +#define SUN8I_AIF1CLK_CTRL_AIF1_BCLK_DIV_MASK GENMASK(12, 9) struct sun8i_codec { struct device *dev; @@ -226,12 +227,57 @@ static int sun8i_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) return 0; } +struct sun8i_codec_clk_div { + u8 div; + u8 val; +}; + +static const struct sun8i_codec_clk_div sun8i_codec_bclk_div[] = { + { .div = 1, .val = 0 }, + { .div = 2, .val = 1 }, + { .div = 4, .val = 2 }, + { .div = 6, .val = 3 }, + { .div = 8, .val = 4 }, + { .div = 12, .val = 5 }, + { .div = 16, .val = 6 }, + { .div = 24, .val = 7 }, + { .div = 32, .val = 8 }, + { .div = 48, .val = 9 }, + { .div = 64, .val = 10 }, + { .div = 96, .val = 11 }, + { .div = 128, .val = 12 }, + { .div = 192, .val = 13 }, +}; + +static u8 sun8i_codec_get_bclk_div(struct sun8i_codec *scodec, + unsigned int rate, + unsigned int word_size) +{ + unsigned long clk_rate = clk_get_rate(scodec->clk_module); + unsigned int div = clk_rate / rate / word_size / 2; + unsigned int best_val = 0, best_diff = ~0; + int i; + + for (i = 0; i < ARRAY_SIZE(sun8i_codec_bclk_div); i++) { + const struct sun8i_codec_clk_div *bdiv = &sun8i_codec_bclk_div[i]; + unsigned int diff = abs(bdiv->div - div); + + if (diff < best_diff) { + best_diff = diff; + best_val = bdiv->val; + } + } + + return best_val; +} + static int sun8i_codec_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) { struct sun8i_codec *scodec = snd_soc_codec_get_drvdata(dai->codec); int sample_rate; + u8 bclk_div; /* * The CPU DAI handles only a sample of 16 bits. Configure the @@ -241,6 +287,13 @@ static int sun8i_codec_hw_params(struct snd_pcm_substream *substream, SUN8I_AIF1CLK_CTRL_AIF1_WORD_SIZ_MASK, SUN8I_AIF1CLK_CTRL_AIF1_WORD_SIZ_16); + bclk_div = sun8i_codec_get_bclk_div(scodec, params_rate(params), + params_width(params)); + + regmap_update_bits(scodec->regmap, SUN8I_AIF1CLK_CTRL, + SUN8I_AIF1CLK_CTRL_AIF1_BCLK_DIV_MASK, + bclk_div << SUN8I_AIF1CLK_CTRL_AIF1_BCLK_DIV); + regmap_update_bits(scodec->regmap, SUN8I_AIF1CLK_CTRL, SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_MASK, SUN8I_AIF1CLK_CTRL_AIF1_LRCK_DIV_16); From patchwork Wed Nov 8 15:47:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 118287 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp5448614qgn; Wed, 8 Nov 2017 07:47:26 -0800 (PST) X-Google-Smtp-Source: ABhQp+QxhCngkOR8yW51i1qiHHmcigs67FGKRVMDRSeKVG0cBmF5kOiVKf7L/DwvPSAgGye72Rk5 X-Received: by 10.159.206.198 with SMTP id x6mr829842plo.35.1510156046572; Wed, 08 Nov 2017 07:47:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510156046; cv=none; d=google.com; s=arc-20160816; b=t4kvnbtp6KtWoHqQFI622KOSrB+IyQehyao42CCQWtBb2S4xiV6uRVuRFUQE8QMVE2 mkR3tLB7fHdDwOc73Jrf1BpyhKw5VUU+AyGQVSJ1uONQjVD/a4WRYWfHK4yY3bGP3cnd gZttL6Pmy1F8oCmL5Z2BJzIfw50KdAFSjLQAipIzdxv5dj6+bLsthUPLtELsNrKxp8W+ mGcuDhPa5BDQDKJdFl2t/BVblXTOoUWl+s17iroesB4DsKnrO0lAQ+ZOvIAr48Dxm+ch QwZm4XKi+fwB7Qn9ppgyOYAX7ovoDgswgEBBtyYIxIt3aqQyijQckyaXsfcv9gQwNzI7 KD1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=v4s1V47oUom5Ib0qwDPvGxsiB5A6prDgJiVFt4v/JLI=; b=wiWeleCWTSGgNoszvDvUBsCRe5Wk2sjZzUbzVpmovvTg8Mt/SXnFGkBc6NINd13F7O UsjemQLLBrOSJSUT2lJMXgSAY0cU0bdt7tEo0IPburFyS4fRmrmTJbBmu4lCDaNTLEAi ww2J++YL/JIj1z098D7vnnQX1pAJJEQqpmCfr9/qONOXOZHJOfb8+LQrqMWYBU+AQ42O KIWDz5f32WPGL6MDqNMsAmgphBxKANYkJI0RN4U3Yrx9n1nD8VVpTTFkK8Jo0e243Sf8 qt8UqvwYyxTzvTyqIE+c6nLmw8vkQ4Ad2QrFpOFrdoXwTjdVLopx3eZNwmbYSmbJKj4e SmcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m6si4025896pgu.691.2017.11.08.07.47.26; Wed, 08 Nov 2017 07:47:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752693AbdKHPrW (ORCPT + 9 others); Wed, 8 Nov 2017 10:47:22 -0500 Received: from mail.free-electrons.com ([62.4.15.54]:44596 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752692AbdKHPrV (ORCPT ); Wed, 8 Nov 2017 10:47:21 -0500 Received: by mail.free-electrons.com (Postfix, from userid 110) id 2AAC720955; Wed, 8 Nov 2017 16:47:19 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 02E2C2068C; Wed, 8 Nov 2017 16:47:18 +0100 (CET) From: Maxime Ripard To: broonie@kernel.org, lgirdwood@gmail.com, Chen-Yu Tsai , Maxime Ripard Cc: Mylene Josserand , linux-arm-kernel@lists.infradead.org, alsa-devel@alsa-project.org, Thomas Petazzoni , codekipper@gmail.com, stable@vger.kernel.org Subject: [PATCH 3/3] ASoC: sun8i-codec: Fix left and right channels inversion Date: Wed, 8 Nov 2017 16:47:10 +0100 Message-Id: <20171108154710.16407-4-maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171108154710.16407-1-maxime.ripard@free-electrons.com> References: <20171108154710.16407-1-maxime.ripard@free-electrons.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Since its introduction, the codec had an inversion of the left and right channels. It turned out to be pretty simple as it appears that the codec doesn't have the same polarity on the LRCK signal than the I2S block. Fix this by inverting our bit value for the LRCK inversion. Fixes: 36c684936fae ("ASoC: Add sun8i digital audio codec") Cc: Signed-off-by: Maxime Ripard --- sound/soc/sunxi/sun8i-codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.14.3 Reviewed-by: Chen-Yu Tsai diff --git a/sound/soc/sunxi/sun8i-codec.c b/sound/soc/sunxi/sun8i-codec.c index 522546e6b153..c8dcb1502d74 100644 --- a/sound/soc/sunxi/sun8i-codec.c +++ b/sound/soc/sunxi/sun8i-codec.c @@ -200,7 +200,7 @@ static int sun8i_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) value << SUN8I_AIF1CLK_CTRL_AIF1_BCLK_INV); regmap_update_bits(scodec->regmap, SUN8I_AIF1CLK_CTRL, BIT(SUN8I_AIF1CLK_CTRL_AIF1_LRCK_INV), - value << SUN8I_AIF1CLK_CTRL_AIF1_LRCK_INV); + !value << SUN8I_AIF1CLK_CTRL_AIF1_LRCK_INV); /* DAI format */ switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {