@@ -367,6 +367,7 @@ static struct {
367
367
u32 beep_needs_two_args :1 ;
368
368
u32 mixer_no_level_control :1 ;
369
369
u32 battery_force_primary :1 ;
370
+ u32 platform_drv_registered :1 ;
370
371
u32 hotkey_poll_active :1 ;
371
372
u32 has_adaptive_kbd :1 ;
372
373
u32 kbd_lang :1 ;
@@ -8793,6 +8794,7 @@ static const struct attribute_group fan_driver_attr_group = {
8793
8794
#define TPACPI_FAN_NS 0x0010 /* For EC with non-Standard register addresses */
8794
8795
#define TPACPI_FAN_DECRPM 0x0020 /* For ECFW's with RPM in register as decimal */
8795
8796
#define TPACPI_FAN_TPR 0x0040 /* Fan speed is in Ticks Per Revolution */
8797
+ #define TPACPI_FAN_NOACPI 0x0080 /* Don't use ACPI methods even if detected */
8796
8798
8797
8799
static const struct tpacpi_quirk fan_quirk_table [] __initconst = {
8798
8800
TPACPI_QEC_IBM ('1' , 'Y' , TPACPI_FAN_Q1 ),
@@ -8823,6 +8825,9 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
8823
8825
TPACPI_Q_LNV3 ('N' , '1' , 'O' , TPACPI_FAN_NOFAN ), /* X1 Tablet (2nd gen) */
8824
8826
TPACPI_Q_LNV3 ('R' , '0' , 'Q' , TPACPI_FAN_DECRPM ),/* L480 */
8825
8827
TPACPI_Q_LNV ('8' , 'F' , TPACPI_FAN_TPR ), /* ThinkPad x120e */
8828
+ TPACPI_Q_LNV3 ('R' , '0' , '0' , TPACPI_FAN_NOACPI ),/* E560 */
8829
+ TPACPI_Q_LNV3 ('R' , '1' , '2' , TPACPI_FAN_NOACPI ),/* T495 */
8830
+ TPACPI_Q_LNV3 ('R' , '1' , '3' , TPACPI_FAN_NOACPI ),/* T495s */
8826
8831
};
8827
8832
8828
8833
static int __init fan_init (struct ibm_init_struct * iibm )
@@ -8874,6 +8879,13 @@ static int __init fan_init(struct ibm_init_struct *iibm)
8874
8879
tp_features .fan_ctrl_status_undef = 1 ;
8875
8880
}
8876
8881
8882
+ if (quirks & TPACPI_FAN_NOACPI ) {
8883
+ /* E560, T495, T495s */
8884
+ pr_info ("Ignoring buggy ACPI fan access method\n" );
8885
+ fang_handle = NULL ;
8886
+ fanw_handle = NULL ;
8887
+ }
8888
+
8877
8889
if (gfan_handle ) {
8878
8890
/* 570, 600e/x, 770e, 770x */
8879
8891
fan_status_access_mode = TPACPI_FAN_RD_ACPI_GFAN ;
@@ -11820,10 +11832,10 @@ static void thinkpad_acpi_module_exit(void)
11820
11832
platform_device_unregister (tpacpi_sensors_pdev );
11821
11833
}
11822
11834
11823
- if (tpacpi_pdev ) {
11835
+ if (tp_features . platform_drv_registered )
11824
11836
platform_driver_unregister (& tpacpi_pdriver );
11837
+ if (tpacpi_pdev )
11825
11838
platform_device_unregister (tpacpi_pdev );
11826
- }
11827
11839
11828
11840
if (proc_dir )
11829
11841
remove_proc_entry (TPACPI_PROC_DIR , acpi_root_dir );
@@ -11893,9 +11905,8 @@ static int __init tpacpi_pdriver_probe(struct platform_device *pdev)
11893
11905
11894
11906
static int __init tpacpi_hwmon_pdriver_probe (struct platform_device * pdev )
11895
11907
{
11896
- tpacpi_hwmon = devm_hwmon_device_register_with_groups (
11897
- & tpacpi_sensors_pdev -> dev , TPACPI_NAME , NULL , tpacpi_hwmon_groups );
11898
-
11908
+ tpacpi_hwmon = devm_hwmon_device_register_with_groups (& pdev -> dev , TPACPI_NAME ,
11909
+ NULL , tpacpi_hwmon_groups );
11899
11910
if (IS_ERR (tpacpi_hwmon ))
11900
11911
pr_err ("unable to register hwmon device\n" );
11901
11912
@@ -11965,15 +11976,23 @@ static int __init thinkpad_acpi_module_init(void)
11965
11976
tp_features .quirks = dmi_id -> driver_data ;
11966
11977
11967
11978
/* Device initialization */
11968
- tpacpi_pdev = platform_create_bundle ( & tpacpi_pdriver , tpacpi_pdriver_probe ,
11969
- NULL , 0 , NULL , 0 );
11979
+ tpacpi_pdev = platform_device_register_simple ( TPACPI_DRVR_NAME , PLATFORM_DEVID_NONE ,
11980
+ NULL , 0 );
11970
11981
if (IS_ERR (tpacpi_pdev )) {
11971
11982
ret = PTR_ERR (tpacpi_pdev );
11972
11983
tpacpi_pdev = NULL ;
11973
- pr_err ("unable to register platform device/driver bundle\n" );
11984
+ pr_err ("unable to register platform device\n" );
11985
+ thinkpad_acpi_module_exit ();
11986
+ return ret ;
11987
+ }
11988
+
11989
+ ret = platform_driver_probe (& tpacpi_pdriver , tpacpi_pdriver_probe );
11990
+ if (ret ) {
11991
+ pr_err ("unable to register main platform driver\n" );
11974
11992
thinkpad_acpi_module_exit ();
11975
11993
return ret ;
11976
11994
}
11995
+ tp_features .platform_drv_registered = 1 ;
11977
11996
11978
11997
tpacpi_sensors_pdev = platform_create_bundle (& tpacpi_hwmon_pdriver ,
11979
11998
tpacpi_hwmon_pdriver_probe ,
0 commit comments