diff options
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.c | 61 | ||||
| -rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_bios.h | 1 |
2 files changed, 62 insertions, 0 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.c b/drivers/gpu/drm/nouveau/nouveau_bios.c index ea690a735325..8dd97b28df36 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.c +++ b/drivers/gpu/drm/nouveau/nouveau_bios.c | |||
| @@ -5173,6 +5173,43 @@ nouveau_bios_connector_entry(struct drm_device *dev, int index) | |||
| 5173 | return cte; | 5173 | return cte; |
| 5174 | } | 5174 | } |
| 5175 | 5175 | ||
| 5176 | static enum dcb_connector_type | ||
| 5177 | divine_connector_type(struct nvbios *bios, int index) | ||
| 5178 | { | ||
| 5179 | struct dcb_table *dcb = &bios->dcb; | ||
| 5180 | unsigned encoders = 0, type = DCB_CONNECTOR_NONE; | ||
| 5181 | int i; | ||
| 5182 | |||
| 5183 | for (i = 0; i < dcb->entries; i++) { | ||
| 5184 | if (dcb->entry[i].connector == index) | ||
| 5185 | encoders |= (1 << dcb->entry[i].type); | ||
| 5186 | } | ||
| 5187 | |||
| 5188 | if (encoders & (1 << OUTPUT_DP)) { | ||
| 5189 | if (encoders & (1 << OUTPUT_TMDS)) | ||
| 5190 | type = DCB_CONNECTOR_DP; | ||
| 5191 | else | ||
| 5192 | type = DCB_CONNECTOR_eDP; | ||
| 5193 | } else | ||
| 5194 | if (encoders & (1 << OUTPUT_TMDS)) { | ||
| 5195 | if (encoders & (1 << OUTPUT_ANALOG)) | ||
| 5196 | type = DCB_CONNECTOR_DVI_I; | ||
| 5197 | else | ||
| 5198 | type = DCB_CONNECTOR_DVI_D; | ||
| 5199 | } else | ||
| 5200 | if (encoders & (1 << OUTPUT_ANALOG)) { | ||
| 5201 | type = DCB_CONNECTOR_VGA; | ||
| 5202 | } else | ||
| 5203 | if (encoders & (1 << OUTPUT_LVDS)) { | ||
| 5204 | type = DCB_CONNECTOR_LVDS; | ||
| 5205 | } else | ||
| 5206 | if (encoders & (1 << OUTPUT_TV)) { | ||
| 5207 | type = DCB_CONNECTOR_TV_0; | ||
| 5208 | } | ||
| 5209 | |||
| 5210 | return type; | ||
| 5211 | } | ||
| 5212 | |||
| 5176 | static void | 5213 | static void |
| 5177 | parse_dcb_connector_table(struct nvbios *bios) | 5214 | parse_dcb_connector_table(struct nvbios *bios) |
| 5178 | { | 5215 | { |
| @@ -5205,6 +5242,7 @@ parse_dcb_connector_table(struct nvbios *bios) | |||
| 5205 | cte->entry = ROM16(entry[0]); | 5242 | cte->entry = ROM16(entry[0]); |
| 5206 | else | 5243 | else |
| 5207 | cte->entry = ROM32(entry[0]); | 5244 | cte->entry = ROM32(entry[0]); |
| 5245 | |||
| 5208 | cte->type = (cte->entry & 0x000000ff) >> 0; | 5246 | cte->type = (cte->entry & 0x000000ff) >> 0; |
| 5209 | cte->index = (cte->entry & 0x00000f00) >> 8; | 5247 | cte->index = (cte->entry & 0x00000f00) >> 8; |
| 5210 | switch (cte->entry & 0x00033000) { | 5248 | switch (cte->entry & 0x00033000) { |
| @@ -5230,6 +5268,29 @@ parse_dcb_connector_table(struct nvbios *bios) | |||
| 5230 | 5268 | ||
| 5231 | NV_INFO(dev, " %d: 0x%08x: type 0x%02x idx %d tag 0x%02x\n", | 5269 | NV_INFO(dev, " %d: 0x%08x: type 0x%02x idx %d tag 0x%02x\n", |
| 5232 | i, cte->entry, cte->type, cte->index, cte->gpio_tag); | 5270 | i, cte->entry, cte->type, cte->index, cte->gpio_tag); |
| 5271 | |||
| 5272 | /* check for known types, fallback to guessing the type | ||
| 5273 | * from attached encoders if we hit an unknown. | ||
| 5274 | */ | ||
| 5275 | switch (cte->type) { | ||
| 5276 | case DCB_CONNECTOR_VGA: | ||
| 5277 | case DCB_CONNECTOR_TV_0: | ||
| 5278 | case DCB_CONNECTOR_TV_1: | ||
| 5279 | case DCB_CONNECTOR_TV_3: | ||
| 5280 | case DCB_CONNECTOR_DVI_I: | ||
| 5281 | case DCB_CONNECTOR_DVI_D: | ||
| 5282 | case DCB_CONNECTOR_LVDS: | ||
| 5283 | case DCB_CONNECTOR_DP: | ||
| 5284 | case DCB_CONNECTOR_eDP: | ||
| 5285 | case DCB_CONNECTOR_HDMI_0: | ||
| 5286 | case DCB_CONNECTOR_HDMI_1: | ||
| 5287 | break; | ||
| 5288 | default: | ||
| 5289 | cte->type = divine_connector_type(bios, cte->index); | ||
| 5290 | NV_WARN(dev, "unknown type, using 0x%02x", cte->type); | ||
| 5291 | break; | ||
| 5292 | } | ||
| 5293 | |||
| 5233 | } | 5294 | } |
| 5234 | } | 5295 | } |
| 5235 | 5296 | ||
diff --git a/drivers/gpu/drm/nouveau/nouveau_bios.h b/drivers/gpu/drm/nouveau/nouveau_bios.h index e3163f1123bd..9f688aa9a655 100644 --- a/drivers/gpu/drm/nouveau/nouveau_bios.h +++ b/drivers/gpu/drm/nouveau/nouveau_bios.h | |||
| @@ -68,6 +68,7 @@ enum dcb_connector_type { | |||
| 68 | DCB_CONNECTOR_eDP = 0x47, | 68 | DCB_CONNECTOR_eDP = 0x47, |
| 69 | DCB_CONNECTOR_HDMI_0 = 0x60, | 69 | DCB_CONNECTOR_HDMI_0 = 0x60, |
| 70 | DCB_CONNECTOR_HDMI_1 = 0x61, | 70 | DCB_CONNECTOR_HDMI_1 = 0x61, |
| 71 | DCB_CONNECTOR_NONE = 0xff | ||
| 71 | }; | 72 | }; |
| 72 | 73 | ||
| 73 | struct dcb_connector_table_entry { | 74 | struct dcb_connector_table_entry { |
