@@ -7885,6 +7885,7 @@ static struct ibm_struct volume_driver_data = {
78857885
78867886#define FAN_NS_CTRL_STATUS BIT(2) /* Bit which determines control is enabled or not */
78877887#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 */
78887889
78897890enum { /* Fan control constants */
78907891 fan_status_offset = 0x2f , /* EC register 0x2f */
@@ -7940,6 +7941,7 @@ static int fan_watchdog_maxinterval;
79407941
79417942static bool fan_with_ns_addr ;
79427943static bool ecfw_with_fan_dec_rpm ;
7944+ static bool fan_speed_in_tpr ;
79437945
79447946static struct mutex fan_mutex ;
79457947
@@ -8142,8 +8144,11 @@ static int fan_get_speed(unsigned int *speed)
81428144 !acpi_ec_read (fan_rpm_offset + 1 , & hi )))
81438145 return - EIO ;
81448146
8145- if (likely (speed ))
8147+ if (likely (speed )) {
81468148 * speed = (hi << 8 ) | lo ;
8149+ if (fan_speed_in_tpr && * speed != 0 )
8150+ * speed = FAN_CLOCK_TPM / * speed ;
8151+ }
81478152 break ;
81488153 case TPACPI_FAN_RD_TPEC_NS :
81498154 if (!acpi_ec_read (fan_rpm_status_ns , & lo ))
@@ -8176,8 +8181,11 @@ static int fan2_get_speed(unsigned int *speed)
81768181 if (rc )
81778182 return - EIO ;
81788183
8179- if (likely (speed ))
8184+ if (likely (speed )) {
81808185 * speed = (hi << 8 ) | lo ;
8186+ if (fan_speed_in_tpr && * speed != 0 )
8187+ * speed = FAN_CLOCK_TPM / * speed ;
8188+ }
81818189 break ;
81828190
81838191 case TPACPI_FAN_RD_TPEC_NS :
@@ -8788,6 +8796,7 @@ static const struct attribute_group fan_driver_attr_group = {
87888796#define TPACPI_FAN_NOFAN 0x0008 /* no fan available */
87898797#define TPACPI_FAN_NS 0x0010 /* For EC with non-Standard register addresses */
87908798#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 */
87918800
87928801static const struct tpacpi_quirk fan_quirk_table [] __initconst = {
87938802 TPACPI_QEC_IBM ('1' , 'Y' , TPACPI_FAN_Q1 ),
@@ -8817,6 +8826,7 @@ static const struct tpacpi_quirk fan_quirk_table[] __initconst = {
88178826 TPACPI_Q_LNV3 ('R' , '0' , 'V' , TPACPI_FAN_NS ), /* 11e Gen5 KL-Y */
88188827 TPACPI_Q_LNV3 ('N' , '1' , 'O' , TPACPI_FAN_NOFAN ), /* X1 Tablet (2nd gen) */
88198828 TPACPI_Q_LNV3 ('R' , '0' , 'Q' , TPACPI_FAN_DECRPM ),/* L480 */
8829+ TPACPI_Q_LNV ('8' , 'F' , TPACPI_FAN_TPR ), /* ThinkPad x120e */
88208830};
88218831
88228832static int __init fan_init (struct ibm_init_struct * iibm )
@@ -8887,6 +8897,8 @@ static int __init fan_init(struct ibm_init_struct *iibm)
88878897
88888898 if (quirks & TPACPI_FAN_Q1 )
88898899 fan_quirk1_setup ();
8900+ if (quirks & TPACPI_FAN_TPR )
8901+ fan_speed_in_tpr = true;
88908902 /* Try and probe the 2nd fan */
88918903 tp_features .second_fan = 1 ; /* needed for get_speed to work */
88928904 res = fan2_get_speed (& speed );
0 commit comments