Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3991138rwd; Tue, 23 May 2023 01:12:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4mBcKvoaVqn/wtyc38quGgEbMWkZAmhSg3QGKju/Ijhmj7YtXDFSvlvEHGHYjZnwgHU/Qt X-Received: by 2002:a17:902:cec2:b0:1af:cdd9:e970 with SMTP id d2-20020a170902cec200b001afcdd9e970mr1389288plg.12.1684829545733; Tue, 23 May 2023 01:12:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684829545; cv=none; d=google.com; s=arc-20160816; b=IWdurr9CgvkWEUgP2No9cA3jPbxHmgfKimR14kGJVJOtha/wYqGF9F5reCkr6Nhgmr sfIhq80IcTsxVbb3oAgTd4mhZFryH5in2sW9lkvyHwfynSFVyCcZ74QIiod6VJGIPuAs Apk6XdoQ0eH7L0ybKN0IK+5OU7Y4iKhBtmq9uGOl5xLfSgvCK6qwz5MDiXUnYpwS6Naf XMgk7b9aNDoPIfdYOE36wxksO5DcMgM8tTMKIEH8S9a0qBq6UvZQ/5izRhz97HCgS8Eh jLib0qxDn12biE1p7cBpI0eja+AvuUC+FUN/7HkdnDbVuQKkyMimB2p1ZTBI4lojgJy1 3Xog== 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:dkim-signature; bh=TygGfmhyxHyXtO48ucZvDwYqdaCkFLRB2qITd7bHM2E=; b=N/hM9kFfcf2E0U8QH59qaEtrPpU6B+UaF8fxALaoXQ3iA1CFWj60WL6hfU+F2q97ZT oJ1nBtsvh+orZDkNYmkENV0haP3KLX8klzg1ltaECab6U9xUWCzigmkXdXp0WNPdzcFK 4HGQLMwm+edTtfelu9tabt29PotWxVRfSAYiuM/4UBgvEy21qKJo/k/63X7hS4HXLsmi 1Zok6GmeNS8s89CghHpXgjcdGXWNBEYL4pfgVCxLqh/5QcoMo6xlbMcDtBwYH1HA7p1V pjhd4wuQCdWTBryIeDXBt1ADOVcyBnzEeWMWawvty0Q8biS6wk0UH4jqbQmW/x3iwrHq hw6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=spLCdVUS; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j14-20020a170903024e00b001aaecb74f86si6142072plh.569.2023.05.23.01.12.13; Tue, 23 May 2023 01:12:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=spLCdVUS; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236056AbjEWH5t (ORCPT + 99 others); Tue, 23 May 2023 03:57:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235984AbjEWH4n (ORCPT ); Tue, 23 May 2023 03:56:43 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F95A10E2 for ; Tue, 23 May 2023 00:55:52 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 68B942040D; Tue, 23 May 2023 07:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1684828447; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TygGfmhyxHyXtO48ucZvDwYqdaCkFLRB2qITd7bHM2E=; b=spLCdVUSBOL1ydTQEo23AMV6VgxobeyHa2dCzCjAVgnS8XxN9lVMXGkNGIc7hxQvE8XguZ eseQ4BEd/mqqoyyem53sqj3iyE+eIuBl5flVzN75+V09d8BR8Tl1lGXiuFYBSxvvR9moBA UIKXMpCDPnrPd4AC/ZC5ke5j4yF8/8A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1684828447; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=TygGfmhyxHyXtO48ucZvDwYqdaCkFLRB2qITd7bHM2E=; b=cvLknQse9tQL16PGNajENYNTBkDL3gHpSCpwsYdEDQsOyn/nArxG+eEgWiwpbWjsO/vHhq HJXZ5lBOfsIWERBw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2944B13A1A; Tue, 23 May 2023 07:54:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id SCYhBx9xbGT4KgAAMHmgww (envelope-from ); Tue, 23 May 2023 07:54:07 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH v2 15/37] ALSA: usb-audio: Enable the legacy raw MIDI support Date: Tue, 23 May 2023 09:53:36 +0200 Message-Id: <20230523075358.9672-16-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20230523075358.9672-1-tiwai@suse.de> References: <20230523075358.9672-1-tiwai@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Attach the legacy rawmidi devices when enabled in Kconfig accordingly. Reviewed-by: Jaroslav Kysela Signed-off-by: Takashi Iwai --- sound/usb/midi2.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/sound/usb/midi2.c b/sound/usb/midi2.c index 7e849b2384ee..f3fba8b07cb3 100644 --- a/sound/usb/midi2.c +++ b/sound/usb/midi2.c @@ -857,6 +857,25 @@ static int create_blocks_from_gtb(struct snd_usb_midi2_interface *umidi) return 0; } +/* attach legacy rawmidis */ +static int attach_legacy_rawmidi(struct snd_usb_midi2_interface *umidi) +{ +#if IS_ENABLED(CONFIG_SND_UMP_LEGACY_RAWMIDI) + struct snd_usb_midi2_ump *rmidi; + int err; + + list_for_each_entry(rmidi, &umidi->rawmidi_list, list) { + err = snd_ump_attach_legacy_rawmidi(rmidi->ump, + "Legacy MIDI", + umidi->chip->num_rawmidis); + if (err < 0) + return err; + umidi->chip->num_rawmidis++; + } +#endif + return 0; +} + static void snd_usb_midi_v2_free(struct snd_usb_midi2_interface *umidi) { free_all_midi2_endpoints(umidi); @@ -922,7 +941,7 @@ static int parse_midi_2_0(struct snd_usb_midi2_interface *umidi) } } - return 0; + return attach_legacy_rawmidi(umidi); } /* is the given interface for MIDI 2.0? */ @@ -991,6 +1010,12 @@ static void set_fallback_rawmidi_names(struct snd_usb_midi2_interface *umidi) usb_string(dev, dev->descriptor.iSerialNumber, ump->info.product_id, sizeof(ump->info.product_id)); +#if IS_ENABLED(CONFIG_SND_UMP_LEGACY_RAWMIDI) + if (ump->legacy_rmidi && !*ump->legacy_rmidi->name) + snprintf(ump->legacy_rmidi->name, + sizeof(ump->legacy_rmidi->name), + "%s (MIDI 1.0)", ump->info.name); +#endif } } -- 2.35.3