Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1312348lqa; Mon, 29 Apr 2024 05:14:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTY9yV1sNtUw3zixPr0WHnjEBCXLY0jMJJcRXVL8tLVIYY/ZAuyT/sjuAO0fnbYKASYIrgzHnw/lDxWQ1iHNMH6RfqoF6/Ep1ggvxIRQ== X-Google-Smtp-Source: AGHT+IEM2dDSUzrxSGP8hBZHvYilkuIjw6fEjOv6J4rQe5rjORlxuXrcqaawL0dIKkwH+5nG9Z7s X-Received: by 2002:a17:906:f299:b0:a55:664b:ff0b with SMTP id gu25-20020a170906f29900b00a55664bff0bmr6305409ejb.38.1714392899753; Mon, 29 Apr 2024 05:14:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714392899; cv=pass; d=google.com; s=arc-20160816; b=FtHHzFeVmrQxuDfrJRnGwks5qJgZ36hvDCsftptiM7O9wQOmGMJ/26tbnfe1o5uihl 3dWbOMXFaEmJw9mBZxZiX4SrFaKzKAanh6ZHHo9GGl4SjTJuTpGRP+hClggwjoOcWt+b 0BvXhcqd+PaXpZrr/e6BZImL7xD8xgUBTisrTBeJbACOaLPc7eBZC+Olb8mgrK+BUyXq SifVLRMOkIow6w1yrRjjLt8AGOGKjuCEMB5rXj5SA77PnqaUNFdFKphPyh7yhgaHqj1D XwHS8xQGlZYzoLtoLj47UYDFcwjtN/0yW80N9r674sPkXxMUnZYLc46AJM3Ms5042ndV Lr6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:references:in-reply-to:subject:cc:to:from:message-id :date:dkim-signature:dkim-signature:dkim-signature:dkim-signature; bh=dZnWgq4tXzT/pnbV9TmhzqgQBTHbr85kNIzhNWX8X4Q=; fh=33XT/RImk+aoGBlHJ6nesGjz75zOGgp9fqxIGl6YIGE=; b=yA0HQXCLx6DSBF584l4sUnMgy8Ni/ar3eEYQwvpQhZ3HOybAsODDgpDe7VvlP6nt7b qwmsmxpkH9eaX1scQGFJ2CD+AdwKPPPTfJvzal9GsYz83uitVqz+AZiMxAvuhX6/+jLN 0q5Meooyp+t7ci93/GyxCgOXKvUMo1+R9ERep9Zid1QpMzhedQH8nQbOWcQyHlCdU14E 24hlrGj6nx+2iVpup7DTgGWATfz4SFlKppdNwDqpgQBa/p/HzzHZsC0xbjLWRzMQmNVc FEFKIjcm6+nM3XXFbeJYdxVKde7LwUamu4q773J5BkihJUFKpOSDhZ1fLMoqXO45omMW dTqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=r7wHopYS; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=r7wHopYS; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-162213-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162213-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s20-20020a170906a19400b00a51a78f4ed7si13813082ejy.220.2024.04.29.05.14.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 05:14:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162213-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=r7wHopYS; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=r7wHopYS; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-162213-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162213-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 53BA11F245AD for ; Mon, 29 Apr 2024 12:14:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9D86B55776; Mon, 29 Apr 2024 12:11:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="r7wHopYS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="v6PkS9iC"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="r7wHopYS"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="v6PkS9iC" Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F3205537FA; Mon, 29 Apr 2024 12:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714392693; cv=none; b=jrcAlwmUbkwD32QWIu3Kv23anThx8giM8EU0nANkmgq/n+wh4XTJlqxeBIuWtgAoE0KlVKzMCojAEQ8Vs8ZUmJkWeMOtHGlWbwWKjB/n7vV/cKG0/JiFbdRyo6rlIfCbTT6PKlh3b+mVTbRj/isy5z8WdXdsKDj7NqjN5zhsdjY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714392693; c=relaxed/simple; bh=Kv9UVoqr4FPtC8ayOP5lsOjpRRdbK3TbUzE2L4pIu3c=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=gj6jZ29HLPg2clDMoZUf1wHLA8qqwOkxH1vDX3AHnz8mZMsvjucm0Y3jowf+HuS0LpFjYXMN0Y3o1r3/s9sb1eJf0BqgwBygn+7MJc0+y1EREGCd7lkNxht6/TC2bbvLd9LPZm4Tuh4W5csJHe3fDkOlUUKUCD8iUsS4GNY2JpI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=r7wHopYS; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=v6PkS9iC; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=r7wHopYS; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=v6PkS9iC; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 227723373E; Mon, 29 Apr 2024 12:11:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1714392690; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dZnWgq4tXzT/pnbV9TmhzqgQBTHbr85kNIzhNWX8X4Q=; b=r7wHopYSw64Ks0Q94uS2D/MljcGTpCE5Wd5xQUBqEiafxM0l1mAvPGo01+ZyWBBc6URMsX 8x3KvUIv/4MXVln7irBteQ03i+kt8xKMzS9DSYCN7Y0Oe9deAJYhwlDaj5XvnrjlFbdw9D RaCJqBhUTGAGHtdY8EnqTv5/L1g7xXg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1714392690; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dZnWgq4tXzT/pnbV9TmhzqgQBTHbr85kNIzhNWX8X4Q=; b=v6PkS9iCjsDfJlMRAseJm2xGdpPi4HY7EH/zD9Dne+kRlONHO0sE5M79hOZmpNAU8s5h8Y bCFZaPNgPMHnnxDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1714392690; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dZnWgq4tXzT/pnbV9TmhzqgQBTHbr85kNIzhNWX8X4Q=; b=r7wHopYSw64Ks0Q94uS2D/MljcGTpCE5Wd5xQUBqEiafxM0l1mAvPGo01+ZyWBBc6URMsX 8x3KvUIv/4MXVln7irBteQ03i+kt8xKMzS9DSYCN7Y0Oe9deAJYhwlDaj5XvnrjlFbdw9D RaCJqBhUTGAGHtdY8EnqTv5/L1g7xXg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1714392690; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dZnWgq4tXzT/pnbV9TmhzqgQBTHbr85kNIzhNWX8X4Q=; b=v6PkS9iCjsDfJlMRAseJm2xGdpPi4HY7EH/zD9Dne+kRlONHO0sE5M79hOZmpNAU8s5h8Y bCFZaPNgPMHnnxDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 9A05A139DE; Mon, 29 Apr 2024 12:11:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id il5OJHGOL2bmVgAAD6G6ig (envelope-from ); Mon, 29 Apr 2024 12:11:29 +0000 Date: Mon, 29 Apr 2024 14:11:41 +0200 Message-ID: <87jzkgpdvm.wl-tiwai@suse.de> From: Takashi Iwai To: ManuLinares Cc: alsa-devel@alsa-project.org, Jaroslav Kysela , Takashi Iwai , dengxiang , Geraldo Nascimento , Max McCarthy , WhaleChang , Lukasz Tyl , Jeremie Knuesel , Alexander Tsoy , Jussi Laako , linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ALSA: usb-audio: Add sampling rates support for Mbox3 In-Reply-To: <20240428005733.202978-1-mbarriolinares@gmail.com> References: <20240428005733.202978-1-mbarriolinares@gmail.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) Emacs/27.2 Mule/6.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-Spam-Level: X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; FREEMAIL_TO(0.00)[gmail.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_TWELVE(0.00)[14]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FREEMAIL_CC(0.00)[alsa-project.org,perex.cz,suse.com,nfschina.com,gmail.com,mcintoshlabs.com,google.com,hem-e.com,tsoy.me,sonarnerd.net,vger.kernel.org]; FUZZY_BLOCKED(0.00)[rspamd.com]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_SOME(0.00)[] X-Spam-Score: -3.30 X-Spam-Flag: NO On Sun, 28 Apr 2024 02:57:29 +0200, ManuLinares wrote: > > This adds support for all sample rates supported by the hardware, > Digidesign Mbox 3 supports: {44100, 48000, 88200, 96000} > > Fixes syncing clock issues that presented as pops. To test this, without > this patch playing 440hz tone produces pops. > > Clock is now synced between playback and capture interfaces so no more > latency drift issue when using pipewire pro-profile. > (https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3900) > > Signed-off-by: ManuLinares (snip) > - dev_dbg(&dev->dev, "device initialised!\n"); > + dev_dbg(&dev->dev, "MBOX3: device initialised!\n"); > > err = usb_get_descriptor(dev, USB_DT_DEVICE, 0, > &dev->descriptor, sizeof(dev->descriptor)); > config = dev->actconfig; > - if (err < 0) > - dev_dbg(&dev->dev, "error usb_get_descriptor: %d\n", err); > + if (err < 0) You put a tailing sparce superfluously. > + dev_dbg(&dev->dev, "MBOX3: error usb_get_descriptor: %d\n", err); > > err = usb_reset_configuration(dev); > - if (err < 0) > - dev_dbg(&dev->dev, "error usb_reset_configuration: %d\n", err); > - dev_dbg(&dev->dev, "mbox3_boot: new boot length = %d\n", > + if (err < 0) Ditto. Try to run checkpatch.pl at the next time; it should warn you such errors. (snip) > +static void mbox3_set_format_quirk(struct snd_usb_substream *subs, > + const struct audioformat *fmt) > +{ > + // Set rate only for one interface > + //u8 iface = subs->data_endpoint->iface; > + //if (iface != 2) return; > + > + u8 buffer[4] = {0}; > + u32 new_rate = subs->data_endpoint->cur_rate; Let's to be classic: try to put the variable definitions at the begin of the function. (snip) > + __le32 set_rate = cpu_to_le32(new_rate); Ditto. (snip) > + // Check whether the change was successful > + buffer[0] = 0; buffer[1] = 0; buffer[2] = 0; buffer[3] = 0; You can use memset(). (Or if it were a __le32 variable, it can be simply zero assignment.) > + snd_usb_ctl_msg(subs->dev, > + usb_sndctrlpipe(subs->dev, 0), > + 0x01, 0x21 | USB_DIR_IN, 0x0100, 0x8101, &buffer, 4); > + //set_rate = *(int *)buffer; > + set_rate = le32_to_cpu(*(u32 *)buffer); Strictly speaking, this won't work always as no alignment is guaranteed for char[4]. If you need to pass/receive a 4-byte integer, better to use a __le32 variable instead. For a one-byte temporary buffer, you can use another variable additionally. Could you resubmit with those corrections? thanks, Takashi