summaryrefslogtreecommitdiff
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2024-07-31 15:05:23 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-09-08 07:54:30 +0200
commit4ed4e84939acc6d9344f791b68e5e4c79ed6f306 (patch)
treece0f14a816a99b9e80482283c0e27e5f668707c1 /sound/core
parent5a494fdbfc63fc2366921edac71b0aad67448618 (diff)
downloadlinux-4ed4e84939acc6d9344f791b68e5e4c79ed6f306.tar.gz
linux-4ed4e84939acc6d9344f791b68e5e4c79ed6f306.tar.bz2
linux-4ed4e84939acc6d9344f791b68e5e4c79ed6f306.zip
ALSA: ump: Explicitly reset RPN with Null RPN
[ Upstream commit 50a6dd19dca9446475f023eaa652016bfe5b1cbe ] RPN with 127:127 is treated as a Null RPN, just to reset the parameters, and it's not translated to MIDI2. Although the current code can work as is in most cases, better to implement the RPN reset explicitly for Null message. Link: https://patch.msgid.link/20240731130528.12600-3-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/ump_convert.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/sound/core/ump_convert.c b/sound/core/ump_convert.c
index 5d1b85e7ac16..0fe13d031656 100644
--- a/sound/core/ump_convert.c
+++ b/sound/core/ump_convert.c
@@ -287,6 +287,15 @@ static int cvt_legacy_system_to_ump(struct ump_cvt_to_ump *cvt,
return 4;
}
+static void reset_rpn(struct ump_cvt_to_ump_bank *cc)
+{
+ cc->rpn_set = 0;
+ cc->nrpn_set = 0;
+ cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
+ cc->cc_data_msb = cc->cc_data_lsb = 0;
+ cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
+}
+
static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
union snd_ump_midi2_msg *midi2,
bool flush)
@@ -312,11 +321,7 @@ static int fill_rpn(struct ump_cvt_to_ump_bank *cc,
midi2->rpn.data = upscale_14_to_32bit((cc->cc_data_msb << 7) |
cc->cc_data_lsb);
- cc->rpn_set = 0;
- cc->nrpn_set = 0;
- cc->cc_rpn_msb = cc->cc_rpn_lsb = 0;
- cc->cc_data_msb = cc->cc_data_lsb = 0;
- cc->cc_data_msb_set = cc->cc_data_lsb_set = 0;
+ reset_rpn(cc);
return 1;
}
@@ -374,11 +379,15 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
ret = fill_rpn(cc, midi2, true);
cc->rpn_set = 1;
cc->cc_rpn_msb = buf[2];
+ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
+ reset_rpn(cc);
return ret;
case UMP_CC_RPN_LSB:
ret = fill_rpn(cc, midi2, true);
cc->rpn_set = 1;
cc->cc_rpn_lsb = buf[2];
+ if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
+ reset_rpn(cc);
return ret;
case UMP_CC_NRPN_MSB:
ret = fill_rpn(cc, midi2, true);