blob: 92a4a93c03b017ce8c576061438bda21d89aa8af [file] [log] [blame]
Channagoud Kadabi539ef722012-03-29 16:02:50 +05301/* Copyright (c) 2012, Code Aurora Forum. All rights reserved.
2 *
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 Code Aurora Forum, Inc. 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#include <debug.h>
30#include <msm_panel.h>
31#include <target/display.h>
32#include <target/board.h>
33
34static struct msm_fb_panel_data panel;
35static uint8_t display_enabled;
36
37extern int msm_display_init(struct msm_fb_panel_data *pdata);
38extern int msm_display_off();
39extern int mipi_renesas_panel_dsi_config(int);
40extern int mipi_nt35510_panel_dsi_config(int);
41
Channagoud Kadabi10189fd2012-05-25 13:33:39 +053042static int msm7627a_mdp_clock_init(int enable)
43{
44 int ret = 0;
Channagoud Kadabiebbca342012-06-29 18:14:31 +053045 unsigned rate = 0;
46
47 rate = panel.panel_info.clk_rate;
Channagoud Kadabi10189fd2012-05-25 13:33:39 +053048
49 if (enable)
Channagoud Kadabiebbca342012-06-29 18:14:31 +053050 mdp_clock_init(rate);
Aparna Mallavarapuc2163802012-06-19 19:15:32 +053051 else
52 mdp_clock_disable();
Channagoud Kadabi10189fd2012-05-25 13:33:39 +053053 return ret;
54}
55
Channagoud Kadabi539ef722012-03-29 16:02:50 +053056void display_init(void)
57{
58 unsigned mach_type;
59 mach_type = board_machtype();
60
61 dprintf(SPEW, "display_init\n");
62
63 switch (mach_type) {
64 case MSM7X27A_SURF:
65 case MSM8X25_SURF:
66 case MSM7X27A_FFA:
Channagoud Kadabif2488462012-06-12 15:22:48 +053067#if MIPI_VIDEO_MODE
68 mipi_renesas_video_fwvga_init(&(panel.panel_info));
69#else
Channagoud Kadabi10189fd2012-05-25 13:33:39 +053070 mipi_renesas_cmd_fwvga_init(&(panel.panel_info));
Channagoud Kadabif2488462012-06-12 15:22:48 +053071#endif
Channagoud Kadabi10189fd2012-05-25 13:33:39 +053072 panel.clk_func = msm7627a_mdp_clock_init;
Channagoud Kadabi539ef722012-03-29 16:02:50 +053073 panel.power_func = mipi_renesas_panel_dsi_config;
74 panel.fb.base = MIPI_FB_ADDR;
75 panel.fb.width = panel.panel_info.xres;
76 panel.fb.height = panel.panel_info.yres;
77 panel.fb.stride = panel.panel_info.xres;
78 panel.fb.bpp = panel.panel_info.bpp;
79 panel.fb.format = FB_FORMAT_RGB888;
80 panel.mdp_rev = MDP_REV_303;
81 break;
82 case MSM7X25A_SURF:
83 case MSM7X25A_FFA:
Channagoud Kadabif2488462012-06-12 15:22:48 +053084#if MIPI_VIDEO_MODE
85 mipi_renesas_video_hvga_init(&(panel.panel_info));
86#else
Channagoud Kadabi10189fd2012-05-25 13:33:39 +053087 mipi_renesas_cmd_hvga_init(&(panel.panel_info));
Channagoud Kadabif2488462012-06-12 15:22:48 +053088#endif
Channagoud Kadabi10189fd2012-05-25 13:33:39 +053089 panel.clk_func = msm7627a_mdp_clock_init;
Channagoud Kadabi539ef722012-03-29 16:02:50 +053090 panel.power_func = mipi_renesas_panel_dsi_config;
91 panel.fb.base = MIPI_FB_ADDR;
92 panel.fb.width = panel.panel_info.xres;
93 panel.fb.height = panel.panel_info.yres;
94 panel.fb.stride = panel.panel_info.xres;
95 panel.fb.bpp = panel.panel_info.bpp;
96 panel.fb.format = FB_FORMAT_RGB888;
97 panel.mdp_rev = MDP_REV_303;
98 break;
99 case MSM7X27A_EVB:
100 case MSM8X25_EVB:
Aparna Mallavarapu287d89c2012-05-11 14:27:03 +0530101 case MSM8X25_EVT:
Channagoud Kadabif2488462012-06-12 15:22:48 +0530102#if MIPI_VIDEO_MODE
103 mipi_nt35510_video_wvga_init(&(panel.panel_info));
104#else
Channagoud Kadabi10189fd2012-05-25 13:33:39 +0530105 mipi_nt35510_cmd_wvga_init(&(panel.panel_info));
Channagoud Kadabif2488462012-06-12 15:22:48 +0530106#endif
Channagoud Kadabi10189fd2012-05-25 13:33:39 +0530107 panel.clk_func = msm7627a_mdp_clock_init;
Channagoud Kadabi539ef722012-03-29 16:02:50 +0530108 panel.power_func = mipi_nt35510_panel_dsi_config;
109 panel.fb.base = MIPI_FB_ADDR;
110 panel.fb.width = panel.panel_info.xres;
111 panel.fb.height = panel.panel_info.yres;
112 panel.fb.stride = panel.panel_info.xres;
113 panel.fb.bpp = panel.panel_info.bpp;
114 panel.fb.format = FB_FORMAT_RGB888;
115 panel.mdp_rev = MDP_REV_303;
Channagoud Kadabi01c91822012-06-06 15:53:30 +0530116 if (mach_type == MSM8X25_EVT)
117 panel.rotate = 1;
Channagoud Kadabi539ef722012-03-29 16:02:50 +0530118 break;
119 default:
120 return;
121 };
122
123 if (msm_display_init(&panel)) {
Channagoud Kadabi898453d2012-06-06 11:14:35 +0530124 dprintf(CRITICAL, "Display init failed!\n");
Channagoud Kadabi539ef722012-03-29 16:02:50 +0530125 return;
126 }
Channagoud Kadabi539ef722012-03-29 16:02:50 +0530127 display_enabled = 1;
128}
129
130void display_shutdown(void)
131{
132 dprintf(SPEW, "display_shutdown()\n");
133 if (display_enabled)
134 msm_display_off();
135}