aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tegra/rgb.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2013-12-12 05:06:55 -0500
committerThierry Reding <treding@nvidia.com>2013-12-20 09:56:07 -0500
commit72d302861530bcdb780ea57ebfc3dff6ec4f802c (patch)
tree07651dcd966b1502a18c1944268b8d31a8abdb0e /drivers/gpu/drm/tegra/rgb.c
parent8620fc629aeec02ac3b3735703940696386a3039 (diff)
drm/tegra: Relocate some output-specific code
Some of the code in the CRTC's mode setting code is specific to the RGB output or needs to be called slightly differently depending on the type of output. Push that code down into the output drivers. Signed-off-by: Thierry Reding <treding@nvidia.com>
Diffstat (limited to 'drivers/gpu/drm/tegra/rgb.c')
-rw-r--r--drivers/gpu/drm/tegra/rgb.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/gpu/drm/tegra/rgb.c b/drivers/gpu/drm/tegra/rgb.c
index 3b29018913a5..03885bb8dcc0 100644
--- a/drivers/gpu/drm/tegra/rgb.c
+++ b/drivers/gpu/drm/tegra/rgb.c
@@ -87,15 +87,60 @@ static void tegra_dc_write_regs(struct tegra_dc *dc,
87static int tegra_output_rgb_enable(struct tegra_output *output) 87static int tegra_output_rgb_enable(struct tegra_output *output)
88{ 88{
89 struct tegra_rgb *rgb = to_rgb(output); 89 struct tegra_rgb *rgb = to_rgb(output);
90 unsigned long value;
90 91
91 tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable)); 92 tegra_dc_write_regs(rgb->dc, rgb_enable, ARRAY_SIZE(rgb_enable));
92 93
94 value = DE_SELECT_ACTIVE | DE_CONTROL_NORMAL;
95 tegra_dc_writel(rgb->dc, value, DC_DISP_DATA_ENABLE_OPTIONS);
96
97 /* XXX: parameterize? */
98 value = tegra_dc_readl(rgb->dc, DC_COM_PIN_OUTPUT_POLARITY(1));
99 value &= ~LVS_OUTPUT_POLARITY_LOW;
100 value &= ~LHS_OUTPUT_POLARITY_LOW;
101 tegra_dc_writel(rgb->dc, value, DC_COM_PIN_OUTPUT_POLARITY(1));
102
103 /* XXX: parameterize? */
104 value = DISP_DATA_FORMAT_DF1P1C | DISP_ALIGNMENT_MSB |
105 DISP_ORDER_RED_BLUE;
106 tegra_dc_writel(rgb->dc, value, DC_DISP_DISP_INTERFACE_CONTROL);
107
108 /* XXX: parameterize? */
109 value = SC0_H_QUALIFIER_NONE | SC1_H_QUALIFIER_NONE;
110 tegra_dc_writel(rgb->dc, value, DC_DISP_SHIFT_CLOCK_OPTIONS);
111
112 value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_COMMAND);
113 value &= ~DISP_CTRL_MODE_MASK;
114 value |= DISP_CTRL_MODE_C_DISPLAY;
115 tegra_dc_writel(rgb->dc, value, DC_CMD_DISPLAY_COMMAND);
116
117 value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_POWER_CONTROL);
118 value |= PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE |
119 PW4_ENABLE | PM0_ENABLE | PM1_ENABLE;
120 tegra_dc_writel(rgb->dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
121
122 tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ << 8, DC_CMD_STATE_CONTROL);
123 tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL);
124
93 return 0; 125 return 0;
94} 126}
95 127
96static int tegra_output_rgb_disable(struct tegra_output *output) 128static int tegra_output_rgb_disable(struct tegra_output *output)
97{ 129{
98 struct tegra_rgb *rgb = to_rgb(output); 130 struct tegra_rgb *rgb = to_rgb(output);
131 unsigned long value;
132
133 value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_POWER_CONTROL);
134 value &= ~(PW0_ENABLE | PW1_ENABLE | PW2_ENABLE | PW3_ENABLE |
135 PW4_ENABLE | PM0_ENABLE | PM1_ENABLE);
136 tegra_dc_writel(rgb->dc, value, DC_CMD_DISPLAY_POWER_CONTROL);
137
138 value = tegra_dc_readl(rgb->dc, DC_CMD_DISPLAY_COMMAND);
139 value &= ~DISP_CTRL_MODE_MASK;
140 tegra_dc_writel(rgb->dc, value, DC_CMD_DISPLAY_COMMAND);
141
142 tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ << 8, DC_CMD_STATE_CONTROL);
143 tegra_dc_writel(rgb->dc, GENERAL_ACT_REQ, DC_CMD_STATE_CONTROL);
99 144
100 tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable)); 145 tegra_dc_write_regs(rgb->dc, rgb_disable, ARRAY_SIZE(rgb_disable));
101 146