@@ -7885,6 +7885,7 @@ static struct ibm_struct volume_driver_data = {
7885
7885
7886
7886
#define FAN_NS_CTRL_STATUS BIT(2) /* Bit which determines control is enabled or not */
7887
7887
#define FAN_NS_CTRL BIT(4) /* Bit which determines control is by host or EC */
7888
+ #define FAN_CLOCK_TPM (22500*60) /* Ticks per minute for a 22.5 kHz clock */
7888
7889
7889
7890
enum { /* Fan control constants */
7890
7891
fan_status_offset = 0x2f , /* EC register 0x2f */
@@ -7940,6 +7941,7 @@ static int fan_watchdog_maxinterval;
7940
7941
7941
7942
static bool fan_with_ns_addr ;
7942
7943
static bool ecfw_with_fan_dec_rpm ;
7944
+ static bool fan_speed_in_tpr ;
7943
7945
7944
7946
static struct mutex fan_mutex ;
7945
7947
@@ -8142,8 +8144,11 @@ static int fan_get_speed(unsigned int *speed)
8142
8144
!acpi_ec_read (fan_rpm_offset + 1 , & hi )))
8143
8145
return - EIO ;
8144
8146
8145
- if (likely (speed ))
8147
+ if (likely (speed )) {
8146
8148
* speed = (hi << 8 ) | lo ;
8149
+ if (fan_speed_in_tpr && * speed != 0 )
8150
+ * speed = FAN_CLOCK_TPM / * speed ;
8151
+ }
8147
8152
break ;
8148
8153
case TPACPI_FAN_RD_TPEC_NS :
8149
8154
if (!acpi_ec_read (fan_rpm_status_ns , & lo ))
@@ -8176,8 +8181,11 @@ static int fan2_get_speed(unsigned int *speed)
8176
8181
if (rc )
8177
8182
return - EIO ;
8178
8183
8179
- if (likely (speed ))
8184
+ if (likely (speed )) {
8180
8185
* speed = (hi << 8 ) | lo ;
8186
+ if (fan_speed_in_tpr && * speed != 0 )
8187
+ * speed = FAN_CLOCK_TPM / * speed ;
8188
+ }
8181
8189
break ;
8182
8190
8183
8191
case TPACPI_FAN_RD_TPEC_NS :
@@ -8788,6 +8796,7 @@ static const struct attribute_group fan_driver_attr_group = {
8788
8796
#define TPACPI_FAN_NOFAN 0x0008 /* no fan available */
8789
8797
#define TPACPI_FAN_NS 0x0010 /* For EC with non-Standard register addresses */
8790
8798
#define TPACPI_FAN_DECRPM 0x0020 /* For ECFW's with RPM in register as decimal */
8799
+ #define TPACPI_FAN_TPR 0x0040 /* Fan speed is in Ticks Per Revolution */
8791
8800
8792
8801
static const struct tpacpi_quirk fan_quirk_table [] __initconst = {
8793
8802
TPACPI_QEC_IBM ('1' , 'Y' , TPACPI_FAN_Q1 ),
@@ -8817,6 +8826,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
8817
8826
TPACPI_Q_LNV3 ('R' , '0' , 'V' , TPACPI_FAN_NS ), /* 11e Gen5 KL-Y */
8818
8827
TPACPI_Q_LNV3 ('N' , '1' , 'O' , TPACPI_FAN_NOFAN ), /* X1 Tablet (2nd gen) */
8819
8828
TPACPI_Q_LNV3 ('R' , '0' , 'Q' , TPACPI_FAN_DECRPM ),/* L480 */
8829
+ TPACPI_Q_LNV ('8' , 'F' , TPACPI_FAN_TPR ), /* ThinkPad x120e */
8820
8830
};
8821
8831
8822
8832
static int __init fan_init (struct ibm_init_struct * iibm )
@@ -8887,6 +8897,8 @@ static int __init fan_init(struct ibm_init_struct *iibm)
8887
8897
8888
8898
if (quirks & TPACPI_FAN_Q1 )
8889
8899
fan_quirk1_setup ();
8900
+ if (quirks & TPACPI_FAN_TPR )
8901
+ fan_speed_in_tpr = true;
8890
8902
/* Try and probe the 2nd fan */
8891
8903
tp_features .second_fan = 1 ; /* needed for get_speed to work */
8892
8904
res = fan2_get_speed (& speed );
0 commit comments