From nobody Mon Sep 28 23:07:09 2026 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F9A834A3D6 for ; Sat, 15 Aug 2026 11:37:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786793835; cv=none; b=Pq3cQ55AyaZt1sFy/vjfGrEBK+WHixns6BLnxKGQm+xpoEGAsSy7KIbsVDOms37ZKAJC+itEioVTEHO4uy44B/oCp+sQiQOjbd4keE8jPxnSW1mXnCrUBOLp/8iIb7FYFPhOcs9FZ2omksdJ4I1PI6fwjt3cFGOpHJxY3Gh9SnA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786793835; c=relaxed/simple; bh=FOugWQtEBeJQzD8N2Sftusib1lLmHx31ieC3m5AMQ6c=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=MzfQF8wZdeYuag+uMvjqvy4LT5rXbc4RSzKc5ATIlpKrrSSKBNqd8Kmp9eZFQmkwIx6VEKU7k/4nz80K+zZt9l8CAT0oxbQPdogwjusxq6j3g5VSXp8gkcXu8Yod+KIDPm0oevJv6UHXcML3XUMSAOBMEAmmH+TWqrhXfOOkxkM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=XXVHEhgm; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="XXVHEhgm" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5b2b92065ffso1772014e87.1 for ; Sat, 15 Aug 2026 04:37:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1786793832; x=1787398632; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to :content-type; bh=V26MBOUuWr7mg1xevaQTApAYaUSfXN8eYj29b1TCTK0=; b=XXVHEhgmi8+ghgbtB0RMh6EVuLqRHK2vixxPXJtZ3pYxFz16uy1hQevI9FXmzU4F8h 7Hi8TuLTiiDCA5me+YaVkhOVWO4M9kQEvsrgu7s1MNkENHBLd5nT0pxgf957GzqsPKu1 uwSRBoW9x0Quz9ZisA9rgScBSzNfZQvXjCUIknb9HSxcT2NduTR8nGrU7+M15Wt+wiD2 l3wmAKkFU3lDnOtC4Thl7Va1v7q26nt7QxnoP8F2GfWzDaca9U3SIJIbI8kc5kaqv0qW KFDslPHVNJKzYV5nKiYjPaq/mmXrqyRIHWXDRWoyPK2rmECTvq5oGPP/G4MZfuIFUVdz K3EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786793832; x=1787398632; h=content-transfer-encoding:content-type:mime-version:message-id:date :subject:cc:to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to:content-type; bh=V26MBOUuWr7mg1xevaQTApAYaUSfXN8eYj29b1TCTK0=; b=goa4OFFD4EpjpEw3jRPfUzvhJfwTPm5I7QDViy6UVNkKNDqC6UpoE5Sf3hEsYEBPdV YKS7c9KLieElRQAnrnejgUM3Ml6I3V6pCRPmNSXYDfWcHHG52gHEsYIW6Bw4QdJQV7Mr v/4y/biFESHcmpCgcES1/skhVCRnI2Sx15hgbQ5AyRnhYRzTt/xtCbwFlIt1RxphlYJ9 XzWuTeipBADwqlKMh8WZimvTYTHJ6I/8OOV7/t9tswShllnxDoByTURf8Bl0h63eBHZi Dzuv5AMvtwx5gEbyedyd6MHpzJaQmbI02q8zPAFCSzA3v9DtGHVrS9Pykfs65grjC+pC r0lw== X-Forwarded-Encrypted: i=1; AHgh+RoVKOJoN0m0mSUstEkTxM16y8sMK2qirVlPCI0D/7xiHSToe5mK2S9K540T9wGLtlCrqZ7kw6NvW7ghd/A=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6mc6ptDIAurlM9q7ObADFGqDAU4KoJQlBA7/6+fdj2EIk98JB j68XhRFyGGzzaxjiuvwVS3CtFSA2tHA9Ld0jfZbcynZGMVyhqI4B5tlX X-Gm-Gg: AR+sD11ai+zsVAzjaEDK5dho3CDLpFqIqI8J51FU0jpZy6kSGm9IxKe3cgUQhIxfan+ /cvj/XiiZlTbuASjcv8lseYLhBuSFiHs28ic2UAsNDyg6ADvr/STU8f+1bsjKBCSKDMZUEf2ia3 ZHLlBn7m+tvCNeH+5V94lcdMg5AxA3aMB8TthhkYOVukdY5+ybN4WPi51WpGKwznRyymgnZAGB3 As6D+ObOXdiqPtuJMn8gqcURutDCXNX6WsvNjUhXPacjvmFw1BCCslGVebiXskShxeKYJFjSZy5 g9xEJQn0hx7RbdT+fYNlxlERnhaI+3wSsdNYc9beBEbj/67rSR4R0wnZmoo9GMnGMmXlCeI9ESa ASNKkcIpcp7W+3pr8VGJbBTTnzKzUHnqjLK9sEY6Wbw+OUiIRayPt0PUHnrfHwDVoNnOPNqAWmO N0uhgECf6PJKgthncmsmGsqn1yreCr1zK2l1rmbM6icEphjHAalt7jr2IuUMdcnwPJYb7aUJD1b mg1xNcAjpNxzC2pMQYWznI= X-Received: by 2002:a05:6512:1306:b0:5b2:a6e6:8d83 with SMTP id 2adb3069b0e04-5b461dfc275mr483051e87.23.1786793832285; Sat, 15 Aug 2026 04:37:12 -0700 (PDT) Received: from localhost (host-80-73-162-2.rev.as20985.net. [80.73.162.2]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5b458c09d2csm1084285e87.65.2026.08.15.04.37.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Aug 2026 04:37:12 -0700 (PDT) From: Andrey Golovko To: Shenghao Ding , Kevin Lu , Baojun Xu , Sen Wang , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai Cc: Antoine Monnet , Robin Everaars , Ville Saarinen , "Holalu Yogendra, Niranjan" , Pierre-Louis Bossart , Charles Keepax , Vijendar Mukunda , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: tas2783-sdw: split a stereo stream across the two mono amps Date: Sat, 15 Aug 2026 14:50:00 +0300 Message-ID: <20260815113000.4488-1-andrey.golovko@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Antoine Monnet A board with two TAS2783 aggregated on one link renders mono: the two amplifiers are mono parts that each carry one channel of the stereo stream, but snd_sdw_params_to_config() hands every codec the full channel mask for playback. The pair stays in mirror mode, both amps render the same channel, and the other channel is never reproduced. Claim a single channel per amplifier instead. The index comes from the machine-assigned component name prefix rather than the SoundWire unique_id, which is board-specific: soc_sdw_ti_amp.c names the amplifiers tas2783-1..4. The bit that is set does not choose the side. sdw_compute_slave_ports() advances the payload offset by hweight32(ch_mask) and never looks at which bit it is, so a one-channel mask fixes mono by defeating mirror mode, and left and right then follow the amplifier's position in the codec order of the DAI link. That was measured: inverting the two masks between the amplifiers does not move the audio. On the boards this has been run on the codec order matches the prefix numbering, so the sides come out as the machine driver names them, but the mapping is not an ABI promise the bus allocator could honour. Reported-by: Robin Everaars Closes: https://lore.kernel.org/all/20260805183517.8665-1-robineveraars@pm.= me/ Suggested-by: Robin Everaars Signed-off-by: Antoine Monnet Tested-by: Andrey Golovko Signed-off-by: Andrey Golovko --- sound/soc/codecs/tas2783-sdw.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/sound/soc/codecs/tas2783-sdw.c b/sound/soc/codecs/tas2783-sdw.c index caf8fe1bf4db..c0c59480064a 100644 --- a/sound/soc/codecs/tas2783-sdw.c +++ b/sound/soc/codecs/tas2783-sdw.c @@ -1001,6 +1001,31 @@ static s32 tas_sdw_hw_params(struct snd_pcm_substrea= m *substream, /* SoundWire specific configuration */ snd_sdw_params_to_config(substream, params, &stream_config, &port_config); + + /* + * The two mono amps each render one channel of the stereo stream: + * snd_sdw_params_to_config() hands every codec the full mask for + * playback, which leaves the pair in mirror mode and one channel + * unreproduced. Claim a single channel instead, keyed off the + * machine-assigned component prefix rather than the SoundWire + * address, which is board-specific: soc_sdw_ti_amp.c names the amps + * tas2783-1..4. + * + * Which side an amp then renders does not follow from the bit that + * is set - sdw_compute_slave_ports() advances the payload offset by + * the popcount of ch_mask and never looks at which bit it is - but + * from the amp's position in the codec order of the DAI link, which + * on these boards matches the prefix numbering. + */ + if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK && + params_channels(params) =3D=3D 2 && component->name_prefix) { + const char *idx_str =3D strrchr(component->name_prefix, '-'); + unsigned long idx; + + if (idx_str && !kstrtoul(idx_str + 1, 10, &idx) && idx) + port_config.ch_mask =3D (idx & 1) ? BIT(0) : BIT(1); + } + /* port 1 for playback */ if (substream->stream =3D=3D SNDRV_PCM_STREAM_PLAYBACK) port_config.num =3D 1; base-commit: 0c7aeb0f5eceb95b5887bd8e83fef865e5a49a13 --=20 2.53.0