]> git.baikalelectronics.ru Git - kernel.git/commit
drm/mipi-dsi: Fix byte order of 16-bit DCS set/get brightness
authorDaniel Mentz <danielmentz@google.com>
Mon, 16 Jan 2023 22:49:07 +0000 (17:49 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Mar 2023 08:33:14 +0000 (09:33 +0100)
commit6bf9fd724fef75bba8a809845ae0049b3f5c61fb
tree6f8595a958b72c3f71d64fb29616e0745311e33f
parenta185f95d6cb8abc3a600444e58dfb83d27433a32
drm/mipi-dsi: Fix byte order of 16-bit DCS set/get brightness

[ Upstream commit 8b3669030014d3546caaa5a66f4f16df4ed0cc57 ]

The MIPI DCS specification demands that brightness values are sent in
big endian byte order. It also states that one parameter (i.e. one byte)
shall be sent/received for 8 bit wide values, and two parameters shall
be used for values that are between 9 and 16 bits wide.

Add new functions to properly handle 16-bit brightness in big endian,
since the two 8- and 16-bit cases are distinct from each other.

[richard: use separate functions instead of switch/case]
[richard: split into 16-bit component]

Fixes: 4112f3481448 ("drm/dsi: Implement DCS set/get display brightness")
Signed-off-by: Daniel Mentz <danielmentz@google.com>
Link: https://android.googlesource.com/kernel/msm/+/754affd62d0ee268c686c53169b1dbb7deac8550
[richard: fix 16-bit brightness_get]
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
Tested-by: Caleb Connolly <caleb@connolly.tech>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20230116224909.23884-2-mailingradian@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/drm_mipi_dsi.c
include/drm/drm_mipi_dsi.h