Joel Stanley | e50183f | 2017-02-28 12:17:46 +1030 | [diff] [blame] | 1 | From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| 2 | From: Benjamin Herrenschmidt <benh@kernel.crashing.org> |
| 3 | Date: Fri, 17 Feb 2017 13:45:24 +1100 |
Joel Stanley | 8d5acef | 2017-03-15 16:24:09 +1030 | [diff] [blame] | 4 | Subject: [PATCH 03/12] drm/ast: const'ify mode setting tables |
Joel Stanley | e50183f | 2017-02-28 12:17:46 +1030 | [diff] [blame] | 5 | |
| 6 | And fix some comment alignment & space/tabs while at it |
| 7 | |
| 8 | Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> |
| 9 | Signed-off-by: Joel Stanley <joel@jms.id.au> |
| 10 | --- |
| 11 | drivers/gpu/drm/ast/ast_drv.h | 4 +- |
| 12 | drivers/gpu/drm/ast/ast_mode.c | 8 +-- |
| 13 | drivers/gpu/drm/ast/ast_tables.h | 106 +++++++++++++++++++-------------------- |
| 14 | 3 files changed, 59 insertions(+), 59 deletions(-) |
| 15 | |
| 16 | diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h |
| 17 | index 3bedcf7ddd2a..3fd9d6e96bce 100644 |
| 18 | --- a/drivers/gpu/drm/ast/ast_drv.h |
| 19 | +++ b/drivers/gpu/drm/ast/ast_drv.h |
| 20 | @@ -304,8 +304,8 @@ struct ast_vbios_dclk_info { |
| 21 | }; |
| 22 | |
| 23 | struct ast_vbios_mode_info { |
| 24 | - struct ast_vbios_stdtable *std_table; |
| 25 | - struct ast_vbios_enhtable *enh_table; |
| 26 | + const struct ast_vbios_stdtable *std_table; |
| 27 | + const struct ast_vbios_enhtable *enh_table; |
| 28 | }; |
| 29 | |
| 30 | extern int ast_mode_init(struct drm_device *dev); |
| 31 | diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c |
| 32 | index e26c98f51eb4..1ff596e90225 100644 |
| 33 | --- a/drivers/gpu/drm/ast/ast_mode.c |
| 34 | +++ b/drivers/gpu/drm/ast/ast_mode.c |
| 35 | @@ -80,9 +80,9 @@ static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mo |
| 36 | { |
| 37 | struct ast_private *ast = crtc->dev->dev_private; |
| 38 | u32 refresh_rate_index = 0, mode_id, color_index, refresh_rate; |
| 39 | + const struct ast_vbios_enhtable *best = NULL; |
| 40 | u32 hborder, vborder; |
| 41 | bool check_sync; |
| 42 | - struct ast_vbios_enhtable *best = NULL; |
| 43 | |
| 44 | switch (crtc->primary->fb->bits_per_pixel) { |
| 45 | case 8: |
| 46 | @@ -146,7 +146,7 @@ static bool ast_get_vbios_mode_info(struct drm_crtc *crtc, struct drm_display_mo |
| 47 | refresh_rate = drm_mode_vrefresh(mode); |
| 48 | check_sync = vbios_mode->enh_table->flags & WideScreenMode; |
| 49 | do { |
| 50 | - struct ast_vbios_enhtable *loop = vbios_mode->enh_table; |
| 51 | + const struct ast_vbios_enhtable *loop = vbios_mode->enh_table; |
| 52 | |
| 53 | while (loop->refresh_rate != 0xff) { |
| 54 | if ((check_sync) && |
| 55 | @@ -225,7 +225,7 @@ static void ast_set_std_reg(struct drm_crtc *crtc, struct drm_display_mode *mode |
| 56 | struct ast_vbios_mode_info *vbios_mode) |
| 57 | { |
| 58 | struct ast_private *ast = crtc->dev->dev_private; |
| 59 | - struct ast_vbios_stdtable *stdtable; |
| 60 | + const struct ast_vbios_stdtable *stdtable; |
| 61 | u32 i; |
| 62 | u8 jreg; |
| 63 | |
| 64 | @@ -381,7 +381,7 @@ static void ast_set_dclk_reg(struct drm_device *dev, struct drm_display_mode *mo |
| 65 | struct ast_vbios_mode_info *vbios_mode) |
| 66 | { |
| 67 | struct ast_private *ast = dev->dev_private; |
| 68 | - struct ast_vbios_dclk_info *clk_info; |
| 69 | + const struct ast_vbios_dclk_info *clk_info; |
| 70 | |
| 71 | clk_info = &dclk_table[vbios_mode->enh_table->dclk_index]; |
| 72 | |
| 73 | diff --git a/drivers/gpu/drm/ast/ast_tables.h b/drivers/gpu/drm/ast/ast_tables.h |
| 74 | index 3608d5aa7451..a4ddf901a54f 100644 |
| 75 | --- a/drivers/gpu/drm/ast/ast_tables.h |
| 76 | +++ b/drivers/gpu/drm/ast/ast_tables.h |
| 77 | @@ -78,37 +78,37 @@ |
| 78 | #define VCLK97_75 0x19 |
| 79 | #define VCLK118_25 0x1A |
| 80 | |
| 81 | -static struct ast_vbios_dclk_info dclk_table[] = { |
| 82 | - {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */ |
| 83 | - {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */ |
| 84 | - {0x67, 0x63, 0x01}, /* 02: VCLK31_5 */ |
| 85 | - {0x76, 0x63, 0x01}, /* 03: VCLK36 */ |
| 86 | - {0xEE, 0x67, 0x01}, /* 04: VCLK40 */ |
| 87 | - {0x82, 0x62, 0x01}, /* 05: VCLK49_5 */ |
| 88 | - {0xC6, 0x64, 0x01}, /* 06: VCLK50 */ |
| 89 | - {0x94, 0x62, 0x01}, /* 07: VCLK56_25 */ |
| 90 | - {0x80, 0x64, 0x00}, /* 08: VCLK65 */ |
| 91 | - {0x7B, 0x63, 0x00}, /* 09: VCLK75 */ |
| 92 | - {0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */ |
| 93 | - {0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */ |
| 94 | - {0x8E, 0x62, 0x00}, /* 0C: VCLK108 */ |
| 95 | - {0x85, 0x24, 0x00}, /* 0D: VCLK135 */ |
| 96 | - {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */ |
| 97 | - {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ |
| 98 | - {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */ |
| 99 | - {0xa7, 0x78, 0x80}, /* 11: VCLK83.5 */ |
| 100 | - {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ |
| 101 | - {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ |
| 102 | - {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */ |
| 103 | - {0x47, 0x6c, 0x80}, /* 15: VCLK71 */ |
| 104 | - {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */ |
| 105 | - {0x77, 0x58, 0x80}, /* 17: VCLK119 */ |
| 106 | - {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ |
| 107 | - {0x6a, 0x6d, 0x80}, /* 19: VCLK97_75 */ |
| 108 | - {0x3b, 0x2c, 0x81}, /* 1A: VCLK118_25 */ |
| 109 | +static const struct ast_vbios_dclk_info dclk_table[] = { |
| 110 | + {0x2C, 0xE7, 0x03}, /* 00: VCLK25_175 */ |
| 111 | + {0x95, 0x62, 0x03}, /* 01: VCLK28_322 */ |
| 112 | + {0x67, 0x63, 0x01}, /* 02: VCLK31_5 */ |
| 113 | + {0x76, 0x63, 0x01}, /* 03: VCLK36 */ |
| 114 | + {0xEE, 0x67, 0x01}, /* 04: VCLK40 */ |
| 115 | + {0x82, 0x62, 0x01}, /* 05: VCLK49_5 */ |
| 116 | + {0xC6, 0x64, 0x01}, /* 06: VCLK50 */ |
| 117 | + {0x94, 0x62, 0x01}, /* 07: VCLK56_25 */ |
| 118 | + {0x80, 0x64, 0x00}, /* 08: VCLK65 */ |
| 119 | + {0x7B, 0x63, 0x00}, /* 09: VCLK75 */ |
| 120 | + {0x67, 0x62, 0x00}, /* 0A: VCLK78_75 */ |
| 121 | + {0x7C, 0x62, 0x00}, /* 0B: VCLK94_5 */ |
| 122 | + {0x8E, 0x62, 0x00}, /* 0C: VCLK108 */ |
| 123 | + {0x85, 0x24, 0x00}, /* 0D: VCLK135 */ |
| 124 | + {0x67, 0x22, 0x00}, /* 0E: VCLK157_5 */ |
| 125 | + {0x6A, 0x22, 0x00}, /* 0F: VCLK162 */ |
| 126 | + {0x4d, 0x4c, 0x80}, /* 10: VCLK154 */ |
| 127 | + {0xa7, 0x78, 0x80}, /* 11: VCLK83.5 */ |
| 128 | + {0x28, 0x49, 0x80}, /* 12: VCLK106.5 */ |
| 129 | + {0x37, 0x49, 0x80}, /* 13: VCLK146.25 */ |
| 130 | + {0x1f, 0x45, 0x80}, /* 14: VCLK148.5 */ |
| 131 | + {0x47, 0x6c, 0x80}, /* 15: VCLK71 */ |
| 132 | + {0x25, 0x65, 0x80}, /* 16: VCLK88.75 */ |
| 133 | + {0x77, 0x58, 0x80}, /* 17: VCLK119 */ |
| 134 | + {0x32, 0x67, 0x80}, /* 18: VCLK85_5 */ |
| 135 | + {0x6a, 0x6d, 0x80}, /* 19: VCLK97_75 */ |
| 136 | + {0x3b, 0x2c, 0x81}, /* 1A: VCLK118_25 */ |
| 137 | }; |
| 138 | |
| 139 | -static struct ast_vbios_stdtable vbios_stdtable[] = { |
| 140 | +static const struct ast_vbios_stdtable vbios_stdtable[] = { |
| 141 | /* MD_2_3_400 */ |
| 142 | { |
| 143 | 0x67, |
| 144 | @@ -181,21 +181,21 @@ static struct ast_vbios_stdtable vbios_stdtable[] = { |
| 145 | }, |
| 146 | }; |
| 147 | |
| 148 | -static struct ast_vbios_enhtable res_640x480[] = { |
| 149 | +static const struct ast_vbios_enhtable res_640x480[] = { |
| 150 | { 800, 640, 8, 96, 525, 480, 2, 2, VCLK25_175, /* 60Hz */ |
| 151 | (SyncNN | HBorder | VBorder | Charx8Dot), 60, 1, 0x2E }, |
| 152 | { 832, 640, 16, 40, 520, 480, 1, 3, VCLK31_5, /* 72Hz */ |
| 153 | (SyncNN | HBorder | VBorder | Charx8Dot), 72, 2, 0x2E }, |
| 154 | { 840, 640, 16, 64, 500, 480, 1, 3, VCLK31_5, /* 75Hz */ |
| 155 | (SyncNN | Charx8Dot) , 75, 3, 0x2E }, |
| 156 | - { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* 85Hz */ |
| 157 | + { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* 85Hz */ |
| 158 | (SyncNN | Charx8Dot) , 85, 4, 0x2E }, |
| 159 | - { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* end */ |
| 160 | + { 832, 640, 56, 56, 509, 480, 1, 3, VCLK36, /* end */ |
| 161 | (SyncNN | Charx8Dot) , 0xFF, 4, 0x2E }, |
| 162 | }; |
| 163 | |
| 164 | -static struct ast_vbios_enhtable res_800x600[] = { |
| 165 | - {1024, 800, 24, 72, 625, 600, 1, 2, VCLK36, /* 56Hz */ |
| 166 | +static const struct ast_vbios_enhtable res_800x600[] = { |
| 167 | + {1024, 800, 24, 72, 625, 600, 1, 2, VCLK36, /* 56Hz */ |
| 168 | (SyncPP | Charx8Dot), 56, 1, 0x30 }, |
| 169 | {1056, 800, 40, 128, 628, 600, 1, 4, VCLK40, /* 60Hz */ |
| 170 | (SyncPP | Charx8Dot), 60, 2, 0x30 }, |
| 171 | @@ -210,7 +210,7 @@ static struct ast_vbios_enhtable res_800x600[] = { |
| 172 | }; |
| 173 | |
| 174 | |
| 175 | -static struct ast_vbios_enhtable res_1024x768[] = { |
| 176 | +static const struct ast_vbios_enhtable res_1024x768[] = { |
| 177 | {1344, 1024, 24, 136, 806, 768, 3, 6, VCLK65, /* 60Hz */ |
| 178 | (SyncNN | Charx8Dot), 60, 1, 0x31 }, |
| 179 | {1328, 1024, 24, 136, 806, 768, 3, 6, VCLK75, /* 70Hz */ |
| 180 | @@ -223,7 +223,7 @@ static struct ast_vbios_enhtable res_1024x768[] = { |
| 181 | (SyncPP | Charx8Dot), 0xFF, 4, 0x31 }, |
| 182 | }; |
| 183 | |
| 184 | -static struct ast_vbios_enhtable res_1280x1024[] = { |
| 185 | +static const struct ast_vbios_enhtable res_1280x1024[] = { |
| 186 | {1688, 1280, 48, 112, 1066, 1024, 1, 3, VCLK108, /* 60Hz */ |
| 187 | (SyncPP | Charx8Dot), 60, 1, 0x32 }, |
| 188 | {1688, 1280, 16, 144, 1066, 1024, 1, 3, VCLK135, /* 75Hz */ |
| 189 | @@ -234,7 +234,7 @@ static struct ast_vbios_enhtable res_1280x1024[] = { |
| 190 | (SyncPP | Charx8Dot), 0xFF, 3, 0x32 }, |
| 191 | }; |
| 192 | |
| 193 | -static struct ast_vbios_enhtable res_1600x1200[] = { |
| 194 | +static const struct ast_vbios_enhtable res_1600x1200[] = { |
| 195 | {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* 60Hz */ |
| 196 | (SyncPP | Charx8Dot), 60, 1, 0x33 }, |
| 197 | {2160, 1600, 64, 192, 1250, 1200, 1, 3, VCLK162, /* end */ |
| 198 | @@ -242,23 +242,23 @@ static struct ast_vbios_enhtable res_1600x1200[] = { |
| 199 | }; |
| 200 | |
| 201 | /* 16:9 */ |
| 202 | -static struct ast_vbios_enhtable res_1360x768[] = { |
| 203 | - {1792, 1360, 64,112, 795, 768, 3, 6, VCLK85_5, /* 60Hz */ |
| 204 | +static const struct ast_vbios_enhtable res_1360x768[] = { |
| 205 | + {1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5, /* 60Hz */ |
| 206 | (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x39 }, |
| 207 | - {1792, 1360, 64,112, 795, 768, 3, 6, VCLK85_5, /* end */ |
| 208 | + {1792, 1360, 64, 112, 795, 768, 3, 6, VCLK85_5, /* end */ |
| 209 | (SyncPP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x39 }, |
| 210 | }; |
| 211 | |
| 212 | -static struct ast_vbios_enhtable res_1600x900[] = { |
| 213 | - {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */ |
| 214 | +static const struct ast_vbios_enhtable res_1600x900[] = { |
| 215 | + {1760, 1600, 48, 32, 926, 900, 3, 5, VCLK97_75, /* 60Hz CVT RB */ |
| 216 | (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x3A }, |
| 217 | - {2112, 1600, 88,168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */ |
| 218 | + {2112, 1600, 88, 168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */ |
| 219 | (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x3A }, |
| 220 | - {2112, 1600, 88,168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */ |
| 221 | + {2112, 1600, 88, 168, 934, 900, 3, 5, VCLK118_25, /* 60Hz CVT */ |
| 222 | (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x3A }, |
| 223 | }; |
| 224 | |
| 225 | -static struct ast_vbios_enhtable res_1920x1080[] = { |
| 226 | +static const struct ast_vbios_enhtable res_1920x1080[] = { |
| 227 | {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */ |
| 228 | (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x38 }, |
| 229 | {2200, 1920, 88, 44, 1125, 1080, 4, 5, VCLK148_5, /* 60Hz */ |
| 230 | @@ -267,8 +267,8 @@ static struct ast_vbios_enhtable res_1920x1080[] = { |
| 231 | |
| 232 | |
| 233 | /* 16:10 */ |
| 234 | -static struct ast_vbios_enhtable res_1280x800[] = { |
| 235 | - {1440, 1280, 48, 32, 823, 800, 3, 6, VCLK71, /* 60Hz RB */ |
| 236 | +static const struct ast_vbios_enhtable res_1280x800[] = { |
| 237 | + {1440, 1280, 48, 32, 823, 800, 3, 6, VCLK71, /* 60Hz RB */ |
| 238 | (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x35 }, |
| 239 | {1680, 1280, 72,128, 831, 800, 3, 6, VCLK83_5, /* 60Hz */ |
| 240 | (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x35 }, |
| 241 | @@ -277,7 +277,7 @@ static struct ast_vbios_enhtable res_1280x800[] = { |
| 242 | |
| 243 | }; |
| 244 | |
| 245 | -static struct ast_vbios_enhtable res_1440x900[] = { |
| 246 | +static const struct ast_vbios_enhtable res_1440x900[] = { |
| 247 | {1600, 1440, 48, 32, 926, 900, 3, 6, VCLK88_75, /* 60Hz RB */ |
| 248 | (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x36 }, |
| 249 | {1904, 1440, 80,152, 934, 900, 3, 6, VCLK106_5, /* 60Hz */ |
| 250 | @@ -286,8 +286,8 @@ static struct ast_vbios_enhtable res_1440x900[] = { |
| 251 | (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x36 }, |
| 252 | }; |
| 253 | |
| 254 | -static struct ast_vbios_enhtable res_1680x1050[] = { |
| 255 | - {1840, 1680, 48, 32, 1080, 1050, 3, 6, VCLK119, /* 60Hz RB */ |
| 256 | +static const struct ast_vbios_enhtable res_1680x1050[] = { |
| 257 | + {1840, 1680, 48, 32, 1080, 1050, 3, 6, VCLK119, /* 60Hz RB */ |
| 258 | (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x37 }, |
| 259 | {2240, 1680,104,176, 1089, 1050, 3, 6, VCLK146_25, /* 60Hz */ |
| 260 | (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 2, 0x37 }, |
| 261 | @@ -295,10 +295,10 @@ static struct ast_vbios_enhtable res_1680x1050[] = { |
| 262 | (SyncPN | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 2, 0x37 }, |
| 263 | }; |
| 264 | |
| 265 | -static struct ast_vbios_enhtable res_1920x1200[] = { |
| 266 | - {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz RB*/ |
| 267 | +static const struct ast_vbios_enhtable res_1920x1200[] = { |
| 268 | + {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz RB*/ |
| 269 | (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 60, 1, 0x34 }, |
| 270 | - {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz RB */ |
| 271 | + {2080, 1920, 48, 32, 1235, 1200, 3, 6, VCLK154, /* 60Hz RB */ |
| 272 | (SyncNP | Charx8Dot | LineCompareOff | WideScreenMode | NewModeInfo), 0xFF, 1, 0x34 }, |
| 273 | }; |
| 274 | |
| 275 | -- |
| 276 | 2.11.0 |
| 277 | |