Rev 6660 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6660 | Rev 6937 | ||
---|---|---|---|
Line 24... | Line 24... | ||
24 | * SOFTWARE. |
24 | * SOFTWARE. |
25 | * |
25 | * |
26 | */ |
26 | */ |
Line 27... | Line 27... | ||
27 | 27 | ||
- | 28 | #include |
|
28 | #include |
29 | #include |
Line 29... | Line 30... | ||
29 | #include |
30 | #include |
30 | 31 | ||
31 | #include |
32 | #include |
Line 44... | Line 45... | ||
44 | #define ACPI_CLID 0x01ac /* current lid state indicator */ |
45 | #define ACPI_CLID 0x01ac /* current lid state indicator */ |
45 | #define ACPI_CDCK 0x01b0 /* current docking state indicator */ |
46 | #define ACPI_CDCK 0x01b0 /* current docking state indicator */ |
46 | #define OPREGION_SWSCI_OFFSET 0x200 |
47 | #define OPREGION_SWSCI_OFFSET 0x200 |
47 | #define OPREGION_ASLE_OFFSET 0x300 |
48 | #define OPREGION_ASLE_OFFSET 0x300 |
48 | #define OPREGION_VBT_OFFSET 0x400 |
49 | #define OPREGION_VBT_OFFSET 0x400 |
- | 50 | #define OPREGION_ASLE_EXT_OFFSET 0x1C00 |
|
Line 49... | Line 51... | ||
49 | 51 | ||
50 | #define OPREGION_SIGNATURE "IntelGraphicsMem" |
52 | #define OPREGION_SIGNATURE "IntelGraphicsMem" |
51 | #define MBOX_ACPI (1<<0) |
53 | #define MBOX_ACPI (1<<0) |
52 | #define MBOX_SWSCI (1<<1) |
54 | #define MBOX_SWSCI (1<<1) |
Line 118... | Line 120... | ||
118 | u32 srot; /* supported rotation angles */ |
120 | u32 srot; /* supported rotation angles */ |
119 | u32 iuer; /* IUER events */ |
121 | u32 iuer; /* IUER events */ |
120 | u64 fdss; |
122 | u64 fdss; |
121 | u32 fdsp; |
123 | u32 fdsp; |
122 | u32 stat; |
124 | u32 stat; |
- | 125 | u64 rvda; /* Physical address of raw vbt data */ |
|
- | 126 | u32 rvds; /* Size of raw vbt data */ |
|
- | 127 | u8 rsvd[58]; |
|
- | 128 | } __packed; |
|
- | 129 | ||
- | 130 | /* OpRegion mailbox #5: ASLE ext */ |
|
- | 131 | struct opregion_asle_ext { |
|
- | 132 | u32 phed; /* Panel Header */ |
|
- | 133 | u8 bddc[256]; /* Panel EDID */ |
|
123 | u8 rsvd[70]; |
134 | u8 rsvd[764]; |
124 | } __packed; |
135 | } __packed; |
Line 125... | Line 136... | ||
125 | 136 | ||
126 | /* Driver readiness indicator */ |
137 | /* Driver readiness indicator */ |
127 | #define ASLE_ARDY_READY (1 << 0) |
138 | #define ASLE_ARDY_READY (1 << 0) |
Line 409... | Line 420... | ||
409 | } |
420 | } |
Line 410... | Line 421... | ||
410 | 421 | ||
411 | static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) |
422 | static u32 asle_set_backlight(struct drm_device *dev, u32 bclp) |
412 | { |
423 | { |
413 | struct drm_i915_private *dev_priv = dev->dev_private; |
424 | struct drm_i915_private *dev_priv = dev->dev_private; |
414 | struct intel_connector *intel_connector; |
425 | struct intel_connector *connector; |
Line 415... | Line 426... | ||
415 | struct opregion_asle *asle = dev_priv->opregion.asle; |
426 | struct opregion_asle *asle = dev_priv->opregion.asle; |
Line 416... | Line 427... | ||
416 | 427 | ||
Line 433... | Line 444... | ||
433 | /* |
444 | /* |
434 | * Update backlight on all connectors that support backlight (usually |
445 | * Update backlight on all connectors that support backlight (usually |
435 | * only one). |
446 | * only one). |
436 | */ |
447 | */ |
437 | DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp); |
448 | DRM_DEBUG_KMS("updating opregion backlight %d/255\n", bclp); |
438 | list_for_each_entry(intel_connector, &dev->mode_config.connector_list, base.head) |
449 | for_each_intel_connector(dev, connector) |
439 | intel_panel_set_backlight_acpi(intel_connector, bclp, 255); |
450 | intel_panel_set_backlight_acpi(connector, bclp, 255); |
440 | asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID; |
451 | asle->cblv = DIV_ROUND_UP(bclp * 100, 255) | ASLE_CBLV_VALID; |
Line 441... | Line 452... | ||
441 | 452 | ||
Line 824... | Line 835... | ||
824 | unregister_acpi_notifier(&intel_opregion_notifier); |
835 | unregister_acpi_notifier(&intel_opregion_notifier); |
825 | } |
836 | } |
Line 826... | Line 837... | ||
826 | 837 | ||
827 | /* just clear all opregion memory pointers now */ |
838 | /* just clear all opregion memory pointers now */ |
- | 839 | memunmap(opregion->header); |
|
- | 840 | if (opregion->rvda) { |
|
- | 841 | memunmap(opregion->rvda); |
|
- | 842 | opregion->rvda = NULL; |
|
828 | memunmap(opregion->header); |
843 | } |
829 | opregion->header = NULL; |
844 | opregion->header = NULL; |
830 | opregion->acpi = NULL; |
845 | opregion->acpi = NULL; |
831 | opregion->swsci = NULL; |
846 | opregion->swsci = NULL; |
832 | opregion->asle = NULL; |
847 | opregion->asle = NULL; |
Line 892... | Line 907... | ||
892 | } |
907 | } |
893 | #else /* CONFIG_ACPI */ |
908 | #else /* CONFIG_ACPI */ |
894 | static inline void swsci_setup(struct drm_device *dev) {} |
909 | static inline void swsci_setup(struct drm_device *dev) {} |
895 | #endif /* CONFIG_ACPI */ |
910 | #endif /* CONFIG_ACPI */ |
Line -... | Line 911... | ||
- | 911 | ||
- | 912 | static int intel_no_opregion_vbt_callback(const struct dmi_system_id *id) |
|
- | 913 | { |
|
- | 914 | DRM_DEBUG_KMS("Falling back to manually reading VBT from " |
|
- | 915 | "VBIOS ROM for %s\n", id->ident); |
|
- | 916 | return 1; |
|
- | 917 | } |
|
- | 918 | ||
- | 919 | static const struct dmi_system_id intel_no_opregion_vbt[] = { |
|
- | 920 | { |
|
- | 921 | .callback = intel_no_opregion_vbt_callback, |
|
- | 922 | .ident = "ThinkCentre A57", |
|
- | 923 | .matches = { |
|
- | 924 | DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), |
|
- | 925 | DMI_MATCH(DMI_PRODUCT_NAME, "97027RG"), |
|
- | 926 | }, |
|
- | 927 | }, |
|
- | 928 | { } |
|
- | 929 | }; |
|
896 | 930 | ||
897 | int intel_opregion_setup(struct drm_device *dev) |
931 | int intel_opregion_setup(struct drm_device *dev) |
898 | { |
932 | { |
899 | struct drm_i915_private *dev_priv = dev->dev_private; |
933 | struct drm_i915_private *dev_priv = dev->dev_private; |
900 | struct intel_opregion *opregion = &dev_priv->opregion; |
934 | struct intel_opregion *opregion = &dev_priv->opregion; |
Line 905... | Line 939... | ||
905 | 939 | ||
906 | BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100); |
940 | BUILD_BUG_ON(sizeof(struct opregion_header) != 0x100); |
907 | BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100); |
941 | BUILD_BUG_ON(sizeof(struct opregion_acpi) != 0x100); |
908 | BUILD_BUG_ON(sizeof(struct opregion_swsci) != 0x100); |
942 | BUILD_BUG_ON(sizeof(struct opregion_swsci) != 0x100); |
- | 943 | BUILD_BUG_ON(sizeof(struct opregion_asle) != 0x100); |
|
Line 909... | Line 944... | ||
909 | BUILD_BUG_ON(sizeof(struct opregion_asle) != 0x100); |
944 | BUILD_BUG_ON(sizeof(struct opregion_asle_ext) != 0x400); |
910 | 945 | ||
911 | pci_read_config_dword(dev->pdev, PCI_ASLS, &asls); |
946 | pci_read_config_dword(dev->pdev, PCI_ASLS, &asls); |
912 | DRM_DEBUG_DRIVER("graphic opregion physical addr: 0x%x\n", asls); |
947 | DRM_DEBUG_DRIVER("graphic opregion physical addr: 0x%x\n", asls); |
Line 929... | Line 964... | ||
929 | DRM_DEBUG_DRIVER("opregion signature mismatch\n"); |
964 | DRM_DEBUG_DRIVER("opregion signature mismatch\n"); |
930 | err = -EINVAL; |
965 | err = -EINVAL; |
931 | goto err_out; |
966 | goto err_out; |
932 | } |
967 | } |
933 | opregion->header = base; |
968 | opregion->header = base; |
934 | opregion->vbt = base + OPREGION_VBT_OFFSET; |
- | |
935 | - | ||
936 | opregion->lid_state = base + ACPI_CLID; |
969 | opregion->lid_state = base + ACPI_CLID; |
Line 937... | Line 970... | ||
937 | 970 | ||
938 | mboxes = opregion->header->mboxes; |
971 | mboxes = opregion->header->mboxes; |
939 | if (mboxes & MBOX_ACPI) { |
972 | if (mboxes & MBOX_ACPI) { |
Line 944... | Line 977... | ||
944 | if (mboxes & MBOX_SWSCI) { |
977 | if (mboxes & MBOX_SWSCI) { |
945 | DRM_DEBUG_DRIVER("SWSCI supported\n"); |
978 | DRM_DEBUG_DRIVER("SWSCI supported\n"); |
946 | opregion->swsci = base + OPREGION_SWSCI_OFFSET; |
979 | opregion->swsci = base + OPREGION_SWSCI_OFFSET; |
947 | swsci_setup(dev); |
980 | swsci_setup(dev); |
948 | } |
981 | } |
- | 982 | ||
949 | if (mboxes & MBOX_ASLE) { |
983 | if (mboxes & MBOX_ASLE) { |
950 | DRM_DEBUG_DRIVER("ASLE supported\n"); |
984 | DRM_DEBUG_DRIVER("ASLE supported\n"); |
951 | opregion->asle = base + OPREGION_ASLE_OFFSET; |
985 | opregion->asle = base + OPREGION_ASLE_OFFSET; |
Line 952... | Line 986... | ||
952 | 986 | ||
953 | opregion->asle->ardy = ASLE_ARDY_NOT_READY; |
987 | opregion->asle->ardy = ASLE_ARDY_NOT_READY; |
Line -... | Line 988... | ||
- | 988 | } |
|
- | 989 | ||
- | 990 | if (mboxes & MBOX_ASLE_EXT) |
|
- | 991 | DRM_DEBUG_DRIVER("ASLE extension supported\n"); |
|
- | 992 | ||
- | 993 | if (!dmi_check_system(intel_no_opregion_vbt)) { |
|
- | 994 | const void *vbt = NULL; |
|
- | 995 | u32 vbt_size = 0; |
|
- | 996 | ||
- | 997 | if (opregion->header->opregion_ver >= 2 && opregion->asle && |
|
- | 998 | opregion->asle->rvda && opregion->asle->rvds) { |
|
- | 999 | opregion->rvda = memremap(opregion->asle->rvda, |
|
- | 1000 | opregion->asle->rvds, |
|
- | 1001 | MEMREMAP_WB); |
|
- | 1002 | vbt = opregion->rvda; |
|
- | 1003 | vbt_size = opregion->asle->rvds; |
|
- | 1004 | } |
|
- | 1005 | ||
- | 1006 | if (intel_bios_is_valid_vbt(vbt, vbt_size)) { |
|
- | 1007 | DRM_DEBUG_KMS("Found valid VBT in ACPI OpRegion (RVDA)\n"); |
|
- | 1008 | opregion->vbt = vbt; |
|
- | 1009 | opregion->vbt_size = vbt_size; |
|
- | 1010 | } else { |
|
- | 1011 | vbt = base + OPREGION_VBT_OFFSET; |
|
- | 1012 | vbt_size = OPREGION_ASLE_EXT_OFFSET - OPREGION_VBT_OFFSET; |
|
- | 1013 | if (intel_bios_is_valid_vbt(vbt, vbt_size)) { |
|
- | 1014 | DRM_DEBUG_KMS("Found valid VBT in ACPI OpRegion (Mailbox #4)\n"); |
|
- | 1015 | opregion->vbt = vbt; |
|
- | 1016 | opregion->vbt_size = vbt_size; |
|
- | 1017 | } |
|
- | 1018 | } |
|
954 | } |
1019 | } |
Line 955... | Line 1020... | ||
955 | 1020 | ||
956 | return 0; |
1021 | return 0; |
957 | 1022 |