Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 75ff2767 authored by Gregor Pintar's avatar Gregor Pintar Committed by Greg Kroah-Hartman
Browse files

ALSA: usb-audio: Add quirk for Focusrite Scarlett 2i2



[ Upstream commit 6f4ea2074ddf689ac6f892afa58515032dabf2e4 ]

Force it to use asynchronous playback.

Same quirk has already been added for Focusrite Scarlett Solo (2nd gen)
with a commit 46f5710f ("ALSA: usb-audio: Add quirk for Focusrite
Scarlett Solo").

This also seems to prevent regular clicks when playing at 44100Hz
on Scarlett 2i2 (2nd gen). I did not notice any side effects.

Moved both quirks to snd_usb_audioformat_attributes_quirk() as suggested.

Signed-off-by: default avatarGregor Pintar <grpintar@gmail.com>
Reviewed-by: default avatarAlexander Tsoy <alexander@tsoy.me>
Link: https://lore.kernel.org/r/20200420214030.2361-1-grpintar@gmail.com


Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 695fcb61
Loading
Loading
Loading
Loading
+0 −84
Original line number Original line Diff line number Diff line
@@ -2776,90 +2776,6 @@ YAMAHA_DEVICE(0x7010, "UB99"),
		.type = QUIRK_MIDI_NOVATION
		.type = QUIRK_MIDI_NOVATION
	}
	}
},
},
{
	/*
	 * Focusrite Scarlett Solo 2nd generation
	 * Reports that playback should use Synch: Synchronous
	 * while still providing a feedback endpoint. Synchronous causes
	 * snapping on some sample rates.
	 * Force it to use Synch: Asynchronous.
	 */
	USB_DEVICE(0x1235, 0x8205),
	.driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
		.ifnum = QUIRK_ANY_INTERFACE,
		.type = QUIRK_COMPOSITE,
		.data = (const struct snd_usb_audio_quirk[]) {
			{
				.ifnum = 1,
				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
				.data = & (const struct audioformat) {
					.formats = SNDRV_PCM_FMTBIT_S32_LE,
					.channels = 2,
					.iface = 1,
					.altsetting = 1,
					.altset_idx = 1,
					.attributes = 0,
					.endpoint = 0x01,
					.ep_attr = USB_ENDPOINT_XFER_ISOC |
						   USB_ENDPOINT_SYNC_ASYNC,
					.protocol = UAC_VERSION_2,
					.rates = SNDRV_PCM_RATE_44100 |
						 SNDRV_PCM_RATE_48000 |
						 SNDRV_PCM_RATE_88200 |
						 SNDRV_PCM_RATE_96000 |
						 SNDRV_PCM_RATE_176400 |
						 SNDRV_PCM_RATE_192000,
					.rate_min = 44100,
					.rate_max = 192000,
					.nr_rates = 6,
					.rate_table = (unsigned int[]) {
						44100, 48000, 88200,
						96000, 176400, 192000
					},
					.clock = 41
				}
			},
			{
				.ifnum = 2,
				.type = QUIRK_AUDIO_FIXED_ENDPOINT,
				.data = & (const struct audioformat) {
					.formats = SNDRV_PCM_FMTBIT_S32_LE,
					.channels = 2,
					.iface = 2,
					.altsetting = 1,
					.altset_idx = 1,
					.attributes = 0,
					.endpoint = 0x82,
					.ep_attr = USB_ENDPOINT_XFER_ISOC |
						   USB_ENDPOINT_SYNC_ASYNC |
						   USB_ENDPOINT_USAGE_IMPLICIT_FB,
					.protocol = UAC_VERSION_2,
					.rates = SNDRV_PCM_RATE_44100 |
						 SNDRV_PCM_RATE_48000 |
						 SNDRV_PCM_RATE_88200 |
						 SNDRV_PCM_RATE_96000 |
						 SNDRV_PCM_RATE_176400 |
						 SNDRV_PCM_RATE_192000,
					.rate_min = 44100,
					.rate_max = 192000,
					.nr_rates = 6,
					.rate_table = (unsigned int[]) {
						44100, 48000, 88200,
						96000, 176400, 192000
					},
					.clock = 41
				}
			},
			{
				.ifnum = 3,
				.type = QUIRK_IGNORE_INTERFACE
			},
			{
				.ifnum = -1
			}
		}
	}
},


/* Access Music devices */
/* Access Music devices */
{
{
+13 −0
Original line number Original line Diff line number Diff line
@@ -1780,6 +1780,19 @@ void snd_usb_audioformat_attributes_quirk(struct snd_usb_audio *chip,
		 */
		 */
		fp->attributes &= ~UAC_EP_CS_ATTR_FILL_MAX;
		fp->attributes &= ~UAC_EP_CS_ATTR_FILL_MAX;
		break;
		break;
	case USB_ID(0x1235, 0x8202):  /* Focusrite Scarlett 2i2 2nd gen */
	case USB_ID(0x1235, 0x8205):  /* Focusrite Scarlett Solo 2nd gen */
		/*
		 * Reports that playback should use Synch: Synchronous
		 * while still providing a feedback endpoint.
		 * Synchronous causes snapping on some sample rates.
		 * Force it to use Synch: Asynchronous.
		 */
		if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
			fp->ep_attr &= ~USB_ENDPOINT_SYNCTYPE;
			fp->ep_attr |= USB_ENDPOINT_SYNC_ASYNC;
		}
		break;
	}
	}
}
}