Duy Truong | f3ac7b3 | 2013-02-13 01:07:28 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2012, The Linux Foundation. All rights reserved. |
Channagoud Kadabi | 10189fd | 2012-05-25 13:33:39 +0530 | [diff] [blame] | 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. |
Duy Truong | f3ac7b3 | 2013-02-13 01:07:28 -0800 | [diff] [blame] | 12 | * * Neither the name of The Linux Foundation nor the names of its |
Channagoud Kadabi | 10189fd | 2012-05-25 13:33:39 +0530 | [diff] [blame] | 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 | #include "mipi_renesas.h" |
| 31 | |
| 32 | int mipi_renesas_cmd_fwvga_config(void *pdata) |
| 33 | { |
| 34 | int ret = NO_ERROR; |
| 35 | |
| 36 | struct msm_panel_info *pinfo = (struct msm_panel_info *) pdata; |
| 37 | |
| 38 | if (pinfo == NULL) |
| 39 | return ERR_INVALID_ARGS; |
| 40 | |
| 41 | ret = mipi_dsi_cmd_mode_config((pinfo->xres), |
| 42 | (pinfo->yres), |
| 43 | (pinfo->xres), |
| 44 | (pinfo->yres), |
| 45 | pinfo->mipi.dst_format, |
| 46 | pinfo->mipi.traffic_mode); |
| 47 | return ret; |
| 48 | } |
| 49 | |
| 50 | int mipi_renesas_cmd_fwvga_on() |
| 51 | { |
| 52 | int ret = NO_ERROR; |
| 53 | return ret; |
| 54 | } |
| 55 | |
| 56 | int mipi_renesas_cmd_fwvga_off() |
| 57 | { |
| 58 | int ret = NO_ERROR; |
| 59 | return ret; |
| 60 | } |
| 61 | |
| 62 | static struct mipi_dsi_phy_ctrl dsi_cmd_mode_phy_db = { |
| 63 | /* DSI_BIT_CLK at 500MHz, 2 lane, RGB888 */ |
| 64 | {0x03, 0x01, 0x01, 0x00}, /* regulator */ |
| 65 | /* timing */ |
| 66 | {0xb9, 0x8e, 0x1f, 0x00, 0x98, 0x9c, 0x22, |
| 67 | 0x90, 0x18, 0x03, 0x04}, |
| 68 | {0x7f, 0x00, 0x00, 0x00}, /* phy ctrl */ |
| 69 | {0xbb, 0x02, 0x06, 0x00}, /* strength */ |
| 70 | /* pll control */ |
| 71 | {0x00, 0xec, 0x31, 0xd2, 0x00, 0x40, 0x37, 0x62, |
| 72 | 0x01, 0x0f, 0x07, /* --> Two lane configuration */ |
| 73 | 0x05, 0x14, 0x03, 0x0, 0x0, 0x0, 0x20, 0x0, 0x02, 0x0}, |
| 74 | }; |
| 75 | |
| 76 | void mipi_renesas_cmd_fwvga_init(struct msm_panel_info *pinfo) |
| 77 | { |
| 78 | if (!pinfo) |
| 79 | return; |
| 80 | |
| 81 | pinfo->xres = REN_MIPI_FB_WIDTH; |
| 82 | pinfo->yres = REN_MIPI_FB_HEIGHT; |
| 83 | pinfo->mipi.num_of_lanes = 2; |
| 84 | |
| 85 | pinfo->type = MIPI_CMD_PANEL; |
| 86 | pinfo->wait_cycle = 0; |
| 87 | pinfo->bpp = 24; |
| 88 | |
| 89 | pinfo->mipi.mode = DSI_CMD_MODE; |
| 90 | pinfo->mipi.traffic_mode = 0; |
| 91 | pinfo->mipi.dst_format = 0; |
| 92 | pinfo->mipi.dsi_phy_db = &dsi_cmd_mode_phy_db; |
| 93 | pinfo->mipi.tx_eot_append = TRUE; |
| 94 | |
| 95 | pinfo->mipi.lane_swap = 1; |
| 96 | pinfo->mipi.panel_cmds = renesas_panel_video_mode_cmds; |
| 97 | pinfo->mipi.num_of_panel_cmds = ARRAY_SIZE(renesas_panel_video_mode_cmds); |
| 98 | |
| 99 | pinfo->on = mipi_renesas_cmd_fwvga_on; |
| 100 | pinfo->off = mipi_renesas_cmd_fwvga_off; |
| 101 | pinfo->config = mipi_renesas_cmd_fwvga_config; |
| 102 | |
| 103 | return; |
| 104 | } |
| 105 | |
| 106 | void mipi_renesas_cmd_hvga_init(struct msm_panel_info *pinfo) |
| 107 | { |
| 108 | if (!pinfo) |
| 109 | return; |
| 110 | |
| 111 | pinfo->xres = REN_MIPI_FB_WIDTH_HVGA; |
| 112 | pinfo->yres = REN_MIPI_FB_HEIGHT_HVGA; |
| 113 | pinfo->mipi.num_of_lanes = 1; |
| 114 | |
| 115 | pinfo->type = MIPI_CMD_PANEL; |
| 116 | pinfo->wait_cycle = 0; |
| 117 | pinfo->bpp = 24; |
Channagoud Kadabi | ebbca34 | 2012-06-29 18:14:31 +0530 | [diff] [blame] | 118 | pinfo->clk_rate = 499000000; |
Channagoud Kadabi | 10189fd | 2012-05-25 13:33:39 +0530 | [diff] [blame] | 119 | |
| 120 | pinfo->mipi.mode = DSI_CMD_MODE; |
| 121 | pinfo->mipi.traffic_mode = 0; |
| 122 | pinfo->mipi.dst_format = 0; |
| 123 | pinfo->mipi.dsi_phy_db = &dsi_cmd_mode_phy_db; |
| 124 | pinfo->mipi.tx_eot_append = TRUE; |
| 125 | |
| 126 | pinfo->mipi.lane_swap = 1; |
| 127 | pinfo->mipi.panel_cmds = renesas_panel_video_mode_cmds; |
| 128 | pinfo->mipi.num_of_panel_cmds = ARRAY_SIZE(renesas_panel_video_mode_cmds); |
| 129 | |
| 130 | pinfo->on = mipi_renesas_cmd_fwvga_on; |
| 131 | pinfo->off = mipi_renesas_cmd_fwvga_off; |
| 132 | pinfo->config = mipi_renesas_cmd_fwvga_config; |
| 133 | |
| 134 | return; |
| 135 | } |