[PATCH v2 09/14] asm-generic: unaligned: add get_unaligned_le24()
Julien Stephan <[email protected]>
| Newsgroups | org.u-boot-project.lists.u-boot |
|---|---|
| Message-ID | <20260826-add-genio-510-and-genio-700-hdmi-v2-9-68ebb1bf17df@baylibre.com> |
Add get_unaligned_le24(), mirroring the helper of the same name in Linux, to read a 24-bit little-endian value from a possibly unaligned buffer. The MediaTek HDMI driver uses it to pack InfoFrame bytes into the 24-bit little-endian controller register fields. Signed-off-by: Julien Stephan <[email protected]> --- include/asm-generic/unaligned.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/asm-generic/unaligned.h b/include/asm-generic/unaligned.h index 9e5d93ec304..8a181ba6682 100644 --- a/include/asm-generic/unaligned.h +++ b/include/asm-generic/unaligned.h @@ -32,6 +32,13 @@ static inline u64 get_unaligned_le64(const void *p) return le64_to_cpu(__get_unaligned_t(__le64, p)); } +static inline u32 get_unaligned_le24(const void *p) +{ + const u8 *_p = p; + + return _p[0] | _p[1] << 8 | _p[2] << 16; +} + static inline void put_unaligned_le16(u16 val, void *p) { __put_unaligned_t(__le16, cpu_to_le16(val), p); -- 2.54.0