[PATCH 1/2] ALSA: ump: clear stale RPN selector on NRPN change

From: Alyandra Zahran Nadhir

Date: Sat Nov 07 2026 - 06:15:12 EST


The legacy-to-UMP converter keeps separate RPN and NRPN selector
flags. When a stream changes selector type without sending data first,
both flags remain set and fill_rpn() gives RPN priority, so subsequent
NRPN data is emitted as RPN.

Clear the previous selector flag after flushing any pending parameter
data and before recording the newly selected parameter type.

Signed-off-by: Alyandra Zahran Nadhir <alyandra5b@xxxxxxxxx>
---
sound/core/ump_convert.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/sound/core/ump_convert.c b/sound/core/ump_convert.c
index 0a7972d91..b112064cb 100644
--- a/sound/core/ump_convert.c
+++ b/sound/core/ump_convert.c
@@ -378,6 +378,7 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
switch (buf[1]) {
case UMP_CC_RPN_MSB:
ret = fill_rpn(cc, midi2, true);
+ cc->nrpn_set = 0;
cc->rpn_set = 1;
cc->cc_rpn_msb = buf[2];
if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
@@ -385,6 +386,7 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
return ret;
case UMP_CC_RPN_LSB:
ret = fill_rpn(cc, midi2, true);
+ cc->nrpn_set = 0;
cc->rpn_set = 1;
cc->cc_rpn_lsb = buf[2];
if (cc->cc_rpn_msb == 0x7f && cc->cc_rpn_lsb == 0x7f)
@@ -392,11 +394,13 @@ static int cvt_legacy_cmd_to_ump(struct ump_cvt_to_ump *cvt,
return ret;
case UMP_CC_NRPN_MSB:
ret = fill_rpn(cc, midi2, true);
+ cc->rpn_set = 0;
cc->nrpn_set = 1;
cc->cc_nrpn_msb = buf[2];
return ret;
case UMP_CC_NRPN_LSB:
ret = fill_rpn(cc, midi2, true);
+ cc->rpn_set = 0;
cc->nrpn_set = 1;
cc->cc_nrpn_lsb = buf[2];
return ret;