Skip to content

Commit 593a21a

Browse files
committed
drm/i915: split out display quirks to a new file
Reduce intel_display.c by splitting out intel_quirks.c. No functional changes. Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Jani Nikula <jani.nikula@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20181016144228.18267-1-jani.nikula@intel.com
1 parent 410ed57 commit 593a21a

File tree

4 files changed

+180
-169
lines changed

4 files changed

+180
-169
lines changed

drivers/gpu/drm/i915/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ i915-y += intel_audio.o \
124124
intel_hotplug.o \
125125
intel_overlay.o \
126126
intel_psr.o \
127+
intel_quirks.o \
127128
intel_sideband.o \
128129
intel_sprite.o
129130
i915-$(CONFIG_ACPI) += intel_acpi.o intel_opregion.o

drivers/gpu/drm/i915/intel_display.c

Lines changed: 0 additions & 169 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
* Eric Anholt <eric@anholt.net>
2525
*/
2626

27-
#include <linux/dmi.h>
2827
#include <linux/module.h>
2928
#include <linux/input.h>
3029
#include <linux/i2c.h>
@@ -14710,174 +14709,6 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv)
1471014709
dev_priv->display.update_crtcs = intel_update_crtcs;
1471114710
}
1471214711

14713-
/*
14714-
* Some machines (Lenovo U160) do not work with SSC on LVDS for some reason
14715-
*/
14716-
static void quirk_ssc_force_disable(struct drm_device *dev)
14717-
{
14718-
struct drm_i915_private *dev_priv = to_i915(dev);
14719-
dev_priv->quirks |= QUIRK_LVDS_SSC_DISABLE;
14720-
DRM_INFO("applying lvds SSC disable quirk\n");
14721-
}
14722-
14723-
/*
14724-
* A machine (e.g. Acer Aspire 5734Z) may need to invert the panel backlight
14725-
* brightness value
14726-
*/
14727-
static void quirk_invert_brightness(struct drm_device *dev)
14728-
{
14729-
struct drm_i915_private *dev_priv = to_i915(dev);
14730-
dev_priv->quirks |= QUIRK_INVERT_BRIGHTNESS;
14731-
DRM_INFO("applying inverted panel brightness quirk\n");
14732-
}
14733-
14734-
/* Some VBT's incorrectly indicate no backlight is present */
14735-
static void quirk_backlight_present(struct drm_device *dev)
14736-
{
14737-
struct drm_i915_private *dev_priv = to_i915(dev);
14738-
dev_priv->quirks |= QUIRK_BACKLIGHT_PRESENT;
14739-
DRM_INFO("applying backlight present quirk\n");
14740-
}
14741-
14742-
/* Toshiba Satellite P50-C-18C requires T12 delay to be min 800ms
14743-
* which is 300 ms greater than eDP spec T12 min.
14744-
*/
14745-
static void quirk_increase_t12_delay(struct drm_device *dev)
14746-
{
14747-
struct drm_i915_private *dev_priv = to_i915(dev);
14748-
14749-
dev_priv->quirks |= QUIRK_INCREASE_T12_DELAY;
14750-
DRM_INFO("Applying T12 delay quirk\n");
14751-
}
14752-
14753-
/*
14754-
* GeminiLake NUC HDMI outputs require additional off time
14755-
* this allows the onboard retimer to correctly sync to signal
14756-
*/
14757-
static void quirk_increase_ddi_disabled_time(struct drm_device *dev)
14758-
{
14759-
struct drm_i915_private *dev_priv = to_i915(dev);
14760-
14761-
dev_priv->quirks |= QUIRK_INCREASE_DDI_DISABLED_TIME;
14762-
DRM_INFO("Applying Increase DDI Disabled quirk\n");
14763-
}
14764-
14765-
struct intel_quirk {
14766-
int device;
14767-
int subsystem_vendor;
14768-
int subsystem_device;
14769-
void (*hook)(struct drm_device *dev);
14770-
};
14771-
14772-
/* For systems that don't have a meaningful PCI subdevice/subvendor ID */
14773-
struct intel_dmi_quirk {
14774-
void (*hook)(struct drm_device *dev);
14775-
const struct dmi_system_id (*dmi_id_list)[];
14776-
};
14777-
14778-
static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
14779-
{
14780-
DRM_INFO("Backlight polarity reversed on %s\n", id->ident);
14781-
return 1;
14782-
}
14783-
14784-
static const struct intel_dmi_quirk intel_dmi_quirks[] = {
14785-
{
14786-
.dmi_id_list = &(const struct dmi_system_id[]) {
14787-
{
14788-
.callback = intel_dmi_reverse_brightness,
14789-
.ident = "NCR Corporation",
14790-
.matches = {DMI_MATCH(DMI_SYS_VENDOR, "NCR Corporation"),
14791-
DMI_MATCH(DMI_PRODUCT_NAME, ""),
14792-
},
14793-
},
14794-
{ } /* terminating entry */
14795-
},
14796-
.hook = quirk_invert_brightness,
14797-
},
14798-
};
14799-
14800-
static struct intel_quirk intel_quirks[] = {
14801-
/* Lenovo U160 cannot use SSC on LVDS */
14802-
{ 0x0046, 0x17aa, 0x3920, quirk_ssc_force_disable },
14803-
14804-
/* Sony Vaio Y cannot use SSC on LVDS */
14805-
{ 0x0046, 0x104d, 0x9076, quirk_ssc_force_disable },
14806-
14807-
/* Acer Aspire 5734Z must invert backlight brightness */
14808-
{ 0x2a42, 0x1025, 0x0459, quirk_invert_brightness },
14809-
14810-
/* Acer/eMachines G725 */
14811-
{ 0x2a42, 0x1025, 0x0210, quirk_invert_brightness },
14812-
14813-
/* Acer/eMachines e725 */
14814-
{ 0x2a42, 0x1025, 0x0212, quirk_invert_brightness },
14815-
14816-
/* Acer/Packard Bell NCL20 */
14817-
{ 0x2a42, 0x1025, 0x034b, quirk_invert_brightness },
14818-
14819-
/* Acer Aspire 4736Z */
14820-
{ 0x2a42, 0x1025, 0x0260, quirk_invert_brightness },
14821-
14822-
/* Acer Aspire 5336 */
14823-
{ 0x2a42, 0x1025, 0x048a, quirk_invert_brightness },
14824-
14825-
/* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */
14826-
{ 0x0a06, 0x1025, 0x0a11, quirk_backlight_present },
14827-
14828-
/* Acer C720 Chromebook (Core i3 4005U) */
14829-
{ 0x0a16, 0x1025, 0x0a11, quirk_backlight_present },
14830-
14831-
/* Apple Macbook 2,1 (Core 2 T7400) */
14832-
{ 0x27a2, 0x8086, 0x7270, quirk_backlight_present },
14833-
14834-
/* Apple Macbook 4,1 */
14835-
{ 0x2a02, 0x106b, 0x00a1, quirk_backlight_present },
14836-
14837-
/* Toshiba CB35 Chromebook (Celeron 2955U) */
14838-
{ 0x0a06, 0x1179, 0x0a88, quirk_backlight_present },
14839-
14840-
/* HP Chromebook 14 (Celeron 2955U) */
14841-
{ 0x0a06, 0x103c, 0x21ed, quirk_backlight_present },
14842-
14843-
/* Dell Chromebook 11 */
14844-
{ 0x0a06, 0x1028, 0x0a35, quirk_backlight_present },
14845-
14846-
/* Dell Chromebook 11 (2015 version) */
14847-
{ 0x0a16, 0x1028, 0x0a35, quirk_backlight_present },
14848-
14849-
/* Toshiba Satellite P50-C-18C */
14850-
{ 0x191B, 0x1179, 0xF840, quirk_increase_t12_delay },
14851-
14852-
/* GeminiLake NUC */
14853-
{ 0x3185, 0x8086, 0x2072, quirk_increase_ddi_disabled_time },
14854-
{ 0x3184, 0x8086, 0x2072, quirk_increase_ddi_disabled_time },
14855-
/* ASRock ITX*/
14856-
{ 0x3185, 0x1849, 0x2212, quirk_increase_ddi_disabled_time },
14857-
{ 0x3184, 0x1849, 0x2212, quirk_increase_ddi_disabled_time },
14858-
};
14859-
14860-
static void intel_init_quirks(struct drm_device *dev)
14861-
{
14862-
struct pci_dev *d = dev->pdev;
14863-
int i;
14864-
14865-
for (i = 0; i < ARRAY_SIZE(intel_quirks); i++) {
14866-
struct intel_quirk *q = &intel_quirks[i];
14867-
14868-
if (d->device == q->device &&
14869-
(d->subsystem_vendor == q->subsystem_vendor ||
14870-
q->subsystem_vendor == PCI_ANY_ID) &&
14871-
(d->subsystem_device == q->subsystem_device ||
14872-
q->subsystem_device == PCI_ANY_ID))
14873-
q->hook(dev);
14874-
}
14875-
for (i = 0; i < ARRAY_SIZE(intel_dmi_quirks); i++) {
14876-
if (dmi_check_system(*intel_dmi_quirks[i].dmi_id_list) != 0)
14877-
intel_dmi_quirks[i].hook(dev);
14878-
}
14879-
}
14880-
1488114712
/* Disable the VGA plane that we never use */
1488214713
static void i915_disable_vga(struct drm_i915_private *dev_priv)
1488314714
{

drivers/gpu/drm/i915/intel_drv.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1981,6 +1981,9 @@ void intel_psr_short_pulse(struct intel_dp *intel_dp);
19811981
int intel_psr_wait_for_idle(const struct intel_crtc_state *new_crtc_state,
19821982
u32 *out_value);
19831983

1984+
/* intel_quirks.c */
1985+
void intel_init_quirks(struct drm_device *dev);
1986+
19841987
/* intel_runtime_pm.c */
19851988
int intel_power_domains_init(struct drm_i915_private *);
19861989
void intel_power_domains_cleanup(struct drm_i915_private *dev_priv);

drivers/gpu/drm/i915/intel_quirks.c

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
// SPDX-License-Identifier: MIT
2+
/*
3+
* Copyright © 2018 Intel Corporation
4+
*/
5+
6+
#include <linux/dmi.h>
7+
8+
#include "intel_drv.h"
9+
10+
/*
11+
* Some machines (Lenovo U160) do not work with SSC on LVDS for some reason
12+
*/
13+
static void quirk_ssc_force_disable(struct drm_device *dev)
14+
{
15+
struct drm_i915_private *dev_priv = to_i915(dev);
16+
dev_priv->quirks |= QUIRK_LVDS_SSC_DISABLE;
17+
DRM_INFO("applying lvds SSC disable quirk\n");
18+
}
19+
20+
/*
21+
* A machine (e.g. Acer Aspire 5734Z) may need to invert the panel backlight
22+
* brightness value
23+
*/
24+
static void quirk_invert_brightness(struct drm_device *dev)
25+
{
26+
struct drm_i915_private *dev_priv = to_i915(dev);
27+
dev_priv->quirks |= QUIRK_INVERT_BRIGHTNESS;
28+
DRM_INFO("applying inverted panel brightness quirk\n");
29+
}
30+
31+
/* Some VBT's incorrectly indicate no backlight is present */
32+
static void quirk_backlight_present(struct drm_device *dev)
33+
{
34+
struct drm_i915_private *dev_priv = to_i915(dev);
35+
dev_priv->quirks |= QUIRK_BACKLIGHT_PRESENT;
36+
DRM_INFO("applying backlight present quirk\n");
37+
}
38+
39+
/* Toshiba Satellite P50-C-18C requires T12 delay to be min 800ms
40+
* which is 300 ms greater than eDP spec T12 min.
41+
*/
42+
static void quirk_increase_t12_delay(struct drm_device *dev)
43+
{
44+
struct drm_i915_private *dev_priv = to_i915(dev);
45+
46+
dev_priv->quirks |= QUIRK_INCREASE_T12_DELAY;
47+
DRM_INFO("Applying T12 delay quirk\n");
48+
}
49+
50+
/*
51+
* GeminiLake NUC HDMI outputs require additional off time
52+
* this allows the onboard retimer to correctly sync to signal
53+
*/
54+
static void quirk_increase_ddi_disabled_time(struct drm_device *dev)
55+
{
56+
struct drm_i915_private *dev_priv = to_i915(dev);
57+
58+
dev_priv->quirks |= QUIRK_INCREASE_DDI_DISABLED_TIME;
59+
DRM_INFO("Applying Increase DDI Disabled quirk\n");
60+
}
61+
62+
struct intel_quirk {
63+
int device;
64+
int subsystem_vendor;
65+
int subsystem_device;
66+
void (*hook)(struct drm_device *dev);
67+
};
68+
69+
/* For systems that don't have a meaningful PCI subdevice/subvendor ID */
70+
struct intel_dmi_quirk {
71+
void (*hook)(struct drm_device *dev);
72+
const struct dmi_system_id (*dmi_id_list)[];
73+
};
74+
75+
static int intel_dmi_reverse_brightness(const struct dmi_system_id *id)
76+
{
77+
DRM_INFO("Backlight polarity reversed on %s\n", id->ident);
78+
return 1;
79+
}
80+
81+
static const struct intel_dmi_quirk intel_dmi_quirks[] = {
82+
{
83+
.dmi_id_list = &(const struct dmi_system_id[]) {
84+
{
85+
.callback = intel_dmi_reverse_brightness,
86+
.ident = "NCR Corporation",
87+
.matches = {DMI_MATCH(DMI_SYS_VENDOR, "NCR Corporation"),
88+
DMI_MATCH(DMI_PRODUCT_NAME, ""),
89+
},
90+
},
91+
{ } /* terminating entry */
92+
},
93+
.hook = quirk_invert_brightness,
94+
},
95+
};
96+
97+
static struct intel_quirk intel_quirks[] = {
98+
/* Lenovo U160 cannot use SSC on LVDS */
99+
{ 0x0046, 0x17aa, 0x3920, quirk_ssc_force_disable },
100+
101+
/* Sony Vaio Y cannot use SSC on LVDS */
102+
{ 0x0046, 0x104d, 0x9076, quirk_ssc_force_disable },
103+
104+
/* Acer Aspire 5734Z must invert backlight brightness */
105+
{ 0x2a42, 0x1025, 0x0459, quirk_invert_brightness },
106+
107+
/* Acer/eMachines G725 */
108+
{ 0x2a42, 0x1025, 0x0210, quirk_invert_brightness },
109+
110+
/* Acer/eMachines e725 */
111+
{ 0x2a42, 0x1025, 0x0212, quirk_invert_brightness },
112+
113+
/* Acer/Packard Bell NCL20 */
114+
{ 0x2a42, 0x1025, 0x034b, quirk_invert_brightness },
115+
116+
/* Acer Aspire 4736Z */
117+
{ 0x2a42, 0x1025, 0x0260, quirk_invert_brightness },
118+
119+
/* Acer Aspire 5336 */
120+
{ 0x2a42, 0x1025, 0x048a, quirk_invert_brightness },
121+
122+
/* Acer C720 and C720P Chromebooks (Celeron 2955U) have backlights */
123+
{ 0x0a06, 0x1025, 0x0a11, quirk_backlight_present },
124+
125+
/* Acer C720 Chromebook (Core i3 4005U) */
126+
{ 0x0a16, 0x1025, 0x0a11, quirk_backlight_present },
127+
128+
/* Apple Macbook 2,1 (Core 2 T7400) */
129+
{ 0x27a2, 0x8086, 0x7270, quirk_backlight_present },
130+
131+
/* Apple Macbook 4,1 */
132+
{ 0x2a02, 0x106b, 0x00a1, quirk_backlight_present },
133+
134+
/* Toshiba CB35 Chromebook (Celeron 2955U) */
135+
{ 0x0a06, 0x1179, 0x0a88, quirk_backlight_present },
136+
137+
/* HP Chromebook 14 (Celeron 2955U) */
138+
{ 0x0a06, 0x103c, 0x21ed, quirk_backlight_present },
139+
140+
/* Dell Chromebook 11 */
141+
{ 0x0a06, 0x1028, 0x0a35, quirk_backlight_present },
142+
143+
/* Dell Chromebook 11 (2015 version) */
144+
{ 0x0a16, 0x1028, 0x0a35, quirk_backlight_present },
145+
146+
/* Toshiba Satellite P50-C-18C */
147+
{ 0x191B, 0x1179, 0xF840, quirk_increase_t12_delay },
148+
149+
/* GeminiLake NUC */
150+
{ 0x3185, 0x8086, 0x2072, quirk_increase_ddi_disabled_time },
151+
{ 0x3184, 0x8086, 0x2072, quirk_increase_ddi_disabled_time },
152+
/* ASRock ITX*/
153+
{ 0x3185, 0x1849, 0x2212, quirk_increase_ddi_disabled_time },
154+
{ 0x3184, 0x1849, 0x2212, quirk_increase_ddi_disabled_time },
155+
};
156+
157+
void intel_init_quirks(struct drm_device *dev)
158+
{
159+
struct pci_dev *d = dev->pdev;
160+
int i;
161+
162+
for (i = 0; i < ARRAY_SIZE(intel_quirks); i++) {
163+
struct intel_quirk *q = &intel_quirks[i];
164+
165+
if (d->device == q->device &&
166+
(d->subsystem_vendor == q->subsystem_vendor ||
167+
q->subsystem_vendor == PCI_ANY_ID) &&
168+
(d->subsystem_device == q->subsystem_device ||
169+
q->subsystem_device == PCI_ANY_ID))
170+
q->hook(dev);
171+
}
172+
for (i = 0; i < ARRAY_SIZE(intel_dmi_quirks); i++) {
173+
if (dmi_check_system(*intel_dmi_quirks[i].dmi_id_list) != 0)
174+
intel_dmi_quirks[i].hook(dev);
175+
}
176+
}

0 commit comments

Comments
 (0)