drm/bridge/synopsys: dsi: use common mipi_dsi_create_packet()
authorBrian Norris <briannorris@chromium.org>
Tue, 9 Jan 2018 20:32:47 +0000 (12:32 -0800)
committerArchit Taneja <architt@codeaurora.org>
Tue, 16 Jan 2018 06:14:01 +0000 (11:44 +0530)
commitad95dc86e67ec8c044b560891576d8eea87251aa
tree8ac3a85304a5f9079dc59ae77480416d87f29c2d
parent552de1bf4daea12eb3aec69763da8f4ad9d87258
drm/bridge/synopsys: dsi: use common mipi_dsi_create_packet()

This takes care of 2 TODOs in this driver, by using the common DSI
packet-marshalling code instead of our custom short/long write code.
This both saves us some duplicated code and gets us free support for
command types that weren't already part of our switch block (e.g.,
MIPI_DSI_GENERIC_LONG_WRITE).

The code logic stays mostly intact, except that it becomes unnecessary
to split the short/long write functions, and we have to copy data a bit
more.

Along the way, I noticed that loop bounds were a little odd:

while (DIV_ROUND_UP(len, pld_data_bytes))

This really was just supposed to be 'len != 0', so I made that more
clear.

Tested on RK3399 with some pending refactoring patches by Nickey Yang,
to make the Rockchip DSI driver wrap this common driver.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Tested-by: Philippe Cornu <philippe.cornu@st.com>
Signed-off-by: Archit Taneja <architt@codeaurora.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180109203248.139249-1-briannorris@chromium.org
drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c