Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2748708pxj; Mon, 31 May 2021 09:45:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzmhOXEDaQhqL5PfMgHXV8owqRiWi7RGzAzTEAWFsPXNky08l3OWYLNthGM+JVK6cx4KOq8 X-Received: by 2002:a92:dcc3:: with SMTP id b3mr8798872ilr.272.1622479524499; Mon, 31 May 2021 09:45:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622479524; cv=none; d=google.com; s=arc-20160816; b=vJjAXEVZutHREiwyJYMcL6x4t22c1dujmEOYNkocZqIBY2pPbT0IrcGkfd3JRgYQ+k 2kvqRCBa+WA3lNQIMnjDPUv1hkmozozFuq3vviZCsN/pFQ9AQRli+QYBAysyyKr92DC8 NRxFX60qDs5Hmkl7UmXViFWblExHtGf1BUovJ4lj7qWLtcPyKEixK/8GlYzV0XBAnFf8 Cp7pd0FzcS9Vel2BVjn1bKgIuUMdPsHJtfwTqbt8uYgATeGgZrJizFgT2rt7K0A30EDE P4ugRpV/nuLxWWrLgYlTEvQgHvxKBCmKNt6uIY04xo3RhMEQ7Dv9OD608/qioGJYpnlX CdZA== 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=dFFlf3jXcfBIS77BRMH35JgiyJKdHqLJH9GXihDBGd0=; b=Xlc+UG4pmNN+eYVY9Ru4ZYZywU1FIy6hindoq1wRMAiSV8+GgjQ1uWOw2pDfaOeSR5 Tn+ZpqvHxjuvYE/vYSi6Tf3jaT6pcke8fMLwEFH2k11oaNBXhLQ5q2GNHoAthRw9Q5DJ dE6FsXdphVl1uYT3A48cQxK56zagEd0ID+JCm9yiO56s1Z238FSKvwJPc9ptnVkdiW6f EYZnVu32exx9t28GRauhNUmqmJ7JEobrOYkC68S2aZZ1rjoIrC8kzPwkJP2Um2OJD3AR dpnxpZB/5X5CJGSnXF0ibuwBx/KnE25uWDrjL2/TVtXRjQukHn1WhRgDanfieO6ypWjU rMUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=nTkYPlbC; 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 v17si14987262jan.123.2021.05.31.09.45.11; Mon, 31 May 2021 09:45:24 -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=nTkYPlbC; 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 S231876AbhEaQqI (ORCPT + 99 others); Mon, 31 May 2021 12:46:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:47902 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233222AbhEaOzU (ORCPT ); Mon, 31 May 2021 10:55:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0FDE261CBD; Mon, 31 May 2021 13:59:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469580; bh=J/bY1BDA2WepYFUzY74lWoOzigSPgpgyi+ZouIRDfug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nTkYPlbCcKiGq8GuoUxwM6iOMjWoxhgiGLU/eZ2+Izv76VX+NtVYgnqVrG80PDP2f pzHmtd2L+mxdcuQ2u1iOUlcVojDag2XY3C6vC/MRHB0K06cU28179xz656mL4wGB46 3GIJBVu9DEq+tKMozs9ALOGs0IGRdu/ZUK7ZEcdk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Takashi Sakamoto , Takashi Iwai , Sasha Levin Subject: [PATCH 5.12 207/296] ALSA: dice: disable double_pcm_frames mode for M-Audio Profire 610, 2626 and Avid M-Box 3 Pro Date: Mon, 31 May 2021 15:14:22 +0200 Message-Id: <20210531130710.830211600@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@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: Takashi Sakamoto [ Upstream commit 9f079c1bdc9087842dc5ac9d81b1d7f2578e81ce ] ALSA dice driver detects jumbo payload at high sampling transfer frequency for below models: * Avid M-Box 3 Pro * M-Audio Profire 610 * M-Audio Profire 2626 Although many DICE-based devices have a quirk at high sampling transfer frequency to multiplex double number of PCM frames into data block than the number in IEC 61883-1/6, the above devices are just compliant to IEC 61883-1/6. This commit disables the mode of double_pcm_frames for the models. Signed-off-by: Takashi Sakamoto Link: https://lore.kernel.org/r/20210518012510.37126-1-o-takashi@sakamocchi.jp Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/firewire/dice/dice-pcm.c | 4 ++-- sound/firewire/dice/dice-stream.c | 2 +- sound/firewire/dice/dice.c | 24 ++++++++++++++++++++++++ sound/firewire/dice/dice.h | 3 ++- 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/sound/firewire/dice/dice-pcm.c b/sound/firewire/dice/dice-pcm.c index af8a90ee40f3..a69ca1111b03 100644 --- a/sound/firewire/dice/dice-pcm.c +++ b/sound/firewire/dice/dice-pcm.c @@ -218,7 +218,7 @@ static int pcm_open(struct snd_pcm_substream *substream) if (frames_per_period > 0) { // For double_pcm_frame quirk. - if (rate > 96000) { + if (rate > 96000 && !dice->disable_double_pcm_frames) { frames_per_period *= 2; frames_per_buffer *= 2; } @@ -273,7 +273,7 @@ static int pcm_hw_params(struct snd_pcm_substream *substream, mutex_lock(&dice->mutex); // For double_pcm_frame quirk. - if (rate > 96000) { + if (rate > 96000 && !dice->disable_double_pcm_frames) { events_per_period /= 2; events_per_buffer /= 2; } diff --git a/sound/firewire/dice/dice-stream.c b/sound/firewire/dice/dice-stream.c index 1a14c083e8ce..c4dfe76500c2 100644 --- a/sound/firewire/dice/dice-stream.c +++ b/sound/firewire/dice/dice-stream.c @@ -181,7 +181,7 @@ static int keep_resources(struct snd_dice *dice, struct amdtp_stream *stream, // as 'Dual Wire'. // For this quirk, blocking mode is required and PCM buffer size should // be aligned to SYT_INTERVAL. - double_pcm_frames = rate > 96000; + double_pcm_frames = (rate > 96000 && !dice->disable_double_pcm_frames); if (double_pcm_frames) { rate /= 2; pcm_chs *= 2; diff --git a/sound/firewire/dice/dice.c b/sound/firewire/dice/dice.c index 107a81691f0e..239d164b0eea 100644 --- a/sound/firewire/dice/dice.c +++ b/sound/firewire/dice/dice.c @@ -21,6 +21,7 @@ MODULE_LICENSE("GPL v2"); #define OUI_SSL 0x0050c2 // Actually ID reserved by IEEE. #define OUI_PRESONUS 0x000a92 #define OUI_HARMAN 0x000fd7 +#define OUI_AVID 0x00a07e #define DICE_CATEGORY_ID 0x04 #define WEISS_CATEGORY_ID 0x00 @@ -222,6 +223,14 @@ static int dice_probe(struct fw_unit *unit, (snd_dice_detect_formats_t)entry->driver_data; } + // Below models are compliant to IEC 61883-1/6 and have no quirk at high sampling transfer + // frequency. + // * Avid M-Box 3 Pro + // * M-Audio Profire 610 + // * M-Audio Profire 2626 + if (entry->vendor_id == OUI_MAUDIO || entry->vendor_id == OUI_AVID) + dice->disable_double_pcm_frames = true; + spin_lock_init(&dice->lock); mutex_init(&dice->mutex); init_completion(&dice->clock_accepted); @@ -278,7 +287,22 @@ static void dice_bus_reset(struct fw_unit *unit) #define DICE_INTERFACE 0x000001 +#define DICE_DEV_ENTRY_TYPICAL(vendor, model, data) \ + { \ + .match_flags = IEEE1394_MATCH_VENDOR_ID | \ + IEEE1394_MATCH_MODEL_ID | \ + IEEE1394_MATCH_SPECIFIER_ID | \ + IEEE1394_MATCH_VERSION, \ + .vendor_id = (vendor), \ + .model_id = (model), \ + .specifier_id = (vendor), \ + .version = DICE_INTERFACE, \ + .driver_data = (kernel_ulong_t)(data), \ + } + static const struct ieee1394_device_id dice_id_table[] = { + // Avid M-Box 3 Pro. To match in probe function. + DICE_DEV_ENTRY_TYPICAL(OUI_AVID, 0x000004, snd_dice_detect_extension_formats), /* M-Audio Profire 2626 has a different value in version field. */ { .match_flags = IEEE1394_MATCH_VENDOR_ID | diff --git a/sound/firewire/dice/dice.h b/sound/firewire/dice/dice.h index adc6f7c84460..3c967d1b3605 100644 --- a/sound/firewire/dice/dice.h +++ b/sound/firewire/dice/dice.h @@ -109,7 +109,8 @@ struct snd_dice { struct fw_iso_resources rx_resources[MAX_STREAMS]; struct amdtp_stream tx_stream[MAX_STREAMS]; struct amdtp_stream rx_stream[MAX_STREAMS]; - bool global_enabled; + bool global_enabled:1; + bool disable_double_pcm_frames:1; struct completion clock_accepted; unsigned int substreams_counter; -- 2.30.2