Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp3757728pxt; Tue, 10 Aug 2021 10:36:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGvyPAJIhMP3QhKrqrpVyy5fVr6lG4fIW5kVMDBLBOCdmMd1SvtmW1Kfg0aDXmXYvbNbOC X-Received: by 2002:a05:6402:35c7:: with SMTP id z7mr6154173edc.85.1628617014981; Tue, 10 Aug 2021 10:36:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628617014; cv=none; d=google.com; s=arc-20160816; b=TAND0tw1Ouj98t0paJJ3StJ+GSRM3BsvyW3NxzQPuSOJwKvfS/h5Z8qJZIoi04xfpo jGTmDSDfDu+RXics8Y8eiC1tMydE5NwxxTeQqnwUtO2KZxde9/OfwMh5jxr1oATYbJMN PIfuwp0nMrCAqC4+O0vPR8eyjs8m85UI132jvBeHmNfFD44DQ+s2KGlMJoYOvR5hR5Xx SO9eNBGhQJE+jkYQtNGhkhz1WDDRv5Fo07W03yfV2H8JeS5iB6Zf3yLWgFrmNFMQfZLE L9V2zLxvrT4al3VUJOKSd2+5xHNU8AlczBv3FXNKa9eKlyleF50SRiCoE7m0ZcBQBfdZ oPhA== 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=TnZgpqAhFtg+NqMhnn9kYP0vnBrNyrbkHFiG8A547E4=; b=D5mhXg6K0TGoyxyTmaxoMhUJb5zumQeEJdxFjjb9fYNFabihxsIosnFiX2jq3Pa6IQ mP46hJ5D4ARAL4ouHYO83PuQHOtu61lj908klk49zQal3VuxsH6VBUwQHCxnr2crvdEz HSA6j6gUQjRSFEnCOTVVqRnIN5Q87besx9Uw9aEusin6izDN9jg6RnoyPkDywU5tBdk0 HBDGzrLfbdJvYp3D9U7vE8+AzJLPPWmy0dIUwAjwxCbD9T7ErXkYFFXyoRy/fB4E3B2q rSh620CB+Del4XPioo35cJ7CGniFzyPYW+UGW+GySCSYV0ZgT1g2h7UnKF5+gChHaUnZ mpKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="LNCOF/KB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b2si10215867edy.436.2021.08.10.10.36.31; Tue, 10 Aug 2021 10:36:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="LNCOF/KB"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232696AbhHJReT (ORCPT + 99 others); Tue, 10 Aug 2021 13:34:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:33850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232684AbhHJRdd (ORCPT ); Tue, 10 Aug 2021 13:33:33 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D5F5F60E09; Tue, 10 Aug 2021 17:33:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1628616791; bh=c5QJr91Cq9hegu54/BXqVv6t7dfayG9sHQMZGabEY/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LNCOF/KBLlub4zupFQ7g4cPw4MtNDWVhWtIVE5eHarHMphtCWvZ/SFieqAbWJDNgA 39pdoWm+ckbkvVkNv2l0rJWqBuzMygvSPIqwTXJQTm1sH+ZAG1YNvloZfymAKmimMK A5JzXWmFjtpJweKnhi9gL+qNkd8MfeLPgZMqRnLQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "chihhao.chen" , Takashi Iwai , Sasha Levin Subject: [PATCH 4.19 05/54] ALSA: usb-audio: fix incorrect clock source setting Date: Tue, 10 Aug 2021 19:29:59 +0200 Message-Id: <20210810172944.361060265@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210810172944.179901509@linuxfoundation.org> References: <20210810172944.179901509@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: chihhao.chen [ Upstream commit 4511781f95da0a3b2bad34f3f5e3967e80cd2d18 ] The following scenario describes an echo test for Samsung USBC Headset (AKG) with VID/PID (0x04e8/0xa051). We first start a capture stream(USB IN transfer) in 96Khz/24bit/1ch mode. In clock find source function, we get value 0x2 for clock selector and 0x1 for clock source. Kernel-4.14 behavior Since clock source is valid so clock selector was not set again. We pass through this function and start a playback stream(USB OUT transfer) in 48Khz/32bit/2ch mode. This time we get value 0x1 for clock selector and 0x1 for clock source. Finally clock id with this setting is 0x9. Kernel-5.10 behavior Clock selector was always set one more time even it is valid. When we start a playback stream, we will get 0x2 for clock selector and 0x1 for clock source. In this case clock id becomes 0xA. This is an incorrect clock source setting and results in severe noises. We see wrong data rate in USB IN transfer. (From 288 bytes/ms becomes 144 bytes/ms) It should keep in 288 bytes/ms. This earphone works fine on older kernel version load because this is a newly-added behavior. Fixes: d2e8f641257d ("ALSA: usb-audio: Explicitly set up the clock selector") Signed-off-by: chihhao.chen Link: https://lore.kernel.org/r/1627100621-19225-1-git-send-email-chihhao.chen@mediatek.com Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/usb/clock.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sound/usb/clock.c b/sound/usb/clock.c index 863ac42076e5..d1455fb2c6fc 100644 --- a/sound/usb/clock.c +++ b/sound/usb/clock.c @@ -296,6 +296,12 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip, selector->baCSourceID[ret - 1], visited, validate); if (ret > 0) { + /* + * For Samsung USBC Headset (AKG), setting clock selector again + * will result in incorrect default clock setting problems + */ + if (chip->usb_id == USB_ID(0x04e8, 0xa051)) + return ret; err = uac_clock_selector_set_val(chip, entity_id, cur); if (err < 0) return err; -- 2.30.2