Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5302723ioo; Wed, 1 Jun 2022 02:41:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx3ws4hoz/HNCddxooqt7prMGTuNFnm2OY/KDGIbrl3TNDtpQn6N6TmBpjwa6dQU+TOZqS4 X-Received: by 2002:a17:903:2d0:b0:14d:8a8d:cb1 with SMTP id s16-20020a17090302d000b0014d8a8d0cb1mr65115446plk.50.1654076471286; Wed, 01 Jun 2022 02:41:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654076471; cv=none; d=google.com; s=arc-20160816; b=NLKUq6dP62X7/GfPziZeGh0nzXcERSgQBPKYtdj1rWsJuSBlkpRJgCaCg2Iqy9uV+Y H+MThe1ZVNC5bQTOiB4KbFyLnmbXb+XR9Mxi2IebpfoRjxK6+KM1bYtvjlNTmtfUo5vk exLNYMH3uyGZjmtJ/WSMxu8tq3HSvwKW66f2M5G8r6N6v/PMg492HYvYNy6OYCUjdYvd ZMS1ybRJkbzCsh+SFv29udRDpRmQ4ZX1srJcBajha7i4sU+gDS9wCgy8//3cWOIm46ZX fUqaYxBHTS+BvLsdrznWkzvwJcuuRo0y43Gxcn2frFY1zJgK+9qXl05+3BeGP77OrBL8 tzzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=amG3Jyi9N6/lsuPnpuAW9fBsxTalMyD68zPGubLJXnM=; b=jez5dz9K+avAqBVEfaVAFgQpp6iT/GKOMhalO7DuQi0vikhDERrF8DEccLCqyv0Zzk u8OxVEFjWh5HDrOmHKuRQMuOX6C7qIvsrkvw9+xCG9XyhQIvdFDqvzjVGaBVUdh4m0kL +PjnYe9l3URZ828UZQgA72g9MAYJIaExkYfsTabOg4uHSyhUGafG9poIxvyFMl9v6aBn 0sNwSjKjBqL6V3PlfijVe9taHlRhGcf48DaDD6Zo8peAkSYF25zJKSsTgHQV6JcDPYsj DwtkIv2xEbRg/epTYwJ49UXa2MGgvJCZSEwYOui2FiufTUuda0Sa0KMYqldY3lxuXRC0 rsKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GRzKRmig; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n13-20020a170903110d00b001586190b7c1si2088540plh.528.2022.06.01.02.40.58; Wed, 01 Jun 2022 02:41:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GRzKRmig; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242619AbiE3ObY (ORCPT + 99 others); Mon, 30 May 2022 10:31:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241922AbiE3OSL (ORCPT ); Mon, 30 May 2022 10:18:11 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA14A9CF02; Mon, 30 May 2022 06:48:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 842C86103D; Mon, 30 May 2022 13:48:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1AC3C341C0; Mon, 30 May 2022 13:48:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1653918507; bh=iDmtIbiCibEJV3q/3pm/u+kHThmsdq8O7eZM/tAXpic=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GRzKRmigijbq4qN6ajskuUmvkh7qtFcbYJGEy+8qvvFpjzVtmGzBaTIOxH3wzraHX nBy8oZPpTbGjgnbfLxJ9aJKP/T1hOzJKretMzOWco/yVRlup0ltHQS4flvzlqWHK4z rcvnFX5rBd2vW/Yi5DG33gz4mR09yJ63sNuYBY7W0ivvM0isBeaBVDWrp1ic2b1+TO b1NU5LVNP4LidTikIag66QvY89ccJ+y1/liYfMblbNemKAjW/N5Ay8a22ntNc9k6Ih ZzS0ZGNkMAUPITEObGZxc5M4X2TaMCwN4ee0FMHRtHLCVO/LGVeLTWLI0n1/DkWW0E Qf6jWeV92cWrg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Charles Keepax , Mark Brown , Sasha Levin , steven.eckhoff.opensource@gmail.com, lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.4 33/55] ASoC: tscs454: Add endianness flag in snd_soc_component_driver Date: Mon, 30 May 2022 09:46:39 -0400 Message-Id: <20220530134701.1935933-33-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220530134701.1935933-1-sashal@kernel.org> References: <20220530134701.1935933-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Charles Keepax [ Upstream commit ff69ec96b87dccb3a29edef8cec5d4fefbbc2055 ] The endianness flag is used on the CODEC side to specify an ambivalence to endian, typically because it is lost over the hardware link. This device receives audio over an I2S DAI and as such should have endianness applied. A fixup is also required to use the width directly rather than relying on the format in hw_params, now both little and big endian would be supported. It is worth noting this changes the behaviour of S24_LE to use a word length of 24 rather than 32. This would appear to be a correction since the fact S24_LE is stored as 32 bits should not be presented over the bus. Signed-off-by: Charles Keepax Link: https://lore.kernel.org/r/20220504170905.332415-26-ckeepax@opensource.cirrus.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/codecs/tscs454.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sound/soc/codecs/tscs454.c b/sound/soc/codecs/tscs454.c index c3587af9985c..3d981441b8d1 100644 --- a/sound/soc/codecs/tscs454.c +++ b/sound/soc/codecs/tscs454.c @@ -3128,18 +3128,17 @@ static int set_aif_sample_format(struct snd_soc_component *component, unsigned int width; int ret; - switch (format) { - case SNDRV_PCM_FORMAT_S16_LE: + switch (snd_pcm_format_width(format)) { + case 16: width = FV_WL_16; break; - case SNDRV_PCM_FORMAT_S20_3LE: + case 20: width = FV_WL_20; break; - case SNDRV_PCM_FORMAT_S24_3LE: + case 24: width = FV_WL_24; break; - case SNDRV_PCM_FORMAT_S24_LE: - case SNDRV_PCM_FORMAT_S32_LE: + case 32: width = FV_WL_32; break; default: @@ -3337,6 +3336,7 @@ static const struct snd_soc_component_driver soc_component_dev_tscs454 = { .num_dapm_routes = ARRAY_SIZE(tscs454_intercon), .controls = tscs454_snd_controls, .num_controls = ARRAY_SIZE(tscs454_snd_controls), + .endianness = 1, }; #define TSCS454_RATES SNDRV_PCM_RATE_8000_96000 -- 2.35.1