aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/sti
diff options
context:
space:
mode:
authorVincent Abriou <vincent.abriou@st.com>2016-09-20 09:03:33 -0400
committerVincent Abriou <vincent.abriou@st.com>2016-09-20 09:03:33 -0400
commitb4bba92dfbe23ccc4f1f6c93db88c39c10aa075a (patch)
treee289790b68206cc95efa3e1eeaf1b69545776d8d /drivers/gpu/drm/sti
parent38fdb8d95f8496f0db4fb1071998d27a35ba16a8 (diff)
drm/sti: remove stih415-416 platform support
stih415 and stih416 platform are obsolete and no more supported. Only stih407 and stih410 platform are maintained. Signed-off-by: Vincent Abriou <vincent.abriou@st.com> Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Acked-by: Peter Griffin <peter.griffin@linaro.org>
Diffstat (limited to 'drivers/gpu/drm/sti')
-rw-r--r--drivers/gpu/drm/sti/Kconfig6
-rw-r--r--drivers/gpu/drm/sti/Makefile1
-rw-r--r--drivers/gpu/drm/sti/sti_compositor.c19
-rw-r--r--drivers/gpu/drm/sti/sti_hda.c39
-rw-r--r--drivers/gpu/drm/sti/sti_hdmi.c20
-rw-r--r--drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c336
-rw-r--r--drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h14
-rw-r--r--drivers/gpu/drm/sti/sti_mixer.c19
-rw-r--r--drivers/gpu/drm/sti/sti_tvout.c40
9 files changed, 14 insertions, 480 deletions
diff --git a/drivers/gpu/drm/sti/Kconfig b/drivers/gpu/drm/sti/Kconfig
index 494ab257f77c..acd72865feac 100644
--- a/drivers/gpu/drm/sti/Kconfig
+++ b/drivers/gpu/drm/sti/Kconfig
@@ -1,6 +1,6 @@
1config DRM_STI 1config DRM_STI
2 tristate "DRM Support for STMicroelectronics SoC stiH41x Series" 2 tristate "DRM Support for STMicroelectronics SoC stiH4xx Series"
3 depends on DRM && (SOC_STIH415 || SOC_STIH416 || ARCH_MULTIPLATFORM) 3 depends on DRM && (ARCH_STI || ARCH_MULTIPLATFORM)
4 select RESET_CONTROLLER 4 select RESET_CONTROLLER
5 select DRM_KMS_HELPER 5 select DRM_KMS_HELPER
6 select DRM_GEM_CMA_HELPER 6 select DRM_GEM_CMA_HELPER
@@ -9,4 +9,4 @@ config DRM_STI
9 select FW_LOADER 9 select FW_LOADER
10 select SND_SOC_HDMI_CODEC if SND_SOC 10 select SND_SOC_HDMI_CODEC if SND_SOC
11 help 11 help
12 Choose this option to enable DRM on STM stiH41x chipset 12 Choose this option to enable DRM on STM stiH4xx chipset
diff --git a/drivers/gpu/drm/sti/Makefile b/drivers/gpu/drm/sti/Makefile
index b8057620b3b3..d20f7c0b4eac 100644
--- a/drivers/gpu/drm/sti/Makefile
+++ b/drivers/gpu/drm/sti/Makefile
@@ -9,7 +9,6 @@ sti-drm-y := \
9 sti_crtc.o \ 9 sti_crtc.o \
10 sti_plane.o \ 10 sti_plane.o \
11 sti_hdmi.o \ 11 sti_hdmi.o \
12 sti_hdmi_tx3g0c55phy.o \
13 sti_hdmi_tx3g4c28phy.o \ 12 sti_hdmi_tx3g4c28phy.o \
14 sti_dvo.o \ 13 sti_dvo.o \
15 sti_awg_utils.o \ 14 sti_awg_utils.o \
diff --git a/drivers/gpu/drm/sti/sti_compositor.c b/drivers/gpu/drm/sti/sti_compositor.c
index a6f391b71d7a..f62041fe8412 100644
--- a/drivers/gpu/drm/sti/sti_compositor.c
+++ b/drivers/gpu/drm/sti/sti_compositor.c
@@ -39,22 +39,6 @@ static const struct sti_compositor_data stih407_compositor_data = {
39 }, 39 },
40}; 40};
41 41
42/*
43 * stiH416 compositor properties
44 * Note:
45 * on stih416 MIXER_AUX has a different base address from MIXER_MAIN
46 * Moreover, GDPx is different for Main and Aux Mixer. So this subdev map does
47 * not fit for stiH416 if we want to enable the MIXER_AUX.
48 */
49static const struct sti_compositor_data stih416_compositor_data = {
50 .nb_subdev = 3,
51 .subdev_desc = {
52 {STI_GPD_SUBDEV, (int)STI_GDP_0, 0x100},
53 {STI_GPD_SUBDEV, (int)STI_GDP_1, 0x200},
54 {STI_MIXER_MAIN_SUBDEV, STI_MIXER_MAIN, 0xC00}
55 },
56};
57
58int sti_compositor_debugfs_init(struct sti_compositor *compo, 42int sti_compositor_debugfs_init(struct sti_compositor *compo,
59 struct drm_minor *minor) 43 struct drm_minor *minor)
60{ 44{
@@ -179,9 +163,6 @@ static const struct component_ops sti_compositor_ops = {
179 163
180static const struct of_device_id compositor_of_match[] = { 164static const struct of_device_id compositor_of_match[] = {
181 { 165 {
182 .compatible = "st,stih416-compositor",
183 .data = &stih416_compositor_data,
184 }, {
185 .compatible = "st,stih407-compositor", 166 .compatible = "st,stih407-compositor",
186 .data = &stih407_compositor_data, 167 .data = &stih407_compositor_data,
187 }, { 168 }, {
diff --git a/drivers/gpu/drm/sti/sti_hda.c b/drivers/gpu/drm/sti/sti_hda.c
index a225c4d5189a..e7c243f70870 100644
--- a/drivers/gpu/drm/sti/sti_hda.c
+++ b/drivers/gpu/drm/sti/sti_hda.c
@@ -62,14 +62,8 @@
62#define SCALE_CTRL_CR_DFLT 0x00DB0249 62#define SCALE_CTRL_CR_DFLT 0x00DB0249
63 63
64/* Video DACs control */ 64/* Video DACs control */
65#define VIDEO_DACS_CONTROL_MASK 0x0FFF
66#define VIDEO_DACS_CONTROL_SYSCFG2535 0x085C /* for stih416 */
67#define DAC_CFG_HD_OFF_SHIFT 5
68#define DAC_CFG_HD_OFF_MASK (0x7 << DAC_CFG_HD_OFF_SHIFT)
69#define VIDEO_DACS_CONTROL_SYSCFG5072 0x0120 /* for stih407 */
70#define DAC_CFG_HD_HZUVW_OFF_MASK BIT(1) 65#define DAC_CFG_HD_HZUVW_OFF_MASK BIT(1)
71 66
72
73/* Upsampler values for the alternative 2X Filter */ 67/* Upsampler values for the alternative 2X Filter */
74#define SAMPLER_COEF_NB 8 68#define SAMPLER_COEF_NB 8
75#define HDA_ANA_SRC_Y_CFG_ALT_2X 0x01130000 69#define HDA_ANA_SRC_Y_CFG_ALT_2X 0x01130000
@@ -300,28 +294,14 @@ static bool hda_get_mode_idx(struct drm_display_mode mode, int *idx)
300 */ 294 */
301static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable) 295static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable)
302{ 296{
303 u32 mask;
304
305 if (hda->video_dacs_ctrl) { 297 if (hda->video_dacs_ctrl) {
306 u32 val; 298 u32 val;
307 299
308 switch ((u32)hda->video_dacs_ctrl & VIDEO_DACS_CONTROL_MASK) {
309 case VIDEO_DACS_CONTROL_SYSCFG2535:
310 mask = DAC_CFG_HD_OFF_MASK;
311 break;
312 case VIDEO_DACS_CONTROL_SYSCFG5072:
313 mask = DAC_CFG_HD_HZUVW_OFF_MASK;
314 break;
315 default:
316 DRM_INFO("Video DACS control register not supported\n");
317 return;
318 }
319
320 val = readl(hda->video_dacs_ctrl); 300 val = readl(hda->video_dacs_ctrl);
321 if (enable) 301 if (enable)
322 val &= ~mask; 302 val &= ~DAC_CFG_HD_HZUVW_OFF_MASK;
323 else 303 else
324 val |= mask; 304 val |= DAC_CFG_HD_HZUVW_OFF_MASK;
325 305
326 writel(val, hda->video_dacs_ctrl); 306 writel(val, hda->video_dacs_ctrl);
327 } 307 }
@@ -352,24 +332,11 @@ static void hda_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
352static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg) 332static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg)
353{ 333{
354 u32 val = readl(reg); 334 u32 val = readl(reg);
355 u32 mask;
356
357 switch ((u32)reg & VIDEO_DACS_CONTROL_MASK) {
358 case VIDEO_DACS_CONTROL_SYSCFG2535:
359 mask = DAC_CFG_HD_OFF_MASK;
360 break;
361 case VIDEO_DACS_CONTROL_SYSCFG5072:
362 mask = DAC_CFG_HD_HZUVW_OFF_MASK;
363 break;
364 default:
365 DRM_DEBUG_DRIVER("Warning: DACS ctrl register not supported\n");
366 return;
367 }
368 335
369 seq_puts(s, "\n"); 336 seq_puts(s, "\n");
370 seq_printf(s, "\n %-25s 0x%08X", "VIDEO_DACS_CONTROL", val); 337 seq_printf(s, "\n %-25s 0x%08X", "VIDEO_DACS_CONTROL", val);
371 seq_puts(s, "\tHD DACs "); 338 seq_puts(s, "\tHD DACs ");
372 seq_puts(s, val & mask ? "disabled" : "enabled"); 339 seq_puts(s, val & DAC_CFG_HD_HZUVW_OFF_MASK ? "disabled" : "enabled");
373} 340}
374 341
375static int hda_dbg_show(struct seq_file *s, void *data) 342static int hda_dbg_show(struct seq_file *s, void *data)
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c
index 1f9e7b4ef2d5..376b0763c874 100644
--- a/drivers/gpu/drm/sti/sti_hdmi.c
+++ b/drivers/gpu/drm/sti/sti_hdmi.c
@@ -22,7 +22,6 @@
22 22
23#include "sti_hdmi.h" 23#include "sti_hdmi.h"
24#include "sti_hdmi_tx3g4c28phy.h" 24#include "sti_hdmi_tx3g4c28phy.h"
25#include "sti_hdmi_tx3g0c55phy.h"
26#include "sti_vtg.h" 25#include "sti_vtg.h"
27 26
28#define HDMI_CFG 0x0000 27#define HDMI_CFG 0x0000
@@ -1374,9 +1373,6 @@ static const struct component_ops sti_hdmi_ops = {
1374 1373
1375static const struct of_device_id hdmi_of_match[] = { 1374static const struct of_device_id hdmi_of_match[] = {
1376 { 1375 {
1377 .compatible = "st,stih416-hdmi",
1378 .data = &tx3g0c55phy_ops,
1379 }, {
1380 .compatible = "st,stih407-hdmi", 1376 .compatible = "st,stih407-hdmi",
1381 .data = &tx3g4c28phy_ops, 1377 .data = &tx3g4c28phy_ops,
1382 }, { 1378 }, {
@@ -1423,22 +1419,6 @@ static int sti_hdmi_probe(struct platform_device *pdev)
1423 goto release_adapter; 1419 goto release_adapter;
1424 } 1420 }
1425 1421
1426 if (of_device_is_compatible(np, "st,stih416-hdmi")) {
1427 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
1428 "syscfg");
1429 if (!res) {
1430 DRM_ERROR("Invalid syscfg resource\n");
1431 ret = -ENOMEM;
1432 goto release_adapter;
1433 }
1434 hdmi->syscfg = devm_ioremap_nocache(dev, res->start,
1435 resource_size(res));
1436 if (!hdmi->syscfg) {
1437 ret = -ENOMEM;
1438 goto release_adapter;
1439 }
1440 }
1441
1442 hdmi->phy_ops = (struct hdmi_phy_ops *) 1422 hdmi->phy_ops = (struct hdmi_phy_ops *)
1443 of_match_node(hdmi_of_match, np)->data; 1423 of_match_node(hdmi_of_match, np)->data;
1444 1424
diff --git a/drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c b/drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c
deleted file mode 100644
index 49ae8e44b285..000000000000
--- a/drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.c
+++ /dev/null
@@ -1,336 +0,0 @@
1/*
2 * Copyright (C) STMicroelectronics SA 2014
3 * Author: Vincent Abriou <vincent.abriou@st.com> for STMicroelectronics.
4 * License terms: GNU General Public License (GPL), version 2
5 */
6
7#include "sti_hdmi_tx3g0c55phy.h"
8
9#define HDMI_SRZ_PLL_CFG 0x0504
10#define HDMI_SRZ_TAP_1 0x0508
11#define HDMI_SRZ_TAP_2 0x050C
12#define HDMI_SRZ_TAP_3 0x0510
13#define HDMI_SRZ_CTRL 0x0514
14
15#define HDMI_SRZ_PLL_CFG_POWER_DOWN BIT(0)
16#define HDMI_SRZ_PLL_CFG_VCOR_SHIFT 1
17#define HDMI_SRZ_PLL_CFG_VCOR_425MHZ 0
18#define HDMI_SRZ_PLL_CFG_VCOR_850MHZ 1
19#define HDMI_SRZ_PLL_CFG_VCOR_1700MHZ 2
20#define HDMI_SRZ_PLL_CFG_VCOR_3000MHZ 3
21#define HDMI_SRZ_PLL_CFG_VCOR_MASK 3
22#define HDMI_SRZ_PLL_CFG_VCOR(x) (x << HDMI_SRZ_PLL_CFG_VCOR_SHIFT)
23#define HDMI_SRZ_PLL_CFG_NDIV_SHIFT 8
24#define HDMI_SRZ_PLL_CFG_NDIV_MASK (0x1F << HDMI_SRZ_PLL_CFG_NDIV_SHIFT)
25#define HDMI_SRZ_PLL_CFG_MODE_SHIFT 16
26#define HDMI_SRZ_PLL_CFG_MODE_13_5_MHZ 0x1
27#define HDMI_SRZ_PLL_CFG_MODE_25_2_MHZ 0x4
28#define HDMI_SRZ_PLL_CFG_MODE_27_MHZ 0x5
29#define HDMI_SRZ_PLL_CFG_MODE_33_75_MHZ 0x6
30#define HDMI_SRZ_PLL_CFG_MODE_40_5_MHZ 0x7
31#define HDMI_SRZ_PLL_CFG_MODE_54_MHZ 0x8
32#define HDMI_SRZ_PLL_CFG_MODE_67_5_MHZ 0x9
33#define HDMI_SRZ_PLL_CFG_MODE_74_25_MHZ 0xA
34#define HDMI_SRZ_PLL_CFG_MODE_81_MHZ 0xB
35#define HDMI_SRZ_PLL_CFG_MODE_82_5_MHZ 0xC
36#define HDMI_SRZ_PLL_CFG_MODE_108_MHZ 0xD
37#define HDMI_SRZ_PLL_CFG_MODE_148_5_MHZ 0xE
38#define HDMI_SRZ_PLL_CFG_MODE_165_MHZ 0xF
39#define HDMI_SRZ_PLL_CFG_MODE_MASK 0xF
40#define HDMI_SRZ_PLL_CFG_MODE(x) (x << HDMI_SRZ_PLL_CFG_MODE_SHIFT)
41
42#define HDMI_SRZ_CTRL_POWER_DOWN (1 << 0)
43#define HDMI_SRZ_CTRL_EXTERNAL_DATA_EN (1 << 1)
44
45/* sysconf registers */
46#define HDMI_REJECTION_PLL_CONFIGURATION 0x0858 /* SYSTEM_CONFIG2534 */
47#define HDMI_REJECTION_PLL_STATUS 0x0948 /* SYSTEM_CONFIG2594 */
48
49#define REJECTION_PLL_HDMI_ENABLE_SHIFT 0
50#define REJECTION_PLL_HDMI_ENABLE_MASK (0x1 << REJECTION_PLL_HDMI_ENABLE_SHIFT)
51#define REJECTION_PLL_HDMI_PDIV_SHIFT 24
52#define REJECTION_PLL_HDMI_PDIV_MASK (0x7 << REJECTION_PLL_HDMI_PDIV_SHIFT)
53#define REJECTION_PLL_HDMI_NDIV_SHIFT 16
54#define REJECTION_PLL_HDMI_NDIV_MASK (0xFF << REJECTION_PLL_HDMI_NDIV_SHIFT)
55#define REJECTION_PLL_HDMI_MDIV_SHIFT 8
56#define REJECTION_PLL_HDMI_MDIV_MASK (0xFF << REJECTION_PLL_HDMI_MDIV_SHIFT)
57
58#define REJECTION_PLL_HDMI_REJ_PLL_LOCK BIT(0)
59
60#define HDMI_TIMEOUT_PLL_LOCK 50 /*milliseconds */
61
62/**
63 * pll mode structure
64 *
65 * A pointer to an array of these structures is passed to a TMDS (HDMI) output
66 * via the control interface to provide board and SoC specific
67 * configurations of the HDMI PHY. Each entry in the array specifies a hardware
68 * specific configuration for a given TMDS clock frequency range. The array
69 * should be terminated with an entry that has all fields set to zero.
70 *
71 * @min: Lower bound of TMDS clock frequency this entry applies to
72 * @max: Upper bound of TMDS clock frequency this entry applies to
73 * @mode: SoC specific register configuration
74 */
75struct pllmode {
76 u32 min;
77 u32 max;
78 u32 mode;
79};
80
81#define NB_PLL_MODE 7
82static struct pllmode pllmodes[NB_PLL_MODE] = {
83 {13500000, 13513500, HDMI_SRZ_PLL_CFG_MODE_13_5_MHZ},
84 {25174800, 25200000, HDMI_SRZ_PLL_CFG_MODE_25_2_MHZ},
85 {27000000, 27027000, HDMI_SRZ_PLL_CFG_MODE_27_MHZ},
86 {54000000, 54054000, HDMI_SRZ_PLL_CFG_MODE_54_MHZ},
87 {72000000, 74250000, HDMI_SRZ_PLL_CFG_MODE_74_25_MHZ},
88 {108000000, 108108000, HDMI_SRZ_PLL_CFG_MODE_108_MHZ},
89 {148351648, 297000000, HDMI_SRZ_PLL_CFG_MODE_148_5_MHZ}
90};
91
92#define NB_HDMI_PHY_CONFIG 5
93static struct hdmi_phy_config hdmiphy_config[NB_HDMI_PHY_CONFIG] = {
94 {0, 40000000, {0x00101010, 0x00101010, 0x00101010, 0x02} },
95 {40000000, 140000000, {0x00111111, 0x00111111, 0x00111111, 0x02} },
96 {140000000, 160000000, {0x00131313, 0x00101010, 0x00101010, 0x02} },
97 {160000000, 250000000, {0x00131313, 0x00111111, 0x00111111, 0x03FE} },
98 {250000000, 300000000, {0x00151515, 0x00101010, 0x00101010, 0x03FE} },
99};
100
101#define PLL_CHANGE_DELAY 1 /* ms */
102
103/**
104 * Disable the pll rejection
105 *
106 * @hdmi: pointer on the hdmi internal structure
107 *
108 * return true if the pll has been disabled
109 */
110static bool disable_pll_rejection(struct sti_hdmi *hdmi)
111{
112 u32 val;
113
114 DRM_DEBUG_DRIVER("\n");
115
116 val = readl(hdmi->syscfg + HDMI_REJECTION_PLL_CONFIGURATION);
117 val &= ~REJECTION_PLL_HDMI_ENABLE_MASK;
118 writel(val, hdmi->syscfg + HDMI_REJECTION_PLL_CONFIGURATION);
119
120 msleep(PLL_CHANGE_DELAY);
121 val = readl(hdmi->syscfg + HDMI_REJECTION_PLL_STATUS);
122
123 return !(val & REJECTION_PLL_HDMI_REJ_PLL_LOCK);
124}
125
126/**
127 * Enable the old BCH/rejection PLL is now reused to provide the CLKPXPLL
128 * clock input to the new PHY PLL that generates the serializer clock
129 * (TMDS*10) and the TMDS clock which is now fed back into the HDMI
130 * formatter instead of the TMDS clock line from ClockGenB.
131 *
132 * @hdmi: pointer on the hdmi internal structure
133 *
134 * return true if pll has been correctly set
135 */
136static bool enable_pll_rejection(struct sti_hdmi *hdmi)
137{
138 unsigned int inputclock;
139 u32 mdiv, ndiv, pdiv, val;
140
141 DRM_DEBUG_DRIVER("\n");
142
143 if (!disable_pll_rejection(hdmi))
144 return false;
145
146 inputclock = hdmi->mode.clock * 1000;
147
148 DRM_DEBUG_DRIVER("hdmi rejection pll input clock = %dHz\n", inputclock);
149
150
151 /* Power up the HDMI rejection PLL
152 * Note: On this SoC (stiH416) we are forced to have the input clock
153 * be equal to the HDMI pixel clock.
154 *
155 * The values here have been suggested by validation however they are
156 * still provisional and subject to change.
157 *
158 * PLLout = (Fin*Mdiv) / ((2 * Ndiv) / 2^Pdiv)
159 */
160 if (inputclock < 50000000) {
161 /*
162 * For slower clocks we need to multiply more to keep the
163 * internal VCO frequency within the physical specification
164 * of the PLL.
165 */
166 pdiv = 4;
167 ndiv = 240;
168 mdiv = 30;
169 } else {
170 pdiv = 2;
171 ndiv = 60;
172 mdiv = 30;
173 }
174
175 val = readl(hdmi->syscfg + HDMI_REJECTION_PLL_CONFIGURATION);
176
177 val &= ~(REJECTION_PLL_HDMI_PDIV_MASK |
178 REJECTION_PLL_HDMI_NDIV_MASK |
179 REJECTION_PLL_HDMI_MDIV_MASK |
180 REJECTION_PLL_HDMI_ENABLE_MASK);
181
182 val |= (pdiv << REJECTION_PLL_HDMI_PDIV_SHIFT) |
183 (ndiv << REJECTION_PLL_HDMI_NDIV_SHIFT) |
184 (mdiv << REJECTION_PLL_HDMI_MDIV_SHIFT) |
185 (0x1 << REJECTION_PLL_HDMI_ENABLE_SHIFT);
186
187 writel(val, hdmi->syscfg + HDMI_REJECTION_PLL_CONFIGURATION);
188
189 msleep(PLL_CHANGE_DELAY);
190 val = readl(hdmi->syscfg + HDMI_REJECTION_PLL_STATUS);
191
192 return (val & REJECTION_PLL_HDMI_REJ_PLL_LOCK);
193}
194
195/**
196 * Start hdmi phy macro cell tx3g0c55
197 *
198 * @hdmi: pointer on the hdmi internal structure
199 *
200 * Return false if an error occur
201 */
202static bool sti_hdmi_tx3g0c55phy_start(struct sti_hdmi *hdmi)
203{
204 u32 ckpxpll = hdmi->mode.clock * 1000;
205 u32 val, tmdsck, freqvco, pllctrl = 0;
206 unsigned int i;
207
208 if (!enable_pll_rejection(hdmi))
209 return false;
210
211 DRM_DEBUG_DRIVER("ckpxpll = %dHz\n", ckpxpll);
212
213 /* Assuming no pixel repetition and 24bits color */
214 tmdsck = ckpxpll;
215 pllctrl = 2 << HDMI_SRZ_PLL_CFG_NDIV_SHIFT;
216
217 /*
218 * Setup the PLL mode parameter based on the ckpxpll. If we haven't got
219 * a clock frequency supported by one of the specific PLL modes then we
220 * will end up using the generic mode (0) which only supports a 10x
221 * multiplier, hence only 24bit color.
222 */
223 for (i = 0; i < NB_PLL_MODE; i++) {
224 if (ckpxpll >= pllmodes[i].min && ckpxpll <= pllmodes[i].max)
225 pllctrl |= HDMI_SRZ_PLL_CFG_MODE(pllmodes[i].mode);
226 }
227
228 freqvco = tmdsck * 10;
229 if (freqvco <= 425000000UL)
230 pllctrl |= HDMI_SRZ_PLL_CFG_VCOR(HDMI_SRZ_PLL_CFG_VCOR_425MHZ);
231 else if (freqvco <= 850000000UL)
232 pllctrl |= HDMI_SRZ_PLL_CFG_VCOR(HDMI_SRZ_PLL_CFG_VCOR_850MHZ);
233 else if (freqvco <= 1700000000UL)
234 pllctrl |= HDMI_SRZ_PLL_CFG_VCOR(HDMI_SRZ_PLL_CFG_VCOR_1700MHZ);
235 else if (freqvco <= 2970000000UL)
236 pllctrl |= HDMI_SRZ_PLL_CFG_VCOR(HDMI_SRZ_PLL_CFG_VCOR_3000MHZ);
237 else {
238 DRM_ERROR("PHY serializer clock out of range\n");
239 goto err;
240 }
241
242 /*
243 * Configure and power up the PHY PLL
244 */
245 hdmi->event_received = false;
246 DRM_DEBUG_DRIVER("pllctrl = 0x%x\n", pllctrl);
247 hdmi_write(hdmi, pllctrl, HDMI_SRZ_PLL_CFG);
248
249 /* wait PLL interrupt */
250 wait_event_interruptible_timeout(hdmi->wait_event,
251 hdmi->event_received == true,
252 msecs_to_jiffies
253 (HDMI_TIMEOUT_PLL_LOCK));
254
255 if ((hdmi_read(hdmi, HDMI_STA) & HDMI_STA_DLL_LCK) == 0) {
256 DRM_ERROR("hdmi phy pll not locked\n");
257 goto err;
258 }
259
260 DRM_DEBUG_DRIVER("got PHY PLL Lock\n");
261
262 /*
263 * To configure the source termination and pre-emphasis appropriately
264 * for different high speed TMDS clock frequencies a phy configuration
265 * table must be provided, tailored to the SoC and board combination.
266 */
267 for (i = 0; i < NB_HDMI_PHY_CONFIG; i++) {
268 if ((hdmiphy_config[i].min_tmds_freq <= tmdsck) &&
269 (hdmiphy_config[i].max_tmds_freq >= tmdsck)) {
270 val = hdmiphy_config[i].config[0];
271 hdmi_write(hdmi, val, HDMI_SRZ_TAP_1);
272 val = hdmiphy_config[i].config[1];
273 hdmi_write(hdmi, val, HDMI_SRZ_TAP_2);
274 val = hdmiphy_config[i].config[2];
275 hdmi_write(hdmi, val, HDMI_SRZ_TAP_3);
276 val = hdmiphy_config[i].config[3];
277 val |= HDMI_SRZ_CTRL_EXTERNAL_DATA_EN;
278 val &= ~HDMI_SRZ_CTRL_POWER_DOWN;
279 hdmi_write(hdmi, val, HDMI_SRZ_CTRL);
280
281 DRM_DEBUG_DRIVER("serializer cfg 0x%x 0x%x 0x%x 0x%x\n",
282 hdmiphy_config[i].config[0],
283 hdmiphy_config[i].config[1],
284 hdmiphy_config[i].config[2],
285 hdmiphy_config[i].config[3]);
286 return true;
287 }
288 }
289
290 /*
291 * Default, power up the serializer with no pre-emphasis or source
292 * termination.
293 */
294 hdmi_write(hdmi, 0x0, HDMI_SRZ_TAP_1);
295 hdmi_write(hdmi, 0x0, HDMI_SRZ_TAP_2);
296 hdmi_write(hdmi, 0x0, HDMI_SRZ_TAP_3);
297 hdmi_write(hdmi, HDMI_SRZ_CTRL_EXTERNAL_DATA_EN, HDMI_SRZ_CTRL);
298
299 return true;
300
301err:
302 disable_pll_rejection(hdmi);
303
304 return false;
305}
306
307/**
308 * Stop hdmi phy macro cell tx3g0c55
309 *
310 * @hdmi: pointer on the hdmi internal structure
311 */
312static void sti_hdmi_tx3g0c55phy_stop(struct sti_hdmi *hdmi)
313{
314 DRM_DEBUG_DRIVER("\n");
315
316 hdmi->event_received = false;
317
318 hdmi_write(hdmi, HDMI_SRZ_CTRL_POWER_DOWN, HDMI_SRZ_CTRL);
319 hdmi_write(hdmi, HDMI_SRZ_PLL_CFG_POWER_DOWN, HDMI_SRZ_PLL_CFG);
320
321 /* wait PLL interrupt */
322 wait_event_interruptible_timeout(hdmi->wait_event,
323 hdmi->event_received == true,
324 msecs_to_jiffies
325 (HDMI_TIMEOUT_PLL_LOCK));
326
327 if (hdmi_read(hdmi, HDMI_STA) & HDMI_STA_DLL_LCK)
328 DRM_ERROR("hdmi phy pll not well disabled\n");
329
330 disable_pll_rejection(hdmi);
331}
332
333struct hdmi_phy_ops tx3g0c55phy_ops = {
334 .start = sti_hdmi_tx3g0c55phy_start,
335 .stop = sti_hdmi_tx3g0c55phy_stop,
336};
diff --git a/drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h b/drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h
deleted file mode 100644
index 068237b3a303..000000000000
--- a/drivers/gpu/drm/sti/sti_hdmi_tx3g0c55phy.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright (C) STMicroelectronics SA 2014
3 * Author: Benjamin Gaignard <benjamin.gaignard@st.com> for STMicroelectronics.
4 * License terms: GNU General Public License (GPL), version 2
5 */
6
7#ifndef _STI_HDMI_TX3G0C55PHY_H_
8#define _STI_HDMI_TX3G0C55PHY_H_
9
10#include "sti_hdmi.h"
11
12extern struct hdmi_phy_ops tx3g0c55phy_ops;
13
14#endif
diff --git a/drivers/gpu/drm/sti/sti_mixer.c b/drivers/gpu/drm/sti/sti_mixer.c
index b78cec538aaa..4ddc58f7fe2e 100644
--- a/drivers/gpu/drm/sti/sti_mixer.c
+++ b/drivers/gpu/drm/sti/sti_mixer.c
@@ -16,12 +16,6 @@ static unsigned int bkg_color = 0x000000;
16MODULE_PARM_DESC(bkgcolor, "Value of the background color 0xRRGGBB"); 16MODULE_PARM_DESC(bkgcolor, "Value of the background color 0xRRGGBB");
17module_param_named(bkgcolor, bkg_color, int, 0644); 17module_param_named(bkgcolor, bkg_color, int, 0644);
18 18
19/* Identity: G=Y , B=Cb , R=Cr */
20static const u32 mixerColorSpaceMatIdentity[] = {
21 0x10000000, 0x00000000, 0x10000000, 0x00001000,
22 0x00000000, 0x00000000, 0x00000000, 0x00000000
23};
24
25/* regs offset */ 19/* regs offset */
26#define GAM_MIXER_CTL 0x00 20#define GAM_MIXER_CTL 0x00
27#define GAM_MIXER_BKC 0x04 21#define GAM_MIXER_BKC 0x04
@@ -358,22 +352,12 @@ int sti_mixer_set_plane_status(struct sti_mixer *mixer,
358 return 0; 352 return 0;
359} 353}
360 354
361static void sti_mixer_set_matrix(struct sti_mixer *mixer)
362{
363 unsigned int i;
364
365 for (i = 0; i < ARRAY_SIZE(mixerColorSpaceMatIdentity); i++)
366 sti_mixer_reg_write(mixer, GAM_MIXER_MX0 + (i * 4),
367 mixerColorSpaceMatIdentity[i]);
368}
369
370struct sti_mixer *sti_mixer_create(struct device *dev, 355struct sti_mixer *sti_mixer_create(struct device *dev,
371 struct drm_device *drm_dev, 356 struct drm_device *drm_dev,
372 int id, 357 int id,
373 void __iomem *baseaddr) 358 void __iomem *baseaddr)
374{ 359{
375 struct sti_mixer *mixer = devm_kzalloc(dev, sizeof(*mixer), GFP_KERNEL); 360 struct sti_mixer *mixer = devm_kzalloc(dev, sizeof(*mixer), GFP_KERNEL);
376 struct device_node *np = dev->of_node;
377 361
378 dev_dbg(dev, "%s\n", __func__); 362 dev_dbg(dev, "%s\n", __func__);
379 if (!mixer) { 363 if (!mixer) {
@@ -384,9 +368,6 @@ struct sti_mixer *sti_mixer_create(struct device *dev,
384 mixer->dev = dev; 368 mixer->dev = dev;
385 mixer->id = id; 369 mixer->id = id;
386 370
387 if (of_device_is_compatible(np, "st,stih416-compositor"))
388 sti_mixer_set_matrix(mixer);
389
390 DRM_DEBUG_DRIVER("%s created. Regs=%p\n", 371 DRM_DEBUG_DRIVER("%s created. Regs=%p\n",
391 sti_mixer_to_str(mixer), mixer->regs); 372 sti_mixer_to_str(mixer), mixer->regs);
392 373
diff --git a/drivers/gpu/drm/sti/sti_tvout.c b/drivers/gpu/drm/sti/sti_tvout.c
index cc07e069a770..ad46d3558d91 100644
--- a/drivers/gpu/drm/sti/sti_tvout.c
+++ b/drivers/gpu/drm/sti/sti_tvout.c
@@ -210,13 +210,11 @@ static void tvout_vip_set_rnd(struct sti_tvout *tvout, int reg, u32 rnd)
210 * @tvout: tvout structure 210 * @tvout: tvout structure
211 * @reg: register to set 211 * @reg: register to set
212 * @main_path: main or auxiliary path 212 * @main_path: main or auxiliary path
213 * @sel_input_logic_inverted: need to invert the logic
214 * @sel_input: selected_input (main/aux + conv) 213 * @sel_input: selected_input (main/aux + conv)
215 */ 214 */
216static void tvout_vip_set_sel_input(struct sti_tvout *tvout, 215static void tvout_vip_set_sel_input(struct sti_tvout *tvout,
217 int reg, 216 int reg,
218 bool main_path, 217 bool main_path,
219 bool sel_input_logic_inverted,
220 enum sti_tvout_video_out_type video_out) 218 enum sti_tvout_video_out_type video_out)
221{ 219{
222 u32 sel_input; 220 u32 sel_input;
@@ -237,8 +235,7 @@ static void tvout_vip_set_sel_input(struct sti_tvout *tvout,
237 } 235 }
238 236
239 /* on stih407 chip the sel_input bypass mode logic is inverted */ 237 /* on stih407 chip the sel_input bypass mode logic is inverted */
240 if (sel_input_logic_inverted) 238 sel_input = sel_input ^ TVO_VIP_SEL_INPUT_BYPASS_MASK;
241 sel_input = sel_input ^ TVO_VIP_SEL_INPUT_BYPASS_MASK;
242 239
243 val &= ~TVO_VIP_SEL_INPUT_MASK; 240 val &= ~TVO_VIP_SEL_INPUT_MASK;
244 val |= sel_input; 241 val |= sel_input;
@@ -296,8 +293,6 @@ static void tvout_preformatter_set_matrix(struct sti_tvout *tvout,
296 */ 293 */
297static void tvout_dvo_start(struct sti_tvout *tvout, bool main_path) 294static void tvout_dvo_start(struct sti_tvout *tvout, bool main_path)
298{ 295{
299 struct device_node *node = tvout->dev->of_node;
300 bool sel_input_logic_inverted = false;
301 u32 tvo_in_vid_format; 296 u32 tvo_in_vid_format;
302 int val, tmp; 297 int val, tmp;
303 298
@@ -335,16 +330,11 @@ static void tvout_dvo_start(struct sti_tvout *tvout, bool main_path)
335 /* Set round mode (rounded to 8-bit per component) */ 330 /* Set round mode (rounded to 8-bit per component) */
336 tvout_vip_set_rnd(tvout, TVO_VIP_DVO, TVO_VIP_RND_8BIT_ROUNDED); 331 tvout_vip_set_rnd(tvout, TVO_VIP_DVO, TVO_VIP_RND_8BIT_ROUNDED);
337 332
338 if (of_device_is_compatible(node, "st,stih407-tvout")) { 333 /* Set input video format */
339 /* Set input video format */ 334 tvout_vip_set_in_vid_fmt(tvout, tvo_in_vid_format, TVO_IN_FMT_SIGNED);
340 tvout_vip_set_in_vid_fmt(tvout, tvo_in_vid_format,
341 TVO_IN_FMT_SIGNED);
342 sel_input_logic_inverted = true;
343 }
344 335
345 /* Input selection */ 336 /* Input selection */
346 tvout_vip_set_sel_input(tvout, TVO_VIP_DVO, main_path, 337 tvout_vip_set_sel_input(tvout, TVO_VIP_DVO, main_path,
347 sel_input_logic_inverted,
348 STI_TVOUT_VIDEO_OUT_RGB); 338 STI_TVOUT_VIDEO_OUT_RGB);
349} 339}
350 340
@@ -357,8 +347,6 @@ static void tvout_dvo_start(struct sti_tvout *tvout, bool main_path)
357 */ 347 */
358static void tvout_hdmi_start(struct sti_tvout *tvout, bool main_path) 348static void tvout_hdmi_start(struct sti_tvout *tvout, bool main_path)
359{ 349{
360 struct device_node *node = tvout->dev->of_node;
361 bool sel_input_logic_inverted = false;
362 u32 tvo_in_vid_format; 350 u32 tvo_in_vid_format;
363 351
364 dev_dbg(tvout->dev, "%s\n", __func__); 352 dev_dbg(tvout->dev, "%s\n", __func__);
@@ -391,16 +379,12 @@ static void tvout_hdmi_start(struct sti_tvout *tvout, bool main_path)
391 /* set round mode (rounded to 8-bit per component) */ 379 /* set round mode (rounded to 8-bit per component) */
392 tvout_vip_set_rnd(tvout, TVO_VIP_HDMI, TVO_VIP_RND_8BIT_ROUNDED); 380 tvout_vip_set_rnd(tvout, TVO_VIP_HDMI, TVO_VIP_RND_8BIT_ROUNDED);
393 381
394 if (of_device_is_compatible(node, "st,stih407-tvout")) { 382 /* set input video format */
395 /* set input video format */ 383 tvout_vip_set_in_vid_fmt(tvout, tvo_in_vid_format, TVO_IN_FMT_SIGNED);
396 tvout_vip_set_in_vid_fmt(tvout, tvo_in_vid_format,
397 TVO_IN_FMT_SIGNED);
398 sel_input_logic_inverted = true;
399 }
400 384
401 /* input selection */ 385 /* input selection */
402 tvout_vip_set_sel_input(tvout, TVO_VIP_HDMI, main_path, 386 tvout_vip_set_sel_input(tvout, TVO_VIP_HDMI, main_path,
403 sel_input_logic_inverted, STI_TVOUT_VIDEO_OUT_RGB); 387 STI_TVOUT_VIDEO_OUT_RGB);
404} 388}
405 389
406/** 390/**
@@ -412,8 +396,6 @@ static void tvout_hdmi_start(struct sti_tvout *tvout, bool main_path)
412 */ 396 */
413static void tvout_hda_start(struct sti_tvout *tvout, bool main_path) 397static void tvout_hda_start(struct sti_tvout *tvout, bool main_path)
414{ 398{
415 struct device_node *node = tvout->dev->of_node;
416 bool sel_input_logic_inverted = false;
417 u32 tvo_in_vid_format; 399 u32 tvo_in_vid_format;
418 int val; 400 int val;
419 401
@@ -449,16 +431,11 @@ static void tvout_hda_start(struct sti_tvout *tvout, bool main_path)
449 /* set round mode (rounded to 10-bit per component) */ 431 /* set round mode (rounded to 10-bit per component) */
450 tvout_vip_set_rnd(tvout, TVO_VIP_HDF, TVO_VIP_RND_10BIT_ROUNDED); 432 tvout_vip_set_rnd(tvout, TVO_VIP_HDF, TVO_VIP_RND_10BIT_ROUNDED);
451 433
452 if (of_device_is_compatible(node, "st,stih407-tvout")) { 434 /* Set input video format */
453 /* set input video format */ 435 tvout_vip_set_in_vid_fmt(tvout, tvo_in_vid_format, TVO_IN_FMT_SIGNED);
454 tvout_vip_set_in_vid_fmt(tvout,
455 tvo_in_vid_format, TVO_IN_FMT_SIGNED);
456 sel_input_logic_inverted = true;
457 }
458 436
459 /* Input selection */ 437 /* Input selection */
460 tvout_vip_set_sel_input(tvout, TVO_VIP_HDF, main_path, 438 tvout_vip_set_sel_input(tvout, TVO_VIP_HDF, main_path,
461 sel_input_logic_inverted,
462 STI_TVOUT_VIDEO_OUT_YUV); 439 STI_TVOUT_VIDEO_OUT_YUV);
463 440
464 /* power up HD DAC */ 441 /* power up HD DAC */
@@ -906,7 +883,6 @@ static int sti_tvout_remove(struct platform_device *pdev)
906} 883}
907 884
908static const struct of_device_id tvout_of_match[] = { 885static const struct of_device_id tvout_of_match[] = {
909 { .compatible = "st,stih416-tvout", },
910 { .compatible = "st,stih407-tvout", }, 886 { .compatible = "st,stih407-tvout", },
911 { /* end node */ } 887 { /* end node */ }
912}; 888};