Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

[HAL][DSI] Provide a way to get the HAL_DSI_DataRate entry matching a lane rate

未关闭
#8 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
45/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
停滞
技术栈
c
领域
embedded-iot

调研方向

Start by reviewing the referenced pull request, then inspect stm32mp2xx_hal_dsi.c and stm32mp2xx_hal_dsi.h where the helper and prototype would belong. Check the existing HAL_DSI_DataRate enumeration and confirm the requested NULL handling and lane-rate boundary behavior. Done means the public API is implemented consistently with the enumeration and validated by the project’s available checks.

由索引模型根据 Issue 内容生成。

描述

Context

On STM32MP2, HAL_DSI_Init() uses DSI_InitTypeDef.PhyDataRate to select the PLL
and PHY regulation settings. This field is of type HAL_DSI_DataRate, whose values
are plain indexes (HAL_DSI_DT_80, HAL_DSI_DT_90, ... HAL_DSI_DT_2500). The lane
rate of each entry only appears in the enumerator names. The table of rates is not
exposed by the HAL.

Problem

A driver that computes the DSI lane rate at runtime from the PLL configuration (for
example the Zephyr STM32 LTDC/DSI display driver, which derives it from the
devicetree clock settings) has to pick the matching HAL_DSI_DataRate entry. The only
way to do that today is to copy the full list of rates (63 entries, from 80 to
2500 Mbps) into the driver and keep it in sync with the enumeration by hand.

This duplicates HAL-internal knowledge in every user and can break silently if the
enumeration changes in a future STM32CubeMP2 release.

Proposal

Add a helper to the DSI HAL that returns the HAL_DSI_DataRate entry for a given lane
rate, so the table stays next to the enumeration it describes:

HAL_StatusTypeDef HAL_DSI_GetPhyDataRate(uint32_t LaneRateMbps,
                                         HAL_DSI_DataRate *PhyDataRate);
  • Returns HAL_ERROR if PhyDataRate is NULL.
  • Returns HAL_DSI_DT_2500 for lane rates of 2450 Mbps and above.
  • The result can be written directly to DSI_InitTypeDef.PhyDataRate.

A reference implementation (about 40 lines in stm32mp2xx_hal_dsi.c plus a prototype
in stm32mp2xx_hal_dsi.h) is available here:
Pull request

Motivation / downstream

We plan to carry this change as a local patch in Zephyr's hal_stm32 module
(stm32cube/stm32mp2xx, based on STM32CubeMP2 v1.3.0) for the STM32MP2 DSI driver.
Zephyr asks that such patches be reported upstream first. Having this API (or an
equivalent, such as exposing the rate table) in STM32CubeMP2 would let us drop the
patch at the next Cube update.

We would also like to know if ST prefers another approach, for example a macro or a
public table.

主要语言
C
星标
19
派生
6
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

STMicroelectronics/STM32CubeMP2 的其他 Issue

查看 STMicroelectronics/STM32CubeMP2 的全部 Issue

相似的 Issue

更多 C Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。