@@ -34,7 +34,7 @@ struct reg_entry {
34
34
unsigned long value ;
35
35
};
36
36
37
- static struct reg_entry rgb_enable [] = {
37
+ static const struct reg_entry rgb_enable [] = {
38
38
{ DC_COM_PIN_OUTPUT_ENABLE (0 ), 0x00000000 },
39
39
{ DC_COM_PIN_OUTPUT_ENABLE (1 ), 0x00000000 },
40
40
{ DC_COM_PIN_OUTPUT_ENABLE (2 ), 0x00000000 },
@@ -99,34 +99,51 @@ static void tegra_rgb_encoder_disable(struct drm_encoder *encoder)
99
99
100
100
static void tegra_rgb_encoder_enable (struct drm_encoder * encoder )
101
101
{
102
+ struct drm_display_mode * mode = & encoder -> crtc -> state -> adjusted_mode ;
102
103
struct tegra_output * output = encoder_to_output (encoder );
104
+ struct drm_connector * connector = drm_panel_bridge_connector (output -> bridge );
103
105
struct tegra_rgb * rgb = to_rgb (output );
104
106
u32 value ;
105
107
106
- /*
107
- * Temporal hack for S6E63M0
108
- *
109
- * Pins DATA_ENABLE, H_SYNC, V_SYNC, PIXEL_CLOCK are low polarity,
110
- * set this in the registers to make the panel working.
111
- */
112
- if (of_machine_is_compatible ("samsung,i927" ))
113
- rgb_enable [7 ].value = 0x00000100 ;
114
-
115
108
tegra_dc_write_regs (rgb -> dc , rgb_enable , ARRAY_SIZE (rgb_enable ));
116
109
117
110
value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL ;
118
111
tegra_dc_writel (rgb -> dc , value , DC_DISP_DATA_ENABLE_OPTIONS );
119
112
120
- /* XXX: parameterize? */
113
+ /* configure H- and V-sync and pixel clock signal polarities */
121
114
value = tegra_dc_readl (rgb -> dc , DC_COM_PIN_OUTPUT_POLARITY (1 ));
122
- value &= ~LVS_OUTPUT_POLARITY_LOW ;
123
- value &= ~LHS_OUTPUT_POLARITY_LOW ;
124
- if (of_machine_is_compatible ("samsung,i927" )) {
125
- value |= LVS_OUTPUT_POLARITY_LOW ;
115
+
116
+ if (mode -> flags & DRM_MODE_FLAG_PHSYNC )
117
+ value &= ~LHS_OUTPUT_POLARITY_LOW ;
118
+
119
+ if (mode -> flags & DRM_MODE_FLAG_NHSYNC )
126
120
value |= LHS_OUTPUT_POLARITY_LOW ;
127
- }
121
+
122
+ if (mode -> flags & DRM_MODE_FLAG_PVSYNC )
123
+ value &= ~LVS_OUTPUT_POLARITY_LOW ;
124
+
125
+ if (mode -> flags & DRM_MODE_FLAG_NVSYNC )
126
+ value |= LVS_OUTPUT_POLARITY_LOW ;
127
+
128
+ if (connector -> display_info .bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE )
129
+ value &= ~LSC0_OUTPUT_POLARITY_LOW ;
130
+
131
+ if (connector -> display_info .bus_flags & DRM_BUS_FLAG_PIXDATA_DRIVE_NEGEDGE )
132
+ value |= LSC0_OUTPUT_POLARITY_LOW ;
133
+
128
134
tegra_dc_writel (rgb -> dc , value , DC_COM_PIN_OUTPUT_POLARITY (1 ));
129
135
136
+ /* configure DE signal polarities */
137
+ value = tegra_dc_readl (rgb -> dc , DC_COM_PIN_OUTPUT_POLARITY (3 ));
138
+
139
+ if (connector -> display_info .bus_flags & DRM_BUS_FLAG_DE_HIGH )
140
+ value &= ~LSPI_OUTPUT_POLARITY_LOW ;
141
+
142
+ if (connector -> display_info .bus_flags & DRM_BUS_FLAG_DE_LOW )
143
+ value |= LSPI_OUTPUT_POLARITY_LOW ;
144
+
145
+ tegra_dc_writel (rgb -> dc , value , DC_COM_PIN_OUTPUT_POLARITY (3 ));
146
+
130
147
/* XXX: parameterize? */
131
148
if (of_machine_is_compatible ("samsung,i927" )) {
132
149
/* Set DISP_COLOR_SWAP bit to swap red and blue colors */
0 commit comments