Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 1 | /* |
| 2 | * linux/drivers/video/omap2/dss/dss_features.c |
| 3 | * |
| 4 | * Copyright (C) 2010 Texas Instruments |
| 5 | * Author: Archit Taneja <archit@ti.com> |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License version 2 as published by |
| 9 | * the Free Software Foundation. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, but WITHOUT |
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 14 | * more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License along with |
| 17 | * this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | */ |
| 19 | |
| 20 | #include <linux/kernel.h> |
| 21 | #include <linux/types.h> |
| 22 | #include <linux/err.h> |
| 23 | #include <linux/slab.h> |
| 24 | |
Tomi Valkeinen | a0b38cc | 2011-05-11 14:05:07 +0300 | [diff] [blame] | 25 | #include <video/omapdss.h> |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 26 | #include <plat/cpu.h> |
| 27 | |
Archit Taneja | 067a57e | 2011-03-02 11:57:25 +0530 | [diff] [blame] | 28 | #include "dss.h" |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 29 | #include "dss_features.h" |
| 30 | |
| 31 | /* Defines a generic omap register field */ |
| 32 | struct dss_reg_field { |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 33 | u8 start, end; |
| 34 | }; |
| 35 | |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 36 | struct dss_param_range { |
| 37 | int min, max; |
| 38 | }; |
| 39 | |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 40 | struct omap_dss_features { |
| 41 | const struct dss_reg_field *reg_fields; |
| 42 | const int num_reg_fields; |
| 43 | |
| 44 | const u32 has_feature; |
| 45 | |
| 46 | const int num_mgrs; |
| 47 | const int num_ovls; |
| 48 | const enum omap_display_type *supported_displays; |
| 49 | const enum omap_color_mode *supported_color_modes; |
Taneja, Archit | 235e7db | 2011-03-14 23:28:21 -0500 | [diff] [blame] | 50 | const char * const *clksrc_names; |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 51 | const struct dss_param_range *dss_params; |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 52 | }; |
| 53 | |
| 54 | /* This struct is assigned to one of the below during initialization */ |
Tomi Valkeinen | ea29033 | 2011-04-20 10:09:36 +0300 | [diff] [blame] | 55 | static const struct omap_dss_features *omap_current_dss_features; |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 56 | |
| 57 | static const struct dss_reg_field omap2_dss_reg_fields[] = { |
Taneja, Archit | 4964111 | 2011-03-14 23:28:23 -0500 | [diff] [blame] | 58 | [FEAT_REG_FIRHINC] = { 11, 0 }, |
| 59 | [FEAT_REG_FIRVINC] = { 27, 16 }, |
| 60 | [FEAT_REG_FIFOLOWTHRESHOLD] = { 8, 0 }, |
| 61 | [FEAT_REG_FIFOHIGHTHRESHOLD] = { 24, 16 }, |
| 62 | [FEAT_REG_FIFOSIZE] = { 8, 0 }, |
| 63 | [FEAT_REG_HORIZONTALACCU] = { 9, 0 }, |
| 64 | [FEAT_REG_VERTICALACCU] = { 25, 16 }, |
| 65 | [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 }, |
| 66 | [FEAT_REG_DSIPLL_REGN] = { 0, 0 }, |
| 67 | [FEAT_REG_DSIPLL_REGM] = { 0, 0 }, |
| 68 | [FEAT_REG_DSIPLL_REGM_DISPC] = { 0, 0 }, |
| 69 | [FEAT_REG_DSIPLL_REGM_DSI] = { 0, 0 }, |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 70 | }; |
| 71 | |
| 72 | static const struct dss_reg_field omap3_dss_reg_fields[] = { |
Taneja, Archit | 4964111 | 2011-03-14 23:28:23 -0500 | [diff] [blame] | 73 | [FEAT_REG_FIRHINC] = { 12, 0 }, |
| 74 | [FEAT_REG_FIRVINC] = { 28, 16 }, |
| 75 | [FEAT_REG_FIFOLOWTHRESHOLD] = { 11, 0 }, |
| 76 | [FEAT_REG_FIFOHIGHTHRESHOLD] = { 27, 16 }, |
| 77 | [FEAT_REG_FIFOSIZE] = { 10, 0 }, |
| 78 | [FEAT_REG_HORIZONTALACCU] = { 9, 0 }, |
| 79 | [FEAT_REG_VERTICALACCU] = { 25, 16 }, |
| 80 | [FEAT_REG_DISPC_CLK_SWITCH] = { 0, 0 }, |
| 81 | [FEAT_REG_DSIPLL_REGN] = { 7, 1 }, |
| 82 | [FEAT_REG_DSIPLL_REGM] = { 18, 8 }, |
| 83 | [FEAT_REG_DSIPLL_REGM_DISPC] = { 22, 19 }, |
| 84 | [FEAT_REG_DSIPLL_REGM_DSI] = { 26, 23 }, |
Archit Taneja | 87a7484 | 2011-03-02 11:19:50 +0530 | [diff] [blame] | 85 | }; |
| 86 | |
| 87 | static const struct dss_reg_field omap4_dss_reg_fields[] = { |
Taneja, Archit | 4964111 | 2011-03-14 23:28:23 -0500 | [diff] [blame] | 88 | [FEAT_REG_FIRHINC] = { 12, 0 }, |
| 89 | [FEAT_REG_FIRVINC] = { 28, 16 }, |
| 90 | [FEAT_REG_FIFOLOWTHRESHOLD] = { 15, 0 }, |
| 91 | [FEAT_REG_FIFOHIGHTHRESHOLD] = { 31, 16 }, |
| 92 | [FEAT_REG_FIFOSIZE] = { 15, 0 }, |
| 93 | [FEAT_REG_HORIZONTALACCU] = { 10, 0 }, |
| 94 | [FEAT_REG_VERTICALACCU] = { 26, 16 }, |
| 95 | [FEAT_REG_DISPC_CLK_SWITCH] = { 9, 8 }, |
| 96 | [FEAT_REG_DSIPLL_REGN] = { 8, 1 }, |
| 97 | [FEAT_REG_DSIPLL_REGM] = { 20, 9 }, |
| 98 | [FEAT_REG_DSIPLL_REGM_DISPC] = { 25, 21 }, |
| 99 | [FEAT_REG_DSIPLL_REGM_DSI] = { 30, 26 }, |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 100 | }; |
| 101 | |
| 102 | static const enum omap_display_type omap2_dss_supported_displays[] = { |
| 103 | /* OMAP_DSS_CHANNEL_LCD */ |
Tomi Valkeinen | f8df01f | 2011-02-24 14:21:25 +0200 | [diff] [blame] | 104 | OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI, |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 105 | |
| 106 | /* OMAP_DSS_CHANNEL_DIGIT */ |
| 107 | OMAP_DISPLAY_TYPE_VENC, |
| 108 | }; |
| 109 | |
Tomi Valkeinen | 4e777dd | 2011-02-24 14:20:31 +0200 | [diff] [blame] | 110 | static const enum omap_display_type omap3430_dss_supported_displays[] = { |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 111 | /* OMAP_DSS_CHANNEL_LCD */ |
| 112 | OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI | |
| 113 | OMAP_DISPLAY_TYPE_SDI | OMAP_DISPLAY_TYPE_DSI, |
| 114 | |
| 115 | /* OMAP_DSS_CHANNEL_DIGIT */ |
| 116 | OMAP_DISPLAY_TYPE_VENC, |
| 117 | }; |
| 118 | |
Tomi Valkeinen | 4e777dd | 2011-02-24 14:20:31 +0200 | [diff] [blame] | 119 | static const enum omap_display_type omap3630_dss_supported_displays[] = { |
| 120 | /* OMAP_DSS_CHANNEL_LCD */ |
| 121 | OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI | |
| 122 | OMAP_DISPLAY_TYPE_DSI, |
| 123 | |
| 124 | /* OMAP_DSS_CHANNEL_DIGIT */ |
| 125 | OMAP_DISPLAY_TYPE_VENC, |
| 126 | }; |
| 127 | |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 128 | static const enum omap_display_type omap4_dss_supported_displays[] = { |
| 129 | /* OMAP_DSS_CHANNEL_LCD */ |
| 130 | OMAP_DISPLAY_TYPE_DBI | OMAP_DISPLAY_TYPE_DSI, |
| 131 | |
| 132 | /* OMAP_DSS_CHANNEL_DIGIT */ |
Mythri P K | b119601 | 2011-03-08 17:15:54 +0530 | [diff] [blame] | 133 | OMAP_DISPLAY_TYPE_VENC | OMAP_DISPLAY_TYPE_HDMI, |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 134 | |
| 135 | /* OMAP_DSS_CHANNEL_LCD2 */ |
| 136 | OMAP_DISPLAY_TYPE_DPI | OMAP_DISPLAY_TYPE_DBI | |
| 137 | OMAP_DISPLAY_TYPE_DSI, |
| 138 | }; |
| 139 | |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 140 | static const enum omap_color_mode omap2_dss_supported_color_modes[] = { |
| 141 | /* OMAP_DSS_GFX */ |
| 142 | OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 | |
| 143 | OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 | |
| 144 | OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 | |
| 145 | OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P, |
| 146 | |
| 147 | /* OMAP_DSS_VIDEO1 */ |
| 148 | OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U | |
| 149 | OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 | |
| 150 | OMAP_DSS_COLOR_UYVY, |
| 151 | |
| 152 | /* OMAP_DSS_VIDEO2 */ |
| 153 | OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U | |
| 154 | OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 | |
| 155 | OMAP_DSS_COLOR_UYVY, |
| 156 | }; |
| 157 | |
| 158 | static const enum omap_color_mode omap3_dss_supported_color_modes[] = { |
| 159 | /* OMAP_DSS_GFX */ |
| 160 | OMAP_DSS_COLOR_CLUT1 | OMAP_DSS_COLOR_CLUT2 | |
| 161 | OMAP_DSS_COLOR_CLUT4 | OMAP_DSS_COLOR_CLUT8 | |
| 162 | OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 | |
| 163 | OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U | |
| 164 | OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_ARGB32 | |
| 165 | OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32, |
| 166 | |
| 167 | /* OMAP_DSS_VIDEO1 */ |
| 168 | OMAP_DSS_COLOR_RGB24U | OMAP_DSS_COLOR_RGB24P | |
| 169 | OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_RGB16 | |
| 170 | OMAP_DSS_COLOR_YUV2 | OMAP_DSS_COLOR_UYVY, |
| 171 | |
| 172 | /* OMAP_DSS_VIDEO2 */ |
| 173 | OMAP_DSS_COLOR_RGB12U | OMAP_DSS_COLOR_ARGB16 | |
| 174 | OMAP_DSS_COLOR_RGB16 | OMAP_DSS_COLOR_RGB24U | |
| 175 | OMAP_DSS_COLOR_RGB24P | OMAP_DSS_COLOR_YUV2 | |
| 176 | OMAP_DSS_COLOR_UYVY | OMAP_DSS_COLOR_ARGB32 | |
| 177 | OMAP_DSS_COLOR_RGBA32 | OMAP_DSS_COLOR_RGBX32, |
| 178 | }; |
| 179 | |
Taneja, Archit | 235e7db | 2011-03-14 23:28:21 -0500 | [diff] [blame] | 180 | static const char * const omap2_dss_clk_source_names[] = { |
Archit Taneja | 89a35e5 | 2011-04-12 13:52:23 +0530 | [diff] [blame] | 181 | [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "N/A", |
| 182 | [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "N/A", |
| 183 | [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK1", |
Archit Taneja | 067a57e | 2011-03-02 11:57:25 +0530 | [diff] [blame] | 184 | }; |
| 185 | |
Taneja, Archit | 235e7db | 2011-03-14 23:28:21 -0500 | [diff] [blame] | 186 | static const char * const omap3_dss_clk_source_names[] = { |
Archit Taneja | 89a35e5 | 2011-04-12 13:52:23 +0530 | [diff] [blame] | 187 | [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "DSI1_PLL_FCLK", |
| 188 | [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "DSI2_PLL_FCLK", |
| 189 | [OMAP_DSS_CLK_SRC_FCK] = "DSS1_ALWON_FCLK", |
Archit Taneja | 067a57e | 2011-03-02 11:57:25 +0530 | [diff] [blame] | 190 | }; |
| 191 | |
Taneja, Archit | 235e7db | 2011-03-14 23:28:21 -0500 | [diff] [blame] | 192 | static const char * const omap4_dss_clk_source_names[] = { |
Archit Taneja | 89a35e5 | 2011-04-12 13:52:23 +0530 | [diff] [blame] | 193 | [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DISPC] = "PLL1_CLK1", |
| 194 | [OMAP_DSS_CLK_SRC_DSI_PLL_HSDIV_DSI] = "PLL1_CLK2", |
| 195 | [OMAP_DSS_CLK_SRC_FCK] = "DSS_FCLK", |
Archit Taneja | 5a8b572 | 2011-05-12 17:26:29 +0530 | [diff] [blame^] | 196 | [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DISPC] = "PLL2_CLK1", |
| 197 | [OMAP_DSS_CLK_SRC_DSI2_PLL_HSDIV_DSI] = "PLL2_CLK2", |
Taneja, Archit | ea75159 | 2011-03-08 05:50:35 -0600 | [diff] [blame] | 198 | }; |
| 199 | |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 200 | static const struct dss_param_range omap2_dss_param_range[] = { |
Taneja, Archit | 4964111 | 2011-03-14 23:28:23 -0500 | [diff] [blame] | 201 | [FEAT_PARAM_DSS_FCK] = { 0, 173000000 }, |
| 202 | [FEAT_PARAM_DSIPLL_REGN] = { 0, 0 }, |
| 203 | [FEAT_PARAM_DSIPLL_REGM] = { 0, 0 }, |
| 204 | [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, 0 }, |
| 205 | [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, 0 }, |
| 206 | [FEAT_PARAM_DSIPLL_FINT] = { 0, 0 }, |
| 207 | [FEAT_PARAM_DSIPLL_LPDIV] = { 0, 0 }, |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 208 | }; |
| 209 | |
| 210 | static const struct dss_param_range omap3_dss_param_range[] = { |
Taneja, Archit | 4964111 | 2011-03-14 23:28:23 -0500 | [diff] [blame] | 211 | [FEAT_PARAM_DSS_FCK] = { 0, 173000000 }, |
| 212 | [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 7) - 1 }, |
| 213 | [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 11) - 1 }, |
| 214 | [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 4) - 1 }, |
| 215 | [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 4) - 1 }, |
| 216 | [FEAT_PARAM_DSIPLL_FINT] = { 750000, 2100000 }, |
| 217 | [FEAT_PARAM_DSIPLL_LPDIV] = { 1, (1 << 13) - 1}, |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 218 | }; |
| 219 | |
| 220 | static const struct dss_param_range omap4_dss_param_range[] = { |
Taneja, Archit | 4964111 | 2011-03-14 23:28:23 -0500 | [diff] [blame] | 221 | [FEAT_PARAM_DSS_FCK] = { 0, 186000000 }, |
| 222 | [FEAT_PARAM_DSIPLL_REGN] = { 0, (1 << 8) - 1 }, |
| 223 | [FEAT_PARAM_DSIPLL_REGM] = { 0, (1 << 12) - 1 }, |
| 224 | [FEAT_PARAM_DSIPLL_REGM_DISPC] = { 0, (1 << 5) - 1 }, |
| 225 | [FEAT_PARAM_DSIPLL_REGM_DSI] = { 0, (1 << 5) - 1 }, |
| 226 | [FEAT_PARAM_DSIPLL_FINT] = { 500000, 2500000 }, |
| 227 | [FEAT_PARAM_DSIPLL_LPDIV] = { 0, (1 << 13) - 1 }, |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 228 | }; |
| 229 | |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 230 | /* OMAP2 DSS Features */ |
Tomi Valkeinen | ea29033 | 2011-04-20 10:09:36 +0300 | [diff] [blame] | 231 | static const struct omap_dss_features omap2_dss_features = { |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 232 | .reg_fields = omap2_dss_reg_fields, |
| 233 | .num_reg_fields = ARRAY_SIZE(omap2_dss_reg_fields), |
| 234 | |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 235 | .has_feature = |
| 236 | FEAT_LCDENABLEPOL | FEAT_LCDENABLESIGNAL | |
Archit Taneja | 87a7484 | 2011-03-02 11:19:50 +0530 | [diff] [blame] | 237 | FEAT_PCKFREEENABLE | FEAT_FUNCGATED | |
| 238 | FEAT_ROWREPEATENABLE | FEAT_RESIZECONF, |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 239 | |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 240 | .num_mgrs = 2, |
| 241 | .num_ovls = 3, |
| 242 | .supported_displays = omap2_dss_supported_displays, |
| 243 | .supported_color_modes = omap2_dss_supported_color_modes, |
Archit Taneja | 067a57e | 2011-03-02 11:57:25 +0530 | [diff] [blame] | 244 | .clksrc_names = omap2_dss_clk_source_names, |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 245 | .dss_params = omap2_dss_param_range, |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 246 | }; |
| 247 | |
| 248 | /* OMAP3 DSS Features */ |
Tomi Valkeinen | ea29033 | 2011-04-20 10:09:36 +0300 | [diff] [blame] | 249 | static const struct omap_dss_features omap3430_dss_features = { |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 250 | .reg_fields = omap3_dss_reg_fields, |
| 251 | .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields), |
| 252 | |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 253 | .has_feature = |
| 254 | FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL | |
| 255 | FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE | |
Archit Taneja | 87a7484 | 2011-03-02 11:19:50 +0530 | [diff] [blame] | 256 | FEAT_FUNCGATED | FEAT_ROWREPEATENABLE | |
Archit Taneja | 9613c02 | 2011-03-22 06:33:36 -0500 | [diff] [blame] | 257 | FEAT_LINEBUFFERSPLIT | FEAT_RESIZECONF | |
Tomi Valkeinen | 293ef19 | 2011-04-15 15:07:33 +0300 | [diff] [blame] | 258 | FEAT_DSI_PLL_FREQSEL | FEAT_DSI_REVERSE_TXCLKESC, |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 259 | |
| 260 | .num_mgrs = 2, |
| 261 | .num_ovls = 3, |
Tomi Valkeinen | 4e777dd | 2011-02-24 14:20:31 +0200 | [diff] [blame] | 262 | .supported_displays = omap3430_dss_supported_displays, |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 263 | .supported_color_modes = omap3_dss_supported_color_modes, |
Archit Taneja | 067a57e | 2011-03-02 11:57:25 +0530 | [diff] [blame] | 264 | .clksrc_names = omap3_dss_clk_source_names, |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 265 | .dss_params = omap3_dss_param_range, |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 266 | }; |
| 267 | |
Tomi Valkeinen | ea29033 | 2011-04-20 10:09:36 +0300 | [diff] [blame] | 268 | static const struct omap_dss_features omap3630_dss_features = { |
Samreen | 8fbde10 | 2010-11-04 12:28:41 +0100 | [diff] [blame] | 269 | .reg_fields = omap3_dss_reg_fields, |
| 270 | .num_reg_fields = ARRAY_SIZE(omap3_dss_reg_fields), |
| 271 | |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 272 | .has_feature = |
| 273 | FEAT_GLOBAL_ALPHA | FEAT_LCDENABLEPOL | |
| 274 | FEAT_LCDENABLESIGNAL | FEAT_PCKFREEENABLE | |
Archit Taneja | 87a7484 | 2011-03-02 11:19:50 +0530 | [diff] [blame] | 275 | FEAT_PRE_MULT_ALPHA | FEAT_FUNCGATED | |
| 276 | FEAT_ROWREPEATENABLE | FEAT_LINEBUFFERSPLIT | |
Archit Taneja | 9613c02 | 2011-03-22 06:33:36 -0500 | [diff] [blame] | 277 | FEAT_RESIZECONF | FEAT_DSI_PLL_PWR_BUG | |
Tomi Valkeinen | 9586136 | 2011-04-14 11:42:22 +0300 | [diff] [blame] | 278 | FEAT_DSI_PLL_FREQSEL, |
Samreen | 8fbde10 | 2010-11-04 12:28:41 +0100 | [diff] [blame] | 279 | |
| 280 | .num_mgrs = 2, |
| 281 | .num_ovls = 3, |
Tomi Valkeinen | 4e777dd | 2011-02-24 14:20:31 +0200 | [diff] [blame] | 282 | .supported_displays = omap3630_dss_supported_displays, |
Samreen | 8fbde10 | 2010-11-04 12:28:41 +0100 | [diff] [blame] | 283 | .supported_color_modes = omap3_dss_supported_color_modes, |
Archit Taneja | 067a57e | 2011-03-02 11:57:25 +0530 | [diff] [blame] | 284 | .clksrc_names = omap3_dss_clk_source_names, |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 285 | .dss_params = omap3_dss_param_range, |
Samreen | 8fbde10 | 2010-11-04 12:28:41 +0100 | [diff] [blame] | 286 | }; |
| 287 | |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 288 | /* OMAP4 DSS Features */ |
Tomi Valkeinen | ea29033 | 2011-04-20 10:09:36 +0300 | [diff] [blame] | 289 | static const struct omap_dss_features omap4_dss_features = { |
Archit Taneja | 87a7484 | 2011-03-02 11:19:50 +0530 | [diff] [blame] | 290 | .reg_fields = omap4_dss_reg_fields, |
| 291 | .num_reg_fields = ARRAY_SIZE(omap4_dss_reg_fields), |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 292 | |
| 293 | .has_feature = |
| 294 | FEAT_GLOBAL_ALPHA | FEAT_PRE_MULT_ALPHA | |
Murthy, Raghuveer | 5c6366e | 2011-03-03 09:27:58 -0600 | [diff] [blame] | 295 | FEAT_MGR_LCD2 | FEAT_GLOBAL_ALPHA_VID1 | |
Archit Taneja | 9613c02 | 2011-03-22 06:33:36 -0500 | [diff] [blame] | 296 | FEAT_CORE_CLK_DIV | FEAT_LCD_CLK_SRC | |
| 297 | FEAT_DSI_DCS_CMD_CONFIG_VC | FEAT_DSI_VC_OCP_WIDTH, |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 298 | |
| 299 | .num_mgrs = 3, |
| 300 | .num_ovls = 3, |
| 301 | .supported_displays = omap4_dss_supported_displays, |
| 302 | .supported_color_modes = omap3_dss_supported_color_modes, |
Taneja, Archit | ea75159 | 2011-03-08 05:50:35 -0600 | [diff] [blame] | 303 | .clksrc_names = omap4_dss_clk_source_names, |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 304 | .dss_params = omap4_dss_param_range, |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 305 | }; |
| 306 | |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 307 | /* Functions returning values related to a DSS feature */ |
| 308 | int dss_feat_get_num_mgrs(void) |
| 309 | { |
| 310 | return omap_current_dss_features->num_mgrs; |
| 311 | } |
| 312 | |
| 313 | int dss_feat_get_num_ovls(void) |
| 314 | { |
| 315 | return omap_current_dss_features->num_ovls; |
| 316 | } |
| 317 | |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 318 | unsigned long dss_feat_get_param_min(enum dss_range_param param) |
Archit Taneja | 819d807 | 2011-03-01 11:54:00 +0530 | [diff] [blame] | 319 | { |
Taneja, Archit | 31ef823 | 2011-03-14 23:28:22 -0500 | [diff] [blame] | 320 | return omap_current_dss_features->dss_params[param].min; |
| 321 | } |
| 322 | |
| 323 | unsigned long dss_feat_get_param_max(enum dss_range_param param) |
| 324 | { |
| 325 | return omap_current_dss_features->dss_params[param].max; |
Archit Taneja | 819d807 | 2011-03-01 11:54:00 +0530 | [diff] [blame] | 326 | } |
| 327 | |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 328 | enum omap_display_type dss_feat_get_supported_displays(enum omap_channel channel) |
| 329 | { |
| 330 | return omap_current_dss_features->supported_displays[channel]; |
| 331 | } |
| 332 | |
| 333 | enum omap_color_mode dss_feat_get_supported_color_modes(enum omap_plane plane) |
| 334 | { |
| 335 | return omap_current_dss_features->supported_color_modes[plane]; |
| 336 | } |
| 337 | |
Archit Taneja | 8dad2ab | 2010-11-25 17:58:10 +0530 | [diff] [blame] | 338 | bool dss_feat_color_mode_supported(enum omap_plane plane, |
| 339 | enum omap_color_mode color_mode) |
| 340 | { |
| 341 | return omap_current_dss_features->supported_color_modes[plane] & |
| 342 | color_mode; |
| 343 | } |
| 344 | |
Archit Taneja | 89a35e5 | 2011-04-12 13:52:23 +0530 | [diff] [blame] | 345 | const char *dss_feat_get_clk_source_name(enum omap_dss_clk_source id) |
Archit Taneja | 067a57e | 2011-03-02 11:57:25 +0530 | [diff] [blame] | 346 | { |
Taneja, Archit | 235e7db | 2011-03-14 23:28:21 -0500 | [diff] [blame] | 347 | return omap_current_dss_features->clksrc_names[id]; |
Archit Taneja | 067a57e | 2011-03-02 11:57:25 +0530 | [diff] [blame] | 348 | } |
| 349 | |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 350 | /* DSS has_feature check */ |
| 351 | bool dss_has_feature(enum dss_feat_id id) |
| 352 | { |
| 353 | return omap_current_dss_features->has_feature & id; |
| 354 | } |
| 355 | |
| 356 | void dss_feat_get_reg_field(enum dss_feat_reg_field id, u8 *start, u8 *end) |
| 357 | { |
| 358 | if (id >= omap_current_dss_features->num_reg_fields) |
| 359 | BUG(); |
| 360 | |
| 361 | *start = omap_current_dss_features->reg_fields[id].start; |
| 362 | *end = omap_current_dss_features->reg_fields[id].end; |
| 363 | } |
| 364 | |
| 365 | void dss_features_init(void) |
| 366 | { |
| 367 | if (cpu_is_omap24xx()) |
| 368 | omap_current_dss_features = &omap2_dss_features; |
Samreen | 8fbde10 | 2010-11-04 12:28:41 +0100 | [diff] [blame] | 369 | else if (cpu_is_omap3630()) |
| 370 | omap_current_dss_features = &omap3630_dss_features; |
| 371 | else if (cpu_is_omap34xx()) |
| 372 | omap_current_dss_features = &omap3430_dss_features; |
Archit Taneja | d50cd03 | 2010-12-02 11:27:08 +0000 | [diff] [blame] | 373 | else |
| 374 | omap_current_dss_features = &omap4_dss_features; |
Archit Taneja | e1ef4d2 | 2010-09-15 18:47:29 +0530 | [diff] [blame] | 375 | } |