Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1147260pxv; Fri, 9 Jul 2021 19:31:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcQIEfXEdVjUnHZpT/g1/GfeoLsdr/qQcloQg1feVF8HGiH/fFqrHdj/N584XIoPAoQrco X-Received: by 2002:a17:906:490b:: with SMTP id b11mr16433044ejq.185.1625884266459; Fri, 09 Jul 2021 19:31:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884266; cv=none; d=google.com; s=arc-20160816; b=HvRSQ3qeYbksPn+e6iJVWKIFL4QUN2FccSp5orQIIwHCGJKwE8lsNy/lmpq4K01ENy MjdY8p1IeifWs+n1RkZnMugZ+kPbs2chA0J/Vt24i4Fk+Q6qgOzkkdmTCHvKBO4i0mxK gwH4BMdj09aIjPZJsQ4uR3OpMlFPDHVaFq46dunCc36mGqo91gGKiA26e5xQpZtoaR3X Lq7oJDE82HhC9AdO6TXhx5S376ETiKfRw9zFmKN7WGNCLW2NnOODI39SCnmhNqHsyZSW 3x5jg1hS5QlxP7f0QlrGTjk/ThUqCTItHQddKF8M357JUkRM9TqovLwSEQc7wXifOFhL 7yEw== 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=4T2qXwncrYZ1R7UdbvCoXuhm6JifvfdL54A1IxeOhSk=; b=RHWedZI4CeA5FC9D6qChAVcR7fiTtoEloWSMr4OcC8m/TaUKwSbmsLaS7q/xY8VFRv Rr+c3F1bwhJ8YgjNN/+MOIx+nj5eESpbjAwCbReYXBG96ACIWyLlbvWkNGk3o+K4um6L b00vRqA8/0JYd5W4/Du6wmuRO5V0jL9+u8FU2+4DKhg7zK05/gTH3zxXco8ZyqGqejxj W5pxfHHcetCfv+EylZX8vkWs3KMEkesrQtHCZGG7NR2VUSbk/GTZuntG6yDjnOyD95Yf qkkssPIQXCXsN42Wzspn1jNOMzQCTsBilECE4SLWYwOTVSF+rztBkrN1sKvq0A/PSBhg CHxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=npI42d2t; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hv7si8511543ejc.379.2021.07.09.19.30.43; Fri, 09 Jul 2021 19:31:06 -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=@kernel.org header.s=k20201202 header.b=npI42d2t; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234114AbhGJCcf (ORCPT + 99 others); Fri, 9 Jul 2021 22:32:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:42484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234627AbhGJC3i (ORCPT ); Fri, 9 Jul 2021 22:29:38 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4CEF6613F0; Sat, 10 Jul 2021 02:26:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625884014; bh=Wc+8IUEWEbx56kg+jURITthTR5thKLxkWh0FSVlJrVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npI42d2tWdQ8PuIEKVQrxgnwUMeeePP9RpI5scXVPBIAtaUWjPzVHvDxQDFPt6jR0 FB6tTZ+fzS9OyymL6Ifbw+BAXfQS+fS14Lc9n8+GPvuULZio7OORYdwxCtrDlzD6sK 5oYYs+mP8aWN0CiVpWDvSRqf/rrptm/aVWShFuTeAIeoduwB2Q6BJrwl7ykyasjioR VDZjpmKiEcgUa8hbc8S/2LomMOQQrtM5Yz+aYhZ6CtwiL8w3M8hrzxZopU6OtIgFMx fOvypUnuSab1ZCHEuz2D9SG0e2Px4Ykyf0fhkuKAuyFutvZGoFe1FzhPutWxd8eN9c 7PXlwt6/DMxtw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Sakamoto , Takashi Iwai , Sasha Levin , alsa-devel@alsa-project.org Subject: [PATCH AUTOSEL 5.10 85/93] ALSA: firewire-motu: fix detection for S/PDIF source on optical interface in v2 protocol Date: Fri, 9 Jul 2021 22:24:19 -0400 Message-Id: <20210710022428.3169839-85-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022428.3169839-1-sashal@kernel.org> References: <20210710022428.3169839-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Sakamoto [ Upstream commit fa4db23233eb912234bdfb0b26a38be079c6b5ea ] The devices in protocol version 2 has a register with flag for IEC 60958 signal detection as source of sampling clock without discrimination between coaxial and optical interfaces. On the other hand, current implementation of driver manage to interpret type of signal on optical interface instead. This commit fixes the detection of optical/coaxial interface for S/PDIF signal. Signed-off-by: Takashi Sakamoto Link: https://lore.kernel.org/r/20210623075941.72562-2-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/firewire/motu/motu-protocol-v2.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/sound/firewire/motu/motu-protocol-v2.c b/sound/firewire/motu/motu-protocol-v2.c index e59e69ab1538..f0d478c5edc8 100644 --- a/sound/firewire/motu/motu-protocol-v2.c +++ b/sound/firewire/motu/motu-protocol-v2.c @@ -86,24 +86,23 @@ static int detect_clock_source_optical_model(struct snd_motu *motu, u32 data, *src = SND_MOTU_CLOCK_SOURCE_INTERNAL; break; case 1: + *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT; + break; + case 2: { __be32 reg; // To check the configuration of optical interface. - int err = snd_motu_transaction_read(motu, V2_IN_OUT_CONF_OFFSET, - ®, sizeof(reg)); + int err = snd_motu_transaction_read(motu, V2_IN_OUT_CONF_OFFSET, ®, sizeof(reg)); if (err < 0) return err; - if (be32_to_cpu(reg) & 0x00000200) + if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) == V2_OPT_IFACE_MODE_SPDIF) *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_OPT; else - *src = SND_MOTU_CLOCK_SOURCE_ADAT_ON_OPT; + *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; break; } - case 2: - *src = SND_MOTU_CLOCK_SOURCE_SPDIF_ON_COAX; - break; case 3: *src = SND_MOTU_CLOCK_SOURCE_SPH; break; -- 2.30.2