]> www.infradead.org Git - users/jedix/linux-maple.git/commit
drm/mediatek: dp: Support flexible length of DP calibration data
authorFei Shao <fshao@chromium.org>
Wed, 4 Dec 2024 14:25:38 +0000 (22:25 +0800)
committerChun-Kuang Hu <chunkuang.hu@kernel.org>
Thu, 2 Jan 2025 13:40:27 +0000 (13:40 +0000)
commitba5811562988652d88de7503b3bd12da063ae729
tree0b979ecda5a105683f13360903aaa7c3f820b6b1
parent4f0d4a8218914da9e3bd56ec2cfb7a644472213d
drm/mediatek: dp: Support flexible length of DP calibration data

The DP calibration data is stored in nvmem cells, and the data layout is
described in the `mtk_dp_efuse_fmt` arrays for each platform.

There is no guarantee that the data is always a 4-length u32 cell array.
For example, MT8188 has a data length of 3, preventing it from passing
the preliminary check and undergoing calibration.

Update the logic to support flexible data lengths. Specifically, we
validate the length returned from `nvmem_cell_read()` against the
platform-specific efuse format. If out-of-bound access is detected, fall
back to the default calibration values. This likely indicates an error
in either the efuse data length described in DT or the efuse format
within the driver.

Signed-off-by: Fei Shao <fshao@chromium.org>
Reviewed-by: CK Hu <ck.hu@mediatek.com>
Link: https://patchwork.kernel.org/project/dri-devel/patch/20241204142626.158395-1-fshao@chromium.org/
Signed-off-by: Chun-Kuang Hu <chunkuang.hu@kernel.org>
drivers/gpu/drm/mediatek/mtk_dp.c