Skip to content

Commit

Permalink
drm/tegra: rgb: Parameterize V- and H-sync polarities
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
thierryreding authored and maximschwalm committed Aug 8, 2023
1 parent d640b4d commit 53dc19e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions drivers/gpu/drm/tegra/rgb.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ static void tegra_rgb_encoder_disable(struct drm_encoder *encoder)

static void tegra_rgb_encoder_enable(struct drm_encoder *encoder)
{
struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode;
struct tegra_output *output = encoder_to_output(encoder);
struct tegra_rgb *rgb = to_rgb(output);
u32 value;
Expand All @@ -108,10 +109,21 @@ static void tegra_rgb_encoder_enable(struct drm_encoder *encoder)
value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL;
tegra_dc_writel(rgb->dc, value, DC_DISP_DATA_ENABLE_OPTIONS);

/* XXX: parameterize? */
/* configure H- and V-sync signal polarities */
value = tegra_dc_readl(rgb->dc, DC_COM_PIN_OUTPUT_POLARITY(1));
value &= ~LVS_OUTPUT_POLARITY_LOW;
value &= ~LHS_OUTPUT_POLARITY_LOW;

if (mode->flags & DRM_MODE_FLAG_PHSYNC)
value &= ~LHS_OUTPUT_POLARITY_LOW;

if (mode->flags & DRM_MODE_FLAG_NHSYNC)
value |= LHS_OUTPUT_POLARITY_LOW;

if (mode->flags & DRM_MODE_FLAG_PVSYNC)
value &= ~LVS_OUTPUT_POLARITY_LOW;

if (mode->flags & DRM_MODE_FLAG_NVSYNC)
value |= LVS_OUTPUT_POLARITY_LOW;

tegra_dc_writel(rgb->dc, value, DC_COM_PIN_OUTPUT_POLARITY(1));

/* XXX: parameterize? */
Expand Down

0 comments on commit 53dc19e

Please sign in to comment.