summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorFancy Fang <chen.fang@nxp.com>2018-08-10 22:40:18 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commite0aff5d7bcb06c7e44e15604dadfae0d69557a68 (patch)
treeaacb171676dd54488547593392bd39935c364f8b /drivers/gpu
parentf35df59e6a0fe41980e710c84e8af494847df786 (diff)
MLK-19158-1 drm/imx: sec-dsim_imx: add bus format check for ENCODER
The connector's 'display_info' usually includes all the bus formats the display peripheral device can be accepted. And the DRM adjusted display mode's 'private_flags' includes bus format the DSIM bridge requested according to the DSI device display format. Add the bus format check to the DSIM encoder's atomic check to make sure these two bus formats have intersection. Signed-off-by: Fancy Fang <chen.fang@nxp.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/imx/sec_mipi_dsim-imx.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/drivers/gpu/drm/imx/sec_mipi_dsim-imx.c b/drivers/gpu/drm/imx/sec_mipi_dsim-imx.c
index bc985dd22fb3..548c3566bb9b 100644
--- a/drivers/gpu/drm/imx/sec_mipi_dsim-imx.c
+++ b/drivers/gpu/drm/imx/sec_mipi_dsim-imx.c
@@ -132,8 +132,30 @@ static int imx_sec_dsim_encoder_helper_atomic_check(struct drm_encoder *encoder,
struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state)
{
+ int i;
+ u32 bus_format;
+ unsigned int num_bus_formats;
+ struct imx_sec_dsim_device *dsim_dev = enc_to_dsim(encoder);
struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode;
struct imx_crtc_state *imx_crtc_state = to_imx_crtc_state(crtc_state);
+ struct drm_display_info *display_info = &conn_state->connector->display_info;
+
+ num_bus_formats = display_info->num_bus_formats;
+ if (unlikely(!num_bus_formats))
+ dev_warn(dsim_dev->dev, "no bus formats assigned by connector\n");
+
+ bus_format = adjusted_mode->private_flags & 0xffff;
+
+ for (i = 0; i < num_bus_formats; i++) {
+ if (display_info->bus_formats[i] != bus_format)
+ continue;
+ break;
+ }
+
+ if (i && i == num_bus_formats) {
+ dev_err(dsim_dev->dev, "invalid bus format for connector\n");
+ return -EINVAL;
+ }
/* sec dsim can only accept active hight DE */
imx_crtc_state->bus_flags |= DRM_BUS_FLAG_DE_HIGH;
@@ -144,7 +166,11 @@ static int imx_sec_dsim_encoder_helper_atomic_check(struct drm_encoder *encoder,
*/
imx_crtc_state->bus_flags |= DRM_BUS_FLAG_PIXDATA_NEGEDGE;
- imx_crtc_state->bus_format = adjusted_mode->private_flags & 0xffff;
+ /* set the bus format for CRTC output which should be
+ * the same as the bus format between dsim and connector,
+ * since dsim cannot do any pixel conversions.
+ */
+ imx_crtc_state->bus_format = bus_format;
return 0;
}