Skip to content

Commit 53dc19e

Browse files
thierryredingmaximschwalm
authored andcommitted
drm/tegra: rgb: Parameterize V- and H-sync polarities
The polarities of the V- and H-sync signals are encoded as flags in the display mode, so use the existing information to setup the signals for the RGB interface. Signed-off-by: Thierry Reding <[email protected]>
1 parent d640b4d commit 53dc19e

File tree

1 file changed

+15
-3
lines changed
  • drivers/gpu/drm/tegra

1 file changed

+15
-3
lines changed

drivers/gpu/drm/tegra/rgb.c

+15-3
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ static void tegra_rgb_encoder_disable(struct drm_encoder *encoder)
9999

100100
static void tegra_rgb_encoder_enable(struct drm_encoder *encoder)
101101
{
102+
struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
102103
struct tegra_output *output = encoder_to_output(encoder);
103104
struct tegra_rgb *rgb = to_rgb(output);
104105
u32 value;
@@ -108,10 +109,21 @@ static void tegra_rgb_encoder_enable(struct drm_encoder *encoder)
108109
value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL;
109110
tegra_dc_writel(rgb->dc, value, DC_DISP_DATA_ENABLE_OPTIONS);
110111

111-
/* XXX: parameterize? */
112+
/* configure H- and V-sync signal polarities */
112113
value = tegra_dc_readl(rgb->dc, DC_COM_PIN_OUTPUT_POLARITY(1));
113-
value &= ~LVS_OUTPUT_POLARITY_LOW;
114-
value &= ~LHS_OUTPUT_POLARITY_LOW;
114+
115+
if (mode->flags & DRM_MODE_FLAG_PHSYNC)
116+
value &= ~LHS_OUTPUT_POLARITY_LOW;
117+
118+
if (mode->flags & DRM_MODE_FLAG_NHSYNC)
119+
value |= LHS_OUTPUT_POLARITY_LOW;
120+
121+
if (mode->flags & DRM_MODE_FLAG_PVSYNC)
122+
value &= ~LVS_OUTPUT_POLARITY_LOW;
123+
124+
if (mode->flags & DRM_MODE_FLAG_NVSYNC)
125+
value |= LVS_OUTPUT_POLARITY_LOW;
126+
115127
tegra_dc_writel(rgb->dc, value, DC_COM_PIN_OUTPUT_POLARITY(1));
116128

117129
/* XXX: parameterize? */

0 commit comments

Comments
 (0)