Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 1 | /* 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 | |
| 34 | static struct msm_fb_panel_data panel; |
| 35 | static uint8_t display_enabled; |
| 36 | |
| 37 | extern int msm_display_init(struct msm_fb_panel_data *pdata); |
| 38 | extern int msm_display_off(); |
| 39 | extern int mipi_renesas_panel_dsi_config(int); |
| 40 | extern int mipi_nt35510_panel_dsi_config(int); |
| 41 | |
Channagoud Kadabi | 10189fd | 2012-05-25 13:33:39 +0530 | [diff] [blame] | 42 | static int msm7627a_mdp_clock_init(int enable) |
| 43 | { |
| 44 | int ret = 0; |
| 45 | |
| 46 | if (enable) |
| 47 | mdp_clock_init(); |
Aparna Mallavarapu | c216380 | 2012-06-19 19:15:32 +0530 | [diff] [blame] | 48 | else |
| 49 | mdp_clock_disable(); |
Channagoud Kadabi | 10189fd | 2012-05-25 13:33:39 +0530 | [diff] [blame] | 50 | return ret; |
| 51 | } |
| 52 | |
Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 53 | void display_init(void) |
| 54 | { |
| 55 | unsigned mach_type; |
| 56 | mach_type = board_machtype(); |
| 57 | |
| 58 | dprintf(SPEW, "display_init\n"); |
| 59 | |
| 60 | switch (mach_type) { |
| 61 | case MSM7X27A_SURF: |
| 62 | case MSM8X25_SURF: |
| 63 | case MSM7X27A_FFA: |
Channagoud Kadabi | 10189fd | 2012-05-25 13:33:39 +0530 | [diff] [blame] | 64 | mipi_renesas_cmd_fwvga_init(&(panel.panel_info)); |
| 65 | panel.clk_func = msm7627a_mdp_clock_init; |
Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 66 | panel.power_func = mipi_renesas_panel_dsi_config; |
| 67 | panel.fb.base = MIPI_FB_ADDR; |
| 68 | panel.fb.width = panel.panel_info.xres; |
| 69 | panel.fb.height = panel.panel_info.yres; |
| 70 | panel.fb.stride = panel.panel_info.xres; |
| 71 | panel.fb.bpp = panel.panel_info.bpp; |
| 72 | panel.fb.format = FB_FORMAT_RGB888; |
| 73 | panel.mdp_rev = MDP_REV_303; |
| 74 | break; |
| 75 | case MSM7X25A_SURF: |
| 76 | case MSM7X25A_FFA: |
Channagoud Kadabi | 10189fd | 2012-05-25 13:33:39 +0530 | [diff] [blame] | 77 | mipi_renesas_cmd_hvga_init(&(panel.panel_info)); |
| 78 | panel.clk_func = msm7627a_mdp_clock_init; |
Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 79 | panel.power_func = mipi_renesas_panel_dsi_config; |
| 80 | panel.fb.base = MIPI_FB_ADDR; |
| 81 | panel.fb.width = panel.panel_info.xres; |
| 82 | panel.fb.height = panel.panel_info.yres; |
| 83 | panel.fb.stride = panel.panel_info.xres; |
| 84 | panel.fb.bpp = panel.panel_info.bpp; |
| 85 | panel.fb.format = FB_FORMAT_RGB888; |
| 86 | panel.mdp_rev = MDP_REV_303; |
| 87 | break; |
| 88 | case MSM7X27A_EVB: |
| 89 | case MSM8X25_EVB: |
Aparna Mallavarapu | 287d89c | 2012-05-11 14:27:03 +0530 | [diff] [blame] | 90 | case MSM8X25_EVT: |
Channagoud Kadabi | 10189fd | 2012-05-25 13:33:39 +0530 | [diff] [blame] | 91 | mipi_nt35510_cmd_wvga_init(&(panel.panel_info)); |
| 92 | panel.clk_func = msm7627a_mdp_clock_init; |
Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 93 | panel.power_func = mipi_nt35510_panel_dsi_config; |
| 94 | panel.fb.base = MIPI_FB_ADDR; |
| 95 | panel.fb.width = panel.panel_info.xres; |
| 96 | panel.fb.height = panel.panel_info.yres; |
| 97 | panel.fb.stride = panel.panel_info.xres; |
| 98 | panel.fb.bpp = panel.panel_info.bpp; |
| 99 | panel.fb.format = FB_FORMAT_RGB888; |
| 100 | panel.mdp_rev = MDP_REV_303; |
Channagoud Kadabi | 01c9182 | 2012-06-06 15:53:30 +0530 | [diff] [blame] | 101 | if (mach_type == MSM8X25_EVT) |
| 102 | panel.rotate = 1; |
Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 103 | break; |
| 104 | default: |
| 105 | return; |
| 106 | }; |
| 107 | |
| 108 | if (msm_display_init(&panel)) { |
Channagoud Kadabi | 898453d | 2012-06-06 11:14:35 +0530 | [diff] [blame] | 109 | dprintf(CRITICAL, "Display init failed!\n"); |
Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 110 | return; |
| 111 | } |
Channagoud Kadabi | 539ef72 | 2012-03-29 16:02:50 +0530 | [diff] [blame] | 112 | display_enabled = 1; |
| 113 | } |
| 114 | |
| 115 | void display_shutdown(void) |
| 116 | { |
| 117 | dprintf(SPEW, "display_shutdown()\n"); |
| 118 | if (display_enabled) |
| 119 | msm_display_off(); |
| 120 | } |