Skip to content

Commit 3be324a

Browse files
iksaifMatthew Garrett
authored andcommitted
samsung-laptop: make the dmi check less strict
This enable the driver for everything that look like a laptop and is from vendor "SAMSUNG ELECTRONICS CO., LTD.". Note that laptop supported by samsung-q10 seem to have a different vendor strict. Also remove every log output until we know that we have a SABI interface (except if the driver is forced to load, or debug is enabled). Keeping a whitelist of laptop with a model granularity is something that can't work without close vendor cooperation (and we don't have that). Signed-off-by: Corentin Chary <corentincj@iksaif.net> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Matthew Garrett <mjg@redhat.com>
1 parent 84d482f commit 3be324a

1 file changed

Lines changed: 15 additions & 220 deletions

File tree

‎drivers/platform/x86/samsung-laptop.c‎

Lines changed: 15 additions & 220 deletions
Original file line numberDiff line numberDiff line change
@@ -1270,7 +1270,8 @@ static int __init samsung_sabi_init(struct samsung_laptop *samsung)
12701270

12711271
samsung->f0000_segment = ioremap_nocache(0xf0000, 0xffff);
12721272
if (!samsung->f0000_segment) {
1273-
pr_err("Can't map the segment at 0xf0000\n");
1273+
if (debug || force)
1274+
pr_err("Can't map the segment at 0xf0000\n");
12741275
ret = -EINVAL;
12751276
goto exit;
12761277
}
@@ -1285,7 +1286,8 @@ static int __init samsung_sabi_init(struct samsung_laptop *samsung)
12851286
}
12861287

12871288
if (loca == 0xffff) {
1288-
pr_err("This computer does not support SABI\n");
1289+
if (debug || force)
1290+
pr_err("This computer does not support SABI\n");
12891291
ret = -ENODEV;
12901292
goto exit;
12911293
}
@@ -1354,244 +1356,34 @@ static int __init samsung_platform_init(struct samsung_laptop *samsung)
13541356
return 0;
13551357
}
13561358

1357-
static int __init dmi_check_cb(const struct dmi_system_id *id)
1358-
{
1359-
pr_info("found laptop model '%s'\n", id->ident);
1360-
return 1;
1361-
}
1362-
13631359
static struct dmi_system_id __initdata samsung_dmi_table[] = {
13641360
{
1365-
.ident = "N128",
1366-
.matches = {
1367-
DMI_MATCH(DMI_SYS_VENDOR,
1368-
"SAMSUNG ELECTRONICS CO., LTD."),
1369-
DMI_MATCH(DMI_PRODUCT_NAME, "N128"),
1370-
DMI_MATCH(DMI_BOARD_NAME, "N128"),
1371-
},
1372-
.callback = dmi_check_cb,
1373-
},
1374-
{
1375-
.ident = "N130",
1376-
.matches = {
1377-
DMI_MATCH(DMI_SYS_VENDOR,
1378-
"SAMSUNG ELECTRONICS CO., LTD."),
1379-
DMI_MATCH(DMI_PRODUCT_NAME, "N130"),
1380-
DMI_MATCH(DMI_BOARD_NAME, "N130"),
1381-
},
1382-
.callback = dmi_check_cb,
1383-
},
1384-
{
1385-
.ident = "N510",
1386-
.matches = {
1387-
DMI_MATCH(DMI_SYS_VENDOR,
1388-
"SAMSUNG ELECTRONICS CO., LTD."),
1389-
DMI_MATCH(DMI_PRODUCT_NAME, "N510"),
1390-
DMI_MATCH(DMI_BOARD_NAME, "N510"),
1391-
},
1392-
.callback = dmi_check_cb,
1393-
},
1394-
{
1395-
.ident = "X125",
1396-
.matches = {
1397-
DMI_MATCH(DMI_SYS_VENDOR,
1398-
"SAMSUNG ELECTRONICS CO., LTD."),
1399-
DMI_MATCH(DMI_PRODUCT_NAME, "X125"),
1400-
DMI_MATCH(DMI_BOARD_NAME, "X125"),
1401-
},
1402-
.callback = dmi_check_cb,
1403-
},
1404-
{
1405-
.ident = "X120/X170",
1406-
.matches = {
1407-
DMI_MATCH(DMI_SYS_VENDOR,
1408-
"SAMSUNG ELECTRONICS CO., LTD."),
1409-
DMI_MATCH(DMI_PRODUCT_NAME, "X120/X170"),
1410-
DMI_MATCH(DMI_BOARD_NAME, "X120/X170"),
1411-
},
1412-
.callback = dmi_check_cb,
1413-
},
1414-
{
1415-
.ident = "NC10",
1416-
.matches = {
1417-
DMI_MATCH(DMI_SYS_VENDOR,
1418-
"SAMSUNG ELECTRONICS CO., LTD."),
1419-
DMI_MATCH(DMI_PRODUCT_NAME, "NC10"),
1420-
DMI_MATCH(DMI_BOARD_NAME, "NC10"),
1421-
},
1422-
.callback = dmi_check_cb,
1423-
},
1424-
{
1425-
.ident = "NP-Q45",
1426-
.matches = {
1427-
DMI_MATCH(DMI_SYS_VENDOR,
1428-
"SAMSUNG ELECTRONICS CO., LTD."),
1429-
DMI_MATCH(DMI_PRODUCT_NAME, "SQ45S70S"),
1430-
DMI_MATCH(DMI_BOARD_NAME, "SQ45S70S"),
1431-
},
1432-
.callback = dmi_check_cb,
1433-
},
1434-
{
1435-
.ident = "X360",
1436-
.matches = {
1437-
DMI_MATCH(DMI_SYS_VENDOR,
1438-
"SAMSUNG ELECTRONICS CO., LTD."),
1439-
DMI_MATCH(DMI_PRODUCT_NAME, "X360"),
1440-
DMI_MATCH(DMI_BOARD_NAME, "X360"),
1441-
},
1442-
.callback = dmi_check_cb,
1443-
},
1444-
{
1445-
.ident = "R410 Plus",
1446-
.matches = {
1447-
DMI_MATCH(DMI_SYS_VENDOR,
1448-
"SAMSUNG ELECTRONICS CO., LTD."),
1449-
DMI_MATCH(DMI_PRODUCT_NAME, "R410P"),
1450-
DMI_MATCH(DMI_BOARD_NAME, "R460"),
1451-
},
1452-
.callback = dmi_check_cb,
1453-
},
1454-
{
1455-
.ident = "R518",
14561361
.matches = {
14571362
DMI_MATCH(DMI_SYS_VENDOR,
14581363
"SAMSUNG ELECTRONICS CO., LTD."),
1459-
DMI_MATCH(DMI_PRODUCT_NAME, "R518"),
1460-
DMI_MATCH(DMI_BOARD_NAME, "R518"),
1364+
DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
14611365
},
1462-
.callback = dmi_check_cb,
14631366
},
14641367
{
1465-
.ident = "R519/R719",
14661368
.matches = {
14671369
DMI_MATCH(DMI_SYS_VENDOR,
14681370
"SAMSUNG ELECTRONICS CO., LTD."),
1469-
DMI_MATCH(DMI_PRODUCT_NAME, "R519/R719"),
1470-
DMI_MATCH(DMI_BOARD_NAME, "R519/R719"),
1371+
DMI_MATCH(DMI_CHASSIS_TYPE, "9"), /* Laptop */
14711372
},
1472-
.callback = dmi_check_cb,
14731373
},
14741374
{
1475-
.ident = "N150/N210/N220",
14761375
.matches = {
14771376
DMI_MATCH(DMI_SYS_VENDOR,
14781377
"SAMSUNG ELECTRONICS CO., LTD."),
1479-
DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220"),
1480-
DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220"),
1378+
DMI_MATCH(DMI_CHASSIS_TYPE, "10"), /* Notebook */
14811379
},
1482-
.callback = dmi_check_cb,
14831380
},
14841381
{
1485-
.ident = "N220",
14861382
.matches = {
14871383
DMI_MATCH(DMI_SYS_VENDOR,
14881384
"SAMSUNG ELECTRONICS CO., LTD."),
1489-
DMI_MATCH(DMI_PRODUCT_NAME, "N220"),
1490-
DMI_MATCH(DMI_BOARD_NAME, "N220"),
1385+
DMI_MATCH(DMI_CHASSIS_TYPE, "14"), /* Sub-Notebook */
14911386
},
1492-
.callback = dmi_check_cb,
1493-
},
1494-
{
1495-
.ident = "N150/N210/N220/N230",
1496-
.matches = {
1497-
DMI_MATCH(DMI_SYS_VENDOR,
1498-
"SAMSUNG ELECTRONICS CO., LTD."),
1499-
DMI_MATCH(DMI_PRODUCT_NAME, "N150/N210/N220/N230"),
1500-
DMI_MATCH(DMI_BOARD_NAME, "N150/N210/N220/N230"),
1501-
},
1502-
.callback = dmi_check_cb,
1503-
},
1504-
{
1505-
.ident = "N150P/N210P/N220P",
1506-
.matches = {
1507-
DMI_MATCH(DMI_SYS_VENDOR,
1508-
"SAMSUNG ELECTRONICS CO., LTD."),
1509-
DMI_MATCH(DMI_PRODUCT_NAME, "N150P/N210P/N220P"),
1510-
DMI_MATCH(DMI_BOARD_NAME, "N150P/N210P/N220P"),
1511-
},
1512-
.callback = dmi_check_cb,
1513-
},
1514-
{
1515-
.ident = "R700",
1516-
.matches = {
1517-
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1518-
DMI_MATCH(DMI_PRODUCT_NAME, "SR700"),
1519-
DMI_MATCH(DMI_BOARD_NAME, "SR700"),
1520-
},
1521-
.callback = dmi_check_cb,
1522-
},
1523-
{
1524-
.ident = "R530/R730",
1525-
.matches = {
1526-
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1527-
DMI_MATCH(DMI_PRODUCT_NAME, "R530/R730"),
1528-
DMI_MATCH(DMI_BOARD_NAME, "R530/R730"),
1529-
},
1530-
.callback = dmi_check_cb,
1531-
},
1532-
{
1533-
.ident = "NF110/NF210/NF310",
1534-
.matches = {
1535-
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1536-
DMI_MATCH(DMI_PRODUCT_NAME, "NF110/NF210/NF310"),
1537-
DMI_MATCH(DMI_BOARD_NAME, "NF110/NF210/NF310"),
1538-
},
1539-
.callback = dmi_check_cb,
1540-
},
1541-
{
1542-
.ident = "N145P/N250P/N260P",
1543-
.matches = {
1544-
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1545-
DMI_MATCH(DMI_PRODUCT_NAME, "N145P/N250P/N260P"),
1546-
DMI_MATCH(DMI_BOARD_NAME, "N145P/N250P/N260P"),
1547-
},
1548-
.callback = dmi_check_cb,
1549-
},
1550-
{
1551-
.ident = "R70/R71",
1552-
.matches = {
1553-
DMI_MATCH(DMI_SYS_VENDOR,
1554-
"SAMSUNG ELECTRONICS CO., LTD."),
1555-
DMI_MATCH(DMI_PRODUCT_NAME, "R70/R71"),
1556-
DMI_MATCH(DMI_BOARD_NAME, "R70/R71"),
1557-
},
1558-
.callback = dmi_check_cb,
1559-
},
1560-
{
1561-
.ident = "P460",
1562-
.matches = {
1563-
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1564-
DMI_MATCH(DMI_PRODUCT_NAME, "P460"),
1565-
DMI_MATCH(DMI_BOARD_NAME, "P460"),
1566-
},
1567-
.callback = dmi_check_cb,
1568-
},
1569-
{
1570-
.ident = "R528/R728",
1571-
.matches = {
1572-
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1573-
DMI_MATCH(DMI_PRODUCT_NAME, "R528/R728"),
1574-
DMI_MATCH(DMI_BOARD_NAME, "R528/R728"),
1575-
},
1576-
.callback = dmi_check_cb,
1577-
},
1578-
{
1579-
.ident = "NC210/NC110",
1580-
.matches = {
1581-
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1582-
DMI_MATCH(DMI_PRODUCT_NAME, "NC210/NC110"),
1583-
DMI_MATCH(DMI_BOARD_NAME, "NC210/NC110"),
1584-
},
1585-
.callback = dmi_check_cb,
1586-
},
1587-
{
1588-
.ident = "X520",
1589-
.matches = {
1590-
DMI_MATCH(DMI_SYS_VENDOR, "SAMSUNG ELECTRONICS CO., LTD."),
1591-
DMI_MATCH(DMI_PRODUCT_NAME, "X520"),
1592-
DMI_MATCH(DMI_BOARD_NAME, "X520"),
1593-
},
1594-
.callback = dmi_check_cb,
15951387
},
15961388
{ },
15971389
};
@@ -1616,12 +1408,9 @@ static int __init samsung_init(void)
16161408

16171409
#ifdef CONFIG_ACPI
16181410
/* Don't handle backlight here if the acpi video already handle it */
1619-
if (acpi_video_backlight_support()) {
1620-
pr_info("Backlight controlled by ACPI video driver\n");
1411+
if (acpi_video_backlight_support())
16211412
samsung->handle_backlight = false;
1622-
}
16231413
#endif
1624-
16251414
ret = samsung_platform_init(samsung);
16261415
if (ret)
16271416
goto error_platform;
@@ -1630,6 +1419,12 @@ static int __init samsung_init(void)
16301419
if (ret)
16311420
goto error_sabi;
16321421

1422+
#ifdef CONFIG_ACPI
1423+
/* Only log that if we are really on a sabi platform */
1424+
if (acpi_video_backlight_support())
1425+
pr_info("Backlight controlled by ACPI video driver\n");
1426+
#endif
1427+
16331428
ret = samsung_sysfs_init(samsung);
16341429
if (ret)
16351430
goto error_sysfs;

0 commit comments

Comments
 (0)