← Back to Pull requests

mcux: sdk-ng: lpc546xx: fix clock rate getters #841

Closed
unknown closed this pull request without merging on Oct 23, 2026 03:47 UTC
View on GitHub
unknown unknown commented on Oct 20, 2026 11:59 UTC
Author

Three clock rate getters in the LPC54628 and LPC54608 fsl_clock.c do not match the clock selector encodings:

| Getter | Selector | Returned | Selects |
|---|---|---|---|
| CLOCK_GetFlexCommClkFreq() | FCLKSEL = 2 | system PLL | audio PLL |
| CLOCK_GetDmicClkFreq() | DMICCLKSEL = 1 | fro_hf | fro_hf_div (FROHFCLKDIV ignored) |
| CLOCK_GetDmicClkFreq() | DMICCLKSEL = 2 | system PLL | audio PLL |
| CLOCK_GetDmicClkFreq() | DMICCLKSEL = 4, 5 | main clock, watchdog osc | reserved |
| CLOCK_GetAsyncApbClkFreq() | ASYNCAPBCLKSELA = 2 | 0 | audio PLL |

References:

  • UM10912 (LPC546xx User manual) Rev. 2.4: Table 157 (FCLKSEL), Table 160 (DMICCLKSEL), Table 240 (ASYNCAPBCLKSELA).

  • The SEL field descriptions in mcux/mcux-sdk-ng/devices/LPC/LPC54000/periph/PERI_SYSCON.h and PERI_ASYNC_SYSCON.h.

  • The attach IDs in the same fsl_clock.h, e.g. kAUDIO_PLL_to_FLEXCOMM6 = MUX_A(CM_FXCOMCLKSEL6, 2), kAUDIO_PLL_to_DMIC = MUX_A(CM_DMICCLKSEL, 2), kAUDIO_PLL_to_ASYNC_APB = MUX_A(CM_ASYNCAPB, 2).

  • LPC54S018/drivers/fsl_clock.c already returns CLOCK_GetAudioPllOutFreq() for FCLKSEL = 2.
  • Zephyr reads these through clock_control_get_rate(): i2s_mcux_flexcomm derives its bit clock divider from the FlexComm rate, dmic_mcux checks the PDM clock range and derives the oversampling ratio from the DMIC rate, and the CTIMER3/4 counters use the async APB rate.

    ASYNCAPBCLKSELA = 3 (FlexComm 6 clock) still returns 0: switching the async APB bridge to it stalled the bus on hardware, so its rate could not be verified.

    Diff: 196 lines (+147 / -49) across 2 files Reviewer: zejiang0jason Review duration: 3828m
    All Vouch review confidence checks passed
    Residual risk 0.14 = Change Risk (0.36) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.36 · 196 lines diff across 2 files
    0.36
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.316
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #841"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 36.1% (MEDIUM) · Higher = larger blast radius
    36.1%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.2% · Safe to merge
    14.2%