blob: 7b0d9302d4172f9c8b6bcf36f8fa8071cecf03b6 [file] [log] [blame]
Aravind Venkateswaran31119842015-01-13 14:46:04 -08001/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
Arpita Banerjee841fa062013-05-24 14:59:51 -07002 *
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 */
29
30/*---------------------------------------------------------------------------*/
31/* HEADER files */
32/*---------------------------------------------------------------------------*/
33#include <stdint.h>
34#include <msm_panel.h>
35#include <mipi_dsi.h>
Veera Sundaram Sankaran602d95a2014-12-09 17:55:04 -080036#include <mdp5.h>
Arpita Banerjee841fa062013-05-24 14:59:51 -070037#include <sys/types.h>
38#include <platform/iomap.h>
39#include <err.h>
40#include <reg.h>
Dhaval Patel551f7f62014-02-18 17:13:00 -080041#include <string.h>
Arpita Banerjee841fa062013-05-24 14:59:51 -070042
Arpita Banerjee841fa062013-05-24 14:59:51 -070043/*---------------------------------------------------------------------------*/
44/* Panel Header */
45/*---------------------------------------------------------------------------*/
46#include "panel_display.h"
47#include "include/panel.h"
Veera Sundaram Sankaran824e6fa2014-12-09 11:32:58 -080048#include "target/display.h"
Arpita Banerjee841fa062013-05-24 14:59:51 -070049
Aravind Venkateswaranfec354c2014-12-04 18:10:14 -080050static int dsi_panel_ctl_base_setup(struct msm_panel_info *pinfo,
51 char *panel_destination)
52{
53 if (!strcmp(panel_destination, "DISPLAY_1")) {
54 pinfo->dest = DISPLAY_1;
55 pinfo->mipi.ctl_base = MIPI_DSI0_BASE;
56 pinfo->mipi.phy_base = DSI0_PHY_BASE;
57 pinfo->mipi.sctl_base = MIPI_DSI1_BASE;
58 pinfo->mipi.sphy_base = DSI1_PHY_BASE;
59 } else if (!strcmp(panel_destination, "DISPLAY_2")) {
60 pinfo->dest = DISPLAY_2;
61 pinfo->mipi.ctl_base = MIPI_DSI1_BASE;
62 pinfo->mipi.phy_base = DSI1_PHY_BASE;
63 pinfo->mipi.sctl_base = MIPI_DSI0_BASE;
64 pinfo->mipi.sphy_base = DSI0_PHY_BASE;
65 } else {
66 pinfo->dest = DISPLAY_UNKNOWN;
67 dprintf(CRITICAL, "%s: Unkown panel destination: %d\n",
68 __func__, pinfo->dest);
69 return ERROR;
70 }
71
72 dprintf(SPEW, "%s: panel dest=%s, ctl_base=0x%08x, phy_base=0x%08x\n",
73 __func__, panel_destination, pinfo->mipi.ctl_base,
74 pinfo->mipi.phy_base);
75 return NO_ERROR;
76}
77
Arpita Banerjee841fa062013-05-24 14:59:51 -070078/*---------------------------------------------------------------------------*/
79/* Panel Init */
80/*---------------------------------------------------------------------------*/
81int dsi_panel_init(struct msm_panel_info *pinfo,
82 struct panel_struct *pstruct)
83{
Aravind Venkateswaranfec354c2014-12-04 18:10:14 -080084 int ret = NO_ERROR;
Arpita Banerjee841fa062013-05-24 14:59:51 -070085 /* Resolution setting*/
86 pinfo->xres = pstruct->panelres->panel_width;
87 pinfo->yres = pstruct->panelres->panel_height;
88 pinfo->lcdc.h_back_porch = pstruct->panelres->hback_porch;
89 pinfo->lcdc.h_front_porch = pstruct->panelres->hfront_porch;
90 pinfo->lcdc.h_pulse_width = pstruct->panelres->hpulse_width;
91 pinfo->lcdc.v_back_porch = pstruct->panelres->vback_porch;
92 pinfo->lcdc.v_front_porch = pstruct->panelres->vfront_porch;
93 pinfo->lcdc.v_pulse_width = pstruct->panelres->vpulse_width;
94 pinfo->lcdc.hsync_skew = pstruct->panelres->hsync_skew;
Kuogee Hsieh31b4ff92014-10-22 14:55:42 -070095
96 pinfo->border_top = pstruct->panelres->vtop_border;
97 pinfo->border_bottom = pstruct->panelres->vbottom_border;
98 pinfo->border_left = pstruct->panelres->hleft_border;
99 pinfo->border_right = pstruct->panelres->hright_border;
100
101 dprintf(SPEW, "%s: left=%d right=%d top=%d bottom=%d\n", __func__,
102 pinfo->border_left, pinfo->border_right,
103 pinfo->border_top, pinfo->border_bottom);
104
105 pinfo->xres += (pinfo->border_left + pinfo->border_right);
106 pinfo->yres += (pinfo->border_top + pinfo->border_bottom);
Arpita Banerjee841fa062013-05-24 14:59:51 -0700107
Dhaval Patelee8675a2013-10-25 10:07:57 -0700108 if (pstruct->paneldata->panel_operating_mode & DUAL_PIPE_FLAG)
109 pinfo->lcdc.dual_pipe = 1;
110 if (pstruct->paneldata->panel_operating_mode & PIPE_SWAP_FLAG)
111 pinfo->lcdc.pipe_swap = 1;
112 if (pstruct->paneldata->panel_operating_mode & SPLIT_DISPLAY_FLAG)
113 pinfo->lcdc.split_display = 1;
Vineet Bajaj4effb132014-07-24 16:55:41 +0530114 if (pstruct->paneldata->panel_operating_mode & DST_SPLIT_FLAG)
115 pinfo->lcdc.dst_split = 1;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700116
117 /* Color setting*/
118 pinfo->lcdc.border_clr = pstruct->color->border_color;
119 pinfo->lcdc.underflow_clr = pstruct->color->underflow_color;
120 pinfo->mipi.rgb_swap = pstruct->color->color_order;
121 switch (pinfo->bpp) {
122 case BPP_16:
123 pinfo->mipi.dst_format = DSI_VIDEO_DST_FORMAT_RGB565;
124 break;
125 case BPP_18:
126 if (pstruct->color->pixel_packing)
127 pinfo->mipi.dst_format
128 = DSI_VIDEO_DST_FORMAT_RGB666_LOOSE;
129 else
130 pinfo->mipi.dst_format
131 = DSI_VIDEO_DST_FORMAT_RGB666;
132 break;
133 case BPP_24:
134 default:
135 pinfo->mipi.dst_format = DSI_VIDEO_DST_FORMAT_RGB888;
136 break;
137 }
138
139 /* Panel generic info */
140 pinfo->mipi.mode = pstruct->paneldata->panel_type;
141 if (pinfo->mipi.mode) {
142 pinfo->type = MIPI_CMD_PANEL;
143 } else {
144 pinfo->type = MIPI_VIDEO_PANEL;
145 }
146 pinfo->bpp = pstruct->color->color_format;
147 pinfo->clk_rate = pstruct->paneldata->panel_clockrate;
Prashant Nukala64eeff92014-07-11 07:35:34 +0530148 pinfo->orientation = pstruct->paneldata->panel_orientation;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700149 pinfo->mipi.interleave_mode = pstruct->paneldata->interleave_mode;
Dhaval Patelee8675a2013-10-25 10:07:57 -0700150 pinfo->mipi.broadcast = pstruct->paneldata->panel_broadcast_mode;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700151 pinfo->mipi.vc = pstruct->paneldata->dsi_virtualchannel_id;
152 pinfo->mipi.frame_rate = pstruct->paneldata->panel_framerate;
153 pinfo->mipi.stream = pstruct->paneldata->dsi_stream;
Dhaval Patelee8675a2013-10-25 10:07:57 -0700154 if (pstruct->paneldata->panel_operating_mode & DUAL_DSI_FLAG)
155 pinfo->mipi.dual_dsi = 1;
Dhaval Patel29f24492013-08-08 20:45:42 -0700156 pinfo->mipi.mode_gpio_state = pstruct->paneldata->mode_gpio_state;
Arpita Banerjeeda0c39a2013-05-24 16:12:45 -0700157 pinfo->mipi.bitclock = pstruct->paneldata->panel_bitclock_freq;
Aravind Venkateswaran31119842015-01-13 14:46:04 -0800158 if (pinfo->mipi.bitclock) {
159 /* panel_clockrate is depcrated in favor of bitclock_freq */
160 pinfo->clk_rate = pinfo->mipi.bitclock;
161 }
Aravind Venkateswaran1e31c782013-11-04 17:32:14 -0800162 pinfo->mipi.use_enable_gpio =
163 pstruct->paneldata->panel_with_enable_gpio;
Aravind Venkateswaranfec354c2014-12-04 18:10:14 -0800164 ret = dsi_panel_ctl_base_setup(pinfo,
165 pstruct->paneldata->panel_destination);
166 if (ret)
167 return ret;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700168
169 /* Video Panel configuration */
170 pinfo->mipi.pulse_mode_hsa_he = pstruct->videopanel->hsync_pulse;
171 pinfo->mipi.hfp_power_stop = pstruct->videopanel->hfp_power_mode;
172 pinfo->mipi.hbp_power_stop = pstruct->videopanel->hbp_power_mode;
173 pinfo->mipi.hsa_power_stop = pstruct->videopanel->hsa_power_mode;
174 pinfo->mipi.eof_bllp_power_stop
175 = pstruct->videopanel->bllp_eof_power_mode;
176 pinfo->mipi.bllp_power_stop = pstruct->videopanel->bllp_power_mode;
177 pinfo->mipi.traffic_mode = pstruct->videopanel->traffic_mode;
178 pinfo->mipi.eof_bllp_power = pstruct->videopanel->bllp_eof_power;
179
180 /* Command Panel configuratoin */
181 pinfo->mipi.insert_dcs_cmd = pstruct->commandpanel->tedcs_command;
182 pinfo->mipi.wr_mem_continue
183 = pstruct->commandpanel->tevsync_continue_lines;
184 pinfo->mipi.wr_mem_start
185 = pstruct->commandpanel->tevsync_rdptr_irqline;
186 pinfo->mipi.te_sel = pstruct->commandpanel->tepin_select;
187
188 /* Data lane configuraiton */
189 pinfo->mipi.num_of_lanes = pstruct->laneconfig->dsi_lanes;
190 pinfo->mipi.data_lane0 = pstruct->laneconfig->lane0_state;
191 pinfo->mipi.data_lane1 = pstruct->laneconfig->lane1_state;
192 pinfo->mipi.data_lane2 = pstruct->laneconfig->lane2_state;
193 pinfo->mipi.data_lane3 = pstruct->laneconfig->lane3_state;
194 pinfo->mipi.lane_swap = pstruct->laneconfig->dsi_lanemap;
195
196 pinfo->mipi.t_clk_post = pstruct->paneltiminginfo->tclk_post;
197 pinfo->mipi.t_clk_pre = pstruct->paneltiminginfo->tclk_pre;
198 pinfo->mipi.mdp_trigger = pstruct->paneltiminginfo->dsi_mdp_trigger;
199 pinfo->mipi.dma_trigger = pstruct->paneltiminginfo->dsi_dma_trigger;
200
Siddhartha Agrawalfe64dcb2014-10-07 12:41:01 -0700201 pinfo->fbc.enabled = pstruct->fbcinfo.enabled;
202 if (pinfo->fbc.enabled) {
203 pinfo->fbc.enabled = pstruct->fbcinfo.enabled;
204 pinfo->fbc.comp_ratio= pstruct->fbcinfo.comp_ratio;
205 pinfo->fbc.comp_mode = pstruct->fbcinfo.comp_mode;
206 pinfo->fbc.qerr_enable = pstruct->fbcinfo.qerr_enable;
207 pinfo->fbc.cd_bias = pstruct->fbcinfo.cd_bias;
208 pinfo->fbc.pat_enable = pstruct->fbcinfo.pat_enable;
209 pinfo->fbc.vlc_enable = pstruct->fbcinfo.vlc_enable;
210 pinfo->fbc.bflc_enable = pstruct->fbcinfo.bflc_enable;
211 pinfo->fbc.line_x_budget = pstruct->fbcinfo.line_x_budget;
212 pinfo->fbc.block_x_budget = pstruct->fbcinfo.block_x_budget;
213 pinfo->fbc.block_budget = pstruct->fbcinfo.block_budget;
214 pinfo->fbc.lossless_mode_thd = pstruct->fbcinfo.lossless_mode_thd;
215 pinfo->fbc.lossy_mode_thd = pstruct->fbcinfo.lossy_mode_thd;
216 pinfo->fbc.lossy_rgb_thd = pstruct->fbcinfo.lossy_rgb_thd;
217 pinfo->fbc.lossy_mode_idx = pstruct->fbcinfo.lossy_mode_idx;
Jeevan Shriram1b07e372014-11-30 22:03:50 -0800218 pinfo->fbc.slice_height = pstruct->fbcinfo.slice_height;
219 pinfo->fbc.pred_mode = pstruct->fbcinfo.pred_mode;
220 pinfo->fbc.max_pred_err = pstruct->fbcinfo.max_pred_err;
221
Siddhartha Agrawalfe64dcb2014-10-07 12:41:01 -0700222 } else {
223 pinfo->fbc.comp_ratio = 1;
224 }
225
Dhaval Patelb22f1bc2013-10-25 13:56:26 -0700226 pinfo->pre_on = dsi_panel_pre_on;
227 pinfo->pre_off = dsi_panel_pre_off;
228 pinfo->on = dsi_panel_post_on;
229 pinfo->off = dsi_panel_post_off;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700230 pinfo->rotate = dsi_panel_rotation;
231 pinfo->config = dsi_panel_config;
232
233 return NO_ERROR;
234}
235
236/*---------------------------------------------------------------------------*/
237/* Panel Callbacks */
238/*---------------------------------------------------------------------------*/
239
Dhaval Patelb22f1bc2013-10-25 13:56:26 -0700240int dsi_panel_pre_on()
Arpita Banerjee841fa062013-05-24 14:59:51 -0700241{
Dhaval Patelb22f1bc2013-10-25 13:56:26 -0700242 return target_display_pre_on();
243}
244
245int dsi_panel_pre_off()
246{
247 return target_display_pre_off();
248}
249
250int dsi_panel_post_on()
251{
252 int ret = NO_ERROR;
253
254 ret = target_display_post_on();
255 if (ret)
256 return ret;
257
Arpita Banerjee841fa062013-05-24 14:59:51 -0700258 return oem_panel_on();
259}
260
Dhaval Patelb22f1bc2013-10-25 13:56:26 -0700261int dsi_panel_post_off()
Arpita Banerjee841fa062013-05-24 14:59:51 -0700262{
Dhaval Patelb22f1bc2013-10-25 13:56:26 -0700263 int ret = NO_ERROR;
264
265 ret = target_display_post_off();
266 if (ret)
267 return ret;
268
Arpita Banerjee841fa062013-05-24 14:59:51 -0700269 return oem_panel_off();
270}
271
272int dsi_panel_rotation()
273{
274 return oem_panel_rotation();
275}
276
277int dsi_video_panel_config(struct msm_panel_info *pinfo,
278 struct lcdc_panel_info *plcdc
279 )
280{
281 int ret = NO_ERROR;
282 uint8_t lane_enable = 0;
283 uint32_t panel_width = pinfo->xres;
Siddhartha Agrawalfe64dcb2014-10-07 12:41:01 -0700284 uint32_t final_xres, final_yres, final_width;
285 uint32_t final_height, final_hbp, final_hfp,final_vbp;
286 uint32_t final_vfp, final_hpw, final_vpw;
Arpita Banerjee841fa062013-05-24 14:59:51 -0700287
288 if (pinfo->mipi.dual_dsi)
289 panel_width = panel_width / 2;
290
Xiaoming Zhou7e0b1e62013-07-29 15:49:39 -0400291 if (pinfo->mipi.data_lane0)
292 lane_enable |= (1 << 0);
293 if (pinfo->mipi.data_lane1)
294 lane_enable |= (1 << 1);
295 if (pinfo->mipi.data_lane2)
296 lane_enable |= (1 << 2);
297 if (pinfo->mipi.data_lane3)
298 lane_enable |= (1 << 3);
Arpita Banerjee841fa062013-05-24 14:59:51 -0700299
Siddhartha Agrawalfe64dcb2014-10-07 12:41:01 -0700300 final_xres = panel_width;
301 final_width = panel_width + pinfo->lcdc.xres_pad;
302
303 if (pinfo->fbc.enabled && pinfo->fbc.comp_ratio) {
304 final_xres /= pinfo->fbc.comp_ratio;
305 final_width /= pinfo->fbc.comp_ratio;
306 dprintf(SPEW, "DSI xres =%d final_width=%d\n", final_xres,
307 final_width);
308 }
309 final_yres = pinfo->yres;
310 final_height = pinfo->yres + pinfo->lcdc.yres_pad;
311 final_hbp = pinfo->lcdc.h_back_porch;
312 final_hfp = pinfo->lcdc.h_front_porch;
313 final_vbp = pinfo->lcdc.v_back_porch;
314 final_vfp = pinfo->lcdc.v_front_porch;
315 final_hpw = pinfo->lcdc.h_pulse_width;
316 final_vpw = pinfo->lcdc.v_pulse_width;
317
318 ret = mdss_dsi_video_mode_config(final_width, final_height,
319 final_xres, final_yres,
320 final_hfp, final_hbp + final_hpw,
321 final_vfp, final_vbp + final_vpw,
322 final_hpw, final_vpw,
Arpita Banerjee841fa062013-05-24 14:59:51 -0700323 pinfo->mipi.dst_format,
324 pinfo->mipi.traffic_mode,
325 lane_enable,
Dhaval Patel729aa972014-01-06 15:20:01 -0800326 pinfo->mipi.hsa_power_stop,
Arpita Banerjee841fa062013-05-24 14:59:51 -0700327 pinfo->mipi.eof_bllp_power,
328 pinfo->mipi.interleave_mode,
Aravind Venkateswaranfec354c2014-12-04 18:10:14 -0800329 pinfo->mipi.ctl_base);
Arpita Banerjee841fa062013-05-24 14:59:51 -0700330
331 if (pinfo->mipi.dual_dsi)
Siddhartha Agrawalfe64dcb2014-10-07 12:41:01 -0700332 ret = mdss_dsi_video_mode_config(final_width, final_height,
333 final_xres, final_yres,
334 final_hfp, final_hbp + final_hpw,
335 final_vfp, final_vbp + final_vpw,
336 final_hpw, final_vpw,
337 pinfo->mipi.dst_format,
338 pinfo->mipi.traffic_mode,
339 lane_enable,
340 pinfo->mipi.hsa_power_stop,
341 pinfo->mipi.eof_bllp_power,
342 pinfo->mipi.interleave_mode,
Aravind Venkateswaranfec354c2014-12-04 18:10:14 -0800343 pinfo->mipi.sctl_base);
Arpita Banerjee841fa062013-05-24 14:59:51 -0700344
345 return ret;
346}
347
348int dsi_cmd_panel_config (struct msm_panel_info *pinfo,
349 struct lcdc_panel_info *plcdc)
350{
351 int ret = NO_ERROR;
Xiaoming Zhou7e0b1e62013-07-29 15:49:39 -0400352 uint8_t lane_en = 0;
353 uint8_t ystride = pinfo->bpp / 8;
Dhaval Patelea19a1e2014-01-02 16:17:26 -0800354 uint32_t panel_width = pinfo->xres;
Aravind Venkateswaran5cfdbc72014-12-03 16:06:45 -0800355 uint32_t final_xres, final_yres, final_width;
356 uint32_t final_height;
Dhaval Patelea19a1e2014-01-02 16:17:26 -0800357
358 if (pinfo->mipi.dual_dsi)
359 panel_width = panel_width / 2;
Xiaoming Zhou7e0b1e62013-07-29 15:49:39 -0400360
361 if (pinfo->mipi.data_lane0)
362 lane_en |= (1 << 0);
363 if (pinfo->mipi.data_lane1)
364 lane_en |= (1 << 1);
365 if (pinfo->mipi.data_lane2)
366 lane_en |= (1 << 2);
367 if (pinfo->mipi.data_lane3)
368 lane_en |= (1 << 3);
Arpita Banerjee841fa062013-05-24 14:59:51 -0700369
Aravind Venkateswaran5cfdbc72014-12-03 16:06:45 -0800370 final_xres = panel_width;
371 final_width = panel_width + pinfo->lcdc.xres_pad;
372
373 if (pinfo->fbc.enabled && pinfo->fbc.comp_ratio) {
374 final_xres /= pinfo->fbc.comp_ratio;
375 final_width /= pinfo->fbc.comp_ratio;
376 dprintf(SPEW, "DSI xres =%d final_width=%d\n", final_xres,
377 final_width);
378 }
379 final_yres = pinfo->yres;
380 final_height = pinfo->yres + pinfo->lcdc.yres_pad;
381
382 ret = mdss_dsi_cmd_mode_config(final_width, final_height,
383 final_xres, final_yres,
Xiaoming Zhou7e0b1e62013-07-29 15:49:39 -0400384 pinfo->mipi.dst_format,
385 ystride, lane_en,
Dhaval Patelea19a1e2014-01-02 16:17:26 -0800386 pinfo->mipi.interleave_mode,
Aravind Venkateswaranfec354c2014-12-04 18:10:14 -0800387 pinfo->mipi.ctl_base);
Dhaval Patelea19a1e2014-01-02 16:17:26 -0800388
389 if (pinfo->mipi.dual_dsi)
Aravind Venkateswaran5cfdbc72014-12-03 16:06:45 -0800390 ret = mdss_dsi_cmd_mode_config(final_width, final_height,
391 final_xres, final_yres,
392 pinfo->mipi.dst_format,
393 ystride, lane_en,
394 pinfo->mipi.interleave_mode,
Aravind Venkateswaranfec354c2014-12-04 18:10:14 -0800395 pinfo->mipi.sctl_base);
Arpita Banerjee841fa062013-05-24 14:59:51 -0700396
397 return ret;
398}
399
400
401int dsi_panel_config(void *pdata)
402{
403 int ret = NO_ERROR;
404 struct msm_panel_info *pinfo = (struct msm_panel_info *)pdata;
405 struct lcdc_panel_info *plcdc = NULL;
406
407 if (pinfo == NULL)
408 return ERR_INVALID_ARGS;
409
410 plcdc = &(pinfo->lcdc);
411 if (plcdc == NULL)
412 return ERR_INVALID_ARGS;
413
414
415 if (pinfo->mipi.mode == DSI_VIDEO_MODE) {
416 ret = dsi_video_panel_config(pinfo, plcdc);
417 } else {
418 ret = dsi_cmd_panel_config(pinfo, plcdc);
419 }
420
421 return ret;
422}
Dhaval Patel551f7f62014-02-18 17:13:00 -0800423
424int32_t panel_name_to_id(struct panel_list supp_panels[],
425 uint32_t supp_panels_size,
426 const char *panel_name)
427{
428 uint32_t i;
429 int32_t panel_id = ERR_NOT_FOUND;
430
431 if (!panel_name) {
432 dprintf(CRITICAL, "Invalid panel name\n");
433 return panel_id;
434 }
435
436 /* Remove any leading whitespaces */
437 panel_name += strspn(panel_name, " ");
438 for (i = 0; i < supp_panels_size; i++) {
439 if (!strncmp(panel_name, supp_panels[i].name,
440 MAX_PANEL_ID_LEN)) {
441 panel_id = supp_panels[i].id;
442 break;
443 }
444 }
445
446 return panel_id;
447}