Merge tag 'io_uring-5.11-2021-01-16' of git://git.kernel.dk/linux-block
[linux/fpc-iii.git] / drivers / gpu / drm / i915 / display / intel_quirks.c
blob46beb155d835f381adba9f332613b31a77e8764f
1 // SPDX-License-Identifier: MIT
2 /*
3 * Copyright © 2018 Intel Corporation
4 */
6 #include <linux/dmi.h>
8 #include "intel_display_types.h"
9 #include "intel_quirks.h"
12 * Some machines (Lenovo U160) do not work with SSC on LVDS for some reason
14 static void quirk_ssc_force_disable(struct drm_i915_private *i915)
16 i915->quirks |= QUIRK_LVDS_SSC_DISABLE;
17 drm_info(&i915->drm, "applying lvds SSC disable quirk\n");
21 * A machine (e.g. Acer Aspire 5734Z) may need to invert the panel backlight
22 * brightness value
24 static void quirk_invert_brightness(struct drm_i915_private *i915)
26 i915->quirks |= QUIRK_INVERT_BRIGHTNESS;
27 drm_info(&i915->drm, "applying inverted panel brightness quirk\n");
30 /* Some VBT's incorrectly indicate no backlight is present */
31 static void quirk_backlight_present(struct drm_i915_private *i915)
33 i915->quirks |= QUIRK_BACKLIGHT_PRESENT;
34 drm_info(&i915->drm, "applying backlight present quirk\n");
37 /* Toshiba Satellite P50-C-18C requires T12 delay to be min 800ms
38 * which is 300 ms greater than eDP spec T12 min.
40 static void quirk_increase_t12_delay(struct drm_i915_private *i915)
42 i915->quirks |= QUIRK_INCREASE_T12_DELAY;
43 drm_info(&i915->drm, "Applying T12 delay quirk\n");
47 * GeminiLake NUC HDMI outputs require additional off time
48 * this allows the onboard retimer to correctly sync to signal
50 static void quirk_increase_ddi_disabled_time(struct drm_i915_private *i915)
52 i915->quirks |= QUIRK_INCREASE_DDI_DISABLED_TIME;
53 drm_info(&i915->drm, "Applying Increase DDI Disabled quirk\n");
56 struct intel_quirk {
57 int device;
58 int subsystem_vendor;
59 int subsystem_device;
60 void (*hook)(struct drm_i915_private *i915);
63 /* For systems that don't have a meaningful PCI subdevice/subvendor ID */
64 struct intel_dmi_quirk {
65 void (*hook)(struct drm_i915_private *i915);
66 const struct dmi_system_id (*dmi_id_list)[];
69 static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
71 DRM_INFO("Backlight polarity reversed on %s\n", id->ident);
72 return 1;
75 static const struct intel_dmi_quirk intel_dmi_quirks[] = {
77 .dmi_id_list = &(const struct dmi_system_id[]) {
79 .callback = intel_dmi_reverse_brightness,
80 .ident = "NCR Corporation",
81 .matches = {DMI_MATCH(DMI_SYS_VENDOR, "NCR Corporation"),
82 DMI_MATCH(DMI_PRODUCT_NAME, ""),
86 .callback = intel_dmi_reverse_brightness,
87 .ident = "Thundersoft TST178 tablet",
88 /* DMI strings are too generic, also match on BIOS date */
89 .matches = {DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
90 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Aptio CRB"),
91 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "To be filled by O.E.M."),
92 DMI_EXACT_MATCH(DMI_BIOS_DATE, "04/15/2014"),
95 { } /* terminating entry */
97 .hook = quirk_invert_brightness,
101 static struct intel_quirk intel_quirks[] = {
102 /* Lenovo U160 cannot use SSC on LVDS */
103 { 0x0046, 0x17aa, 0x3920, quirk_ssc_force_disable },
105 /* Sony Vaio Y cannot use SSC on LVDS */
106 { 0x0046, 0x104d, 0x9076, quirk_ssc_force_disable },
108 /* Acer Aspire 5734Z must invert backlight brightness */
109 { 0x2a42, 0x1025, 0x0459, quirk_invert_brightness },
111 /* Acer/eMachines G725 */
112 { 0x2a42, 0x1025, 0x0210, quirk_invert_brightness },
114 /* Acer/eMachines e725 */
115 { 0x2a42, 0x1025, 0x0212, quirk_invert_brightness },
117 /* Acer/Packard Bell NCL20 */
118 { 0x2a42, 0x1025, 0x034b, quirk_invert_brightness },
120 /* Acer Aspire 4736Z */
121 { 0x2a42, 0x1025, 0x0260, quirk_invert_brightness },
123 /* Acer Aspire 5336 */
124 { 0x2a42, 0x1025, 0x048a, quirk_invert_brightness },
126 /* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */
127 { 0x0a06, 0x1025, 0x0a11, quirk_backlight_present },
129 /* Acer C720 Chromebook (Core i3 4005U) */
130 { 0x0a16, 0x1025, 0x0a11, quirk_backlight_present },
132 /* Apple Macbook 2,1 (Core 2 T7400) */
133 { 0x27a2, 0x8086, 0x7270, quirk_backlight_present },
135 /* Apple Macbook 4,1 */
136 { 0x2a02, 0x106b, 0x00a1, quirk_backlight_present },
138 /* Toshiba CB35 Chromebook (Celeron 2955U) */
139 { 0x0a06, 0x1179, 0x0a88, quirk_backlight_present },
141 /* HP Chromebook 14 (Celeron 2955U) */
142 { 0x0a06, 0x103c, 0x21ed, quirk_backlight_present },
144 /* Dell Chromebook 11 */
145 { 0x0a06, 0x1028, 0x0a35, quirk_backlight_present },
147 /* Dell Chromebook 11 (2015 version) */
148 { 0x0a16, 0x1028, 0x0a35, quirk_backlight_present },
150 /* Toshiba Satellite P50-C-18C */
151 { 0x191B, 0x1179, 0xF840, quirk_increase_t12_delay },
153 /* GeminiLake NUC */
154 { 0x3185, 0x8086, 0x2072, quirk_increase_ddi_disabled_time },
155 { 0x3184, 0x8086, 0x2072, quirk_increase_ddi_disabled_time },
156 /* ASRock ITX*/
157 { 0x3185, 0x1849, 0x2212, quirk_increase_ddi_disabled_time },
158 { 0x3184, 0x1849, 0x2212, quirk_increase_ddi_disabled_time },
161 void intel_init_quirks(struct drm_i915_private *i915)
163 struct pci_dev *d = i915->drm.pdev;
164 int i;
166 for (i = 0; i < ARRAY_SIZE(intel_quirks); i++) {
167 struct intel_quirk *q = &intel_quirks[i];
169 if (d->device == q->device &&
170 (d->subsystem_vendor == q->subsystem_vendor ||
171 q->subsystem_vendor == PCI_ANY_ID) &&
172 (d->subsystem_device == q->subsystem_device ||
173 q->subsystem_device == PCI_ANY_ID))
174 q->hook(i915);
176 for (i = 0; i < ARRAY_SIZE(intel_dmi_quirks); i++) {
177 if (dmi_check_system(*intel_dmi_quirks[i].dmi_id_list) != 0)
178 intel_dmi_quirks[i].hook(i915);