xref: /dflybsd-src/sys/dev/drm/i915/intel_dsi_pll.c (revision 9edbd4a07c3138f5c4f076f77de5d722fcc606cc)
1*9edbd4a0SFrançois Tigeot /*
2*9edbd4a0SFrançois Tigeot  * Copyright © 2013 Intel Corporation
3*9edbd4a0SFrançois Tigeot  *
4*9edbd4a0SFrançois Tigeot  * Permission is hereby granted, free of charge, to any person obtaining a
5*9edbd4a0SFrançois Tigeot  * copy of this software and associated documentation files (the "Software"),
6*9edbd4a0SFrançois Tigeot  * to deal in the Software without restriction, including without limitation
7*9edbd4a0SFrançois Tigeot  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*9edbd4a0SFrançois Tigeot  * and/or sell copies of the Software, and to permit persons to whom the
9*9edbd4a0SFrançois Tigeot  * Software is furnished to do so, subject to the following conditions:
10*9edbd4a0SFrançois Tigeot  *
11*9edbd4a0SFrançois Tigeot  * The above copyright notice and this permission notice (including the next
12*9edbd4a0SFrançois Tigeot  * paragraph) shall be included in all copies or substantial portions of the
13*9edbd4a0SFrançois Tigeot  * Software.
14*9edbd4a0SFrançois Tigeot  *
15*9edbd4a0SFrançois Tigeot  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16*9edbd4a0SFrançois Tigeot  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17*9edbd4a0SFrançois Tigeot  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
18*9edbd4a0SFrançois Tigeot  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19*9edbd4a0SFrançois Tigeot  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20*9edbd4a0SFrançois Tigeot  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21*9edbd4a0SFrançois Tigeot  * DEALINGS IN THE SOFTWARE.
22*9edbd4a0SFrançois Tigeot  *
23*9edbd4a0SFrançois Tigeot  * Authors:
24*9edbd4a0SFrançois Tigeot  *	Shobhit Kumar <shobhit.kumar@intel.com>
25*9edbd4a0SFrançois Tigeot  *	Yogesh Mohan Marimuthu <yogesh.mohan.marimuthu@intel.com>
26*9edbd4a0SFrançois Tigeot  */
27*9edbd4a0SFrançois Tigeot 
28*9edbd4a0SFrançois Tigeot #include <linux/kernel.h>
29*9edbd4a0SFrançois Tigeot #include "intel_drv.h"
30*9edbd4a0SFrançois Tigeot #include "i915_drv.h"
31*9edbd4a0SFrançois Tigeot #include "intel_dsi.h"
32*9edbd4a0SFrançois Tigeot 
33*9edbd4a0SFrançois Tigeot #define DSI_HSS_PACKET_SIZE		4
34*9edbd4a0SFrançois Tigeot #define DSI_HSE_PACKET_SIZE		4
35*9edbd4a0SFrançois Tigeot #define DSI_HSA_PACKET_EXTRA_SIZE	6
36*9edbd4a0SFrançois Tigeot #define DSI_HBP_PACKET_EXTRA_SIZE	6
37*9edbd4a0SFrançois Tigeot #define DSI_HACTIVE_PACKET_EXTRA_SIZE	6
38*9edbd4a0SFrançois Tigeot #define DSI_HFP_PACKET_EXTRA_SIZE	6
39*9edbd4a0SFrançois Tigeot #define DSI_EOTP_PACKET_SIZE		4
40*9edbd4a0SFrançois Tigeot 
41*9edbd4a0SFrançois Tigeot struct dsi_mnp {
42*9edbd4a0SFrançois Tigeot 	u32 dsi_pll_ctrl;
43*9edbd4a0SFrançois Tigeot 	u32 dsi_pll_div;
44*9edbd4a0SFrançois Tigeot };
45*9edbd4a0SFrançois Tigeot 
46*9edbd4a0SFrançois Tigeot static const u32 lfsr_converts[] = {
47*9edbd4a0SFrançois Tigeot 	426, 469, 234, 373, 442, 221, 110, 311, 411,		/* 62 - 70 */
48*9edbd4a0SFrançois Tigeot 	461, 486, 243, 377, 188, 350, 175, 343, 427, 213,	/* 71 - 80 */
49*9edbd4a0SFrançois Tigeot 	106, 53, 282, 397, 354, 227, 113, 56, 284, 142,		/* 81 - 90 */
50*9edbd4a0SFrançois Tigeot 	71, 35							/* 91 - 92 */
51*9edbd4a0SFrançois Tigeot };
52*9edbd4a0SFrançois Tigeot 
53*9edbd4a0SFrançois Tigeot #ifdef DSI_CLK_FROM_RR
54*9edbd4a0SFrançois Tigeot 
55*9edbd4a0SFrançois Tigeot static u32 dsi_rr_formula(const struct drm_display_mode *mode,
56*9edbd4a0SFrançois Tigeot 			  int pixel_format, int video_mode_format,
57*9edbd4a0SFrançois Tigeot 			  int lane_count, bool eotp)
58*9edbd4a0SFrançois Tigeot {
59*9edbd4a0SFrançois Tigeot 	u32 bpp;
60*9edbd4a0SFrançois Tigeot 	u32 hactive, vactive, hfp, hsync, hbp, vfp, vsync, vbp;
61*9edbd4a0SFrançois Tigeot 	u32 hsync_bytes, hbp_bytes, hactive_bytes, hfp_bytes;
62*9edbd4a0SFrançois Tigeot 	u32 bytes_per_line, bytes_per_frame;
63*9edbd4a0SFrançois Tigeot 	u32 num_frames;
64*9edbd4a0SFrançois Tigeot 	u32 bytes_per_x_frames, bytes_per_x_frames_x_lanes;
65*9edbd4a0SFrançois Tigeot 	u32 dsi_bit_clock_hz;
66*9edbd4a0SFrançois Tigeot 	u32 dsi_clk;
67*9edbd4a0SFrançois Tigeot 
68*9edbd4a0SFrançois Tigeot 	switch (pixel_format) {
69*9edbd4a0SFrançois Tigeot 	default:
70*9edbd4a0SFrançois Tigeot 	case VID_MODE_FORMAT_RGB888:
71*9edbd4a0SFrançois Tigeot 	case VID_MODE_FORMAT_RGB666_LOOSE:
72*9edbd4a0SFrançois Tigeot 		bpp = 24;
73*9edbd4a0SFrançois Tigeot 		break;
74*9edbd4a0SFrançois Tigeot 	case VID_MODE_FORMAT_RGB666:
75*9edbd4a0SFrançois Tigeot 		bpp = 18;
76*9edbd4a0SFrançois Tigeot 		break;
77*9edbd4a0SFrançois Tigeot 	case VID_MODE_FORMAT_RGB565:
78*9edbd4a0SFrançois Tigeot 		bpp = 16;
79*9edbd4a0SFrançois Tigeot 		break;
80*9edbd4a0SFrançois Tigeot 	}
81*9edbd4a0SFrançois Tigeot 
82*9edbd4a0SFrançois Tigeot 	hactive = mode->hdisplay;
83*9edbd4a0SFrançois Tigeot 	vactive = mode->vdisplay;
84*9edbd4a0SFrançois Tigeot 	hfp = mode->hsync_start - mode->hdisplay;
85*9edbd4a0SFrançois Tigeot 	hsync = mode->hsync_end - mode->hsync_start;
86*9edbd4a0SFrançois Tigeot 	hbp = mode->htotal - mode->hsync_end;
87*9edbd4a0SFrançois Tigeot 
88*9edbd4a0SFrançois Tigeot 	vfp = mode->vsync_start - mode->vdisplay;
89*9edbd4a0SFrançois Tigeot 	vsync = mode->vsync_end - mode->vsync_start;
90*9edbd4a0SFrançois Tigeot 	vbp = mode->vtotal - mode->vsync_end;
91*9edbd4a0SFrançois Tigeot 
92*9edbd4a0SFrançois Tigeot 	hsync_bytes = DIV_ROUND_UP(hsync * bpp, 8);
93*9edbd4a0SFrançois Tigeot 	hbp_bytes = DIV_ROUND_UP(hbp * bpp, 8);
94*9edbd4a0SFrançois Tigeot 	hactive_bytes = DIV_ROUND_UP(hactive * bpp, 8);
95*9edbd4a0SFrançois Tigeot 	hfp_bytes = DIV_ROUND_UP(hfp * bpp, 8);
96*9edbd4a0SFrançois Tigeot 
97*9edbd4a0SFrançois Tigeot 	bytes_per_line = DSI_HSS_PACKET_SIZE + hsync_bytes +
98*9edbd4a0SFrançois Tigeot 		DSI_HSA_PACKET_EXTRA_SIZE + DSI_HSE_PACKET_SIZE +
99*9edbd4a0SFrançois Tigeot 		hbp_bytes + DSI_HBP_PACKET_EXTRA_SIZE +
100*9edbd4a0SFrançois Tigeot 		hactive_bytes + DSI_HACTIVE_PACKET_EXTRA_SIZE +
101*9edbd4a0SFrançois Tigeot 		hfp_bytes + DSI_HFP_PACKET_EXTRA_SIZE;
102*9edbd4a0SFrançois Tigeot 
103*9edbd4a0SFrançois Tigeot 	/*
104*9edbd4a0SFrançois Tigeot 	 * XXX: Need to accurately calculate LP to HS transition timeout and add
105*9edbd4a0SFrançois Tigeot 	 * it to bytes_per_line/bytes_per_frame.
106*9edbd4a0SFrançois Tigeot 	 */
107*9edbd4a0SFrançois Tigeot 
108*9edbd4a0SFrançois Tigeot 	if (eotp && video_mode_format == VIDEO_MODE_BURST)
109*9edbd4a0SFrançois Tigeot 		bytes_per_line += DSI_EOTP_PACKET_SIZE;
110*9edbd4a0SFrançois Tigeot 
111*9edbd4a0SFrançois Tigeot 	bytes_per_frame = vsync * bytes_per_line + vbp * bytes_per_line +
112*9edbd4a0SFrançois Tigeot 		vactive * bytes_per_line + vfp * bytes_per_line;
113*9edbd4a0SFrançois Tigeot 
114*9edbd4a0SFrançois Tigeot 	if (eotp &&
115*9edbd4a0SFrançois Tigeot 	    (video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_PULSE ||
116*9edbd4a0SFrançois Tigeot 	     video_mode_format == VIDEO_MODE_NON_BURST_WITH_SYNC_EVENTS))
117*9edbd4a0SFrançois Tigeot 		bytes_per_frame += DSI_EOTP_PACKET_SIZE;
118*9edbd4a0SFrançois Tigeot 
119*9edbd4a0SFrançois Tigeot 	num_frames = drm_mode_vrefresh(mode);
120*9edbd4a0SFrançois Tigeot 	bytes_per_x_frames = num_frames * bytes_per_frame;
121*9edbd4a0SFrançois Tigeot 
122*9edbd4a0SFrançois Tigeot 	bytes_per_x_frames_x_lanes = bytes_per_x_frames / lane_count;
123*9edbd4a0SFrançois Tigeot 
124*9edbd4a0SFrançois Tigeot 	/* the dsi clock is divided by 2 in the hardware to get dsi ddr clock */
125*9edbd4a0SFrançois Tigeot 	dsi_bit_clock_hz = bytes_per_x_frames_x_lanes * 8;
126*9edbd4a0SFrançois Tigeot 	dsi_clk = dsi_bit_clock_hz / 1000;
127*9edbd4a0SFrançois Tigeot 
128*9edbd4a0SFrançois Tigeot 	if (eotp && video_mode_format == VIDEO_MODE_BURST)
129*9edbd4a0SFrançois Tigeot 		dsi_clk *= 2;
130*9edbd4a0SFrançois Tigeot 
131*9edbd4a0SFrançois Tigeot 	return dsi_clk;
132*9edbd4a0SFrançois Tigeot }
133*9edbd4a0SFrançois Tigeot 
134*9edbd4a0SFrançois Tigeot #else
135*9edbd4a0SFrançois Tigeot 
136*9edbd4a0SFrançois Tigeot /* Get DSI clock from pixel clock */
137*9edbd4a0SFrançois Tigeot static u32 dsi_clk_from_pclk(const struct drm_display_mode *mode,
138*9edbd4a0SFrançois Tigeot 			  int pixel_format, int lane_count)
139*9edbd4a0SFrançois Tigeot {
140*9edbd4a0SFrançois Tigeot 	u32 dsi_clk_khz;
141*9edbd4a0SFrançois Tigeot 	u32 bpp;
142*9edbd4a0SFrançois Tigeot 
143*9edbd4a0SFrançois Tigeot 	switch (pixel_format) {
144*9edbd4a0SFrançois Tigeot 	default:
145*9edbd4a0SFrançois Tigeot 	case VID_MODE_FORMAT_RGB888:
146*9edbd4a0SFrançois Tigeot 	case VID_MODE_FORMAT_RGB666_LOOSE:
147*9edbd4a0SFrançois Tigeot 		bpp = 24;
148*9edbd4a0SFrançois Tigeot 		break;
149*9edbd4a0SFrançois Tigeot 	case VID_MODE_FORMAT_RGB666:
150*9edbd4a0SFrançois Tigeot 		bpp = 18;
151*9edbd4a0SFrançois Tigeot 		break;
152*9edbd4a0SFrançois Tigeot 	case VID_MODE_FORMAT_RGB565:
153*9edbd4a0SFrançois Tigeot 		bpp = 16;
154*9edbd4a0SFrançois Tigeot 		break;
155*9edbd4a0SFrançois Tigeot 	}
156*9edbd4a0SFrançois Tigeot 
157*9edbd4a0SFrançois Tigeot 	/* DSI data rate = pixel clock * bits per pixel / lane count
158*9edbd4a0SFrançois Tigeot 	   pixel clock is converted from KHz to Hz */
159*9edbd4a0SFrançois Tigeot 	dsi_clk_khz = DIV_ROUND_CLOSEST(mode->clock * bpp, lane_count);
160*9edbd4a0SFrançois Tigeot 
161*9edbd4a0SFrançois Tigeot 	return dsi_clk_khz;
162*9edbd4a0SFrançois Tigeot }
163*9edbd4a0SFrançois Tigeot 
164*9edbd4a0SFrançois Tigeot #endif
165*9edbd4a0SFrançois Tigeot 
166*9edbd4a0SFrançois Tigeot static int dsi_calc_mnp(u32 dsi_clk, struct dsi_mnp *dsi_mnp)
167*9edbd4a0SFrançois Tigeot {
168*9edbd4a0SFrançois Tigeot 	u32 m, n, p;
169*9edbd4a0SFrançois Tigeot 	u32 ref_clk;
170*9edbd4a0SFrançois Tigeot 	u32 error;
171*9edbd4a0SFrançois Tigeot 	u32 tmp_error;
172*9edbd4a0SFrançois Tigeot 	int target_dsi_clk;
173*9edbd4a0SFrançois Tigeot 	int calc_dsi_clk;
174*9edbd4a0SFrançois Tigeot 	u32 calc_m;
175*9edbd4a0SFrançois Tigeot 	u32 calc_p;
176*9edbd4a0SFrançois Tigeot 	u32 m_seed;
177*9edbd4a0SFrançois Tigeot 
178*9edbd4a0SFrançois Tigeot 	/* dsi_clk is expected in KHZ */
179*9edbd4a0SFrançois Tigeot 	if (dsi_clk < 300000 || dsi_clk > 1150000) {
180*9edbd4a0SFrançois Tigeot 		DRM_ERROR("DSI CLK Out of Range\n");
181*9edbd4a0SFrançois Tigeot 		return -ECHRNG;
182*9edbd4a0SFrançois Tigeot 	}
183*9edbd4a0SFrançois Tigeot 
184*9edbd4a0SFrançois Tigeot 	ref_clk = 25000;
185*9edbd4a0SFrançois Tigeot 	target_dsi_clk = dsi_clk;
186*9edbd4a0SFrançois Tigeot 	error = 0xFFFFFFFF;
187*9edbd4a0SFrançois Tigeot 	tmp_error = 0xFFFFFFFF;
188*9edbd4a0SFrançois Tigeot 	calc_m = 0;
189*9edbd4a0SFrançois Tigeot 	calc_p = 0;
190*9edbd4a0SFrançois Tigeot 
191*9edbd4a0SFrançois Tigeot 	for (m = 62; m <= 92; m++) {
192*9edbd4a0SFrançois Tigeot 		for (p = 2; p <= 6; p++) {
193*9edbd4a0SFrançois Tigeot 			/* Find the optimal m and p divisors
194*9edbd4a0SFrançois Tigeot 			with minimal error +/- the required clock */
195*9edbd4a0SFrançois Tigeot 			calc_dsi_clk = (m * ref_clk) / p;
196*9edbd4a0SFrançois Tigeot 			if (calc_dsi_clk == target_dsi_clk) {
197*9edbd4a0SFrançois Tigeot 				calc_m = m;
198*9edbd4a0SFrançois Tigeot 				calc_p = p;
199*9edbd4a0SFrançois Tigeot 				error = 0;
200*9edbd4a0SFrançois Tigeot 				break;
201*9edbd4a0SFrançois Tigeot 			} else
202*9edbd4a0SFrançois Tigeot 				tmp_error = abs(target_dsi_clk - calc_dsi_clk);
203*9edbd4a0SFrançois Tigeot 
204*9edbd4a0SFrançois Tigeot 			if (tmp_error < error) {
205*9edbd4a0SFrançois Tigeot 				error = tmp_error;
206*9edbd4a0SFrançois Tigeot 				calc_m = m;
207*9edbd4a0SFrançois Tigeot 				calc_p = p;
208*9edbd4a0SFrançois Tigeot 			}
209*9edbd4a0SFrançois Tigeot 		}
210*9edbd4a0SFrançois Tigeot 
211*9edbd4a0SFrançois Tigeot 		if (error == 0)
212*9edbd4a0SFrançois Tigeot 			break;
213*9edbd4a0SFrançois Tigeot 	}
214*9edbd4a0SFrançois Tigeot 
215*9edbd4a0SFrançois Tigeot 	m_seed = lfsr_converts[calc_m - 62];
216*9edbd4a0SFrançois Tigeot 	n = 1;
217*9edbd4a0SFrançois Tigeot 	dsi_mnp->dsi_pll_ctrl = 1 << (DSI_PLL_P1_POST_DIV_SHIFT + calc_p - 2);
218*9edbd4a0SFrançois Tigeot 	dsi_mnp->dsi_pll_div = (n - 1) << DSI_PLL_N1_DIV_SHIFT |
219*9edbd4a0SFrançois Tigeot 		m_seed << DSI_PLL_M1_DIV_SHIFT;
220*9edbd4a0SFrançois Tigeot 
221*9edbd4a0SFrançois Tigeot 	return 0;
222*9edbd4a0SFrançois Tigeot }
223*9edbd4a0SFrançois Tigeot 
224*9edbd4a0SFrançois Tigeot /*
225*9edbd4a0SFrançois Tigeot  * XXX: The muxing and gating is hard coded for now. Need to add support for
226*9edbd4a0SFrançois Tigeot  * sharing PLLs with two DSI outputs.
227*9edbd4a0SFrançois Tigeot  */
228*9edbd4a0SFrançois Tigeot static void vlv_configure_dsi_pll(struct intel_encoder *encoder)
229*9edbd4a0SFrançois Tigeot {
230*9edbd4a0SFrançois Tigeot 	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
231*9edbd4a0SFrançois Tigeot 	struct intel_crtc *intel_crtc = to_intel_crtc(encoder->base.crtc);
232*9edbd4a0SFrançois Tigeot 	const struct drm_display_mode *mode = &intel_crtc->config.adjusted_mode;
233*9edbd4a0SFrançois Tigeot 	struct intel_dsi *intel_dsi = enc_to_intel_dsi(&encoder->base);
234*9edbd4a0SFrançois Tigeot 	int ret;
235*9edbd4a0SFrançois Tigeot 	struct dsi_mnp dsi_mnp;
236*9edbd4a0SFrançois Tigeot 	u32 dsi_clk;
237*9edbd4a0SFrançois Tigeot 
238*9edbd4a0SFrançois Tigeot 	dsi_clk = dsi_clk_from_pclk(mode, intel_dsi->pixel_format,
239*9edbd4a0SFrançois Tigeot 						intel_dsi->lane_count);
240*9edbd4a0SFrançois Tigeot 
241*9edbd4a0SFrançois Tigeot 	ret = dsi_calc_mnp(dsi_clk, &dsi_mnp);
242*9edbd4a0SFrançois Tigeot 	if (ret) {
243*9edbd4a0SFrançois Tigeot 		DRM_DEBUG_KMS("dsi_calc_mnp failed\n");
244*9edbd4a0SFrançois Tigeot 		return;
245*9edbd4a0SFrançois Tigeot 	}
246*9edbd4a0SFrançois Tigeot 
247*9edbd4a0SFrançois Tigeot 	dsi_mnp.dsi_pll_ctrl |= DSI_PLL_CLK_GATE_DSI0_DSIPLL;
248*9edbd4a0SFrançois Tigeot 
249*9edbd4a0SFrançois Tigeot 	DRM_DEBUG_KMS("dsi pll div %08x, ctrl %08x\n",
250*9edbd4a0SFrançois Tigeot 		      dsi_mnp.dsi_pll_div, dsi_mnp.dsi_pll_ctrl);
251*9edbd4a0SFrançois Tigeot 
252*9edbd4a0SFrançois Tigeot 	vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_CONTROL, 0);
253*9edbd4a0SFrançois Tigeot 	vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_DIVIDER, dsi_mnp.dsi_pll_div);
254*9edbd4a0SFrançois Tigeot 	vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_CONTROL, dsi_mnp.dsi_pll_ctrl);
255*9edbd4a0SFrançois Tigeot }
256*9edbd4a0SFrançois Tigeot 
257*9edbd4a0SFrançois Tigeot void vlv_enable_dsi_pll(struct intel_encoder *encoder)
258*9edbd4a0SFrançois Tigeot {
259*9edbd4a0SFrançois Tigeot 	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
260*9edbd4a0SFrançois Tigeot 	u32 tmp;
261*9edbd4a0SFrançois Tigeot 
262*9edbd4a0SFrançois Tigeot 	DRM_DEBUG_KMS("\n");
263*9edbd4a0SFrançois Tigeot 
264*9edbd4a0SFrançois Tigeot 	mutex_lock(&dev_priv->dpio_lock);
265*9edbd4a0SFrançois Tigeot 
266*9edbd4a0SFrançois Tigeot 	vlv_configure_dsi_pll(encoder);
267*9edbd4a0SFrançois Tigeot 
268*9edbd4a0SFrançois Tigeot 	/* wait at least 0.5 us after ungating before enabling VCO */
269*9edbd4a0SFrançois Tigeot 	usleep_range(1, 10);
270*9edbd4a0SFrançois Tigeot 
271*9edbd4a0SFrançois Tigeot 	tmp = vlv_cck_read(dev_priv, CCK_REG_DSI_PLL_CONTROL);
272*9edbd4a0SFrançois Tigeot 	tmp |= DSI_PLL_VCO_EN;
273*9edbd4a0SFrançois Tigeot 	vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_CONTROL, tmp);
274*9edbd4a0SFrançois Tigeot 
275*9edbd4a0SFrançois Tigeot 	mutex_unlock(&dev_priv->dpio_lock);
276*9edbd4a0SFrançois Tigeot 
277*9edbd4a0SFrançois Tigeot 	if (wait_for(I915_READ(PIPECONF(PIPE_A)) & PIPECONF_DSI_PLL_LOCKED, 20)) {
278*9edbd4a0SFrançois Tigeot 		DRM_ERROR("DSI PLL lock failed\n");
279*9edbd4a0SFrançois Tigeot 		return;
280*9edbd4a0SFrançois Tigeot 	}
281*9edbd4a0SFrançois Tigeot 
282*9edbd4a0SFrançois Tigeot 	DRM_DEBUG_KMS("DSI PLL locked\n");
283*9edbd4a0SFrançois Tigeot }
284*9edbd4a0SFrançois Tigeot 
285*9edbd4a0SFrançois Tigeot void vlv_disable_dsi_pll(struct intel_encoder *encoder)
286*9edbd4a0SFrançois Tigeot {
287*9edbd4a0SFrançois Tigeot 	struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;
288*9edbd4a0SFrançois Tigeot 	u32 tmp;
289*9edbd4a0SFrançois Tigeot 
290*9edbd4a0SFrançois Tigeot 	DRM_DEBUG_KMS("\n");
291*9edbd4a0SFrançois Tigeot 
292*9edbd4a0SFrançois Tigeot 	mutex_lock(&dev_priv->dpio_lock);
293*9edbd4a0SFrançois Tigeot 
294*9edbd4a0SFrançois Tigeot 	tmp = vlv_cck_read(dev_priv, CCK_REG_DSI_PLL_CONTROL);
295*9edbd4a0SFrançois Tigeot 	tmp &= ~DSI_PLL_VCO_EN;
296*9edbd4a0SFrançois Tigeot 	tmp |= DSI_PLL_LDO_GATE;
297*9edbd4a0SFrançois Tigeot 	vlv_cck_write(dev_priv, CCK_REG_DSI_PLL_CONTROL, tmp);
298*9edbd4a0SFrançois Tigeot 
299*9edbd4a0SFrançois Tigeot 	mutex_unlock(&dev_priv->dpio_lock);
300*9edbd4a0SFrançois Tigeot }
301