Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/bridge: nwl-dsi: Use vsync/hsync polarity from display mode

Using the correct bit helps. The documentation specifies bit 0 in both
registers to be controlling polarity of dpi_vsync_input and
dpi_hsync_input polarity. Bit 1 is reserved, and should therefore not be
set.

Tested with panel that requires active high vsync and hsync.

Signed-off-by: Esben Haabendal <esben@geanix.com>
Reviewed-by: Robert Foss <rfoss@kernel.org>
Signed-off-by: Robert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240814-nwl-dsi-sync-polarity-v1-1-ee198e369196@geanix.com

authored by

Esben Haabendal and committed by
Robert Foss
8a879141 11c742bb

+6 -6
+4 -4
drivers/gpu/drm/bridge/nwl-dsi.c
··· 289 289 290 290 nwl_dsi_write(dsi, NWL_DSI_INTERFACE_COLOR_CODING, NWL_DSI_DPI_24_BIT); 291 291 nwl_dsi_write(dsi, NWL_DSI_PIXEL_FORMAT, color_format); 292 - /* 293 - * Adjusting input polarity based on the video mode results in 294 - * a black screen so always pick active low: 295 - */ 296 292 nwl_dsi_write(dsi, NWL_DSI_VSYNC_POLARITY, 293 + dsi->mode.flags & DRM_MODE_FLAG_PVSYNC ? 294 + NWL_DSI_VSYNC_POLARITY_ACTIVE_HIGH : 297 295 NWL_DSI_VSYNC_POLARITY_ACTIVE_LOW); 298 296 nwl_dsi_write(dsi, NWL_DSI_HSYNC_POLARITY, 297 + dsi->mode.flags & DRM_MODE_FLAG_PHSYNC ? 298 + NWL_DSI_HSYNC_POLARITY_ACTIVE_HIGH : 299 299 NWL_DSI_HSYNC_POLARITY_ACTIVE_LOW); 300 300 301 301 burst_mode = (dsi->dsi_mode_flags & MIPI_DSI_MODE_VIDEO_BURST) &&
+2 -2
drivers/gpu/drm/bridge/nwl-dsi.h
··· 30 30 #define NWL_DSI_PIXEL_FORMAT 0x20c 31 31 #define NWL_DSI_VSYNC_POLARITY 0x210 32 32 #define NWL_DSI_VSYNC_POLARITY_ACTIVE_LOW 0 33 - #define NWL_DSI_VSYNC_POLARITY_ACTIVE_HIGH BIT(1) 33 + #define NWL_DSI_VSYNC_POLARITY_ACTIVE_HIGH BIT(0) 34 34 35 35 #define NWL_DSI_HSYNC_POLARITY 0x214 36 36 #define NWL_DSI_HSYNC_POLARITY_ACTIVE_LOW 0 37 - #define NWL_DSI_HSYNC_POLARITY_ACTIVE_HIGH BIT(1) 37 + #define NWL_DSI_HSYNC_POLARITY_ACTIVE_HIGH BIT(0) 38 38 39 39 #define NWL_DSI_VIDEO_MODE 0x218 40 40 #define NWL_DSI_HFP 0x21c