Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2932998iog; Mon, 20 Jun 2022 07:46:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v4Tf+2H71cp7aFAtnlu9Y7TaqXIdm4cS/1/0NBydTPHTXveApbsxVaGJdTVDyD5CNF6T97 X-Received: by 2002:a17:902:dace:b0:16a:3239:8dfb with SMTP id q14-20020a170902dace00b0016a32398dfbmr950876plx.11.1655736380925; Mon, 20 Jun 2022 07:46:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655736380; cv=none; d=google.com; s=arc-20160816; b=SWOuoXR/Pwzs35CKcYOggOqphKIQdW921E6GH9ZFIkjufbLzAkjg6Cw1L2GOy5sp+F r8EJVoZesm4WHWFqRYAGjHXxhVfO3WvFZQE6FauEHq8tZLqt8XuF2n0vUwEeH7bhX6Mb Tkoc4CcXHchDlQA2iBsFpyI5uLIXXx1j/DOtJcP1RUvLaBg93G8fJsKxfmjtGIYxthXV UjH56V+8vNmMRBXZ1kD3pXCDM5ShO7xYfGkIjm/8DPqE8C3DW3DbNsUD7W+gHvEMa8NF OfTzoDor3D3NQJcIm099QPpprAMwlGZoSdv6f3xCPFJ/wAlADEk8iRK28ZgGvByY5JCs mTXQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=YzrLjvj1Sjtl/e+BS0yMeesGzW5fWj5f7eIwQVf0f9U=; b=l/y1JZwucZRURjDjZW5ybnjPAbvlsSJ5FCHYdALKNxU9XJhEW2ugkm8bJb7WKhI/It lTWBVuHpv2WvoywLmWSkcSHU83WgaaqcV3iFaQoO3uubEQDtRLa5f0sUCGq2FIDmLazX 0rt0zhxo59LI7DEsjwZv4xtmia8WO2Eju1OYyR7c7RUJOXN3ajvE9XrJGphOoVAIT98J 8DCS/7xmCBBHq14Jo7neuR44a0wJ0npzJsVCdregVfV7Cc4AHJkUWIcGUT3pVj4MsEPI 0uz/vbszp2Pp1tLAIoSMMOHqq9Qh0c6f+BiquFAdYCYUHVdbl3CjDQHtGFgZyWEw0mP2 gzLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="m/ARWKSP"; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d22-20020a056a0024d600b0051c509444d8si18232541pfv.379.2022.06.20.07.46.08; Mon, 20 Jun 2022 07:46:20 -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=@linuxfoundation.org header.s=korg header.b="m/ARWKSP"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242868AbiFTMxh (ORCPT + 99 others); Mon, 20 Jun 2022 08:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241906AbiFTMxM (ORCPT ); Mon, 20 Jun 2022 08:53:12 -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 1A6BBDFC2; Mon, 20 Jun 2022 05:53:12 -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 AA174614CA; Mon, 20 Jun 2022 12:53:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B759EC3411C; Mon, 20 Jun 2022 12:53:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655729591; bh=2Z1+VyDmSP217IlxogHI6k4uHyug/J80iBfbbftIv3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=m/ARWKSPp5St//vX9o8yyuyPtIdbN1L/74a1h09IduMTVwIY3Q/Ilix5g15IurTfd gnraYrbu4BDCGUTiXblBJV3S4rQI1wZH1OH6fUM4q+EayAfS/aHHolUWIvBnwrk9C6 E4H+xor8EpEYQmUy0evjMzYEWRwp/Nrt2aX15JA0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, xliu , Brent Lu , Pierre-Louis Bossart , Mark Brown , Sasha Levin Subject: [PATCH 5.18 012/141] ASoC: Intel: cirrus-common: fix incorrect channel mapping Date: Mon, 20 Jun 2022 14:49:10 +0200 Message-Id: <20220620124729.882789615@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220620124729.509745706@linuxfoundation.org> References: <20220620124729.509745706@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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: xliu [ Upstream commit d69a155555c9d57463b788c400f6b452d976bacd ] The default mapping of ASPRX1 (DAC source) is slot 0. Change the slot mapping of right amplifiers (WR and TR) to slot 1 to receive right channel data. Also update the ACPI instance ID mapping according to HW configuration. Signed-off-by: xliu Signed-off-by: Brent Lu Acked-by: Pierre-Louis Bossart Link: https://lore.kernel.org/r/20220602051922.1232457-1-brent.lu@intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/intel/boards/sof_cirrus_common.c | 40 +++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/boards/sof_cirrus_common.c b/sound/soc/intel/boards/sof_cirrus_common.c index e71d74ec1b0b..f4192df962d6 100644 --- a/sound/soc/intel/boards/sof_cirrus_common.c +++ b/sound/soc/intel/boards/sof_cirrus_common.c @@ -54,22 +54,29 @@ static struct snd_soc_dai_link_component cs35l41_components[] = { }, }; +/* + * Mapping between ACPI instance id and speaker position. + * + * Four speakers: + * 0: Tweeter left, 1: Woofer left + * 2: Tweeter right, 3: Woofer right + */ static struct snd_soc_codec_conf cs35l41_codec_conf[] = { { .dlc = COMP_CODEC_CONF(CS35L41_DEV0_NAME), - .name_prefix = "WL", + .name_prefix = "TL", }, { .dlc = COMP_CODEC_CONF(CS35L41_DEV1_NAME), - .name_prefix = "WR", + .name_prefix = "WL", }, { .dlc = COMP_CODEC_CONF(CS35L41_DEV2_NAME), - .name_prefix = "TL", + .name_prefix = "TR", }, { .dlc = COMP_CODEC_CONF(CS35L41_DEV3_NAME), - .name_prefix = "TR", + .name_prefix = "WR", }, }; @@ -101,6 +108,21 @@ static int cs35l41_init(struct snd_soc_pcm_runtime *rtd) return ret; } +/* + * Channel map: + * + * TL/WL: ASPRX1 on slot 0, ASPRX2 on slot 1 (default) + * TR/WR: ASPRX1 on slot 1, ASPRX2 on slot 0 + */ +static const struct { + unsigned int rx[2]; +} cs35l41_channel_map[] = { + {.rx = {0, 1}}, /* TL */ + {.rx = {0, 1}}, /* WL */ + {.rx = {1, 0}}, /* TR */ + {.rx = {1, 0}}, /* WR */ +}; + static int cs35l41_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -134,6 +156,16 @@ static int cs35l41_hw_params(struct snd_pcm_substream *substream, ret); return ret; } + + /* setup channel map */ + ret = snd_soc_dai_set_channel_map(codec_dai, 0, NULL, + ARRAY_SIZE(cs35l41_channel_map[i].rx), + (unsigned int *)cs35l41_channel_map[i].rx); + if (ret < 0) { + dev_err(codec_dai->dev, "fail to set channel map, ret %d\n", + ret); + return ret; + } } return 0; -- 2.35.1