From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796196755; b=3zFrkZHbLqcr6E30yliDiH9mL2NYHAqLarv2bNWlb5Nj03tho62sXVwkm9XzutbOgTau voH5xVD/6xQLIvGkgCBMUZNhP6hEg+pDruGp8eaqPHizngLhhrMUviCXcq0y92Or0NryS OYcyyoDqnGdaPUvUqw4qJn1x8gqaa+EjLY95PSA6Z5dUODm0bNsVcCpc0g3T25wqpgcri sEseLcAeLCzSxE2m1aLwjlilOeSg9nUrQO9C4507hds6Q66K2i+cOANTJP7Eyy80eYfks xpP1o7/NVaHqxi/q4pjixHieb19Mb04oqarnggiEWVzeqvdA9QjlPBAWsHynk9zHDEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796196755; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=iHBLiCkmHEenGWyHmkeiKNmCFohCsUOL0nK9J4dPvoI=; b=qKPfnpG1jbIh3T0PqTJKyYVV+dRtxWnJ4oJ3zSXHQ3tpBq9R01ePTN27aglO3jl1I7Ja t7sapxPlbjmUhK1NCkWuNNc9fLS6D15nJ3Ugaon4kTMz4ZsK1gVJKX30ISvMA98vbQm7o QBacQkGDvCiKmgbGKYrKmJFaP1Uxy66mYYF3oWHXXUb/ERU9w833e2W30ugdK8QDNHU+V OWkE86EacjHYuxy+xxLfKF1Eor8DxzbQcZHVPLkRRLcEmzps+EoPzogYLLtI7dKqzB/Dj IvZA7kbr1UcwzytgfIpPtDdhvvwNgA4wPaolvX66t5HldsOamM4NKI7EYuub3hdBR9g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=qL8LI5Og; arc=none smtp.remote-ip=209.85.210.180 Received: from mail-pf1-f180.google.com (mail-pf1-f180.google.com [209.85.210.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A0E08606A323 for ; Wed, 2 Dec 2026 07:32:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org A0E08606A323 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=qL8LI5Og Received: by mail-pf1-f180.google.com with SMTP id d2e1a72fcca58-8a052aff9e9so9104802b3a.0 for ; Tue, 01 Dec 2026 23:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796196754; x=1796801554; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=iHBLiCkmHEenGWyHmkeiKNmCFohCsUOL0nK9J4dPvoI=; b=qL8LI5OgJ/J2XwePobfv1kVvK8o5+yZ7dfbCP8uGYRmdIvo4u1z8v6VKu6u7YfRV6Y u+n4ROawLwYGA9Q+vRb313oo1muW/5tbIIyLa1BYH8S0Fgr9P+2CpG6tN+G2MJD1YHPq F2NCyIofTgs8Ak9bRwGZpufrjNzjxZEAidzYEqfJAZfWK/mzgWixQvlO/36MYGfyKS95 U9NnB8boLlz6b8hvcsfqBzU3hex+HuEE/ObrfGv9G4n+gnY+8GkLQC76dhEFtlHrHN/q em6RtHwt/kkVkByp/4da1Qv7KUwQqOzDDz0SV85OmJEhkjxIWZBsIxSWUksUgOF2w5j5 SlSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796196754; x=1796801554; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=iHBLiCkmHEenGWyHmkeiKNmCFohCsUOL0nK9J4dPvoI=; b=yyuJNjLziBbR4acNVuPy3ytnfGrDHNb4hEQSo2MW8IntVF3UApJicdktH4Lf1FjlBZ 1z8tkkDVsi/Rc9vXsU/yBE8pMwNwlOdC6SyIzQTfmqBiuGaBT82eeRQma6EsWavfED5d CuY5G10dm7J6eOsYwgT0Uk03rjix++cGwWuOuhgwee7bU5HtLNbVIDmBjalUiWJey6Bw hkyFJbV4sNISpnXWl5CMwwtqHacZxYI3Ffx5Z/2ZwD0DxJvkaNJdOfptoKxoXvRY0pnt TclfBBnJN7RdIB497Lz1HEvwBlbf609f3jclBvAJpP4QUDCQVjV9yKTwirCEr0uinf8w 3fXQ== X-Forwarded-Encrypted: i=1; AL+hErGz807vALelGu3bfiG7xxfFhK26dW+KOHzhi/I7SuXlQZQrxWMwdMHKIs+XOo4OQktI4uWwPCzxlDBHikQ=@vger.kernel.org X-Gm-Message-State: APuU4Z/Td0tIW9sqI4MP5l5ocWQq0DmG0Uuae0Rmo2lphOLR1BGEBhNS M8H9rLomQvbX28d3S/GvJ9lf6BdcKS2MGD2UH+MdtZ5kvXvLZYqdYVKD X-Gm-Gg: AZFdTZeLcyx98pocIcbmdpkYUjfYxIsTr1Kh3bvG8/wOZOqqya3650HihT7LRscKe6S Nu7sUWSpEzDWeyezsXkYuWmuiFe0PUNy14k61Cjh/xCSsxBbtW+l1Fa2P9Uei0lE/JIMisIk0D8 YxoyeBlK+gt4+JFl9tTVk3zjnKw8i6nRqyoFO85bo3lCIzRuh7damdbDupTHRc1EeiF5YeoXQuG fjy8TgAcMZbLZgZl7abm2mS67VnTuQqc3XmTUVkniwa4AbDpQNVrNrXY5Wucz9n9zmODR4JUKE/ H8+UGMpC16ciyCZxqbyJSIiTx4erZPC5LJb0GsJq5EazddLuFP1TrvqSlLQKcGW2KLD2n08GyN5 u2s2lXsZ57NJiz2xq17IXbcEv/4X/p61A7jSHjK5gilWPLUsaG3VHBM2xth75Hrl0D99H9aXbAp H+zvBAv3FXVZoUdH4EyFzXwwm8iAlaU5BaOB9cmiSo/5rb2TYhYa05ft8KAKsgZN9iwbF9RVITA pkCU7L0WoIpKE42/OwsVS4T0iIzVzaqKanHtl6Ojy8BjnsIpMjFj1l8x//aTbuHAVTVjHUGyN0C pl5Wwak0ruoSBw1MK0Aa/38hWL09MIl0NxdkX7Sn2nZEhDQmnZEoVKBgfT4xyFaH1rYk5YfWzg4 Pe9Vh3RlED3QUNk3hhmzTSQf0JWxSWsXOrN2/hG1y X-Received: by 2002:a05:6a00:b48:b0:89f:ed19:f093 with SMTP id d2e1a72fcca58-8c87c864e92mr39743978b3a.34.1796196753761; Tue, 01 Dec 2026 23:32:33 -0800 (PST) Received: from nugod-NUC15CRHU5.tail9f095a.ts.net ([218.237.104.87]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c87392d408sm21170107b3a.44.2026.12.01.23.32.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Dec 2026 23:32:33 -0800 (PST) From: HyeongJun An To: Takashi Iwai Cc: Jaroslav Kysela , Mark Brown , Shuah Khan , linux-sound@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, HyeongJun An Subject: [PATCH 2/4] selftests/alsa: Test the sequencer UMP bank and program change conversion Date: Wed, 2 Dec 2026 16:32:13 +0900 Message-ID: <20261202073215.2588603-3-sammiee5311@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20261202073215.2588603-1-sammiee5311@gmail.com> References: <20261202073215.2588603-1-sammiee5311@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Check that a bank select from a legacy client goes to a UMP MIDI 2.0 client with the next program change, sent as CCs and as CONTROL14. For the CCs, also check that the program change after that has no bank, and that a later bank select LSB keeps the MSB. The latter was fixed by commit a200df7deb31 ("ALSA: seq: Don't clear bank selection at event -> UMP MIDI2 conversion"). Also check the bank of a program change between UMP MIDI 1.0 and MIDI 2.0 clients. ump_midi2_to_midi1_program fails without "ALSA: seq: ump: Don't leave the bank LSB in a MIDI 1.0 program change". Signed-off-by: HyeongJun An --- tools/testing/selftests/alsa/seq-ump-test.c | 64 ++++++++++++++++++++- 1 file changed, 62 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/alsa/seq-ump-test.c b/tools/testing/selftests/alsa/seq-ump-test.c index 7030d061dfae8..f2051777a9dc5 100644 --- a/tools/testing/selftests/alsa/seq-ump-test.c +++ b/tools/testing/selftests/alsa/seq-ump-test.c @@ -4,8 +4,8 @@ * packets between MIDI 1.0 and MIDI 2.0 clients. * * A client sends events to a UMP client, and the test checks the packets - * that the UMP client receives. The converter keeps its RPN/NRPN state - * per destination port and channel, so each test uses new clients. + * that the UMP client receives. The converter keeps its RPN/NRPN and bank + * state per destination port and channel, so each test uses new clients. */ #include #include @@ -232,6 +232,8 @@ struct event { { SNDRV_SEQ_EVENT_CONTROLLER, ch, param, value } #define C14(ch, param, value) \ { SNDRV_SEQ_EVENT_CONTROL14, ch, param, value } +#define PGM(ch, value) \ + { SNDRV_SEQ_EVENT_PGMCHANGE, ch, 0, value } static int send_events(struct seq_client *src, struct seq_client *dst, const struct event *ev, int n) @@ -482,6 +484,26 @@ TEST_F(seq_ump, key_pressure) EXPECT_PACKETS({ 0x40a24000, 0 }); } +/* + * A bank select goes with the next program change only, and a later + * bank select LSB keeps the MSB + */ +TEST_F(seq_ump, program_bank) +{ + SEND(CC(0, 0, 1), CC(0, 32, 2), PGM(0, 5)); + SEND(CC(0, 32, 3), PGM(0, 6), PGM(0, 7)); + EXPECT_PACKETS({ 0x40c00001, 0x05000102 }, + { 0x40c00001, 0x06000103 }, + { 0x40c00000, 0x07000000 }); +} + +/* the same with the bank select sent as CONTROL14 */ +TEST_F(seq_ump, c14_program_bank) +{ + SEND(C14(7, 0, (3 << 7) | 4), PGM(7, 9)); + EXPECT_PACKETS({ 0x40c70001, 0x09000304 }); +} + /* a UMP MIDI 1.0 client gets the CCs as they are, RPN selection included */ TEST(midi1_passthrough) { @@ -640,4 +662,42 @@ TEST_F(seq_pair, ump_midi2_to_midi1_rpn) { 0x20b10609, 0 }, { 0x20b1260d, 0 }); } +/* UMP MIDI 1.0 to MIDI 2.0: the bank select CCs go into the program change */ +TEST_F(seq_pair, ump_midi1_to_midi2_program) +{ + int skip = 0; + int err; + + err = open_pair(&self->dst, SNDRV_SEQ_CLIENT_UMP_MIDI_2_0, + &self->src, SNDRV_SEQ_CLIENT_UMP_MIDI_1_0, &skip); + if (skip) + SKIP(return, "UMP sequencer client unavailable: %s", + strerror(-err)); + ASSERT_EQ(0, err); + + SEND_UMP(0x20b00001, 0); + SEND_UMP(0x20b02002, 0); + SEND_UMP(0x20c00500, 0); + EXPECT_PACKETS({ 0x40c00001, 0x05000102 }); +} + +/* UMP MIDI 2.0 to MIDI 1.0: a program change with a bank is three messages */ +TEST_F(seq_pair, ump_midi2_to_midi1_program) +{ + int skip = 0; + int err; + + err = open_pair(&self->dst, SNDRV_SEQ_CLIENT_UMP_MIDI_1_0, + &self->src, SNDRV_SEQ_CLIENT_UMP_MIDI_2_0, &skip); + if (skip) + SKIP(return, "UMP sequencer client unavailable: %s", + strerror(-err)); + ASSERT_EQ(0, err); + + SEND_UMP(0x40c00001, 0x05000102); + SEND_UMP(0x40c00000, 0x06000000); + EXPECT_MT_PACKETS(2, { 0x20b00001, 0 }, { 0x20b02002, 0 }, + { 0x20c00500, 0 }, { 0x20c00600, 0 }); +} + TEST_HARNESS_MAIN -- 2.43.0