drm: bridge: ti-sn65dsi83: Retrieve output format from bridge state
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 21 Jun 2021 12:55:17 +0000 (15:55 +0300)
committerRobert Foss <robert.foss@linaro.org>
Tue, 22 Jun 2021 08:15:56 +0000 (10:15 +0200)
commit03ea01c0c295fc93291adc842e9d6a72bd57e1f7
treeee0193e2ee8fe96c84cb2709252c5d5fc13e3b4e
parenta6ea7d268a6348ba252d01deeb5df28f361439e5
drm: bridge: ti-sn65dsi83: Retrieve output format from bridge state

The driver currently iterates over all connectors to get the bus format,
used to configure the LVDS output format. This causes several issues:

- If other connectors than the LVDS output are present, the format used
  by the driver may end up belonging to an entirely different output.

- The code can crash if some connectors are not connected, as bus_format
  may then be NULL.

- There's no guarantee that the bus format on the connector at the
  output of the pipeline matches the output of the sn65dsi83, as there
  may be other bridges in the pipeline.

Solve this by retrieving the format from the bridge state instead, which
provides the format corresponding to the output of the bridge.

The struct sn65dsi83 lvds_format_24bpp and lvds_format_jeida fields are
moved to local variables in sn65dsi83_atomic_enable() as they're now
used in that function only.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210621125518.13715-5-laurent.pinchart@ideasonboard.com
drivers/gpu/drm/bridge/ti-sn65dsi83.c