2 * fbcon_dmi_quirks.c -- DMI based quirk detection for fbcon
4 * Copyright (C) 2017 Hans de Goede <hdegoede@redhat.com>
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file COPYING in the main directory of this archive for
11 #include <linux/dmi.h>
13 #include <linux/kernel.h>
17 * Some x86 clamshell design devices use portrait tablet screens and a display
18 * engine which cannot rotate in hardware, so we need to rotate the fbcon to
19 * compensate. Unfortunately these (cheap) devices also typically have quite
20 * generic DMI data, so we match on a combination of DMI data, screen resolution
21 * and a list of known BIOS dates to avoid false positives.
24 struct fbcon_dmi_rotate_data {
27 const char * const *bios_dates;
31 static const struct fbcon_dmi_rotate_data rotate_data_asus_t100ha = {
34 .rotate = FB_ROTATE_CCW,
37 static const struct fbcon_dmi_rotate_data rotate_data_gpd_pocket = {
40 .bios_dates = (const char * const []){ "05/26/2017", "06/28/2017",
41 "07/05/2017", "08/07/2017", NULL },
42 .rotate = FB_ROTATE_CW,
45 static const struct fbcon_dmi_rotate_data rotate_data_gpd_win = {
48 .bios_dates = (const char * const []){
49 "10/25/2016", "11/18/2016", "12/23/2016", "12/26/2016",
50 "02/21/2017", "03/20/2017", "05/25/2017", NULL },
51 .rotate = FB_ROTATE_CW,
54 static const struct fbcon_dmi_rotate_data rotate_data_itworks_tw891 = {
57 .bios_dates = (const char * const []){ "10/16/2015", NULL },
58 .rotate = FB_ROTATE_CW,
61 static const struct fbcon_dmi_rotate_data rotate_data_vios_lth17 = {
64 .rotate = FB_ROTATE_CW,
67 static const struct dmi_system_id rotate_data[] = {
70 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
71 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "T100HAN"),
73 .driver_data = (void *)&rotate_data_asus_t100ha,
75 * GPD Pocket, note that the the DMI data is less generic then
76 * it seems, devices with a board-vendor of "AMI Corporation"
77 * are quite rare, as are devices which have both board- *and*
78 * product-id set to "Default String"
81 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
82 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
83 DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"),
84 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
86 .driver_data = (void *)&rotate_data_gpd_pocket,
87 }, { /* GPD Win (same note on DMI match as GPD Pocket) */
89 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
90 DMI_EXACT_MATCH(DMI_BOARD_NAME, "Default string"),
91 DMI_EXACT_MATCH(DMI_BOARD_SERIAL, "Default string"),
92 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Default string"),
94 .driver_data = (void *)&rotate_data_gpd_win,
95 }, { /* I.T.Works TW891 */
97 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "To be filled by O.E.M."),
98 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TW891"),
99 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "To be filled by O.E.M."),
100 DMI_EXACT_MATCH(DMI_BOARD_NAME, "TW891"),
102 .driver_data = (void *)&rotate_data_itworks_tw891,
103 }, { /* VIOS LTH17 */
105 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "VIOS"),
106 DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "LTH17"),
107 DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "VIOS"),
108 DMI_EXACT_MATCH(DMI_BOARD_NAME, "LTH17"),
110 .driver_data = (void *)&rotate_data_vios_lth17,
115 int fbcon_platform_get_rotate(struct fb_info *info)
117 const struct dmi_system_id *match;
118 const struct fbcon_dmi_rotate_data *data;
119 const char *bios_date;
122 for (match = dmi_first_match(rotate_data);
124 match = dmi_first_match(match + 1)) {
125 data = match->driver_data;
127 if (data->width != info->var.xres ||
128 data->height != info->var.yres)
131 if (!data->bios_dates)
134 bios_date = dmi_get_system_info(DMI_BIOS_DATE);
138 for (i = 0; data->bios_dates[i]; i++) {
139 if (!strcmp(data->bios_dates[i], bios_date))