oxp-sensors.c (a35762dd14adb952442e487d8dad4bb50b614b2b) | oxp-sensors.c (49ffb5eefebccf498fb2a45b46ff58d0b255bf97) |
---|---|
1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Platform driver for OneXPlayer, AOK ZOE, and Aya Neo Handhelds that expose 4 * fan reading and control via hwmon sysfs. 5 * 6 * Old OXP boards have the same DMI strings and they are told apart by 7 * the boot cpu vendor (Intel/AMD). Currently only AMD boards are 8 * supported but the code is made to be simple to add other handheld --- 420 unchanged lines hidden (view full) --- 429static const struct hwmon_chip_info oxp_ec_chip_info = { 430 .ops = &oxp_ec_hwmon_ops, 431 .info = oxp_platform_sensors, 432}; 433 434/* Initialization logic */ 435static int oxp_platform_probe(struct platform_device *pdev) 436{ | 1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Platform driver for OneXPlayer, AOK ZOE, and Aya Neo Handhelds that expose 4 * fan reading and control via hwmon sysfs. 5 * 6 * Old OXP boards have the same DMI strings and they are told apart by 7 * the boot cpu vendor (Intel/AMD). Currently only AMD boards are 8 * supported but the code is made to be simple to add other handheld --- 420 unchanged lines hidden (view full) --- 429static const struct hwmon_chip_info oxp_ec_chip_info = { 430 .ops = &oxp_ec_hwmon_ops, 431 .info = oxp_platform_sensors, 432}; 433 434/* Initialization logic */ 435static int oxp_platform_probe(struct platform_device *pdev) 436{ |
437 const struct dmi_system_id *dmi_entry; | |
438 struct device *dev = &pdev->dev; 439 struct device *hwdev; 440 | 437 struct device *dev = &pdev->dev; 438 struct device *hwdev; 439 |
441 /* 442 * Have to check for AMD processor here because DMI strings are the 443 * same between Intel and AMD boards, the only way to tell them apart 444 * is the CPU. 445 * Intel boards seem to have different EC registers and values to 446 * read/write. 447 */ 448 dmi_entry = dmi_first_match(dmi_table); 449 if (!dmi_entry || boot_cpu_data.x86_vendor != X86_VENDOR_AMD) 450 return -ENODEV; 451 452 board = (enum oxp_board)(unsigned long)dmi_entry->driver_data; 453 | |
454 hwdev = devm_hwmon_device_register_with_info(dev, "oxpec", NULL, 455 &oxp_ec_chip_info, NULL); 456 457 return PTR_ERR_OR_ZERO(hwdev); 458} 459 460static struct platform_driver oxp_platform_driver = { 461 .driver = { 462 .name = "oxp-platform", 463 .dev_groups = oxp_ec_groups, 464 }, 465 .probe = oxp_platform_probe, 466}; 467 468static struct platform_device *oxp_platform_device; 469 470static int __init oxp_platform_init(void) 471{ | 440 hwdev = devm_hwmon_device_register_with_info(dev, "oxpec", NULL, 441 &oxp_ec_chip_info, NULL); 442 443 return PTR_ERR_OR_ZERO(hwdev); 444} 445 446static struct platform_driver oxp_platform_driver = { 447 .driver = { 448 .name = "oxp-platform", 449 .dev_groups = oxp_ec_groups, 450 }, 451 .probe = oxp_platform_probe, 452}; 453 454static struct platform_device *oxp_platform_device; 455 456static int __init oxp_platform_init(void) 457{ |
458 const struct dmi_system_id *dmi_entry; 459 460 /* 461 * Have to check for AMD processor here because DMI strings are the 462 * same between Intel and AMD boards, the only way to tell them apart 463 * is the CPU. 464 * Intel boards seem to have different EC registers and values to 465 * read/write. 466 */ 467 dmi_entry = dmi_first_match(dmi_table); 468 if (!dmi_entry || boot_cpu_data.x86_vendor != X86_VENDOR_AMD) 469 return -ENODEV; 470 471 board = (enum oxp_board)(unsigned long)dmi_entry->driver_data; 472 |
|
472 oxp_platform_device = 473 platform_create_bundle(&oxp_platform_driver, 474 oxp_platform_probe, NULL, 0, NULL, 0); 475 476 return PTR_ERR_OR_ZERO(oxp_platform_device); 477} 478 479static void __exit oxp_platform_exit(void) --- 13 unchanged lines hidden --- | 473 oxp_platform_device = 474 platform_create_bundle(&oxp_platform_driver, 475 oxp_platform_probe, NULL, 0, NULL, 0); 476 477 return PTR_ERR_OR_ZERO(oxp_platform_device); 478} 479 480static void __exit oxp_platform_exit(void) --- 13 unchanged lines hidden --- |