1404d1a3eSHans de Goede /* SPDX-License-Identifier: MIT */
2404d1a3eSHans de Goede /*
3404d1a3eSHans de Goede * drm_panel_orientation_quirks.c -- Quirks for non-normal panel orientation
4404d1a3eSHans de Goede *
5404d1a3eSHans de Goede * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
6404d1a3eSHans de Goede *
7404d1a3eSHans de Goede * Note the quirks in this file are shared with fbdev/efifb and as such
8404d1a3eSHans de Goede * must not depend on other drm code.
9404d1a3eSHans de Goede */
10404d1a3eSHans de Goede
11404d1a3eSHans de Goede #include <linux/dmi.h>
12e61a656fSDavid Lechner #include <linux/module.h>
13404d1a3eSHans de Goede #include <drm/drm_connector.h>
14f6d25e1cSVille Syrjälä #include <drm/drm_utils.h>
15404d1a3eSHans de Goede
16404d1a3eSHans de Goede #ifdef CONFIG_DMI
17404d1a3eSHans de Goede
18404d1a3eSHans de Goede /*
19404d1a3eSHans de Goede * Some x86 clamshell design devices use portrait tablet screens and a display
20404d1a3eSHans de Goede * engine which cannot rotate in hardware, so we need to rotate the fbcon to
21404d1a3eSHans de Goede * compensate. Unfortunately these (cheap) devices also typically have quite
22404d1a3eSHans de Goede * generic DMI data, so we match on a combination of DMI data, screen resolution
23404d1a3eSHans de Goede * and a list of known BIOS dates to avoid false positives.
24404d1a3eSHans de Goede */
25404d1a3eSHans de Goede
26404d1a3eSHans de Goede struct drm_dmi_panel_orientation_data {
27404d1a3eSHans de Goede int width;
28404d1a3eSHans de Goede int height;
29404d1a3eSHans de Goede const char * const *bios_dates;
30404d1a3eSHans de Goede int orientation;
31404d1a3eSHans de Goede };
32404d1a3eSHans de Goede
33f2f2bb60SHans de Goede static const struct drm_dmi_panel_orientation_data gpd_micropc = {
34f2f2bb60SHans de Goede .width = 720,
35f2f2bb60SHans de Goede .height = 1280,
36f2f2bb60SHans de Goede .bios_dates = (const char * const []){ "04/26/2019",
37f2f2bb60SHans de Goede NULL },
38f2f2bb60SHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
39f2f2bb60SHans de Goede };
40f2f2bb60SHans de Goede
41cbb7eb2dSKai Uwe Broulik static const struct drm_dmi_panel_orientation_data gpd_onemix2s = {
42cbb7eb2dSKai Uwe Broulik .width = 1200,
43cbb7eb2dSKai Uwe Broulik .height = 1920,
44cbb7eb2dSKai Uwe Broulik .bios_dates = (const char * const []){ "05/21/2018", "10/26/2018",
45cbb7eb2dSKai Uwe Broulik "03/04/2019", NULL },
46cbb7eb2dSKai Uwe Broulik .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
47cbb7eb2dSKai Uwe Broulik };
48cbb7eb2dSKai Uwe Broulik
49404d1a3eSHans de Goede static const struct drm_dmi_panel_orientation_data gpd_pocket = {
50404d1a3eSHans de Goede .width = 1200,
51404d1a3eSHans de Goede .height = 1920,
52404d1a3eSHans de Goede .bios_dates = (const char * const []){ "05/26/2017", "06/28/2017",
53404d1a3eSHans de Goede "07/05/2017", "08/07/2017", NULL },
54404d1a3eSHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
55404d1a3eSHans de Goede };
56404d1a3eSHans de Goede
576dab9102SHans de Goede static const struct drm_dmi_panel_orientation_data gpd_pocket2 = {
586dab9102SHans de Goede .width = 1200,
596dab9102SHans de Goede .height = 1920,
606dab9102SHans de Goede .bios_dates = (const char * const []){ "06/28/2018", "08/28/2018",
616dab9102SHans de Goede "12/07/2018", NULL },
626dab9102SHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
636dab9102SHans de Goede };
646dab9102SHans de Goede
65404d1a3eSHans de Goede static const struct drm_dmi_panel_orientation_data gpd_win = {
66404d1a3eSHans de Goede .width = 720,
67404d1a3eSHans de Goede .height = 1280,
68404d1a3eSHans de Goede .bios_dates = (const char * const []){
69404d1a3eSHans de Goede "10/25/2016", "11/18/2016", "12/23/2016", "12/26/2016",
70404d1a3eSHans de Goede "02/21/2017", "03/20/2017", "05/25/2017", NULL },
71404d1a3eSHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
72404d1a3eSHans de Goede };
73404d1a3eSHans de Goede
741f0eb8b8SHans de Goede static const struct drm_dmi_panel_orientation_data gpd_win2 = {
751f0eb8b8SHans de Goede .width = 720,
761f0eb8b8SHans de Goede .height = 1280,
771f0eb8b8SHans de Goede .bios_dates = (const char * const []){
788817b44aSGabriel Krisman Bertazi "12/07/2017", "05/24/2018", "06/29/2018", NULL },
791f0eb8b8SHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
801f0eb8b8SHans de Goede };
811f0eb8b8SHans de Goede
82404d1a3eSHans de Goede static const struct drm_dmi_panel_orientation_data itworks_tw891 = {
83404d1a3eSHans de Goede .width = 800,
84404d1a3eSHans de Goede .height = 1280,
85404d1a3eSHans de Goede .bios_dates = (const char * const []){ "10/16/2015", NULL },
86404d1a3eSHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
87404d1a3eSHans de Goede };
88404d1a3eSHans de Goede
8981ad7f9fSJared Baldridge static const struct drm_dmi_panel_orientation_data onegx1_pro = {
9081ad7f9fSJared Baldridge .width = 1200,
9181ad7f9fSJared Baldridge .height = 1920,
9281ad7f9fSJared Baldridge .bios_dates = (const char * const []){ "12/17/2020", NULL },
9381ad7f9fSJared Baldridge .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
9481ad7f9fSJared Baldridge };
9581ad7f9fSJared Baldridge
96dae1cceeSHans de Goede static const struct drm_dmi_panel_orientation_data lcd720x1280_rightside_up = {
97dae1cceeSHans de Goede .width = 720,
98dae1cceeSHans de Goede .height = 1280,
99dae1cceeSHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
100dae1cceeSHans de Goede };
101dae1cceeSHans de Goede
102a3caf7eaSAllen Ballway static const struct drm_dmi_panel_orientation_data lcd800x1280_leftside_up = {
103a3caf7eaSAllen Ballway .width = 800,
104a3caf7eaSAllen Ballway .height = 1280,
105a3caf7eaSAllen Ballway .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
106a3caf7eaSAllen Ballway };
107a3caf7eaSAllen Ballway
108f55826f0SHans de Goede static const struct drm_dmi_panel_orientation_data lcd800x1280_rightside_up = {
109404d1a3eSHans de Goede .width = 800,
110404d1a3eSHans de Goede .height = 1280,
111404d1a3eSHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
112404d1a3eSHans de Goede };
113404d1a3eSHans de Goede
114e10ea7b9SMaya Matuszczyk static const struct drm_dmi_panel_orientation_data lcd1080x1920_leftside_up = {
115e10ea7b9SMaya Matuszczyk .width = 1080,
116e10ea7b9SMaya Matuszczyk .height = 1920,
117e10ea7b9SMaya Matuszczyk .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
118e10ea7b9SMaya Matuszczyk };
119e10ea7b9SMaya Matuszczyk
120f19ad403SSamuel Dionne-Riel static const struct drm_dmi_panel_orientation_data lcd1080x1920_rightside_up = {
121f19ad403SSamuel Dionne-Riel .width = 1080,
122f19ad403SSamuel Dionne-Riel .height = 1920,
123f19ad403SSamuel Dionne-Riel .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
124f19ad403SSamuel Dionne-Riel };
125f19ad403SSamuel Dionne-Riel
126c825dc23SDavid Santamaría Rogado static const struct drm_dmi_panel_orientation_data lcd1200x1920_rightside_up = {
127c825dc23SDavid Santamaría Rogado .width = 1200,
128c825dc23SDavid Santamaría Rogado .height = 1920,
129c825dc23SDavid Santamaría Rogado .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
130c825dc23SDavid Santamaría Rogado };
131c825dc23SDavid Santamaría Rogado
13288fa1fdeSHans de Goede static const struct drm_dmi_panel_orientation_data lcd1280x1920_rightside_up = {
13388fa1fdeSHans de Goede .width = 1280,
13488fa1fdeSHans de Goede .height = 1920,
13588fa1fdeSHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
13688fa1fdeSHans de Goede };
13788fa1fdeSHans de Goede
138d3cbc6e3SRaymond Jay Golo static const struct drm_dmi_panel_orientation_data lcd1600x2560_leftside_up = {
139d3cbc6e3SRaymond Jay Golo .width = 1600,
140d3cbc6e3SRaymond Jay Golo .height = 2560,
141d3cbc6e3SRaymond Jay Golo .orientation = DRM_MODE_PANEL_ORIENTATION_LEFT_UP,
142d3cbc6e3SRaymond Jay Golo };
143d3cbc6e3SRaymond Jay Golo
1448a238d7fSHans de Goede static const struct drm_dmi_panel_orientation_data lcd1600x2560_rightside_up = {
1458a238d7fSHans de Goede .width = 1600,
1468a238d7fSHans de Goede .height = 2560,
1478a238d7fSHans de Goede .orientation = DRM_MODE_PANEL_ORIENTATION_RIGHT_UP,
1488a238d7fSHans de Goede };
1498a238d7fSHans de Goede
150404d1a3eSHans de Goede static const struct dmi_system_id orientation_data[] = {
1510e8afefdSHans de Goede { /* Acer One 10 (S1003) */
1520e8afefdSHans de Goede .matches = {
1530e8afefdSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"),
1540e8afefdSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"),
1550e8afefdSHans de Goede },
156a05caf9eSHans de Goede .driver_data = (void *)&lcd800x1280_rightside_up,
157653f2d94SHans de Goede }, { /* Acer Switch V 10 (SW5-017) */
158653f2d94SHans de Goede .matches = {
159653f2d94SHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"),
160653f2d94SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SW5-017"),
161653f2d94SHans de Goede },
162653f2d94SHans de Goede .driver_data = (void *)&lcd800x1280_rightside_up,
163770e1907SMaya Matuszczyk }, { /* Anbernic Win600 */
164770e1907SMaya Matuszczyk .matches = {
165770e1907SMaya Matuszczyk DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Anbernic"),
166770e1907SMaya Matuszczyk DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Win600"),
167770e1907SMaya Matuszczyk },
168770e1907SMaya Matuszczyk .driver_data = (void *)&lcd720x1280_rightside_up,
1690e8afefdSHans de Goede }, { /* Asus T100HA */
170404d1a3eSHans de Goede .matches = {
171404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
172404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"),
173404d1a3eSHans de Goede },
174a3caf7eaSAllen Ballway .driver_data = (void *)&lcd800x1280_leftside_up,
1756c22bc18SHans de Goede }, { /* Asus T101HA */
1766c22bc18SHans de Goede .matches = {
1776c22bc18SHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
1786c22bc18SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T101HA"),
1796c22bc18SHans de Goede },
1806c22bc18SHans de Goede .driver_data = (void *)&lcd800x1280_rightside_up,
181b5ac98cbSMarius Iacob }, { /* Asus T103HAF */
182b5ac98cbSMarius Iacob .matches = {
183b5ac98cbSMarius Iacob DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
184b5ac98cbSMarius Iacob DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T103HAF"),
185b5ac98cbSMarius Iacob },
186b5ac98cbSMarius Iacob .driver_data = (void *)&lcd800x1280_rightside_up,
187290127c6SJoaquín Ignacio Aramendía }, { /* AYA NEO AYANEO 2 */
188290127c6SJoaquín Ignacio Aramendía .matches = {
189290127c6SJoaquín Ignacio Aramendía DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYANEO"),
190290127c6SJoaquín Ignacio Aramendía DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYANEO 2"),
191290127c6SJoaquín Ignacio Aramendía },
192290127c6SJoaquín Ignacio Aramendía .driver_data = (void *)&lcd1200x1920_rightside_up,
193def0c369SBryant Mairs }, { /* AYA NEO 2021 */
194def0c369SBryant Mairs .matches = {
195def0c369SBryant Mairs DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYADEVICE"),
196def0c369SBryant Mairs DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "AYA NEO 2021"),
197def0c369SBryant Mairs },
198def0c369SBryant Mairs .driver_data = (void *)&lcd800x1280_rightside_up,
199e10ea7b9SMaya Matuszczyk }, { /* AYA NEO AIR */
200e10ea7b9SMaya Matuszczyk .matches = {
201e10ea7b9SMaya Matuszczyk DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYANEO"),
2021aa7f416SMaya Matuszczyk DMI_MATCH(DMI_PRODUCT_NAME, "AIR"),
203e10ea7b9SMaya Matuszczyk },
204e10ea7b9SMaya Matuszczyk .driver_data = (void *)&lcd1080x1920_leftside_up,
20533126ee7SJoaquín Ignacio Aramendía }, { /* AYA NEO Founder */
20633126ee7SJoaquín Ignacio Aramendía .matches = {
20733126ee7SJoaquín Ignacio Aramendía DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYA NEO"),
20833126ee7SJoaquín Ignacio Aramendía DMI_MATCH(DMI_PRODUCT_NAME, "AYA NEO Founder"),
20933126ee7SJoaquín Ignacio Aramendía },
21033126ee7SJoaquín Ignacio Aramendía .driver_data = (void *)&lcd800x1280_rightside_up,
211*189dc703SJoaquín Ignacio Aramendía }, { /* AYA NEO GEEK */
212*189dc703SJoaquín Ignacio Aramendía .matches = {
213*189dc703SJoaquín Ignacio Aramendía DMI_EXACT_MATCH(DMI_SYS_VENDOR, "AYANEO"),
214*189dc703SJoaquín Ignacio Aramendía DMI_MATCH(DMI_PRODUCT_NAME, "GEEK"),
215*189dc703SJoaquín Ignacio Aramendía },
216*189dc703SJoaquín Ignacio Aramendía .driver_data = (void *)&lcd800x1280_rightside_up,
217be33d52eSMaya Matuszczyk }, { /* AYA NEO NEXT */
218be33d52eSMaya Matuszczyk .matches = {
219be33d52eSMaya Matuszczyk DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
220be33d52eSMaya Matuszczyk DMI_MATCH(DMI_BOARD_NAME, "NEXT"),
221be33d52eSMaya Matuszczyk },
222be33d52eSMaya Matuszczyk .driver_data = (void *)&lcd800x1280_rightside_up,
22397f71343STobias Jakobi }, { /* AYA NEO KUN */
22497f71343STobias Jakobi .matches = {
22597f71343STobias Jakobi DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AYANEO"),
22697f71343STobias Jakobi DMI_MATCH(DMI_BOARD_NAME, "KUN"),
22797f71343STobias Jakobi },
22897f71343STobias Jakobi .driver_data = (void *)&lcd1600x2560_rightside_up,
22931b9fc3dSBouke Sybren Haarsma }, { /* AYN Loki Max */
23031b9fc3dSBouke Sybren Haarsma .matches = {
23131b9fc3dSBouke Sybren Haarsma DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ayn"),
23231b9fc3dSBouke Sybren Haarsma DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Loki Max"),
23331b9fc3dSBouke Sybren Haarsma },
23431b9fc3dSBouke Sybren Haarsma .driver_data = (void *)&lcd1080x1920_leftside_up,
2357d42d199SBouke Sybren Haarsma }, { /* AYN Loki Zero */
2367d42d199SBouke Sybren Haarsma .matches = {
2377d42d199SBouke Sybren Haarsma DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ayn"),
2387d42d199SBouke Sybren Haarsma DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Loki Zero"),
2397d42d199SBouke Sybren Haarsma },
2407d42d199SBouke Sybren Haarsma .driver_data = (void *)&lcd1080x1920_leftside_up,
24163a48815SHans de Goede }, { /* Chuwi HiBook (CWI514) */
24263a48815SHans de Goede .matches = {
24363a48815SHans de Goede DMI_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
24463a48815SHans de Goede DMI_MATCH(DMI_BOARD_NAME, "Cherry Trail CR"),
24563a48815SHans de Goede /* Above matches are too generic, add bios-date match */
24663a48815SHans de Goede DMI_MATCH(DMI_BIOS_DATE, "05/07/2016"),
24763a48815SHans de Goede },
24863a48815SHans de Goede .driver_data = (void *)&lcd1200x1920_rightside_up,
249072e70d5SHans de Goede }, { /* Chuwi Hi10 Pro (CWI529) */
250072e70d5SHans de Goede .matches = {
251072e70d5SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Hampoo"),
252072e70d5SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Hi10 pro tablet"),
253072e70d5SHans de Goede },
254072e70d5SHans de Goede .driver_data = (void *)&lcd1200x1920_rightside_up,
255a3caf7eaSAllen Ballway }, { /* Dynabook K50 */
256a3caf7eaSAllen Ballway .matches = {
257a3caf7eaSAllen Ballway DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Dynabook Inc."),
258a3caf7eaSAllen Ballway DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "dynabook K50/FR"),
259a3caf7eaSAllen Ballway },
260a3caf7eaSAllen Ballway .driver_data = (void *)&lcd800x1280_leftside_up,
261f2f2bb60SHans de Goede }, { /* GPD MicroPC (generic strings, also match on bios date) */
262f2f2bb60SHans de Goede .matches = {
263f2f2bb60SHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),
264f2f2bb60SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
265f2f2bb60SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),
266f2f2bb60SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
267f2f2bb60SHans de Goede },
268f2f2bb60SHans de Goede .driver_data = (void *)&gpd_micropc,
269dae1cceeSHans de Goede }, { /* GPD MicroPC (later BIOS versions with proper DMI strings) */
270dae1cceeSHans de Goede .matches = {
271dae1cceeSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"),
272dae1cceeSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "MicroPC"),
273dae1cceeSHans de Goede },
274dae1cceeSHans de Goede .driver_data = (void *)&lcd720x1280_rightside_up,
2750b464ca3SAnisse Astier }, { /* GPD Win Max */
2760b464ca3SAnisse Astier .matches = {
2770b464ca3SAnisse Astier DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"),
2780b464ca3SAnisse Astier DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "G1619-01"),
2790b464ca3SAnisse Astier },
2800b464ca3SAnisse Astier .driver_data = (void *)&lcd800x1280_rightside_up,
281404d1a3eSHans de Goede }, { /*
282dc6934d5SJiang Jian * GPD Pocket, note that the DMI data is less generic then
283404d1a3eSHans de Goede * it seems, devices with a board-vendor of "AMI Corporation"
284404d1a3eSHans de Goede * are quite rare, as are devices which have both board- *and*
285404d1a3eSHans de Goede * product-id set to "Default String"
286404d1a3eSHans de Goede */
287404d1a3eSHans de Goede .matches = {
288404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
289404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
290404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"),
291404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
292404d1a3eSHans de Goede },
293404d1a3eSHans de Goede .driver_data = (void *)&gpd_pocket,
2946dab9102SHans de Goede }, { /* GPD Pocket 2 (generic strings, also match on bios date) */
2956dab9102SHans de Goede .matches = {
2966dab9102SHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),
2976dab9102SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
2986dab9102SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),
2996dab9102SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
3006dab9102SHans de Goede },
3016dab9102SHans de Goede .driver_data = (void *)&gpd_pocket2,
302404d1a3eSHans de Goede }, { /* GPD Win (same note on DMI match as GPD Pocket) */
303404d1a3eSHans de Goede .matches = {
304404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
305404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
306404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"),
307404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
308404d1a3eSHans de Goede },
309404d1a3eSHans de Goede .driver_data = (void *)&gpd_win,
3101f0eb8b8SHans de Goede }, { /* GPD Win 2 (too generic strings, also match on bios date) */
3111f0eb8b8SHans de Goede .matches = {
3121f0eb8b8SHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),
3131f0eb8b8SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
3141f0eb8b8SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),
3151f0eb8b8SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
3161f0eb8b8SHans de Goede },
3171f0eb8b8SHans de Goede .driver_data = (void *)&gpd_win2,
31861b1d445SMario }, { /* GPD Win 3 */
31961b1d445SMario .matches = {
32061b1d445SMario DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"),
32161b1d445SMario DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "G1618-03")
32261b1d445SMario },
32361b1d445SMario .driver_data = (void *)&lcd720x1280_rightside_up,
324f19ad403SSamuel Dionne-Riel }, { /* GPD Win Mini */
325f19ad403SSamuel Dionne-Riel .matches = {
326f19ad403SSamuel Dionne-Riel DMI_EXACT_MATCH(DMI_SYS_VENDOR, "GPD"),
327f19ad403SSamuel Dionne-Riel DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "G1617-01")
328f19ad403SSamuel Dionne-Riel },
329f19ad403SSamuel Dionne-Riel .driver_data = (void *)&lcd1080x1920_rightside_up,
330404d1a3eSHans de Goede }, { /* I.T.Works TW891 */
331404d1a3eSHans de Goede .matches = {
332404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "To be filled by O.E.M."),
333404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TW891"),
334404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
335404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "TW891"),
336404d1a3eSHans de Goede },
337404d1a3eSHans de Goede .driver_data = (void *)&itworks_tw891,
338a53f1dd3SHans de Goede }, { /* KD Kurio Smart C15200 2-in-1 */
339a53f1dd3SHans de Goede .matches = {
340a53f1dd3SHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "KD Interactive"),
341a53f1dd3SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Kurio Smart"),
342a53f1dd3SHans de Goede DMI_EXACT_MATCH(DMI_BOARD_NAME, "KDM960BCP"),
343a53f1dd3SHans de Goede },
344a53f1dd3SHans de Goede .driver_data = (void *)&lcd800x1280_rightside_up,
345068b01d8SHans de Goede }, { /*
346068b01d8SHans de Goede * Lenovo Ideapad Miix 310 laptop, only some production batches
347068b01d8SHans de Goede * have a portrait screen, the resolution checks makes the quirk
348068b01d8SHans de Goede * apply only to those batches.
349068b01d8SHans de Goede */
350068b01d8SHans de Goede .matches = {
351068b01d8SHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
352068b01d8SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80SG"),
353068b01d8SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "MIIX 310-10ICR"),
354068b01d8SHans de Goede },
355f55826f0SHans de Goede .driver_data = (void *)&lcd800x1280_rightside_up,
356f55826f0SHans de Goede }, { /* Lenovo Ideapad Miix 320 */
357f55826f0SHans de Goede .matches = {
358f55826f0SHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
359f55826f0SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
360f55826f0SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
361f55826f0SHans de Goede },
362f55826f0SHans de Goede .driver_data = (void *)&lcd800x1280_rightside_up,
363820a2ab2SHans de Goede }, { /* Lenovo Ideapad D330-10IGM (HD) */
364c825dc23SDavid Santamaría Rogado .matches = {
365c825dc23SDavid Santamaría Rogado DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
366820a2ab2SHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"),
367820a2ab2SHans de Goede },
368820a2ab2SHans de Goede .driver_data = (void *)&lcd800x1280_rightside_up,
369820a2ab2SHans de Goede }, { /* Lenovo Ideapad D330-10IGM (FHD) */
370820a2ab2SHans de Goede .matches = {
371820a2ab2SHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
372c825dc23SDavid Santamaría Rogado DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGM"),
373c825dc23SDavid Santamaría Rogado },
374c825dc23SDavid Santamaría Rogado .driver_data = (void *)&lcd1200x1920_rightside_up,
3750688773fSPatrick Thompson }, { /* Lenovo Ideapad D330-10IGL (HD) */
3760688773fSPatrick Thompson .matches = {
3770688773fSPatrick Thompson DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
3780688773fSPatrick Thompson DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad D330-10IGL"),
3790688773fSPatrick Thompson },
3800688773fSPatrick Thompson .driver_data = (void *)&lcd800x1280_rightside_up,
38138b2d8efSDarrell Kavanagh }, { /* Lenovo IdeaPad Duet 3 10IGL5 */
38238b2d8efSDarrell Kavanagh .matches = {
38338b2d8efSDarrell Kavanagh DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
38438b2d8efSDarrell Kavanagh DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "IdeaPad Duet 3 10IGL5"),
38538b2d8efSDarrell Kavanagh },
38638b2d8efSDarrell Kavanagh .driver_data = (void *)&lcd1200x1920_rightside_up,
387ac1ddbedSBrenton Simpson }, { /* Lenovo Legion Go 8APU1 */
388ac1ddbedSBrenton Simpson .matches = {
389ac1ddbedSBrenton Simpson DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
390ac1ddbedSBrenton Simpson DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Legion Go 8APU1"),
391ac1ddbedSBrenton Simpson },
392ac1ddbedSBrenton Simpson .driver_data = (void *)&lcd1600x2560_leftside_up,
39303aecb1aSHans de Goede }, { /* Lenovo Yoga Book X90F / X90L */
394bc30c3b0SHans de Goede .matches = {
39503aecb1aSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
39603aecb1aSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "CHERRYVIEW D1 PLATFORM"),
39703aecb1aSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "YETI-11"),
39803aecb1aSHans de Goede },
39903aecb1aSHans de Goede .driver_data = (void *)&lcd1200x1920_rightside_up,
40003aecb1aSHans de Goede }, { /* Lenovo Yoga Book X91F / X91L */
40103aecb1aSHans de Goede .matches = {
40203aecb1aSHans de Goede /* Non exact match to match F + L versions */
40303aecb1aSHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "Lenovo YB1-X91"),
404bc30c3b0SHans de Goede },
405bc30c3b0SHans de Goede .driver_data = (void *)&lcd1200x1920_rightside_up,
40614424851SHans de Goede }, { /* Lenovo Yoga Tablet 2 830F / 830L */
40714424851SHans de Goede .matches = {
40814424851SHans de Goede /*
40914424851SHans de Goede * Note this also matches the Lenovo Yoga Tablet 2 1050F/L
41014424851SHans de Goede * since that uses the same mainboard. The resolution match
41114424851SHans de Goede * will limit this to only matching on the 830F/L. Neither has
41214424851SHans de Goede * any external video outputs so those are not a concern.
41314424851SHans de Goede */
41414424851SHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Intel Corp."),
41514424851SHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "VALLEYVIEW C0 PLATFORM"),
41614424851SHans de Goede DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"),
41714424851SHans de Goede /* Partial match on beginning of BIOS version */
41814424851SHans de Goede DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21"),
41914424851SHans de Goede },
42014424851SHans de Goede .driver_data = (void *)&lcd1200x1920_rightside_up,
4218a238d7fSHans de Goede }, { /* Lenovo Yoga Tab 3 X90F */
4228a238d7fSHans de Goede .matches = {
4238a238d7fSHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
4248a238d7fSHans de Goede DMI_MATCH(DMI_PRODUCT_VERSION, "Blade3-10A-001"),
4258a238d7fSHans de Goede },
4268a238d7fSHans de Goede .driver_data = (void *)&lcd1600x2560_rightside_up,
427308451d9SHans de Goede }, { /* Nanote UMPC-01 */
428308451d9SHans de Goede .matches = {
429308451d9SHans de Goede DMI_MATCH(DMI_SYS_VENDOR, "RWC CO.,LTD"),
430308451d9SHans de Goede DMI_MATCH(DMI_PRODUCT_NAME, "UMPC-01"),
431308451d9SHans de Goede },
432308451d9SHans de Goede .driver_data = (void *)&lcd1200x1920_rightside_up,
43381ad7f9fSJared Baldridge }, { /* OneGX1 Pro */
43481ad7f9fSJared Baldridge .matches = {
43581ad7f9fSJared Baldridge DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SYSTEM_MANUFACTURER"),
43681ad7f9fSJared Baldridge DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "SYSTEM_PRODUCT_NAME"),
43781ad7f9fSJared Baldridge DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Default string"),
43881ad7f9fSJared Baldridge },
43981ad7f9fSJared Baldridge .driver_data = (void *)&onegx1_pro,
440d3cbc6e3SRaymond Jay Golo }, { /* OneXPlayer */
441d3cbc6e3SRaymond Jay Golo .matches = {
442d3cbc6e3SRaymond Jay Golo DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ONE-NETBOOK TECHNOLOGY CO., LTD."),
443d3cbc6e3SRaymond Jay Golo DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ONE XPLAYER"),
444d3cbc6e3SRaymond Jay Golo },
445d3cbc6e3SRaymond Jay Golo .driver_data = (void *)&lcd1600x2560_leftside_up,
446512bd0cdSPhilip Mueller }, { /* OrangePi Neo */
447512bd0cdSPhilip Mueller .matches = {
448512bd0cdSPhilip Mueller DMI_EXACT_MATCH(DMI_SYS_VENDOR, "OrangePi"),
449512bd0cdSPhilip Mueller DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "NEO-01"),
450512bd0cdSPhilip Mueller },
451512bd0cdSPhilip Mueller .driver_data = (void *)&lcd1200x1920_rightside_up,
45288fa1fdeSHans de Goede }, { /* Samsung GalaxyBook 10.6 */
45388fa1fdeSHans de Goede .matches = {
45488fa1fdeSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
45588fa1fdeSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galaxy Book 10.6"),
45688fa1fdeSHans de Goede },
45788fa1fdeSHans de Goede .driver_data = (void *)&lcd1280x1920_rightside_up,
4589eeb7b4eSSimon Ser }, { /* Valve Steam Deck */
4599eeb7b4eSSimon Ser .matches = {
4609eeb7b4eSSimon Ser DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"),
4619eeb7b4eSSimon Ser DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Jupiter"),
4629eeb7b4eSSimon Ser DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"),
4639eeb7b4eSSimon Ser },
4649eeb7b4eSSimon Ser .driver_data = (void *)&lcd800x1280_rightside_up,
46533de7c47SJohn Schoenick }, { /* Valve Steam Deck */
46633de7c47SJohn Schoenick .matches = {
46733de7c47SJohn Schoenick DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Valve"),
46833de7c47SJohn Schoenick DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Galileo"),
46933de7c47SJohn Schoenick DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "1"),
47033de7c47SJohn Schoenick },
47133de7c47SJohn Schoenick .driver_data = (void *)&lcd800x1280_rightside_up,
472404d1a3eSHans de Goede }, { /* VIOS LTH17 */
473404d1a3eSHans de Goede .matches = {
474404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
475404d1a3eSHans de Goede DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "LTH17"),
476404d1a3eSHans de Goede },
477f55826f0SHans de Goede .driver_data = (void *)&lcd800x1280_rightside_up,
478cbb7eb2dSKai Uwe Broulik }, { /* One Mix 2S (generic strings, also match on bios date) */
479cbb7eb2dSKai Uwe Broulik .matches = {
480cbb7eb2dSKai Uwe Broulik DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Default string"),
481cbb7eb2dSKai Uwe Broulik DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
482cbb7eb2dSKai Uwe Broulik DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Default string"),
483cbb7eb2dSKai Uwe Broulik DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
484cbb7eb2dSKai Uwe Broulik },
485cbb7eb2dSKai Uwe Broulik .driver_data = (void *)&gpd_onemix2s,
486404d1a3eSHans de Goede },
487404d1a3eSHans de Goede {}
488404d1a3eSHans de Goede };
489404d1a3eSHans de Goede
490404d1a3eSHans de Goede /**
491404d1a3eSHans de Goede * drm_get_panel_orientation_quirk - Check for panel orientation quirks
492404d1a3eSHans de Goede * @width: width in pixels of the panel
493404d1a3eSHans de Goede * @height: height in pixels of the panel
494404d1a3eSHans de Goede *
495404d1a3eSHans de Goede * This function checks for platform specific (e.g. DMI based) quirks
496404d1a3eSHans de Goede * providing info on panel_orientation for systems where this cannot be
497404d1a3eSHans de Goede * probed from the hard-/firm-ware. To avoid false-positive this function
498404d1a3eSHans de Goede * takes the panel resolution as argument and checks that against the
499404d1a3eSHans de Goede * resolution expected by the quirk-table entry.
500404d1a3eSHans de Goede *
501404d1a3eSHans de Goede * Note this function is also used outside of the drm-subsys, by for example
502404d1a3eSHans de Goede * the efifb code. Because of this this function gets compiled into its own
503404d1a3eSHans de Goede * kernel-module when built as a module.
504404d1a3eSHans de Goede *
505404d1a3eSHans de Goede * Returns:
506404d1a3eSHans de Goede * A DRM_MODE_PANEL_ORIENTATION_* value if there is a quirk for this system,
507404d1a3eSHans de Goede * or DRM_MODE_PANEL_ORIENTATION_UNKNOWN if there is no quirk.
508404d1a3eSHans de Goede */
drm_get_panel_orientation_quirk(int width,int height)509404d1a3eSHans de Goede int drm_get_panel_orientation_quirk(int width, int height)
510404d1a3eSHans de Goede {
511404d1a3eSHans de Goede const struct dmi_system_id *match;
512404d1a3eSHans de Goede const struct drm_dmi_panel_orientation_data *data;
513404d1a3eSHans de Goede const char *bios_date;
514404d1a3eSHans de Goede int i;
515404d1a3eSHans de Goede
516404d1a3eSHans de Goede for (match = dmi_first_match(orientation_data);
517404d1a3eSHans de Goede match;
518404d1a3eSHans de Goede match = dmi_first_match(match + 1)) {
519404d1a3eSHans de Goede data = match->driver_data;
520404d1a3eSHans de Goede
521404d1a3eSHans de Goede if (data->width != width ||
522404d1a3eSHans de Goede data->height != height)
523404d1a3eSHans de Goede continue;
524404d1a3eSHans de Goede
525404d1a3eSHans de Goede if (!data->bios_dates)
526404d1a3eSHans de Goede return data->orientation;
527404d1a3eSHans de Goede
528404d1a3eSHans de Goede bios_date = dmi_get_system_info(DMI_BIOS_DATE);
529404d1a3eSHans de Goede if (!bios_date)
530404d1a3eSHans de Goede continue;
531404d1a3eSHans de Goede
532818c05d8SAndy Shevchenko i = match_string(data->bios_dates, -1, bios_date);
533818c05d8SAndy Shevchenko if (i >= 0)
534404d1a3eSHans de Goede return data->orientation;
535404d1a3eSHans de Goede }
536404d1a3eSHans de Goede
537404d1a3eSHans de Goede return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
538404d1a3eSHans de Goede }
539404d1a3eSHans de Goede EXPORT_SYMBOL(drm_get_panel_orientation_quirk);
540404d1a3eSHans de Goede
541404d1a3eSHans de Goede #else
542404d1a3eSHans de Goede
543404d1a3eSHans de Goede /* There are no quirks for non x86 devices yet */
drm_get_panel_orientation_quirk(int width,int height)544404d1a3eSHans de Goede int drm_get_panel_orientation_quirk(int width, int height)
545404d1a3eSHans de Goede {
546404d1a3eSHans de Goede return DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
547404d1a3eSHans de Goede }
548404d1a3eSHans de Goede EXPORT_SYMBOL(drm_get_panel_orientation_quirk);
549404d1a3eSHans de Goede
550404d1a3eSHans de Goede #endif
551e61a656fSDavid Lechner
552e61a656fSDavid Lechner MODULE_LICENSE("Dual MIT/GPL");
553