This is an automated email from the ASF dual-hosted git repository.

GUIDINGLI pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new dfd1bf6738a arch/arm64/imx9: skip unused PWM channel slots
dfd1bf6738a is described below

commit dfd1bf6738ac3b6b51b0c350eb3981a32af60bc0
Author: Royyan Zahir <[email protected]>
AuthorDate: Thu Oct 1 07:18:13 2026 +0400

    arch/arm64/imx9: skip unused PWM channel slots
    
    A channel number of zero marks an unused slot, as pwm.rst documents.
    pwm_start() handed every slot to pwm_update_duty(), which refuses
    channel 0, so a caller that fills only some slots, like PX4's tone
    alarm, got EINVAL.
    
    Signed-off-by: Royyan Zahir <[email protected]>
---
 arch/arm64/src/imx9/imx9_flexio_pwm.c | 5 +++++
 arch/arm64/src/imx9/imx9_tpm_pwm.c    | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/arch/arm64/src/imx9/imx9_flexio_pwm.c 
b/arch/arm64/src/imx9/imx9_flexio_pwm.c
index be123a464d1..4d05a15b115 100644
--- a/arch/arm64/src/imx9/imx9_flexio_pwm.c
+++ b/arch/arm64/src/imx9/imx9_flexio_pwm.c
@@ -602,6 +602,11 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
           break;
         }
 
+      if (info->channels[i].channel == 0)
+        {
+          continue;
+        }
+
       ret = pwm_update_duty(priv, info->channels[i].channel,
                             info->channels[i].duty);
     }
diff --git a/arch/arm64/src/imx9/imx9_tpm_pwm.c 
b/arch/arm64/src/imx9/imx9_tpm_pwm.c
index bfc7884d92d..35a639f9225 100644
--- a/arch/arm64/src/imx9/imx9_tpm_pwm.c
+++ b/arch/arm64/src/imx9/imx9_tpm_pwm.c
@@ -541,6 +541,11 @@ static int pwm_start(struct pwm_lowerhalf_s *dev,
           break;
         }
 
+      if (info->channels[i].channel == 0)
+        {
+          continue;
+        }
+
       ret = pwm_update_duty(priv, info->channels[i].channel,
                             info->channels[i].duty);
     }

Reply via email to