]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
soc: mediatek: mtk-mmsys: Add compile time check for mmsys routes
authorAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Wed, 12 Feb 2025 10:00:07 +0000 (11:00 +0100)
committerAngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Thu, 6 Mar 2025 10:54:20 +0000 (11:54 +0100)
commit854ac9c8885e5f7977864b40d217254cb8c6d6fb
tree28b4d210f54e10856da9d1bd04a87af249be7736
parent881d5094b138d002aab14922d41ec2058b9570c7
soc: mediatek: mtk-mmsys: Add compile time check for mmsys routes

Every MediaTek SoC with multimedia capabilities has an array of
structure mtk_mmsys_routes that defines a multimedia connection
between hardware components.

This connection is activated by writing a (masked) value in each
specific register, and the association between from->to path and
value to write is expressed as an entry in that array.

Failing to set the right path does not give any meaningful error
and makes things to simply not work as the data will either not
be retrieved from the right input port, or will be written to
the wrong output port (or both): since a misconfiguration may
effectively still be a possibly correct configuration at the HW
level, this may be only giving side effects in terms of simply
getting no functionality but, again, no errors.

In order to reduce room for mistakes in declarations of the
mmsys routes, add a macro that compile-time checks that the
provided value does at least fit in the register mask.

Link: https://lore.kernel.org/r/20250212100012.33001-4-angelogioacchino.delregno@collabora.com
Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
drivers/soc/mediatek/mtk-mmsys.h