drm: bridge: icn6211: Adjust clock phase using SYS_CTRL_1
authorJonathan Liu <net147@gmail.com>
Mon, 23 May 2022 13:01:44 +0000 (23:01 +1000)
committerRobert Foss <robert.foss@linaro.org>
Thu, 26 May 2022 12:02:55 +0000 (14:02 +0200)
commit9180c30cd61aa0b2f0eb4791c8e490c8c5abc54c
tree99bf3d3de3a756cba95281224ba1b710e44de045
parentf4d8aec6e4bf0a554388f30d555657cfb0d6e8c4
drm: bridge: icn6211: Adjust clock phase using SYS_CTRL_1

The code from [1] sets SYS_CTRL_1 to different values depending on the
desired clock phase (0, 1/4, 1/2 or 3/4). A clock phase of 0 aligns the
positive edge of the clock with the pixel data while other values delay
the clock by a fraction of the clock period. A clock phase of 1/2 aligns
the negative edge of the clock with the pixel data.

The driver currently hard codes SYS_CTRL_1 to 0x88 which corresponds to
aligning the positive edge of the clock with the pixel data. This won't
work correctly for panels that require aligning the negative edge of the
clock with the pixel data.

Adjust the clock phase to 0 if DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE is
present in bus_flags, otherwise adjust the clock phase to 1/2 as
appropriate for DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE.

[1] https://github.com/tdjastrzebski/ICN6211-Configurator

Signed-off-by: Jonathan Liu <net147@gmail.com>
Reviewed-by: Marek Vasut <marex@denx.de>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20220523130144.444225-1-net147@gmail.com
drivers/gpu/drm/bridge/chipone-icn6211.c