Commit f3bbb9ccbf2a0362363ce6d7e4e57dbf34a5cef1
1 parent
a76fb4e8ff
Exists in
master
and in
4 other branches
drm/nv40: rework lvds table parsing
All indications seem to be that the version 0x30 table should be handled the same way as 0x40 (as used on G80), at least for the parts that we currently try use. This commit cleans up the parsing to make it clearer about what we're actually trying to achieve, and unifies the 0x30/0x40 parsing. Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Showing 2 changed files with 17 additions and 28 deletions Side-by-side Diff
drivers/gpu/drm/nouveau/nouveau_bios.c
... | ... | @@ -3198,7 +3198,6 @@ |
3198 | 3198 | struct nvbios *bios = &dev_priv->vbios; |
3199 | 3199 | unsigned int outputset = (dcbent->or == 4) ? 1 : 0; |
3200 | 3200 | uint16_t scriptptr = 0, clktable; |
3201 | - uint8_t clktableptr = 0; | |
3202 | 3201 | |
3203 | 3202 | /* |
3204 | 3203 | * For now we assume version 3.0 table - g80 support will need some |
3205 | 3204 | |
3206 | 3205 | |
3207 | 3206 | |
3208 | 3207 | |
3209 | 3208 | |
... | ... | @@ -3217,26 +3216,29 @@ |
3217 | 3216 | scriptptr = ROM16(bios->data[bios->fp.lvdsmanufacturerpointer + 11 + outputset * 2]); |
3218 | 3217 | break; |
3219 | 3218 | case LVDS_RESET: |
3219 | + clktable = bios->fp.lvdsmanufacturerpointer + 15; | |
3220 | + if (dcbent->or == 4) | |
3221 | + clktable += 8; | |
3222 | + | |
3220 | 3223 | if (dcbent->lvdsconf.use_straps_for_mode) { |
3221 | 3224 | if (bios->fp.dual_link) |
3222 | - clktableptr += 2; | |
3223 | - if (bios->fp.BITbit1) | |
3224 | - clktableptr++; | |
3225 | + clktable += 4; | |
3226 | + if (bios->fp.if_is_24bit) | |
3227 | + clktable += 2; | |
3225 | 3228 | } else { |
3226 | 3229 | /* using EDID */ |
3227 | - uint8_t fallback = bios->data[bios->fp.lvdsmanufacturerpointer + 4]; | |
3228 | - int fallbackcmpval = (dcbent->or == 4) ? 4 : 1; | |
3230 | + int cmpval_24bit = (dcbent->or == 4) ? 4 : 1; | |
3229 | 3231 | |
3230 | 3232 | if (bios->fp.dual_link) { |
3231 | - clktableptr += 2; | |
3232 | - fallbackcmpval *= 2; | |
3233 | + clktable += 4; | |
3234 | + cmpval_24bit <<= 1; | |
3233 | 3235 | } |
3234 | - if (fallbackcmpval & fallback) | |
3235 | - clktableptr++; | |
3236 | + | |
3237 | + if (bios->fp.strapless_is_24bit & cmpval_24bit) | |
3238 | + clktable += 2; | |
3236 | 3239 | } |
3237 | 3240 | |
3238 | - /* adding outputset * 8 may not be correct */ | |
3239 | - clktable = ROM16(bios->data[bios->fp.lvdsmanufacturerpointer + 15 + clktableptr * 2 + outputset * 8]); | |
3241 | + clktable = ROM16(bios->data[clktable]); | |
3240 | 3242 | if (!clktable) { |
3241 | 3243 | NV_ERROR(dev, "Pixel clock comparison table not found\n"); |
3242 | 3244 | return -ENOENT; |
3243 | 3245 | |
3244 | 3246 | |
3245 | 3247 | |
3246 | 3248 | |
... | ... | @@ -3638,30 +3640,18 @@ |
3638 | 3640 | *if_is_24bit = bios->data[lvdsofs] & 16; |
3639 | 3641 | break; |
3640 | 3642 | case 0x30: |
3643 | + case 0x40: | |
3641 | 3644 | /* |
3642 | - * My money would be on there being a 24 bit interface bit in | |
3643 | - * this table, but I have no example of a laptop bios with a | |
3644 | - * 24 bit panel to confirm that. Hence we shout loudly if any | |
3645 | - * bit other than bit 0 is set (I've not even seen bit 1) | |
3646 | - */ | |
3647 | - if (bios->data[lvdsofs] > 1) | |
3648 | - NV_ERROR(dev, | |
3649 | - "You have a very unusual laptop display; please report it\n"); | |
3650 | - /* | |
3651 | 3645 | * No sign of the "power off for reset" or "reset for panel |
3652 | 3646 | * on" bits, but it's safer to assume we should |
3653 | 3647 | */ |
3654 | 3648 | bios->fp.power_off_for_reset = true; |
3655 | 3649 | bios->fp.reset_after_pclk_change = true; |
3650 | + | |
3656 | 3651 | /* |
3657 | 3652 | * It's ok lvdsofs is wrong for nv4x edid case; dual_link is |
3658 | - * over-written, and BITbit1 isn't used | |
3653 | + * over-written, and if_is_24bit isn't used | |
3659 | 3654 | */ |
3660 | - bios->fp.dual_link = bios->data[lvdsofs] & 1; | |
3661 | - bios->fp.BITbit1 = bios->data[lvdsofs] & 2; | |
3662 | - bios->fp.duallink_transition_clk = ROM16(bios->data[bios->fp.lvdsmanufacturerpointer + 5]) * 10; | |
3663 | - break; | |
3664 | - case 0x40: | |
3665 | 3655 | bios->fp.dual_link = bios->data[lvdsofs] & 1; |
3666 | 3656 | bios->fp.if_is_24bit = bios->data[lvdsofs] & 2; |
3667 | 3657 | bios->fp.strapless_is_24bit = bios->data[bios->fp.lvdsmanufacturerpointer + 4]; |
drivers/gpu/drm/nouveau/nouveau_bios.h