Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp1146879pxv; Fri, 9 Jul 2021 19:30:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYe6CaalfF8UFmrdGxOOSx3RBm1Ppve8CJTTAZkcwBF/dq8FB67+EX7J7PGoJmz6szFJ1B X-Received: by 2002:a17:907:9622:: with SMTP id gb34mr40875659ejc.401.1625884221879; Fri, 09 Jul 2021 19:30:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625884221; cv=none; d=google.com; s=arc-20160816; b=G4x4+u9m2LdF9wo7K9uAuwvEG/t6IfUabeshw6/F7eP6wF41A7HmRLSXgNyABKqBeq ZbI3jk5hRF3zr7xX5JJC8Y2Of/CXssG72e+BDlC7JwdWJy+OBM3PvDOkCkIOp4Nj4SHZ 07sIi3NYFOCyMYxWnkSbK5pfei9Tr7Mtx5SxE0MLdVwZ6wjb0wiD34ErjiE9iW/iAple JVsMLLFBNk9nLme1k4ObixQM7GEfZOrOMIFeprOs+fa0Qd1pVPkldy6Lqgy30VOePnOr XflqPso7a+uJvzDUD4/0HeQC1Sqy6qg/JoezxpWxXVMTufkEyaEgJKhbdVkV3vaQFrq5 ujrA== 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=WwSQDkUeJaACnW9MJP3SfjrNc3nQbuV7roOzVRTG0qBojtXEFdwo62M11vl9VjTc43 /npVMBengRS9ashPlzzr+dqhSXMyOSvwG4uw42vbVrSI0r9njcxI35dgqiAOphzt1/dl nVw8XZazW17v3WgRrfqqL6VUChCvy7beS8SsNwyn6AOaIJfsHns5NlJc4voSOQUMTERT 4RaC5a68HYin8a++gBLYID7LRerbQCXnzDxM0Ke8FpaZRQXQMCbWrDZic0EBUL7Ryi00 TR8BuunACRqvoII6xu1p5SkLPEhZwSjv+Acqt5RW1o1MCWMnPq4eTZuW2ML+IK0mSTvm phZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R7js9x72; 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 w14si3076901edr.176.2021.07.09.19.29.57; Fri, 09 Jul 2021 19:30:21 -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=R7js9x72; 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 S234104AbhGJC3H (ORCPT + 99 others); Fri, 9 Jul 2021 22:29:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:43326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233728AbhGJC1H (ORCPT ); Fri, 9 Jul 2021 22:27:07 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id BDA1E613E4; Sat, 10 Jul 2021 02:24:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625883853; bh=Wc+8IUEWEbx56kg+jURITthTR5thKLxkWh0FSVlJrVk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R7js9x72hBbk8INvcrpn3dcCupFVsm7rBDYmuCLLXU/EOm4vsoUokqcPAocg1Fc4+ gdy6Ritl7bD7RUXklKh4bBe3i7QHKbuVD2QrOBsXwsEmti8w/rTyHHBV1kftRZH2// yRYxlELctSUUGm9T/Z0PyJU6AxTKh4F14KWA9tKJ98aI6cJXLJujZcSwpSnjyUHzun 37AxMuF1Ui2bxI66SC24H+gaTnrB6PxQGUhPtml6J1nYOPuZtJEjNVpYXyCRx+HMbc AIZZrCWBt27andXw28u257iT4U9PRFkIM2PVtA183sKg2CU2szcZTu1i69BObGPWql jNPiQ17D/oXGQ== 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.12 096/104] ALSA: firewire-motu: fix detection for S/PDIF source on optical interface in v2 protocol Date: Fri, 9 Jul 2021 22:21:48 -0400 Message-Id: <20210710022156.3168825-96-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210710022156.3168825-1-sashal@kernel.org> References: <20210710022156.3168825-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