Skip to contentSkip to conversation

acerhdf/thermal: adding new models and appropriate governor

PATCH Superseded Peter Feuerer 9 participants 97 messages Apr 27, 2014 – Dec 11, 2014

Subsystems (3)
lore
Share & tools
lore

Peter Feuerer

author maintainer
#0 lore raw

cover acerhdf/thermal: adding new models and appropriate governor

Hi,

finally I found time, to do some work on acerhdf.

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models. Unfortunately this extends lines defining the bios table over 80 characters, but all other methods make the code really ugly and hard to read. So I hope for the reason of readability it is ok to break this rule.

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

Please test/review the patches and send me your comments.

Thanks and kind regards,
peter

Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Zhang Rui <[email protected]>

Peter Feuerer (4):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
thermal: Added Bang-bang thermal governor
acerhdf: Use bang-bang thermal governor

 drivers/platform/x86/Kconfig    |   2 +-
 drivers/platform/x86/acerhdf.c  | 246 +++++++++++++++++++++++++---------------
 drivers/thermal/Kconfig         |  10 ++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 124 ++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 +
 drivers/thermal/thermal_core.h  |   8 ++
 7 files changed, 304 insertions(+), 92 deletions(-)
 create mode 100644 drivers/thermal/gov_bang_bang.c
Signature · 1 line
1.9.2
author maintainer
#1 lore raw

PATCH 1/4 acerhdf: Adding support for "manual mode"

From: Peter Feuerer <[email protected]>

Some Acer models require an additional command to turn off the fan after bios mode has been enabled. Adding new section in bios table to allow support for those models, by writing an extra "manual mode" register.

Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 181 ++++++++++++++++++++++-------------------
 1 file changed, 97 insertions(+), 84 deletions(-)
drivers/platform/x86/acerhdf.c +97 -84
index f94467c..eb9c94f 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.26"
+#define DRV_VER "0.5.29"
 
 /*
  * According to the Atom N270 datasheet,
@@ -119,6 +119,12 @@ struct fancmd {
 	u8 cmd_auto;
 };
 
+struct manualcmd {
+	int enable;
+	u8 mreg;
+	u8 moff;
+};
+
 /* BIOS settings */
 struct bios_settings_t {
 	const char *vendor;
@@ -127,105 +133,106 @@ struct bios_settings_t {
 	unsigned char fanreg;
 	unsigned char tempreg;
 	struct fancmd cmd;
+	struct manualcmd mcmd;
 };
 
 /* Register addresses and values for different BIOS versions */
 static const struct bios_settings_t bios_tbl[] = {
 	/* AOA110 */
-	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
 	/* AOA150 */
-	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
 	/* LT1005u */
-	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
 	/* Acer 1410 */
-	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
 	/* Acer 1810xx */
-	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
 	/* Acer 531 */
-	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
 	/* Acer 751 */
-	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
 	/* Acer 1825 */
-	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
 	/* Acer TravelMate 7730 */
-	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} },
+	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, {0, 0, 0} },
 	/* Gateway */
-	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00} },
-	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00} },
-	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
+	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
+	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
 	/* Packard Bell */
-	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00} },
+	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
 	/* pewpew-terminator */
-	{"", "", "", 0, 0, {0, 0} }
+	{"", "", "", 0, 0, {0, 0}, {0, 0, 0} }
 };
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
@@ -275,6 +282,12 @@ static void acerhdf_change_fanstate(int state)
 	fanstate = state;
 
 	ec_write(bios_cfg->fanreg, cmd);
+
+	if (bios_cfg->mcmd.enable && state == ACERHDF_FAN_OFF) {
+		if (verbose)
+			pr_notice("turning off fan manually\n");
+		ec_write(bios_cfg->mcmd.mreg, bios_cfg->mcmd.moff);
+	}
 }
 
 static void acerhdf_check_param(struct thermal_zone_device *thermal)
Signature · 1 line
1.9.2
#2 lore raw

Re: [PATCH 1/4] acerhdf: Adding support for "manual mode"

Quoted 5 lines · Peter Feuerer

From: Peter Feuerer <[email protected]>

Some Acer models require an additional command to turn off the fan after bios mode has been enabled. Adding new section in bios table to allow support for those models, by writing an extra "manual mode" register.

Why?

That command is always the same AFAICT. So why not add a single flag to bios_settings_t called "needs_manual" or such and then do the required dance in acerhdf_change_fanstate() if it is set?

Btw, this "struct bios_settings_t" could lose that "_t" at the end as it is not a typedef. We don't like typedefs anyway. :-)

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#3 lore raw

Re: [PATCH 1/4] acerhdf: Adding support for "manual mode"

Quoted 7 lines · Borislav Petkov
Quoted 5 lines · Peter Feuerer

From: Peter Feuerer <[email protected]>

Some Acer models require an additional command to turn off the fan after bios mode has been enabled. Adding new section in bios table to allow support for those models, by writing an extra "manual mode" register.

Quoted 5 lines

Why?

That command is always the same AFAICT. So why not add a single flag to bios_settings_t called "needs_manual" or such and then do the required dance in acerhdf_change_fanstate() if it is set?

I wanted to be prepared for possible upcoming models with changed registers / values. But I guess it would make sense to go for your proposal for now and then afterwards we should discuss about implementing the idea of Andreas and split the bios_tbl.

Quoted 2 lines

Btw, this "struct bios_settings_t" could lose that "_t" at the end as it is not a typedef. We don't like typedefs anyway. :-)

True, will put this on my todo list :)

Signature · 1 line
--peter;
author maintainer
#4 lore raw

PATCH 2/4 acerhdf: Adding support for new models

In reply to Peter Feuerer

From: Peter Feuerer <[email protected]>

added following new models:
* Aspire 5755G
* AO521
* AO751h
* Aspire One 753
* Extensa 5420
* Aspire 5315
* Aspire 5739G
* TravelMate TM8573T

Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +23 -1
index eb9c94f..8b6466b 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.29"
+#define DRV_VER "0.5.30"
 
 /*
  * According to the Atom N270 datasheet,
@@ -194,17 +194,33 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
 	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
 	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	/* Acer 5755G */
+	{"Acer", "Aspire 5755G",  "V1.20",   0xab, 0xb4, {0x00, 0x08}, {0, 0, 0} },
+	{"Acer", "Aspire 5755G",  "V1.21",   0xab, 0xb3, {0x00, 0x08}, {0, 0, 0} },
+	/* Acer 521 */
+	{"Acer", "AO521", "V1.11", 0x55, 0x58, {0x1f, 0x00}, {0, 0, 0} },
 	/* Acer 531 */
 	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
 	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
 	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
 	/* Acer 751 */
+	{"Acer", "AO751h", "V0.3206", 0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
 	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
+	/* Acer 753 */
+	{"Acer", "Aspire One 753", "V1.24", 0x93, 0xac, {0x14, 0x04}, {1, 0x94, 0xff} },
 	/* Acer 1825 */
 	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
 	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, {0, 0, 0} },
+	/* Acer Extensa 5420 */
+	{"Acer", "Extensa 5420", "V1.17", 0x93, 0xac, {0x14, 0x04}, {1, 0x94, 0xff} },
+	/* Acer Aspire 5315 */
+	{"Acer", "Aspire 5315", "V1.19", 0x93, 0xac, {0x14, 0x04}, {1, 0x94, 0xff} },
+	/* Acer Aspire 5739 */
+	{"Acer", "Aspire 5739G", "V1.3311", 0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
 	/* Acer TravelMate 7730 */
 	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, {0, 0, 0} },
+	/* Acer TravelMate TM8573T */
+	{"Acer", "TM8573T", "V1.13", 0x93, 0xa8, {0x14, 0x04}, {1, 0x94, 0xff} },
 	/* Gateway */
 	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, {0, 0, 0} },
 	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, {0, 0, 0} },
@@ -736,9 +752,14 @@ MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5755G:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAO521*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5739G:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5315:");
 MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:");
+MODULE_ALIAS("dmi:*:*Acer*:TM8573T:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:");
@@ -747,6 +768,7 @@ MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnExtensa 5420*:");
 
 module_init(acerhdf_init);
 module_exit(acerhdf_exit);
Signature · 1 line
1.9.2
author maintainer
#5 lore raw

PATCH 3/4 thermal: Added Bang-bang thermal governor

In reply to Peter Feuerer

From: Peter Feuerer <[email protected]>

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/thermal/Kconfig         |  10 ++++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 124 ++++++++++++++++++++++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 ++
 drivers/thermal/thermal_core.h  |   8 +++
 5 files changed, 148 insertions(+)
 create mode 100644 drivers/thermal/gov_bang_bang.c
drivers/thermal/Kconfig +10 -0
index 2d51912..2ede94f 100644
@@ -84,6 +84,16 @@ config THERMAL_GOV_STEP_WISE
 	  Enable this to manage platform thermals using a simple linear
 	  governor.
 
+config THERMAL_GOV_BANG_BANG
+	bool "Bang Bang thermal governor"
+	default y
+	help
+	  Enable this to manage platform thermals using bang bang governor.
+
+	  Say 'Y' here if you want to use two point temperature regulation
+	  used for fans without throttling.  Some fan drivers depend on this
+	  governor to be enabled (e.g. acerhdf).
+
 config THERMAL_GOV_USER_SPACE
 	bool "User_space thermal governor"
 	help
drivers/thermal/Makefile +1 -0
index 54e4ec9..1c32a5d 100644
@@ -11,6 +11,7 @@ thermal_sys-$(CONFIG_THERMAL_OF)		+= of-thermal.o
 
 # governors
 thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE)	+= fair_share.o
+thermal_sys-$(CONFIG_THERMAL_GOV_BANG_BANG)	+= gov_bang_bang.o
 thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE)	+= step_wise.o
 thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE)	+= user_space.o
 
drivers/thermal/gov_bang_bang.c new file +124 -0

124 lines not on this page · raw message

drivers/thermal/thermal_core.c +5 -0
index 71b0ec0..4c2726b 100644
@@ -1790,6 +1790,10 @@ static int __init thermal_register_governors(void)
 	if (result)
 		return result;
 
+	result = thermal_gov_bang_bang_register();
+	if (result)
+		return result;
+
 	return thermal_gov_user_space_register();
 }
 
@@ -1797,6 +1801,7 @@ static void thermal_unregister_governors(void)
 {
 	thermal_gov_step_wise_unregister();
 	thermal_gov_fair_share_unregister();
+	thermal_gov_bang_bang_unregister();
 	thermal_gov_user_space_unregister();
 }
 
drivers/thermal/thermal_core.h +8 -0
index 3db339f..d15d243 100644
@@ -69,6 +69,14 @@ static inline int thermal_gov_fair_share_register(void) { return 0; }
 static inline void thermal_gov_fair_share_unregister(void) {}
 #endif /* CONFIG_THERMAL_GOV_FAIR_SHARE */
 
+#ifdef CONFIG_THERMAL_GOV_BANG_BANG
+int thermal_gov_bang_bang_register(void);
+void thermal_gov_bang_bang_unregister(void);
+#else
+static inline int thermal_gov_bang_bang_register(void) { return 0; }
+static inline void thermal_gov_bang_bang_unregister(void) {}
+#endif /* CONFIG_THERMAL_GOV_BANG_BANG */
+
 #ifdef CONFIG_THERMAL_GOV_USER_SPACE
 int thermal_gov_user_space_register(void);
 void thermal_gov_user_space_unregister(void);
Signature · 1 line
1.9.2
author maintainer
#6 lore raw

PATCH 4/4 acerhdf: Use bang-bang thermal governor

In reply to Peter Feuerer

From: Peter Feuerer <[email protected]>

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 45 ++++++++++++++++++++++++++++++++++--------
 2 files changed, 38 insertions(+), 9 deletions(-)
drivers/platform/x86/Kconfig +1 -1
index 27df2c5..bbc5dd2 100644
@@ -38,7 +38,7 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	depends on THERMAL && ACPI && THERMAL_GOV_BANG_BANG
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +37 -8

99 lines not on this page · raw message

Signature · 1 line
1.9.2
#7 lore raw
In reply to Peter Feuerer

Hi,

Quoted 3 lines · Peter Feuerer

Hi,

finally I found time, to do some work on acerhdf.

Heh, yeah. I'm starting to come to the realization that once having entered an "extended" state of life it might be better to "take" the time rather than "have" it ;-P

Quoted 7 lines

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models. Unfortunately this extends lines defining the bios table over 80 characters, but all other methods make the code really ugly and hard to read. So I hope for the reason of readability it is ok to break this rule.

Hmm... got an idea there. Possibly it's time to do away with direct "device name" <-> open-coded config data mappings.
After all a specific device name is not really all too meaningful, can (and will) be invented out of thin air, with its reg config being identical to (read: painfully duplicated)
several other names/BIOS versions in the series.
So perhaps one should have a helper struct defined,
with instances then named as particular base samples of a model series (ideally named after the precise internal development code name of the series), to then be referenced by all model/BIOS names which match.

struct {
struct reg_feat_1;
struct reg_feat_2;
} aao_reg_map;

static const aao_reg_map aao_reg_map_AOAxxx_Acer_orig_version;

{ "Acer", "AOA1....", &aao_reg_map_AOAxxx_Acer_orig_version },

Of course you then have the indirection of device name <-> specific register values (quote: "really ugly and hard to read"?), but IMHO that's ok since normally you wouldn't be too focused on looking up register values (...right!?).

And if the next interface-breaking config change came along, you'd otherwise have to add yet another register index pair... (at which point some 100+ char line monsters
would be breathing down our neck...)

Model additions:
Ain't there one MODULE_ALIAS missing?? (7 new models <-> 6 entries!?!?)
"Aspire One 753"? But perhaps that's already implicitly covered by
another existing entry? [if so, the commit log did not mention it ;)]

Quoted 5 lines

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

I'm afraid I don't have the full picture,
but so far it seems that this factoring out of common handling is a very good idea.

- depends on THERMAL && ACPI
+ depends on THERMAL && ACPI && THERMAL_GOV_BANG_BANG
Do we actively depend on THERMAL (code-wise, I mean?) Or is it now an implicit dependency given that we request THERMAL_GOV_BANG_BANG? If implicit, then THERMAL probably ought to be removed. But if we use generic thermal APIs (which we probably do), then of course we do have that dependency....

"bang_bang_throttle - throttles devices asscciated with the given zone"

Typo ;)

"used to force thermal" --> misleading ("we used to do this, but it's bad so we better do that").

"intended to"? "established to"? "added to"? or some simpler wording?

pr_err("Thermal governor %s is not compiled into thermal subsystem\n"
--> you are lying here... (the only thing we can reliably indicate
is that we did not get the expected name -
so we should perhaps indicate something like we "didn't get bang-bang, since perhaps not compiled into thermal subsystem").

Quoted 1 line

Please test/review the patches and send me your comments.

-ENODATA (my crappy JMicron JMF601 SSD had managed to break again,
this time with fatal firmware corruption, so I had to reflash firmware to resurrect it, but I haven't restored my environment yet, but I'll obviously report back immediately if something comes up)

Quoted 1 line

Thanks and kind regards,

Thanks definitely ought to go to the active party instead! :)

Andreas Mohr

author maintainer
#8 lore raw

Hi,

Quoted 37 lines · Andreas Mohr
Quoted 7 lines · Peter Feuerer

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models. Unfortunately this extends lines defining the bios table over 80 characters, but all other methods make the code really ugly and hard to read. So I hope for the reason of readability it is ok to break this rule.

Hmm... got an idea there. Possibly it's time to do away with direct "device name" <-> open-coded config data mappings.
After all a specific device name is not really all too meaningful, can (and will) be invented out of thin air, with its reg config being identical to (read: painfully duplicated)
several other names/BIOS versions in the series.
So perhaps one should have a helper struct defined,
with instances then named as particular base samples of a model series (ideally named after the precise internal development code name of the series), to then be referenced by all model/BIOS names which match.

struct {
struct reg_feat_1;
struct reg_feat_2;
} aao_reg_map;

static const aao_reg_map aao_reg_map_AOAxxx_Acer_orig_version;

{ "Acer", "AOA1....", &aao_reg_map_AOAxxx_Acer_orig_version },

Of course you then have the indirection of device name <-> specific register values (quote: "really ugly and hard to read"?), but IMHO that's ok since normally you wouldn't be too focused on looking up register values (...right!?).

Quoted 4 lines

And if the next interface-breaking config change came along, you'd otherwise have to add yet another register index pair... (at which point some 100+ char line monsters
would be breathing down our neck...)

I think we have been discussing this solution a year ago or something and seems like it is really time to implement it. As I wrote in the other mail to Boris, I'd like to just do a minor modification for now and then when those 4 patches have been applied concentrate on implementing the splitted structs.

Quoted 4 lines

Model additions:
Ain't there one MODULE_ALIAS missing?? (7 new models <-> 6 entries!?!?)
"Aspire One 753"? But perhaps that's already implicitly covered by
another existing entry? [if so, the commit log did not mention it ;)]

You are right, alias for 753 is missing, will add it for the next patch set.

Quoted 9 lines
Quoted 5 lines

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

I'm afraid I don't have the full picture,
but so far it seems that this factoring out of common handling is a very good idea.

ok.

Quoted 7 lines
(quoted diff) +1 -1
-       depends on THERMAL && ACPI
+       depends on THERMAL && ACPI && THERMAL_GOV_BANG_BANG

Do we actively depend on THERMAL (code-wise, I mean?) Or is it now an implicit dependency given that we request THERMAL_GOV_BANG_BANG? If implicit, then THERMAL probably ought to be removed. But if we use generic thermal APIs (which we probably do), then of course we do have that dependency....

There's an implicit dependency due to the request of THERMAL_GOV_BANG_BANG, so yes, we could remove THERMAL here.

Quoted 3 lines

"bang_bang_throttle - throttles devices asscciated with the given zone"

Typo ;)

c != o, got it.

Quoted 4 lines

"used to force thermal" --> misleading ("we used to do this, but it's bad so we better do that").

"intended to"? "established to"? "added to"? or some simpler wording?

What do you think about this wording:
/*
* this struct is used to instruct thermal layer to use bang_bang instead of
* default governor for acerhdf
*/

Quoted 5 lines

pr_err("Thermal governor %s is not compiled into thermal subsystem\n"
--> you are lying here... (the only thing we can reliably indicate
is that we did not get the expected name -
so we should perhaps indicate something like we "didn't get bang-bang, since perhaps not compiled into thermal subsystem").

Fixed in next submit.

Quoted 6 lines
Quoted 1 line

Please test/review the patches and send me your comments.

-ENODATA (my crappy JMicron JMF601 SSD had managed to break again,
this time with fatal firmware corruption, so I had to reflash firmware to resurrect it, but I haven't restored my environment yet, but I'll obviously report back immediately if something comes up)

Ok, good luck with this.

Thanks for all the good input.

Signature · 2 lines
kind regards,
--peter;
#9 lore raw

Hi,

Quoted 16 lines · Peter Feuerer

Hi,

Quoted 11 lines · Andreas Mohr

{ "Acer", "AOA1....", &aao_reg_map_AOAxxx_Acer_orig_version },

Of course you then have the indirection of device name <-> specific register values (quote: "really ugly and hard to read"?), but IMHO that's ok since normally you wouldn't be too focused on looking up register values (...right!?).

And if the next interface-breaking config change came along, you'd otherwise have to add yet another register index pair... (at which point some 100+ char line monsters
would be breathing down our neck...)

Quoted 5 lines

I think we have been discussing this solution a year ago or something and seems like it is really time to implement it. As I wrote in the other mail to Boris, I'd like to just do a minor modification for now and then when those 4 patches have been applied concentrate on implementing the splitted structs.

Yup, to get things out of the way now :)

[[BTW your mail environment seems configured to have trailing blanks - might want to "optimize" that away...]]

Quoted 10 lines
Quoted 7 lines
(quoted diff) +1 -1
-       depends on THERMAL && ACPI
+       depends on THERMAL && ACPI && THERMAL_GOV_BANG_BANG

Do we actively depend on THERMAL (code-wise, I mean?) Or is it now an implicit dependency given that we request THERMAL_GOV_BANG_BANG? If implicit, then THERMAL probably ought to be removed. But if we use generic thermal APIs (which we probably do), then of course we do have that dependency....

There's an implicit dependency due to the request of THERMAL_GOV_BANG_BANG, so yes, we could remove THERMAL here.

ok. Does not seem too risky, and reduces the need for future updates.

Quoted 10 lines
Quoted 4 lines

"used to force thermal" --> misleading ("we used to do this, but it's bad so we better do that").

"intended to"? "established to"? "added to"? or some simpler wording?

What do you think about this wording:
/*
* this struct is used to instruct thermal layer to use bang_bang instead of
* default governor for acerhdf
*/

Nicely detailed.

About the _t typedef: it's said that use of "_t" is undesirable anyway due to being reserved for POSIX.
https://en.wikipedia.org/wiki/Typedef
http://stackoverflow.com/questions/1186072/naming-scheme-for-typedefs
As an alternative using a full "_type" is ok right?
(that's what I've been doing...)

Andreas

author maintainer
#10 lore raw

v2 cover acerhdf/thermal: adding new models and appropriate governor

In reply to Peter Feuerer

Hi,

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

Please test/review the patches and send me your comments.

Thanks and kind regards,
peter

Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Zhang Rui <[email protected]>

Peter Feuerer (4):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
thermal: Added Bang-bang thermal governor
acerhdf: Use bang-bang thermal governor

 drivers/platform/x86/Kconfig    |   2 +-
 drivers/platform/x86/acerhdf.c  | 256 ++++++++++++++++++++++++++--------------
 drivers/thermal/Kconfig         |  10 ++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 124 +++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 +
 drivers/thermal/thermal_core.h  |   8 ++
 7 files changed, 314 insertions(+), 92 deletions(-)
 create mode 100644 drivers/thermal/gov_bang_bang.c
Signature · 1 line
1.9.2
author maintainer
#11 lore raw

PATCH v2 1/4 acerhdf: Adding support for "manual mode"

Some Acer models require an additional command to turn off the fan after bios mode has been enabled. Adding new section in bios table to allow support for those models, by writing an extra "manual mode" register.

Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 187 +++++++++++++++++++++++------------------
 1 file changed, 103 insertions(+), 84 deletions(-)
drivers/platform/x86/acerhdf.c +103 -84
index f94467c..dd63e93 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.26"
+#define DRV_VER "0.5.29"
 
 /*
  * According to the Atom N270 datasheet,
@@ -119,6 +119,17 @@ struct fancmd {
 	u8 cmd_auto;
 };
 
+struct manualcmd {
+	u8 mreg;
+	u8 moff;
+};
+
+/* default register and command to disable fan in manual mode */
+static const struct manualcmd mcmd = {
+	.mreg = 0x94,
+	.moff = 0xff,
+};
+
 /* BIOS settings */
 struct bios_settings_t {
 	const char *vendor;
@@ -127,105 +138,107 @@ struct bios_settings_t {
 	unsigned char fanreg;
 	unsigned char tempreg;
 	struct fancmd cmd;
+	int mcmd_enable;
 };
 
+
 /* Register addresses and values for different BIOS versions */
 static const struct bios_settings_t bios_tbl[] = {
 	/* AOA110 */
-	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* AOA150 */
-	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* LT1005u */
-	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 1410 */
-	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 1810xx */
-	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 531 */
-	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
-	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* Acer 1825 */
-	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer TravelMate 7730 */
-	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} },
+	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
 	/* Gateway */
-	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00} },
-	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00} },
-	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
+	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Packard Bell */
-	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00} },
+	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00}, 0},
 	/* pewpew-terminator */
-	{"", "", "", 0, 0, {0, 0} }
+	{"", "", "", 0, 0, {0, 0}, 0}
 };
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
@@ -275,6 +288,12 @@ static void acerhdf_change_fanstate(int state)
 	fanstate = state;
 
 	ec_write(bios_cfg->fanreg, cmd);
+
+	if (bios_cfg->mcmd_enable && state == ACERHDF_FAN_OFF) {
+		if (verbose)
+			pr_notice("turning off fan manually\n");
+		ec_write(mcmd.mreg, mcmd.moff);
+	}
 }
 
 static void acerhdf_check_param(struct thermal_zone_device *thermal)
Signature · 1 line
1.9.2
author maintainer
#12 lore raw

PATCH v2 2/4 acerhdf: Adding support for new models

In reply to Peter Feuerer

added following new models:
* Aspire 5755G
* AO521
* AO751h
* Aspire One 753
* Extensa 5420
* Aspire 5315
* Aspire 5739G
* TravelMate TM8573T

Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +24 -1
index dd63e93..176edbd 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.29"
+#define DRV_VER "0.5.30"
 
 /*
  * According to the Atom N270 datasheet,
@@ -200,17 +200,33 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer 5755G */
+	{"Acer", "Aspire 5755G",  "V1.20",   0xab, 0xb4, {0x00, 0x08}, 0},
+	{"Acer", "Aspire 5755G",  "V1.21",   0xab, 0xb3, {0x00, 0x08}, 0},
+	/* Acer 521 */
+	{"Acer", "AO521", "V1.11", 0x55, 0x58, {0x1f, 0x00}, 0},
 	/* Acer 531 */
 	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
+	{"Acer", "AO751h", "V0.3206", 0x55, 0x58, {0x21, 0x00}, 0},
 	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
+	/* Acer 753 */
+	{"Acer", "Aspire One 753", "V1.24", 0x93, 0xac, {0x14, 0x04}, 1},
 	/* Acer 1825 */
 	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer Extensa 5420 */
+	{"Acer", "Extensa 5420", "V1.17", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5315 */
+	{"Acer", "Aspire 5315", "V1.19", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5739 */
+	{"Acer", "Aspire 5739G", "V1.3311", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer TravelMate 7730 */
 	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
+	/* Acer TravelMate TM8573T */
+	{"Acer", "TM8573T", "V1.13", 0x93, 0xa8, {0x14, 0x04}, 1},
 	/* Gateway */
 	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
 	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
@@ -742,9 +758,15 @@ MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5755G:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAO521*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5739G:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*One*753:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5315:");
 MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:");
+MODULE_ALIAS("dmi:*:*Acer*:TM8573T:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:");
@@ -753,6 +775,7 @@ MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnExtensa 5420*:");
 
 module_init(acerhdf_init);
 module_exit(acerhdf_exit);
Signature · 1 line
1.9.2
author maintainer
#13 lore raw

PATCH v2 3/4 thermal: Added Bang-bang thermal governor

In reply to Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/thermal/Kconfig         |  10 ++++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 124 ++++++++++++++++++++++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 ++
 drivers/thermal/thermal_core.h  |   8 +++
 5 files changed, 148 insertions(+)
 create mode 100644 drivers/thermal/gov_bang_bang.c
drivers/thermal/Kconfig +10 -0
index 2d51912..2ede94f 100644
@@ -84,6 +84,16 @@ config THERMAL_GOV_STEP_WISE
 	  Enable this to manage platform thermals using a simple linear
 	  governor.
 
+config THERMAL_GOV_BANG_BANG
+	bool "Bang Bang thermal governor"
+	default y
+	help
+	  Enable this to manage platform thermals using bang bang governor.
+
+	  Say 'Y' here if you want to use two point temperature regulation
+	  used for fans without throttling.  Some fan drivers depend on this
+	  governor to be enabled (e.g. acerhdf).
+
 config THERMAL_GOV_USER_SPACE
 	bool "User_space thermal governor"
 	help
drivers/thermal/Makefile +1 -0
index 54e4ec9..1c32a5d 100644
@@ -11,6 +11,7 @@ thermal_sys-$(CONFIG_THERMAL_OF)		+= of-thermal.o
 
 # governors
 thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE)	+= fair_share.o
+thermal_sys-$(CONFIG_THERMAL_GOV_BANG_BANG)	+= gov_bang_bang.o
 thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE)	+= step_wise.o
 thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE)	+= user_space.o
 
drivers/thermal/gov_bang_bang.c new file +124 -0

124 lines not on this page · raw message

drivers/thermal/thermal_core.c +5 -0
index 71b0ec0..4c2726b 100644
@@ -1790,6 +1790,10 @@ static int __init thermal_register_governors(void)
 	if (result)
 		return result;
 
+	result = thermal_gov_bang_bang_register();
+	if (result)
+		return result;
+
 	return thermal_gov_user_space_register();
 }
 
@@ -1797,6 +1801,7 @@ static void thermal_unregister_governors(void)
 {
 	thermal_gov_step_wise_unregister();
 	thermal_gov_fair_share_unregister();
+	thermal_gov_bang_bang_unregister();
 	thermal_gov_user_space_unregister();
 }
 
drivers/thermal/thermal_core.h +8 -0
index 3db339f..d15d243 100644
@@ -69,6 +69,14 @@ static inline int thermal_gov_fair_share_register(void) { return 0; }
 static inline void thermal_gov_fair_share_unregister(void) {}
 #endif /* CONFIG_THERMAL_GOV_FAIR_SHARE */
 
+#ifdef CONFIG_THERMAL_GOV_BANG_BANG
+int thermal_gov_bang_bang_register(void);
+void thermal_gov_bang_bang_unregister(void);
+#else
+static inline int thermal_gov_bang_bang_register(void) { return 0; }
+static inline void thermal_gov_bang_bang_unregister(void) {}
+#endif /* CONFIG_THERMAL_GOV_BANG_BANG */
+
 #ifdef CONFIG_THERMAL_GOV_USER_SPACE
 int thermal_gov_user_space_register(void);
 void thermal_gov_user_space_unregister(void);
Signature · 1 line
1.9.2
#14 lore raw

Re: [PATCH v2 3/4] thermal: Added Bang-bang thermal governor

Quoted 6 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

I don't really understand why step-wise doesn't work for you (AIUI, this governor should be a subset of it. I'll let others comment on that, just a minor comment below.

[...]

Quoted 43 lines
drivers/thermal/gov_bang_bang.c new file +37 -0
new file mode 100644
index 0000000..328dde0
@@ -0,0 +1,124 @@
+/*
+ *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
+ *
+ *  Copyright (C) 2014 Peter Feuerer <[email protected]>
+ *
+ *  Based on step_wise.c with following Copyrights:
+ *  Copyright (C) 2012 Intel Corp
+ *  Copyright (C) 2012 Durgadoss R <[email protected]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ */
+
+#include <linux/thermal.h>
+
+#include "thermal_core.h"
+
+static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
+{
+	long trip_temp;
+	unsigned long trip_hyst;
+	struct thermal_instance *instance;
+
+	tz->ops->get_trip_temp(tz, trip, &trip_temp);
+	tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
+
+	dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n",
+				trip, trip_temp, tz->temperature,
+				trip_hyst);

drivers/thermal/gov_bang_bang.c line 47

Quoted 10 lines
drivers/thermal/gov_bang_bang.c new file +10 -0
+
+	mutex_lock(&tz->lock);
+
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
+		if (instance->trip != trip)
+			continue;
+
+		/* in case fan is neither on nor off set the fan to active */
+		if (instance->target != 0 && instance->target != 1)
+			instance->target = 1;

I think you should add a pr_warn() here to warn the user that the governor is being used with a cooling device that seems to support more than one cooling state.

Cheers,
Javi

author maintainer
#15 lore raw

Re: [PATCH v2 3/4] thermal: Added Bang-bang thermal governor

Quoted 11 lines · Javi Merino
Quoted 6 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

I don't really understand why step-wise doesn't work for you (AIUI, this governor should be a subset of it. I'll let others comment on that, just a minor comment below.

That's what we thought in the first place too and we've been doing a lot of fiddling in the past to somehow fit acerhdf into stepwise. But it never really fitted and it broke all the time. Furthermore stepwise has a lot of features like trend analysis, which is just overkill for the two step regulation of acerhdf.

If I recall correctly, even Rui claimed in some email, that inventing a separate governor would be a good long term solution.

Quoted 50 lines

[...]

Quoted 49 lines
drivers/thermal/gov_bang_bang.c new file +43 -0
new file mode 100644
index 0000000..328dde0
@@ -0,0 +1,124 @@
+/*
+ *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
+ *
+ *  Copyright (C) 2014 Peter Feuerer <[email protected]>
+ *
+ *  Based on step_wise.c with following Copyrights:
+ *  Copyright (C) 2012 Intel Corp
+ *  Copyright (C) 2012 Durgadoss R <[email protected]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ */
+
+#include <linux/thermal.h>
+
+#include "thermal_core.h"
+
+static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
+{
+	long trip_temp;
+	unsigned long trip_hyst;
+	struct thermal_instance *instance;
+
+	tz->ops->get_trip_temp(tz, trip, &trip_temp);
+	tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
+
+	dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n",
+				trip, trip_temp, tz->temperature,
+				trip_hyst);
+
+	mutex_lock(&tz->lock);
+
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
+		if (instance->trip != trip)
+			continue;
Quoted 8 lines

drivers/thermal/gov_bang_bang.c line 47

Quoted 4 lines
drivers/thermal/gov_bang_bang.c new file +4 -0
+
+		/* in case fan is neither on nor off set the fan to active */
+		if (instance->target != 0 && instance->target != 1)
+			instance->target = 1;

I think you should add a pr_warn() here to warn the user that the governor is being used with a cooling device that seems to support more than one cooling state.

Strange thing is, that the first time it is actually called with acerhdf attached, it comes in with instance→target = -1 … I did not yet find out, why.

I'll further investigate on this and add some warning to it.

thanks for your comments.

Signature · 2 lines
kind regards,
--peter;
author maintainer
#16 lore raw

Re: [PATCH v2 3/4] thermal: Added Bang-bang thermal governor

Hi Javi,

Quoted 1 line · Peter Feuerer

Javi Merino writes:

[...]

Quoted 58 lines
Quoted 49 lines
Quoted 49 lines
drivers/thermal/gov_bang_bang.c new file +43 -0
new file mode 100644
index 0000000..328dde0
@@ -0,0 +1,124 @@
+/*
+ *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
+ *
+ *  Copyright (C) 2014 Peter Feuerer <[email protected]>
+ *
+ *  Based on step_wise.c with following Copyrights:
+ *  Copyright (C) 2012 Intel Corp
+ *  Copyright (C) 2012 Durgadoss R <[email protected]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ */
+
+#include <linux/thermal.h>
+
+#include "thermal_core.h"
+
+static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
+{
+	long trip_temp;
+	unsigned long trip_hyst;
+	struct thermal_instance *instance;
+
+	tz->ops->get_trip_temp(tz, trip, &trip_temp);
+	tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
+
+	dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n",
+				trip, trip_temp, tz->temperature,
+				trip_hyst);
+
+	mutex_lock(&tz->lock);
+
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
+		if (instance->trip != trip)
+			continue;
Quoted 8 lines

drivers/thermal/gov_bang_bang.c line 47

Quoted 4 lines
drivers/thermal/gov_bang_bang.c new file +4 -0
+
+		/* in case fan is neither on nor off set the fan to active */
+		if (instance->target != 0 && instance->target != 1)
+			instance->target = 1;

I think you should add a pr_warn() here to warn the user that the governor is being used with a cooling device that seems to support more than one cooling state.

Quoted 5 lines

Strange thing is, that the first time it is actually called with acerhdf attached, it comes in with instance→target = -1 … I did not yet find out, why.

I'll further investigate on this and add some warning to it.

I found out, that the default init state of a cooling device is:

drivers/thermal/thermal_core.c:
960 dev->target = THERMAL_NO_TARGET;

While drivers/thermal/thermal_core.h:
30 /* Initial state of a cooling device during binding */ 31 #define THERMAL_NO_TARGET -1UL

So I changed my patch to this:

+ /* in case fan is in initial state, switch the fan off */
+ if (instance->target == THERMAL_NO_TARGET)
+ instance->target = 0;
+
+ /* in case fan is neither on nor off set the fan to active */
+ if (instance->target != 0 && instance->target != 1) {
+ pr_warn("Thermal instance %s controlled by bang-bang has unexpected state: %ld\n",
+ instance->name, instance->target);
+ instance->target = 1;
+ }

Signature · 2 lines
kind regards,
--peter;
#17 lore raw

Re: [PATCH v2 3/4] thermal: Added Bang-bang thermal governor

Hi Peter,

Quoted 81 lines · Peter Feuerer
Quoted 1 line · Peter Feuerer

Javi Merino writes:

[...]

Quoted 58 lines
Quoted 49 lines
Quoted 49 lines
drivers/thermal/gov_bang_bang.c new file +43 -0
new file mode 100644
index 0000000..328dde0
@@ -0,0 +1,124 @@
+/*
+ *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
+ *
+ *  Copyright (C) 2014 Peter Feuerer <[email protected]>
+ *
+ *  Based on step_wise.c with following Copyrights:
+ *  Copyright (C) 2012 Intel Corp
+ *  Copyright (C) 2012 Durgadoss R <[email protected]>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 2.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
+ * the GNU General Public License for more details.
+ *
+ */
+
+#include <linux/thermal.h>
+
+#include "thermal_core.h"
+
+static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
+{
+	long trip_temp;
+	unsigned long trip_hyst;
+	struct thermal_instance *instance;
+
+	tz->ops->get_trip_temp(tz, trip, &trip_temp);
+	tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
+
+	dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n",
+				trip, trip_temp, tz->temperature,
+				trip_hyst);
+
+	mutex_lock(&tz->lock);
+
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
+		if (instance->trip != trip)
+			continue;
Quoted 8 lines

drivers/thermal/gov_bang_bang.c line 47

Quoted 4 lines
drivers/thermal/gov_bang_bang.c new file +4 -0
+
+		/* in case fan is neither on nor off set the fan to active */
+		if (instance->target != 0 && instance->target != 1)
+			instance->target = 1;

I think you should add a pr_warn() here to warn the user that the governor is being used with a cooling device that seems to support more than one cooling state.

Quoted 5 lines

Strange thing is, that the first time it is actually called with acerhdf attached, it comes in with instance→target = -1 … I did not yet find out, why.

I'll further investigate on this and add some warning to it.

I found out, that the default init state of a cooling device is:

drivers/thermal/thermal_core.c:
960 dev->target = THERMAL_NO_TARGET;

While drivers/thermal/thermal_core.h:
30 /* Initial state of a cooling device during binding */ 31 #define THERMAL_NO_TARGET -1UL

So I changed my patch to this:

Review

Quoted 10 lines
(quoted diff) +10 -0
+               /* in case fan is in initial state, switch the fan off */
+               if (instance->target == THERMAL_NO_TARGET)
+                       instance->target = 0;
+
+               /* in case fan is neither on nor off set the fan to active */
+               if (instance->target != 0 && instance->target != 1) {
+                       pr_warn("Thermal instance %s controlled by bang-bang has unexpected state: %ld\n",
+                                       instance->name, instance->target);
+                       instance->target = 1;
+               }

That sounds like a better solution, thanks!
Javi

author maintainer
#18 lore raw

PATCH v2 4/4 acerhdf: Use bang-bang thermal governor

In reply to Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 48 +++++++++++++++++++++++++++++++++++-------
 2 files changed, 41 insertions(+), 9 deletions(-)
drivers/platform/x86/Kconfig +1 -1
index 27df2c5..0c15d89 100644
@@ -38,7 +38,7 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	depends on ACPI && THERMAL_GOV_BANG_BANG
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +40 -8

102 lines not on this page · raw message

Signature · 1 line
1.9.2
#19 lore raw

Re: [PATCH v2 4/4] acerhdf: Use bang-bang thermal governor

Quoted 55 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 48 +++++++++++++++++++++++++++++++++++-------
 2 files changed, 41 insertions(+), 9 deletions(-)
drivers/platform/x86/Kconfig +1 -1
index 27df2c5..0c15d89 100644
@@ -38,7 +38,7 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	depends on ACPI && THERMAL_GOV_BANG_BANG
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +3 -3
index 176edbd..f3884f9 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.5.31"
 
 /*
  * According to the Atom N270 datasheet,
@@ -135,8 +135,8 @@ struct bios_settings_t {
 	const char *vendor;
 	const char *product;
 	const char *version;
-	unsigned char fanreg;
-	unsigned char tempreg;
+	u8 fanreg;
+	u8 tempreg;
 	struct fancmd cmd;
 	int mcmd_enable;
 };
@@ -259,6 +259,17 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 

drivers/platform/x86/acerhdf.c static const struct bios_settings_t bios_tbl[] = { · line 271

Quoted 10 lines
drivers/platform/x86/acerhdf.c +10 -0
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+	.no_hwmon = 0,
+	.num_tbps = 0,
+	.tbp = 0,
+};

You don't need to initialize statics to 0. checkpatch only considers it an error if it finds it in a variable, but I think it also applies to fields in struct.

drivers/platform/x86/acerhdf.c static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip, · line 451

Quoted 10 lines
drivers/platform/x86/acerhdf.c +3 -0
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -436,6 +447,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*type = THERMAL_TRIP_ACTIVE;
+	if (trip == 1)
+		*type = THERMAL_TRIP_CRITICAL;

This looks like an unrelated change that should be on a patch on its own.

Quoted 22 lines
drivers/platform/x86/acerhdf.c +11 -0
+
+	return 0;
+}
+
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip == 0)
+		*temp = fanon - fanoff;
 
 	return 0;
 }
@@ -445,6 +467,8 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*temp = fanon;
+	else if (trip == 1)
+		*temp = ACERHDF_TEMP_CRIT;
 
 	return 0;
 }

drivers/platform/x86/acerhdf.c static struct thermal_zone_device_ops acerhdf_dev_ops = { · line 494

Quoted 7 lines
drivers/platform/x86/acerhdf.c +2 -0
@@ -464,8 +488,10 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
+	.notify = NULL,

Same as before, no need to initialize static to NULL.

Cheers,
Javi

author maintainer
#20 lore raw

Re: [PATCH v2 4/4] acerhdf: Use bang-bang thermal governor

Quoted 56 lines · Javi Merino
Quoted 55 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 48 +++++++++++++++++++++++++++++++++++-------
 2 files changed, 41 insertions(+), 9 deletions(-)
drivers/platform/x86/Kconfig +1 -1
index 27df2c5..0c15d89 100644
@@ -38,7 +38,7 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	depends on ACPI && THERMAL_GOV_BANG_BANG
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +3 -3
index 176edbd..f3884f9 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.5.31"
 
 /*
  * According to the Atom N270 datasheet,
@@ -135,8 +135,8 @@ struct bios_settings_t {
 	const char *vendor;
 	const char *product;
 	const char *version;
-	unsigned char fanreg;
-	unsigned char tempreg;
+	u8 fanreg;
+	u8 tempreg;
 	struct fancmd cmd;
 	int mcmd_enable;
 };
@@ -259,6 +259,17 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
Quoted 14 lines

drivers/platform/x86/acerhdf.c static const struct bios_settings_t bios_tbl[] = { · line 271

Quoted 10 lines
drivers/platform/x86/acerhdf.c +10 -0
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+	.no_hwmon = 0,
+	.num_tbps = 0,
+	.tbp = 0,
+};

You don't need to initialize statics to 0. checkpatch only considers it an error if it finds it in a variable, but I think it also applies to fields in struct.

I agree, this is superfluous. I'll remove those lines.

Quoted 5 lines
Quoted 5 lines
drivers/platform/x86/acerhdf.c +1 -0
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -436,6 +447,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
Quoted 8 lines

drivers/platform/x86/acerhdf.c static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip, · line 451

Quoted 5 lines
drivers/platform/x86/acerhdf.c +2 -0
 {
 	if (trip == 0)
 		*type = THERMAL_TRIP_ACTIVE;
+	if (trip == 1)
+		*type = THERMAL_TRIP_CRITICAL;

This looks like an unrelated change that should be on a patch on its own.

Yes, will do so.

Quoted 19 lines
Quoted 19 lines
drivers/platform/x86/acerhdf.c +11 -0
+
+	return 0;
+}
+
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip == 0)
+		*temp = fanon - fanoff;
 
 	return 0;
 }
@@ -445,6 +467,8 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*temp = fanon;
+	else if (trip == 1)
+		*temp = ACERHDF_TEMP_CRIT;
 
Quoted 12 lines

drivers/platform/x86/acerhdf.c static struct thermal_zone_device_ops acerhdf_dev_ops = { · line 494

Quoted 10 lines
drivers/platform/x86/acerhdf.c +2 -0
 	return 0;
 }
@@ -464,8 +488,10 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
+	.notify = NULL,

Same as before, no need to initialize static to NULL.

Ok, thanks.

Signature · 2 lines
kind regards,
--peter; 
author maintainer
#21 lore raw
In reply to Peter Feuerer

Hi all,

Quoted 5 lines · Peter Feuerer

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

Quoted 7 lines

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

Please test/review the patches and send me your comments.

Further comments on the patch series? Otherwise I'll create another series containing the improvement to Javi's finding and we could get it committed?

@Rui: what do you think about the bang bang governor?

[...]

Signature · 2 lines
kind regards,
--peter;
author maintainer
#22 lore raw

v3 cover acerhdf/thermal: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer

Hi,

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 5)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 6)

Thanks and kind regards,
peter

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Javi Merino <[email protected]>

Peter Feuerer (6):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
thermal: Added Bang-bang thermal governor
acerhdf: Use bang-bang thermal governor
acerhdf: added critical trip point
acerhdf: minor clean up

 drivers/platform/x86/Kconfig    |   2 +-
 drivers/platform/x86/acerhdf.c  | 260 +++++++++++++++++++++++++---------------
 drivers/thermal/Kconfig         |  10 ++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 +
 drivers/thermal/thermal_core.h  |   8 ++
 7 files changed, 321 insertions(+), 96 deletions(-)
 create mode 100644 drivers/thermal/gov_bang_bang.c
Signature · 1 line
1.9.2
author maintainer
#23 lore raw

PATCH v3 1/6 acerhdf: Adding support for "manual mode"

Some Acer models require an additional command to turn off the fan after bios mode has been enabled. Adding new section in bios table to allow support for those models, by writing an extra "manual mode" register.

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 187 +++++++++++++++++++++++------------------
 1 file changed, 103 insertions(+), 84 deletions(-)
drivers/platform/x86/acerhdf.c +103 -84
index f94467c..dd63e93 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.26"
+#define DRV_VER "0.5.29"
 
 /*
  * According to the Atom N270 datasheet,
@@ -119,6 +119,17 @@ struct fancmd {
 	u8 cmd_auto;
 };
 
+struct manualcmd {
+	u8 mreg;
+	u8 moff;
+};
+
+/* default register and command to disable fan in manual mode */
+static const struct manualcmd mcmd = {
+	.mreg = 0x94,
+	.moff = 0xff,
+};
+
 /* BIOS settings */
 struct bios_settings_t {
 	const char *vendor;
@@ -127,105 +138,107 @@ struct bios_settings_t {
 	unsigned char fanreg;
 	unsigned char tempreg;
 	struct fancmd cmd;
+	int mcmd_enable;
 };
 
+
 /* Register addresses and values for different BIOS versions */
 static const struct bios_settings_t bios_tbl[] = {
 	/* AOA110 */
-	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* AOA150 */
-	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* LT1005u */
-	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 1410 */
-	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 1810xx */
-	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 531 */
-	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
-	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* Acer 1825 */
-	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer TravelMate 7730 */
-	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} },
+	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
 	/* Gateway */
-	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00} },
-	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00} },
-	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
+	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Packard Bell */
-	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00} },
+	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00}, 0},
 	/* pewpew-terminator */
-	{"", "", "", 0, 0, {0, 0} }
+	{"", "", "", 0, 0, {0, 0}, 0}
 };
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
@@ -275,6 +288,12 @@ static void acerhdf_change_fanstate(int state)
 	fanstate = state;
 
 	ec_write(bios_cfg->fanreg, cmd);
+
+	if (bios_cfg->mcmd_enable && state == ACERHDF_FAN_OFF) {
+		if (verbose)
+			pr_notice("turning off fan manually\n");
+		ec_write(mcmd.mreg, mcmd.moff);
+	}
 }
 
 static void acerhdf_check_param(struct thermal_zone_device *thermal)
Signature · 1 line
1.9.2
Acked-by on v3 1/6
#24 lore raw

Re: [PATCH v3 1/6] acerhdf: Adding support for "manual mode"

Quoted 8 lines · Peter Feuerer

Some Acer models require an additional command to turn off the fan after bios mode has been enabled. Adding new section in bios table to allow support for those models, by writing an extra "manual mode" register.

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>

Looks ok, I guess. I do worry a bit about the growing size of this bios_tbl and how it contains lotsa repeated info - you might wanna think of a slick scheme to slim it down one day, if you're bored.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#25 lore raw

PATCH v3 2/6 acerhdf: Adding support for new models

In reply to Peter Feuerer

added following new models:
* Aspire 5755G
* AO521
* AO751h
* Aspire One 753
* Extensa 5420
* Aspire 5315
* Aspire 5739G
* TravelMate TM8573T

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +24 -1
index dd63e93..176edbd 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.29"
+#define DRV_VER "0.5.30"
 
 /*
  * According to the Atom N270 datasheet,
@@ -200,17 +200,33 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer 5755G */
+	{"Acer", "Aspire 5755G",  "V1.20",   0xab, 0xb4, {0x00, 0x08}, 0},
+	{"Acer", "Aspire 5755G",  "V1.21",   0xab, 0xb3, {0x00, 0x08}, 0},
+	/* Acer 521 */
+	{"Acer", "AO521", "V1.11", 0x55, 0x58, {0x1f, 0x00}, 0},
 	/* Acer 531 */
 	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
+	{"Acer", "AO751h", "V0.3206", 0x55, 0x58, {0x21, 0x00}, 0},
 	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
+	/* Acer 753 */
+	{"Acer", "Aspire One 753", "V1.24", 0x93, 0xac, {0x14, 0x04}, 1},
 	/* Acer 1825 */
 	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer Extensa 5420 */
+	{"Acer", "Extensa 5420", "V1.17", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5315 */
+	{"Acer", "Aspire 5315", "V1.19", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5739 */
+	{"Acer", "Aspire 5739G", "V1.3311", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer TravelMate 7730 */
 	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
+	/* Acer TravelMate TM8573T */
+	{"Acer", "TM8573T", "V1.13", 0x93, 0xa8, {0x14, 0x04}, 1},
 	/* Gateway */
 	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
 	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
@@ -742,9 +758,15 @@ MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5755G:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAO521*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5739G:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*One*753:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5315:");
 MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:");
+MODULE_ALIAS("dmi:*:*Acer*:TM8573T:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:");
@@ -753,6 +775,7 @@ MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnExtensa 5420*:");
 
 module_init(acerhdf_init);
 module_exit(acerhdf_exit);
Signature · 1 line
1.9.2
Acked-by on v3 2/6
#26 lore raw

Re: [PATCH v3 2/6] acerhdf: Adding support for new models

Quoted 10 lines · Peter Feuerer

added following new models:
* Aspire 5755G
* AO521
* AO751h
* Aspire One 753
* Extensa 5420
* Aspire 5315
* Aspire 5739G
* TravelMate TM8573T

Quoted 4 lines
Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Quoted 9 lines
---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +0 -0
index dd63e93..176edbd 100644

drivers/platform/x86/acerhdf.c line 53

Quoted 5 lines
drivers/platform/x86/acerhdf.c +1 -1
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.29"
+#define DRV_VER "0.5.30"

What's the logic here, increment second minor version number after each change?

:-)

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#27 lore raw

Re: [PATCH v3 2/6] acerhdf: Adding support for new models

Quoted 30 lines · Borislav Petkov
Quoted 10 lines · Peter Feuerer

added following new models:
* Aspire 5755G
* AO521
* AO751h
* Aspire One 753
* Extensa 5420
* Aspire 5315
* Aspire 5739G
* TravelMate TM8573T

Quoted 4 lines
Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Quoted 12 lines
---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +0 -0
index dd63e93..176edbd 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
Quoted 5 lines

drivers/platform/x86/acerhdf.c line 53

Quoted 2 lines
drivers/platform/x86/acerhdf.c +1 -1
-#define DRV_VER "0.5.29"
+#define DRV_VER "0.5.30"

What's the logic here, increment second minor version number after each change?

Everytime I send out a modified version of acerhdf.c to someone in the internet for trying out some changes, I increment the second minor version number. And from time to time I push things to Mainline, then I need to catch up with the numbering ;)

The major 0 is just from the ages, when all cool projects used to have a 0 in front.

Maybe it would be a good idea to go for 1.0 when I implemented a better handling for the huge bios table.

Signature · 1 line
--peter;
#28 lore raw

Re: [PATCH v3 2/6] acerhdf: Adding support for new models

Quoted 4 lines · Peter Feuerer

Everytime I send out a modified version of acerhdf.c to someone in the internet for trying out some changes, I increment the second minor version number. And from time to time I push things to Mainline, then I need to catch up with the numbering ;)

Right, that's a good way to know which version people are testing when you're staring at dmesg.

Quoted 5 lines

The major 0 is just from the ages, when all cool projects used to have a 0 in front.

Maybe it would be a good idea to go for 1.0 when I implemented a better handling for the huge bios table.

Probably. You could at least increment it to 0.6 when you switch to the bang-bang governor :-)

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#29 lore raw

Re: [PATCH v3 2/6] acerhdf: Adding support for new models

Quoted 8 lines · Borislav Petkov
Quoted 5 lines

The major 0 is just from the ages, when all cool projects used to have a 0 in front.

Maybe it would be a good idea to go for 1.0 when I implemented a better handling for the huge bios table.

Probably. You could at least increment it to 0.6 when you switch to the bang-bang governor :-)

actually 0.6 is already taken by some tial modification, so I'd have to go for 0.7 ;)

Signature · 1 line
--peter;
author maintainer
#30 lore raw

PATCH v3 3/6 thermal: Added Bang-bang thermal governor

In reply to Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/thermal/Kconfig         |  10 +++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 ++
 drivers/thermal/thermal_core.h  |   8 +++
 5 files changed, 155 insertions(+)
 create mode 100644 drivers/thermal/gov_bang_bang.c
drivers/thermal/Kconfig +10 -0
index 2d51912..2ede94f 100644
@@ -84,6 +84,16 @@ config THERMAL_GOV_STEP_WISE
 	  Enable this to manage platform thermals using a simple linear
 	  governor.
 
+config THERMAL_GOV_BANG_BANG
+	bool "Bang Bang thermal governor"
+	default y
+	help
+	  Enable this to manage platform thermals using bang bang governor.
+
+	  Say 'Y' here if you want to use two point temperature regulation
+	  used for fans without throttling.  Some fan drivers depend on this
+	  governor to be enabled (e.g. acerhdf).
+
 config THERMAL_GOV_USER_SPACE
 	bool "User_space thermal governor"
 	help
drivers/thermal/Makefile +1 -0
index 54e4ec9..1c32a5d 100644
@@ -11,6 +11,7 @@ thermal_sys-$(CONFIG_THERMAL_OF)		+= of-thermal.o
 
 # governors
 thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE)	+= fair_share.o
+thermal_sys-$(CONFIG_THERMAL_GOV_BANG_BANG)	+= gov_bang_bang.o
 thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE)	+= step_wise.o
 thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE)	+= user_space.o
 
drivers/thermal/gov_bang_bang.c new file +131 -0

131 lines not on this page · raw message

drivers/thermal/thermal_core.c +5 -0
index 71b0ec0..4c2726b 100644
@@ -1790,6 +1790,10 @@ static int __init thermal_register_governors(void)
 	if (result)
 		return result;
 
+	result = thermal_gov_bang_bang_register();
+	if (result)
+		return result;
+
 	return thermal_gov_user_space_register();
 }
 
@@ -1797,6 +1801,7 @@ static void thermal_unregister_governors(void)
 {
 	thermal_gov_step_wise_unregister();
 	thermal_gov_fair_share_unregister();
+	thermal_gov_bang_bang_unregister();
 	thermal_gov_user_space_unregister();
 }
 
drivers/thermal/thermal_core.h +8 -0
index 3db339f..d15d243 100644
@@ -69,6 +69,14 @@ static inline int thermal_gov_fair_share_register(void) { return 0; }
 static inline void thermal_gov_fair_share_unregister(void) {}
 #endif /* CONFIG_THERMAL_GOV_FAIR_SHARE */
 
+#ifdef CONFIG_THERMAL_GOV_BANG_BANG
+int thermal_gov_bang_bang_register(void);
+void thermal_gov_bang_bang_unregister(void);
+#else
+static inline int thermal_gov_bang_bang_register(void) { return 0; }
+static inline void thermal_gov_bang_bang_unregister(void) {}
+#endif /* CONFIG_THERMAL_GOV_BANG_BANG */
+
 #ifdef CONFIG_THERMAL_GOV_USER_SPACE
 int thermal_gov_user_space_register(void);
 void thermal_gov_user_space_unregister(void);
Signature · 1 line
1.9.2
#31 lore raw

Re: [PATCH v3 3/6] thermal: Added Bang-bang thermal governor

Quoted 13 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>

...

Quoted 15 lines
drivers/thermal/gov_bang_bang.c new file +15 -0
+static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
+{
+	long trip_temp;
+	unsigned long trip_hyst;
+	struct thermal_instance *instance;
+
+	tz->ops->get_trip_temp(tz, trip, &trip_temp);
+	tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
+
+	dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n",
+				trip, trip_temp, tz->temperature,
+				trip_hyst);
+
+	mutex_lock(&tz->lock);
+

drivers/thermal/gov_bang_bang.c line 50

Quoted 10 lines
drivers/thermal/gov_bang_bang.c new file +10 -0
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
+		if (instance->trip != trip)
+			continue;
+
+		/* in case fan is in initial state, switch the fan off */
+		if (instance->target == THERMAL_NO_TARGET)
+			instance->target = 0;
+
+		/* in case fan is neither on nor off set the fan to active */
+		if (instance->target != 0 && instance->target != 1) {

->target is unsigned long so

		if (instance->target > 1)

(and btw, a whole unsigned long for a cooling state... 2^64-1 cooling states, nice).

drivers/thermal/gov_bang_bang.c line 54

Quoted 4 lines
drivers/thermal/gov_bang_bang.c new file +4 -0
+			pr_warn("Thermal instance %s controlled by bang-bang has unexpected state: %ld\n",
+					instance->name, instance->target);
+			instance->target = 1;
+		}

Can that even happen?

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#32 lore raw

Re: [PATCH v3 3/6] thermal: Added Bang-bang thermal governor

Quoted 45 lines · Borislav Petkov
Quoted 13 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>

...

Quoted 15 lines
drivers/thermal/gov_bang_bang.c new file +15 -0
+static void thermal_zone_trip_update(struct thermal_zone_device *tz, int trip)
+{
+	long trip_temp;
+	unsigned long trip_hyst;
+	struct thermal_instance *instance;
+
+	tz->ops->get_trip_temp(tz, trip, &trip_temp);
+	tz->ops->get_trip_hyst(tz, trip, &trip_hyst);
+
+	dev_dbg(&tz->device, "Trip%d[temp=%ld]:temp=%d:hyst=%ld\n",
+				trip, trip_temp, tz->temperature,
+				trip_hyst);
+
+	mutex_lock(&tz->lock);
+

drivers/thermal/gov_bang_bang.c line 50

Quoted 10 lines
drivers/thermal/gov_bang_bang.c new file +10 -0
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
+		if (instance->trip != trip)
+			continue;
+
+		/* in case fan is in initial state, switch the fan off */
+		if (instance->target == THERMAL_NO_TARGET)
+			instance->target = 0;
+
+		/* in case fan is neither on nor off set the fan to active */
+		if (instance->target != 0 && instance->target != 1) {

->target is unsigned long so

Quoted 1 line
		if (instance->target > 1)

Right, but I wanted to clearly point out the two possible states.

Quoted 2 lines

(and btw, a whole unsigned long for a cooling state... 2^64-1 cooling states, nice).

Hehe, true, maybe u8 makes more sense, so the compiler can take the action to align it accordingly to prevent bit shifting.

Quoted 7 lines

drivers/thermal/gov_bang_bang.c line 54

Quoted 5 lines
drivers/thermal/gov_bang_bang.c new file +4 -0
+			pr_warn("Thermal instance %s controlled by bang-bang has unexpected state: %ld\n",
+					instance->name, instance->target);
+			instance->target = 1;
+		}

Can that even happen?

It should not, but if so, we have a warning and I have the feeling we should keep it there.

Signature · 1 line
--peter;
author maintainer
#33 lore raw

PATCH v3 4/6 acerhdf: Use bang-bang thermal governor

In reply to Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 34 +++++++++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +1 -1
index 27df2c5..0c15d89 100644
@@ -38,7 +38,7 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	depends on ACPI && THERMAL_GOV_BANG_BANG
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +29 -5
index 176edbd..afaa849 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.5.31"
 
 /*
  * According to the Atom N270 datasheet,
@@ -259,6 +259,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -440,6 +448,15 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip == 0)
+		*temp = fanon - fanoff;
+
+	return 0;
+}
+
 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 				 unsigned long *temp)
 {
@@ -464,6 +481,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
 };
@@ -516,9 +534,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 	}
 
 	if (state == 0) {
-		/* turn fan off only if below fanoff temperature */
-		if ((cur_state == ACERHDF_FAN_AUTO) &&
-		    (cur_temp < fanoff))
+		if (cur_state == ACERHDF_FAN_AUTO)
 			acerhdf_change_fanstate(ACERHDF_FAN_OFF);
 	} else {
 		if (cur_state == ACERHDF_FAN_OFF)
@@ -697,11 +713,19 @@ static int acerhdf_register_thermal(void)
 		return -EINVAL;
 
 	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+					      &acerhdf_dev_ops,
+					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
 	if (IS_ERR(thz_dev))
 		return -EINVAL;
 
+	if (strcmp(thz_dev->governor->name,
+				acerhdf_zone_params.governor_name)) {
+		pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",
+				acerhdf_zone_params.governor_name);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
Signature · 1 line
1.9.2
#34 lore raw

Re: [PATCH v3 4/6] acerhdf: Use bang-bang thermal governor

Hi Peter,

Quoted 60 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 34 +++++++++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +1 -1
index 27df2c5..0c15d89 100644
@@ -38,7 +38,7 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	depends on ACPI && THERMAL_GOV_BANG_BANG
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +9 -1
index 176edbd..afaa849 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.5.31"
 
 /*
  * According to the Atom N270 datasheet,
@@ -259,6 +259,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -440,6 +448,15 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }

drivers/platform/x86/acerhdf.c static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip, · line 459

Quoted 10 lines
drivers/platform/x86/acerhdf.c +9 -0
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip == 0)
+		*temp = fanon - fanoff;
+
+	return 0;
+}
+

I think you should only return 0 if you've updated the temperature. Otherwise you're telling the calling function that everything went all right but you may be leaving garbage in *temp. What about

	if (trip != 0)
		return -EINVAL;

	*temp = fanon - fanoff;
	return 0;

Cheers,
Javi

author maintainer
#35 lore raw

Re: [PATCH v3 4/6] acerhdf: Use bang-bang thermal governor

Hi Javi,

Quoted 78 lines · Javi Merino

Hi Peter,

Quoted 60 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 34 +++++++++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +1 -1
index 27df2c5..0c15d89 100644
@@ -38,7 +38,7 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	depends on ACPI && THERMAL_GOV_BANG_BANG
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +9 -1
index 176edbd..afaa849 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.5.31"
 
 /*
  * According to the Atom N270 datasheet,
@@ -259,6 +259,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -440,6 +448,15 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }

drivers/platform/x86/acerhdf.c static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip, · line 459

Quoted 10 lines
drivers/platform/x86/acerhdf.c +9 -0
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip == 0)
+		*temp = fanon - fanoff;
+
+	return 0;
+}
+

I think you should only return 0 if you've updated the temperature. Otherwise you're telling the calling function that everything went all right but you may be leaving garbage in *temp. What about

Quoted 5 lines
	if (trip != 0)
		return -EINVAL;

	*temp = fanon - fanoff;
	return 0;

Yes, sounds good. What about trip == 1? This is a valid trip point for acerhdf (critical) and one could argue, that it has a valid hysteresis of 0. - Thus EINVAL would be wrong here.

thanks and kind regards,
--peter;

#36 lore raw

Re: [PATCH v3 4/6] acerhdf: Use bang-bang thermal governor

Hi Peter,

Quoted 80 lines · Peter Feuerer
Quoted 79 lines · Javi Merino
Quoted 60 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 34 +++++++++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +1 -1
index 27df2c5..0c15d89 100644
@@ -38,7 +38,7 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	depends on ACPI && THERMAL_GOV_BANG_BANG
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +9 -1
index 176edbd..afaa849 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.5.31"
 
 /*
  * According to the Atom N270 datasheet,
@@ -259,6 +259,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -440,6 +448,15 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }

drivers/platform/x86/acerhdf.c static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip, · line 459

Quoted 10 lines
drivers/platform/x86/acerhdf.c +9 -0
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip == 0)
+		*temp = fanon - fanoff;
+
+	return 0;
+}
+

I think you should only return 0 if you've updated the temperature. Otherwise you're telling the calling function that everything went all right but you may be leaving garbage in *temp. What about

	if (trip != 0)
		return -EINVAL;
Quoted 6 lines
Quoted 2 lines
	*temp = fanon - fanoff;
	return 0;

Yes, sounds good. What about trip == 1? This is a valid trip point for acerhdf (critical) and one could argue, that it has a valid hysteresis of
0. - Thus EINVAL would be wrong here.

Then for trip == 1 you should also write something in *temp if it's a valid trip point and you don't want to return -EINVAL. I don't know what is the correct hysteresis for trip == 1. Maybe 0? What I'm trying to say is that you should return 0 only if you've updated *temp.

Cheers,
Javi

author maintainer
#37 lore raw

PATCH v3 5/6 acerhdf: added critical trip point

In reply to Peter Feuerer

added critical trip point which represents the temperature limit.

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +5 -1
index afaa849..bc10260 100644
@@ -444,6 +444,8 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*type = THERMAL_TRIP_ACTIVE;
+	if (trip == 1)
+		*type = THERMAL_TRIP_CRITICAL;
 
 	return 0;
 }
@@ -462,6 +464,8 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*temp = fanon;
+	else if (trip == 1)
+		*temp = ACERHDF_TEMP_CRIT;
 
 	return 0;
 }
@@ -712,7 +716,7 @@ static int acerhdf_register_thermal(void)
 	if (IS_ERR(cl_dev))
 		return -EINVAL;
 
-	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
+	thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL,
 					      &acerhdf_dev_ops,
 					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
Signature · 1 line
1.9.2
author maintainer
#38 lore raw

PATCH v3 6/6 acerhdf: minor clean up

In reply to Peter Feuerer

* renamed bios_settings_t to bios_settings, as it is no typedef
* replaced "unsigned char" by u8 in bios_settings struct for better readability.

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/platform/x86/acerhdf.c +6 -6
index bc10260..4ecea81 100644
@@ -131,19 +131,19 @@ static const struct manualcmd mcmd = {
 };
 
 /* BIOS settings */
-struct bios_settings_t {
+struct bios_settings {
 	const char *vendor;
 	const char *product;
 	const char *version;
-	unsigned char fanreg;
-	unsigned char tempreg;
+	u8 fanreg;
+	u8 tempreg;
 	struct fancmd cmd;
 	int mcmd_enable;
 };
 
 
 /* Register addresses and values for different BIOS versions */
-static const struct bios_settings_t bios_tbl[] = {
+static const struct bios_settings bios_tbl[] = {
 	/* AOA110 */
 	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
 	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
@@ -257,7 +257,7 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"", "", "", 0, 0, {0, 0}, 0}
 };
 
-static const struct bios_settings_t *bios_cfg __read_mostly;
+static const struct bios_settings *bios_cfg __read_mostly;
 
 /*
  * this struct is used to instruct thermal layer to use bang_bang instead of
@@ -614,7 +614,7 @@ static int str_starts_with(const char *str, const char *start)
 static int acerhdf_check_hardware(void)
 {
 	char const *vendor, *version, *product;
-	const struct bios_settings_t *bt = NULL;
+	const struct bios_settings *bt = NULL;
 
 	/* get BIOS data */
 	vendor  = dmi_get_system_info(DMI_SYS_VENDOR);
Signature · 1 line
1.9.2
Acked-by on v3 6/6
#39 lore raw

Re: [PATCH v3 6/6] acerhdf: minor clean up

Quoted 8 lines · Peter Feuerer

* renamed bios_settings_t to bios_settings, as it is no typedef
* replaced "unsigned char" by u8 in bios_settings struct for better readability.

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
#40 lore raw

Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer

Hello Peter,

Quoted 5 lines · Peter Feuerer

Hi,

This patch series is intended to:

Quoted 9 lines

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

Can you please provide more groundings why step_wise is not working?

I had a look on bang bang proposal patch and to me, at a first glance, step_wise should cover the target behavior. Of course, that also depend on the cooling device you attach to it.

Is it possible to report the problems you have with step_wise? This way we could benefit the other users of it as well.

Quoted 42 lines

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 5)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 6)

Thanks and kind regards,
peter

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Javi Merino <[email protected]>

Peter Feuerer (6):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
thermal: Added Bang-bang thermal governor
acerhdf: Use bang-bang thermal governor
acerhdf: added critical trip point
acerhdf: minor clean up

 drivers/platform/x86/Kconfig    |   2 +-
 drivers/platform/x86/acerhdf.c  | 260 +++++++++++++++++++++++++---------------
 drivers/thermal/Kconfig         |  10 ++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 +
 drivers/thermal/thermal_core.h  |   8 ++
 7 files changed, 321 insertions(+), 96 deletions(-)
 create mode 100644 drivers/thermal/gov_bang_bang.c
Signature · 7 lines
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
author maintainer
#41 lore raw

Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up

Hi Eduardo,

Quoted 11 lines · Eduardo Valentin

Hello Peter,

Quoted 8 lines · Peter Feuerer

Hi,

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

Quoted 8 lines
Quoted 6 lines

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

Can you please provide more groundings why step_wise is not working?

Step_wise does (or did) not support hysteresis functionality, so what we've done in the past was to manipulate the fan handling within acerhdf (e.g. reporting different trip temperature, based whether the fan is on or not). But this was very fragile and with each change in step_wise we had to find another method to somehow fit acerhdf into it again. Step_wise is clearly intended for fans which can be regulated in speed and it has some fancy algorithms like trend monitoring which work fine there.

But for the audience of acerhdf it has always been overkill and they've noticed broken fan control, when things changed in step_wise again.

Quoted 2 lines

I had a look on bang bang proposal patch and to me, at a first glance,
step_wise should cover the target behavior. Of course, that also depend on the cooling device you attach to it.

Actually even Rui stated a while ago, creation of a separate governor would be one thinkable solution to get a more robust solution for the two step regulation of acerhdf.

Quoted 2 lines

Is it possible to report the problems you have with step_wise? This way we could benefit the other users of it as well.

There is no problem in step_wise in general. It is just so, that the governor is overkill for the simple on-off fan of acerhdf.

And what's the deal of having plugable governors, when you try to fit every single feature into one gigantic?
Aren't the unix philosophies of modularity, serparation and simplicity valid in the kernel too?

kind regards,
--peter;

Quoted 46 lines
Quoted 46 lines

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 5)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 6)

Thanks and kind regards,
peter

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Javi Merino <[email protected]>

Peter Feuerer (6):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
thermal: Added Bang-bang thermal governor
acerhdf: Use bang-bang thermal governor
acerhdf: added critical trip point
acerhdf: minor clean up

 drivers/platform/x86/Kconfig    |   2 +-
 drivers/platform/x86/acerhdf.c  | 260 +++++++++++++++++++++++++---------------
 drivers/thermal/Kconfig         |  10 ++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 +
 drivers/thermal/thermal_core.h  |   8 ++
 7 files changed, 321 insertions(+), 96 deletions(-)
 create mode 100644 drivers/thermal/gov_bang_bang.c
Signature · 7 lines
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#42 lore raw

Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up

Hello Peter,
is there a newer version of acerhdf than 'acerhdf_kmod-0.5.30b-linux-3.8' which includes all your recent patches?
I am struggeling to get the fan of my Aspire V5 under control.
Is there a way to determine the adresses of the bios for the fans, so I can add my model to the acerhdf.c? Maybe under windows (?), as I suceeded to turn it down there.
I would really appreciate any help!
Best,
Felix

#43 lore raw

Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer

Hello Peter,

Quoted 32 lines · Peter Feuerer

Hi Eduardo,

Quoted 11 lines · Eduardo Valentin

Hello Peter,

Quoted 8 lines · Peter Feuerer

Hi,

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

Quoted 8 lines
Quoted 6 lines

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

Can you please provide more groundings why step_wise is not working?

Step_wise does (or did) not support hysteresis functionality, so what we've done in the past was to manipulate the fan handling within acerhdf (e.g. reporting different trip temperature, based whether the fan is on or not). But this was very fragile and with each change in step_wise we had to find another method to somehow fit acerhdf into it again. Step_wise is clearly intended for fans which can be regulated in speed and it has some fancy algorithms like trend monitoring which work fine there.

Quoted 3 lines

But for the audience of acerhdf it has always been overkill and they've noticed broken fan control, when things changed in step_wise again.

Can you please add your arguments in the commit message and in the code documentation itself. Explaining the audience why we have an extra governor is my intention here. My point is for you to improve your patch description and code documentation with your arguments (above) explaining the reasons why acerhd needs a special governor.

Quoted 70 lines
Quoted 4 lines

I had a look on bang bang proposal patch and to me, at a first glance, step_wise should cover the target behavior. Of course, that also depend on the cooling device you attach to it.

Actually even Rui stated a while ago, creation of a separate governor would be one thinkable solution to get a more robust solution for the two step regulation of acerhdf.

Quoted 2 lines

Is it possible to report the problems you have with step_wise? This way we could benefit the other users of it as well.

There is no problem in step_wise in general. It is just so, that the governor is overkill for the simple on-off fan of acerhdf.

And what's the deal of having plugable governors, when you try to fit every single feature into one gigantic?
Aren't the unix philosophies of modularity, serparation and simplicity valid in the kernel too?

kind regards,
--peter;

Quoted 46 lines
Quoted 46 lines

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 5)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 6)

Thanks and kind regards,
peter

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Javi Merino <[email protected]>

Peter Feuerer (6):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
thermal: Added Bang-bang thermal governor
acerhdf: Use bang-bang thermal governor
acerhdf: added critical trip point
acerhdf: minor clean up

 drivers/platform/x86/Kconfig    |   2 +-
 drivers/platform/x86/acerhdf.c  | 260 +++++++++++++++++++++++++---------------
 drivers/thermal/Kconfig         |  10 ++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 +
 drivers/thermal/thermal_core.h  |   8 ++
 7 files changed, 321 insertions(+), 96 deletions(-)
 create mode 100644 drivers/thermal/gov_bang_bang.c
Signature · 7 lines
1.9.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
#44 lore raw

Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer

Hi Peter,

Quoted 11 lines · Peter Feuerer

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

Quoted 4 lines

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 5)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 6)

so what's the state of those?

In the meantime I noticed the breakage here too, after updating the kernel on the aspire one - the fan remains on.

Do you have a latest version which is ready for testing or should I take those?

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#45 lore raw

Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up

Hi Boris,

nice to hear from you.

Quoted 19 lines · Borislav Petkov

Hi Peter,

Quoted 11 lines · Peter Feuerer

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

Quoted 4 lines

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 5)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 6)

Quoted 7 lines

so what's the state of those?

In the meantime I noticed the breakage here too, after updating the kernel on the aspire one - the fan remains on.

Do you have a latest version which is ready for testing or should I take those?

I'll send out new set of patches by Sunday latestly, but you could of course start testing with version3 of the patchset, as I just planned to do minor fixes anyhow.

Signature · 2 lines
kind regards,
--peter;
#46 lore raw

Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up

Quoted 3 lines · Peter Feuerer

I'll send out new set of patches by Sunday latestly, but you could of course start testing with version3 of the patchset, as I just planned to do minor fixes anyhow.

Yeah, I'll wait for your latest submission and give it a run here.

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#47 lore raw

v4 cover acerhdf/thermal: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer

Hi,

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 5)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 6)

Thanks and kind regards,
peter

Peter Feuerer (6):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
thermal: Added Bang-bang thermal governor
acerhdf: Use bang-bang thermal governor
acerhdf: added critical trip point
acerhdf: minor clean up

 drivers/platform/x86/Kconfig    |   2 +-
 drivers/platform/x86/acerhdf.c  | 266 ++++++++++++++++++++++++++--------------
 drivers/thermal/Kconfig         |  10 ++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 +
 drivers/thermal/thermal_core.h  |   8 ++
 7 files changed, 327 insertions(+), 96 deletions(-)
 create mode 100644 drivers/thermal/gov_bang_bang.c
Signature · 1 line
2.0.2
author maintainer
#48 lore raw

PATCH v4 1/6 acerhdf: Adding support for "manual mode"

Some Acer models require an additional command to turn off the fan after bios mode has been enabled. Adding new section in bios table to allow support for those models, by writing an extra "manual mode" register.

---
 drivers/platform/x86/acerhdf.c | 187 +++++++++++++++++++++++------------------
 1 file changed, 103 insertions(+), 84 deletions(-)
drivers/platform/x86/acerhdf.c +103 -84
index f94467c..dd63e93 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.26"
+#define DRV_VER "0.5.29"
 
 /*
  * According to the Atom N270 datasheet,
@@ -119,6 +119,17 @@ struct fancmd {
 	u8 cmd_auto;
 };
 
+struct manualcmd {
+	u8 mreg;
+	u8 moff;
+};
+
+/* default register and command to disable fan in manual mode */
+static const struct manualcmd mcmd = {
+	.mreg = 0x94,
+	.moff = 0xff,
+};
+
 /* BIOS settings */
 struct bios_settings_t {
 	const char *vendor;
@@ -127,105 +138,107 @@ struct bios_settings_t {
 	unsigned char fanreg;
 	unsigned char tempreg;
 	struct fancmd cmd;
+	int mcmd_enable;
 };
 
+
 /* Register addresses and values for different BIOS versions */
 static const struct bios_settings_t bios_tbl[] = {
 	/* AOA110 */
-	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* AOA150 */
-	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* LT1005u */
-	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 1410 */
-	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 1810xx */
-	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 531 */
-	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
-	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* Acer 1825 */
-	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer TravelMate 7730 */
-	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} },
+	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
 	/* Gateway */
-	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00} },
-	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00} },
-	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
+	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Packard Bell */
-	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00} },
+	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00}, 0},
 	/* pewpew-terminator */
-	{"", "", "", 0, 0, {0, 0} }
+	{"", "", "", 0, 0, {0, 0}, 0}
 };
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
@@ -275,6 +288,12 @@ static void acerhdf_change_fanstate(int state)
 	fanstate = state;
 
 	ec_write(bios_cfg->fanreg, cmd);
+
+	if (bios_cfg->mcmd_enable && state == ACERHDF_FAN_OFF) {
+		if (verbose)
+			pr_notice("turning off fan manually\n");
+		ec_write(mcmd.mreg, mcmd.moff);
+	}
 }
 
 static void acerhdf_check_param(struct thermal_zone_device *thermal)
Signature · 1 line
2.0.2
#49 lore raw

Re: [PATCH v4 1/6] acerhdf: Adding support for "manual mode"

Hi,

drivers/platform/x86/acerhdf.c struct bios_settings_t { · line 146

Quoted 10 lines · Peter Feuerer
drivers/platform/x86/acerhdf.c +2 -0
@@ -127,105 +138,107 @@ struct bios_settings_t {
 	unsigned char fanreg;
 	unsigned char tempreg;
 	struct fancmd cmd;
+	int mcmd_enable;
 };
 
+
 /* Register addresses and values for different BIOS versions */
 static const struct bios_settings_t bios_tbl[] = {

Change-unrelated content here, might want to move away.

Suggestion (if ok from a commit revision/history POV):
git rebase -i s:/'acerhdf: Adding support for "manual mode"'~1 <"e"dit first commit>
git checkout -p s:/'acerhdf: Adding support for "manual mode"' <grab hunk [split as needed]>
git commit -m "FIXUP"
git rebase --continue
git rebase -i s:/'acerhdf: Adding support for "manual mode"'~1 <move FIXUP line post [PATCH v4 6/6] acerhdf: minor clean up> <do "f"ixup>

Sorry that I didn't find worse breakage during my review than this si{mp|ng}le line ;)

Andreas

author maintainer
#50 lore raw

Re: [PATCH v4 1/6] acerhdf: Adding support for "manual mode"

Hi Andreas,

Quoted 10 lines · Andreas Mohr

Hi

Quoted 7 lines · Peter Feuerer
drivers/platform/x86/acerhdf.c +1 -0
@@ -127,105 +138,107 @@ struct bios_settings_t {
 	unsigned char fanreg;
 	unsigned char tempreg;
 	struct fancmd cmd;
+	int mcmd_enable;
 };
 
Quoted 5 lines

drivers/platform/x86/acerhdf.c struct bios_settings_t { · line 146

Quoted 3 lines
drivers/platform/x86/acerhdf.c +1 -0
+
 /* Register addresses and values for different BIOS versions */
 static const struct bios_settings_t bios_tbl[] = {

Change-unrelated content here, might want to move away.

You mean this newline?

Quoted 10 lines

Suggestion (if ok from a commit revision/history POV):
git rebase -i s:/'acerhdf: Adding support for "manual mode"'~1 <"e"dit first commit>
git checkout -p s:/'acerhdf: Adding support for "manual mode"' <grab hunk [split as needed]>
git commit -m "FIXUP"
git rebase --continue
git rebase -i s:/'acerhdf: Adding support for "manual mode"'~1 <move FIXUP line post [PATCH v4 6/6] acerhdf: minor clean up> <do "f"ixup>

If I understand this correctly, you want me to move this new line to patch 6, correct?

Quoted 2 lines

Sorry that I didn't find worse breakage during my review than this si{mp|ng}le line ;)

No problem, as long as you give your Acked-by / Reviewed-by ;)

--peter;

#51 lore raw

Re: [PATCH v4 1/6] acerhdf: Adding support for "manual mode"

Hi,

Quoted 16 lines · Peter Feuerer

Hi Andreas,

Quoted 12 lines · Andreas Mohr

drivers/platform/x86/acerhdf.c struct bios_settings_t { · line 145

Quoted 9 lines · Peter Feuerer
drivers/platform/x86/acerhdf.c +2 -0
@@ -127,105 +138,107 @@ struct bios_settings_t {
 	unsigned char fanreg;
 	unsigned char tempreg;
 	struct fancmd cmd;
+	int mcmd_enable;
 };
+
 /* Register addresses and values for different BIOS versions */
 static const struct bios_settings_t bios_tbl[] = {

Change-unrelated content here, might want to move away.

Quoted 1 line

You mean this newline?

Yup.

Quoted 11 lines
Quoted 10 lines

Suggestion (if ok from a commit revision/history POV):
git rebase -i s:/'acerhdf: Adding support for "manual mode"'~1 <"e"dit first commit>
git checkout -p s:/'acerhdf: Adding support for "manual mode"' <grab hunk [split as needed]>
git commit -m "FIXUP"
git rebase --continue
git rebase -i s:/'acerhdf: Adding support for "manual mode"'~1 <move FIXUP line post [PATCH v4 6/6] acerhdf: minor clean up> <do "f"ixup>

Quoted 2 lines

If I understand this correctly, you want me to move this new line to patch 6, correct?

Yup, to a suitable "other stuff" location, which patch 6 likely would be.

Quoted 4 lines
Quoted 2 lines

Sorry that I didn't find worse breakage during my review than this si{mp|ng}le line ;)

No problem, as long as you give your Acked-by / Reviewed-by ;)

Hmm, I'm unsure whether my involvement is sufficient for a full Reviewed-by (think full replacement of core driver mechanisms as in bang-bang governor, etc.).

But yeah, at least I can say I did review things
and I did not see any obvious issues.

Thanks,

Andreas

author maintainer
#52 lore raw

PATCH v4 2/6 acerhdf: Adding support for new models

In reply to Peter Feuerer

added following new models:
* Aspire 5755G
* AO521
* AO751h
* Aspire One 753
* Extensa 5420
* Aspire 5315
* Aspire 5739G
* TravelMate TM8573T

---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +24 -1
index dd63e93..176edbd 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.29"
+#define DRV_VER "0.5.30"
 
 /*
  * According to the Atom N270 datasheet,
@@ -200,17 +200,33 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer 5755G */
+	{"Acer", "Aspire 5755G",  "V1.20",   0xab, 0xb4, {0x00, 0x08}, 0},
+	{"Acer", "Aspire 5755G",  "V1.21",   0xab, 0xb3, {0x00, 0x08}, 0},
+	/* Acer 521 */
+	{"Acer", "AO521", "V1.11", 0x55, 0x58, {0x1f, 0x00}, 0},
 	/* Acer 531 */
 	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
+	{"Acer", "AO751h", "V0.3206", 0x55, 0x58, {0x21, 0x00}, 0},
 	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
+	/* Acer 753 */
+	{"Acer", "Aspire One 753", "V1.24", 0x93, 0xac, {0x14, 0x04}, 1},
 	/* Acer 1825 */
 	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer Extensa 5420 */
+	{"Acer", "Extensa 5420", "V1.17", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5315 */
+	{"Acer", "Aspire 5315", "V1.19", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5739 */
+	{"Acer", "Aspire 5739G", "V1.3311", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer TravelMate 7730 */
 	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
+	/* Acer TravelMate TM8573T */
+	{"Acer", "TM8573T", "V1.13", 0x93, 0xa8, {0x14, 0x04}, 1},
 	/* Gateway */
 	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
 	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
@@ -742,9 +758,15 @@ MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5755G:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAO521*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5739G:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*One*753:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5315:");
 MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:");
+MODULE_ALIAS("dmi:*:*Acer*:TM8573T:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:");
@@ -753,6 +775,7 @@ MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnExtensa 5420*:");
 
 module_init(acerhdf_init);
 module_exit(acerhdf_exit);
Signature · 1 line
2.0.2
author maintainer
#53 lore raw

PATCH v4 3/6 thermal: Added Bang-bang thermal governor

In reply to Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/thermal/Kconfig         |  10 +++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 ++
 drivers/thermal/thermal_core.h  |   8 +++
 5 files changed, 155 insertions(+)
 create mode 100644 drivers/thermal/gov_bang_bang.c
drivers/thermal/Kconfig +10 -0
index f9a1386..cdddf09 100644
@@ -84,6 +84,16 @@ config THERMAL_GOV_STEP_WISE
 	  Enable this to manage platform thermals using a simple linear
 	  governor.
 
+config THERMAL_GOV_BANG_BANG
+	bool "Bang Bang thermal governor"
+	default y
+	help
+	  Enable this to manage platform thermals using bang bang governor.
+
+	  Say 'Y' here if you want to use two point temperature regulation
+	  used for fans without throttling.  Some fan drivers depend on this
+	  governor to be enabled (e.g. acerhdf).
+
 config THERMAL_GOV_USER_SPACE
 	bool "User_space thermal governor"
 	help
drivers/thermal/Makefile +1 -0
index de0636a..a675980 100644
@@ -11,6 +11,7 @@ thermal_sys-$(CONFIG_THERMAL_OF)		+= of-thermal.o
 
 # governors
 thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE)	+= fair_share.o
+thermal_sys-$(CONFIG_THERMAL_GOV_BANG_BANG)	+= gov_bang_bang.o
 thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE)	+= step_wise.o
 thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE)	+= user_space.o
 
drivers/thermal/gov_bang_bang.c new file +131 -0

131 lines not on this page · raw message

drivers/thermal/thermal_core.c +5 -0
index 71b0ec0..4c2726b 100644
@@ -1790,6 +1790,10 @@ static int __init thermal_register_governors(void)
 	if (result)
 		return result;
 
+	result = thermal_gov_bang_bang_register();
+	if (result)
+		return result;
+
 	return thermal_gov_user_space_register();
 }
 
@@ -1797,6 +1801,7 @@ static void thermal_unregister_governors(void)
 {
 	thermal_gov_step_wise_unregister();
 	thermal_gov_fair_share_unregister();
+	thermal_gov_bang_bang_unregister();
 	thermal_gov_user_space_unregister();
 }
 
drivers/thermal/thermal_core.h +8 -0
index 3db339f..d15d243 100644
@@ -69,6 +69,14 @@ static inline int thermal_gov_fair_share_register(void) { return 0; }
 static inline void thermal_gov_fair_share_unregister(void) {}
 #endif /* CONFIG_THERMAL_GOV_FAIR_SHARE */
 
+#ifdef CONFIG_THERMAL_GOV_BANG_BANG
+int thermal_gov_bang_bang_register(void);
+void thermal_gov_bang_bang_unregister(void);
+#else
+static inline int thermal_gov_bang_bang_register(void) { return 0; }
+static inline void thermal_gov_bang_bang_unregister(void) {}
+#endif /* CONFIG_THERMAL_GOV_BANG_BANG */
+
 #ifdef CONFIG_THERMAL_GOV_USER_SPACE
 int thermal_gov_user_space_register(void);
 void thermal_gov_user_space_unregister(void);
Signature · 1 line
2.0.2
#54 lore raw

Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor

Quoted 27 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/thermal/Kconfig         |  10 +++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 ++
 drivers/thermal/thermal_core.h  |   8 +++
 5 files changed, 155 insertions(+)
 create mode 100644 drivers/thermal/gov_bang_bang.c
drivers/thermal/Kconfig +0 -0
index f9a1386..cdddf09 100644

drivers/thermal/Kconfig config THERMAL_GOV_STEP_WISE · line 89

Quoted 6 lines
drivers/thermal/Kconfig +3 -0
@@ -84,6 +84,16 @@ config THERMAL_GOV_STEP_WISE
 	  Enable this to manage platform thermals using a simple linear
 	  governor.
 
+config THERMAL_GOV_BANG_BANG
+	bool "Bang Bang thermal governor"
+	default y

Right, this is problematic.

When people are faced with the new selection after doing oldconfig, they can say yes or no.

However, as acerhdf depends on it now, prompting the user to unconditionally says yes is kinda redundant. Especially as this governor is not supposed to be default anyway.

Actually you don't need the Kconfig prompt at all as this is a sort-of "internal" governor and devices select it. IOW, it should be "default n" and ACERHDF will do "select THERMAL_GOV_BANG_BANG". Something like that at least.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
reviewer
#55 lore raw

Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor

Quoted 8 lines · Borislav Petkov
Quoted 7 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Quoted 6 lines
Quoted 6 lines
Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>

For thermal related patches, please do cc linux-pm mailing list so that I can see them in patchwork.

thanks,
rui

Quoted 35 lines
Quoted 14 lines
---
 drivers/thermal/Kconfig         |  10 +++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 ++
 drivers/thermal/thermal_core.h  |   8 +++
 5 files changed, 155 insertions(+)
 create mode 100644 drivers/thermal/gov_bang_bang.c
drivers/thermal/Kconfig +0 -0
index f9a1386..cdddf09 100644

drivers/thermal/Kconfig config THERMAL_GOV_STEP_WISE · line 89

Quoted 6 lines
drivers/thermal/Kconfig +3 -0
@@ -84,6 +84,16 @@ config THERMAL_GOV_STEP_WISE
 	  Enable this to manage platform thermals using a simple linear
 	  governor.
 
+config THERMAL_GOV_BANG_BANG
+	bool "Bang Bang thermal governor"
+	default y

Right, this is problematic.

When people are faced with the new selection after doing oldconfig, they can say yes or no.

However, as acerhdf depends on it now, prompting the user to unconditionally says yes is kinda redundant. Especially as this governor is not supposed to be default anyway.

Actually you don't need the Kconfig prompt at all as this is a sort-of "internal" governor and devices select it. IOW, it should be "default n" and ACERHDF will do "select THERMAL_GOV_BANG_BANG". Something like that at least.

reviewer
#56 lore raw

Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor

In reply to Borislav Petkov
Quoted 40 lines · Borislav Petkov
Quoted 27 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/thermal/Kconfig         |  10 +++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 ++
 drivers/thermal/thermal_core.h  |   8 +++
 5 files changed, 155 insertions(+)
 create mode 100644 drivers/thermal/gov_bang_bang.c
drivers/thermal/Kconfig +0 -0
index f9a1386..cdddf09 100644

drivers/thermal/Kconfig config THERMAL_GOV_STEP_WISE · line 89

Quoted 6 lines
drivers/thermal/Kconfig +3 -0
@@ -84,6 +84,16 @@ config THERMAL_GOV_STEP_WISE
 	  Enable this to manage platform thermals using a simple linear
 	  governor.
 
+config THERMAL_GOV_BANG_BANG
+	bool "Bang Bang thermal governor"
+	default y

Right, this is problematic.

When people are faced with the new selection after doing oldconfig, they can say yes or no.

Quoted 9 lines

However, as acerhdf depends on it now, prompting the user to unconditionally says yes is kinda redundant. Especially as this governor is not supposed to be default anyway.

Actually you don't need the Kconfig prompt at all as this is a sort-of "internal" governor and devices select it. IOW, it should be "default n" and ACERHDF will do "select THERMAL_GOV_BANG_BANG". Something like that at least.

I agree with this approach.

thanks,
rui

author maintainer
#57 lore raw

Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor

Hi,

Quoted 45 lines · Zhang Rui
Quoted 44 lines · Borislav Petkov
Quoted 27 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/thermal/Kconfig         |  10 +++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 ++
 drivers/thermal/thermal_core.h  |   8 +++
 5 files changed, 155 insertions(+)
 create mode 100644 drivers/thermal/gov_bang_bang.c
drivers/thermal/Kconfig +0 -0
index f9a1386..cdddf09 100644

drivers/thermal/Kconfig config THERMAL_GOV_STEP_WISE · line 89

Quoted 6 lines
drivers/thermal/Kconfig +3 -0
@@ -84,6 +84,16 @@ config THERMAL_GOV_STEP_WISE
 	  Enable this to manage platform thermals using a simple linear
 	  governor.
 
+config THERMAL_GOV_BANG_BANG
+	bool "Bang Bang thermal governor"
+	default y

Right, this is problematic.

When people are faced with the new selection after doing oldconfig, they can say yes or no.

However, as acerhdf depends on it now, prompting the user to unconditionally says yes is kinda redundant. Especially as this governor is not supposed to be default anyway.

Quoted 6 lines
Quoted 5 lines

Actually you don't need the Kconfig prompt at all as this is a sort-of "internal" governor and devices select it. IOW, it should be "default n" and ACERHDF will do "select THERMAL_GOV_BANG_BANG". Something like that at least.

I agree with this approach.

Yes, you are right, this looks better. Then the "depend on THERMAL_GOV_BANG_BANG" could be removed from acerhdf Kbuild, as the "select" will take care acerhdf is compiled with THERMAL_GOV_BANG_BANG enabled, right?

Signature · 1 line
--peter;
#58 lore raw

Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor

Quoted 3 lines · Peter Feuerer

Then the "depend on THERMAL_GOV_BANG_BANG" could be removed from acerhdf Kbuild, as the "select" will take care acerhdf is compiled with THERMAL_GOV_BANG_BANG enabled, right?

Yes, try it.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#59 lore raw

PATCH v4 4/6 acerhdf: Use bang-bang thermal governor

In reply to Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 32 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +1 -1
index 172f26c..d89252a 100644
@@ -38,7 +38,7 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	depends on ACPI && THERMAL_GOV_BANG_BANG
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +31 -5
index 176edbd..e8c3111 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.7.0"
 
 /*
  * According to the Atom N270 datasheet,
@@ -259,6 +259,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -440,6 +448,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip != 0)
+		return -EINVAL;
+
+	*temp = fanon - fanoff;
+
+	return 0;
+}
+
 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 				 unsigned long *temp)
 {
@@ -464,6 +483,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
 };
@@ -516,9 +536,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 	}
 
 	if (state == 0) {
-		/* turn fan off only if below fanoff temperature */
-		if ((cur_state == ACERHDF_FAN_AUTO) &&
-		    (cur_temp < fanoff))
+		if (cur_state == ACERHDF_FAN_AUTO)
 			acerhdf_change_fanstate(ACERHDF_FAN_OFF);
 	} else {
 		if (cur_state == ACERHDF_FAN_OFF)
@@ -697,11 +715,19 @@ static int acerhdf_register_thermal(void)
 		return -EINVAL;
 
 	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+					      &acerhdf_dev_ops,
+					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
 	if (IS_ERR(thz_dev))
 		return -EINVAL;
 
+	if (strcmp(thz_dev->governor->name,
+				acerhdf_zone_params.governor_name)) {
+		pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",
+				acerhdf_zone_params.governor_name);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.0.2
#60 lore raw

Re: [PATCH v4 4/6] acerhdf: Use bang-bang thermal governor

Quoted 4 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Initial testing looks good.

It wasn't that easy to test though, judging by the current weather temperatures - I had to go into the fridge with the laptop to cause it to go under fanoff :-)

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#61 lore raw

PATCH v4 5/6 acerhdf: added critical trip point

In reply to Peter Feuerer

added critical trip point which represents the temperature limit. Added return -EINVAL in case wrong trip point is provided.

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +9 -1
index e8c3111..0d521ea 100644
@@ -444,6 +444,10 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*type = THERMAL_TRIP_ACTIVE;
+	else if (trip == 1)
+		*type = THERMAL_TRIP_CRITICAL;
+	else
+		return -EINVAL;
 
 	return 0;
 }
@@ -464,6 +468,10 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*temp = fanon;
+	else if (trip == 1)
+		*temp = ACERHDF_TEMP_CRIT;
+	else
+		return -EINVAL;
 
 	return 0;
 }
@@ -714,7 +722,7 @@ static int acerhdf_register_thermal(void)
 	if (IS_ERR(cl_dev))
 		return -EINVAL;
 
-	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
+	thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL,
 					      &acerhdf_dev_ops,
 					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
Signature · 1 line
2.0.2
author maintainer
#62 lore raw

PATCH v4 6/6 acerhdf: minor clean up

In reply to Peter Feuerer

* renamed bios_settings_t to bios_settings, as it is no typedef
* replaced "unsigned char" by u8 in bios_settings struct for better readability.

---
 drivers/platform/x86/acerhdf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/platform/x86/acerhdf.c +6 -6
index 0d521ea..e608ef1 100644
@@ -131,19 +131,19 @@ static const struct manualcmd mcmd = {
 };
 
 /* BIOS settings */
-struct bios_settings_t {
+struct bios_settings {
 	const char *vendor;
 	const char *product;
 	const char *version;
-	unsigned char fanreg;
-	unsigned char tempreg;
+	u8 fanreg;
+	u8 tempreg;
 	struct fancmd cmd;
 	int mcmd_enable;
 };
 
 
 /* Register addresses and values for different BIOS versions */
-static const struct bios_settings_t bios_tbl[] = {
+static const struct bios_settings bios_tbl[] = {
 	/* AOA110 */
 	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
 	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
@@ -257,7 +257,7 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"", "", "", 0, 0, {0, 0}, 0}
 };
 
-static const struct bios_settings_t *bios_cfg __read_mostly;
+static const struct bios_settings *bios_cfg __read_mostly;
 
 /*
  * this struct is used to instruct thermal layer to use bang_bang instead of
@@ -620,7 +620,7 @@ static int str_starts_with(const char *str, const char *start)
 static int acerhdf_check_hardware(void)
 {
 	char const *vendor, *version, *product;
-	const struct bios_settings_t *bt = NULL;
+	const struct bios_settings *bt = NULL;
 
 	/* get BIOS data */
 	vendor  = dmi_get_system_info(DMI_SYS_VENDOR);
Signature · 1 line
2.0.2
author maintainer
#63 lore raw

v5 cover acerhdf/thermal: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer

Hi,

This patch series is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

* Add an appropriate thermal governor (Patch 3 & 4). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 5)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 6)

Thanks and kind regards,
peter

Peter Feuerer (6):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
thermal: Added Bang-bang thermal governor
acerhdf: Use bang-bang thermal governor
acerhdf: added critical trip point
acerhdf: minor clean up

 drivers/platform/x86/Kconfig    |   3 +-
 drivers/platform/x86/acerhdf.c  | 265 ++++++++++++++++++++++++++--------------
 drivers/thermal/Kconfig         |  10 ++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 +
 drivers/thermal/thermal_core.h  |   8 ++
 7 files changed, 327 insertions(+), 96 deletions(-)
 create mode 100644 drivers/thermal/gov_bang_bang.c
Signature · 1 line
2.0.2
author maintainer
#64 lore raw

PATCH v5 1/6 acerhdf: Adding support for "manual mode"

Some Acer models require an additional command to turn off the fan after bios mode has been enabled. Adding new section in bios table to allow support for those models, by writing an extra "manual mode" register.

---
 drivers/platform/x86/acerhdf.c | 186 ++++++++++++++++++++++-------------------
 1 file changed, 102 insertions(+), 84 deletions(-)
drivers/platform/x86/acerhdf.c +102 -84
index f94467c..2c58f10 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.26"
+#define DRV_VER "0.5.29"
 
 /*
  * According to the Atom N270 datasheet,
@@ -119,6 +119,17 @@ struct fancmd {
 	u8 cmd_auto;
 };
 
+struct manualcmd {
+	u8 mreg;
+	u8 moff;
+};
+
+/* default register and command to disable fan in manual mode */
+static const struct manualcmd mcmd = {
+	.mreg = 0x94,
+	.moff = 0xff,
+};
+
 /* BIOS settings */
 struct bios_settings_t {
 	const char *vendor;
@@ -127,105 +138,106 @@ struct bios_settings_t {
 	unsigned char fanreg;
 	unsigned char tempreg;
 	struct fancmd cmd;
+	int mcmd_enable;
 };
 
 /* Register addresses and values for different BIOS versions */
 static const struct bios_settings_t bios_tbl[] = {
 	/* AOA110 */
-	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* AOA150 */
-	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* LT1005u */
-	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 1410 */
-	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 1810xx */
-	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 531 */
-	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
-	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* Acer 1825 */
-	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer TravelMate 7730 */
-	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} },
+	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
 	/* Gateway */
-	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00} },
-	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00} },
-	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
+	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Packard Bell */
-	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00} },
+	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00}, 0},
 	/* pewpew-terminator */
-	{"", "", "", 0, 0, {0, 0} }
+	{"", "", "", 0, 0, {0, 0}, 0}
 };
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
@@ -275,6 +287,12 @@ static void acerhdf_change_fanstate(int state)
 	fanstate = state;
 
 	ec_write(bios_cfg->fanreg, cmd);
+
+	if (bios_cfg->mcmd_enable && state == ACERHDF_FAN_OFF) {
+		if (verbose)
+			pr_notice("turning off fan manually\n");
+		ec_write(mcmd.mreg, mcmd.moff);
+	}
 }
 
 static void acerhdf_check_param(struct thermal_zone_device *thermal)
Signature · 1 line
2.0.2
author maintainer
#65 lore raw

PATCH v5 2/6 acerhdf: Adding support for new models

In reply to Peter Feuerer

added following new models:
* Aspire 5755G
* AO521
* AO751h
* Aspire One 753
* Extensa 5420
* Aspire 5315
* Aspire 5739G
* TravelMate TM8573T

---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +24 -1
index 2c58f10..f30767f 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.29"
+#define DRV_VER "0.5.30"
 
 /*
  * According to the Atom N270 datasheet,
@@ -199,17 +199,33 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer 5755G */
+	{"Acer", "Aspire 5755G",  "V1.20",   0xab, 0xb4, {0x00, 0x08}, 0},
+	{"Acer", "Aspire 5755G",  "V1.21",   0xab, 0xb3, {0x00, 0x08}, 0},
+	/* Acer 521 */
+	{"Acer", "AO521", "V1.11", 0x55, 0x58, {0x1f, 0x00}, 0},
 	/* Acer 531 */
 	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
+	{"Acer", "AO751h", "V0.3206", 0x55, 0x58, {0x21, 0x00}, 0},
 	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
+	/* Acer 753 */
+	{"Acer", "Aspire One 753", "V1.24", 0x93, 0xac, {0x14, 0x04}, 1},
 	/* Acer 1825 */
 	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer Extensa 5420 */
+	{"Acer", "Extensa 5420", "V1.17", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5315 */
+	{"Acer", "Aspire 5315", "V1.19", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5739 */
+	{"Acer", "Aspire 5739G", "V1.3311", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer TravelMate 7730 */
 	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
+	/* Acer TravelMate TM8573T */
+	{"Acer", "TM8573T", "V1.13", 0x93, 0xa8, {0x14, 0x04}, 1},
 	/* Gateway */
 	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
 	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
@@ -741,9 +757,15 @@ MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5755G:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAO521*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5739G:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*One*753:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5315:");
 MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:");
+MODULE_ALIAS("dmi:*:*Acer*:TM8573T:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:");
@@ -752,6 +774,7 @@ MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnExtensa 5420*:");
 
 module_init(acerhdf_init);
 module_exit(acerhdf_exit);
Signature · 1 line
2.0.2
author maintainer
#66 lore raw

PATCH v5 3/6 thermal: Added Bang-bang thermal governor

In reply to Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/thermal/Kconfig         |  10 +++
 drivers/thermal/Makefile        |   1 +
 drivers/thermal/gov_bang_bang.c | 131 ++++++++++++++++++++++++++++++++++++++++
 drivers/thermal/thermal_core.c  |   5 ++
 drivers/thermal/thermal_core.h  |   8 +++
 5 files changed, 155 insertions(+)
 create mode 100644 drivers/thermal/gov_bang_bang.c
drivers/thermal/Kconfig +10 -0
index f9a1386..fa14d56 100644
@@ -84,6 +84,16 @@ config THERMAL_GOV_STEP_WISE
 	  Enable this to manage platform thermals using a simple linear
 	  governor.
 
+config THERMAL_GOV_BANG_BANG
+	bool "Bang Bang thermal governor"
+	default n
+	help
+	  Enable this to manage platform thermals using bang bang governor.
+
+	  Say 'Y' here if you want to use two point temperature regulation
+	  used for fans without throttling.  Some fan drivers depend on this
+	  governor to be enabled (e.g. acerhdf).
+
 config THERMAL_GOV_USER_SPACE
 	bool "User_space thermal governor"
 	help
drivers/thermal/Makefile +1 -0
index de0636a..a675980 100644
@@ -11,6 +11,7 @@ thermal_sys-$(CONFIG_THERMAL_OF)		+= of-thermal.o
 
 # governors
 thermal_sys-$(CONFIG_THERMAL_GOV_FAIR_SHARE)	+= fair_share.o
+thermal_sys-$(CONFIG_THERMAL_GOV_BANG_BANG)	+= gov_bang_bang.o
 thermal_sys-$(CONFIG_THERMAL_GOV_STEP_WISE)	+= step_wise.o
 thermal_sys-$(CONFIG_THERMAL_GOV_USER_SPACE)	+= user_space.o
 
drivers/thermal/gov_bang_bang.c new file +131 -0

131 lines not on this page · raw message

drivers/thermal/thermal_core.c +5 -0
index 71b0ec0..4c2726b 100644
@@ -1790,6 +1790,10 @@ static int __init thermal_register_governors(void)
 	if (result)
 		return result;
 
+	result = thermal_gov_bang_bang_register();
+	if (result)
+		return result;
+
 	return thermal_gov_user_space_register();
 }
 
@@ -1797,6 +1801,7 @@ static void thermal_unregister_governors(void)
 {
 	thermal_gov_step_wise_unregister();
 	thermal_gov_fair_share_unregister();
+	thermal_gov_bang_bang_unregister();
 	thermal_gov_user_space_unregister();
 }
 
drivers/thermal/thermal_core.h +8 -0
index 3db339f..d15d243 100644
@@ -69,6 +69,14 @@ static inline int thermal_gov_fair_share_register(void) { return 0; }
 static inline void thermal_gov_fair_share_unregister(void) {}
 #endif /* CONFIG_THERMAL_GOV_FAIR_SHARE */
 
+#ifdef CONFIG_THERMAL_GOV_BANG_BANG
+int thermal_gov_bang_bang_register(void);
+void thermal_gov_bang_bang_unregister(void);
+#else
+static inline int thermal_gov_bang_bang_register(void) { return 0; }
+static inline void thermal_gov_bang_bang_unregister(void) {}
+#endif /* CONFIG_THERMAL_GOV_BANG_BANG */
+
 #ifdef CONFIG_THERMAL_GOV_USER_SPACE
 int thermal_gov_user_space_register(void);
 void thermal_gov_user_space_unregister(void);
Signature · 1 line
2.0.2
author maintainer
#67 lore raw

Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor

Hi Rui,

Quoted 9 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>

Anything that prevents you from giving your acked-by?

[...]

Signature · 2 lines
kind regards,
--peter;
reviewer
#68 lore raw

Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor

Quoted 11 lines · Peter Feuerer

Hi Rui,

Quoted 7 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Quoted 5 lines
Quoted 2 lines
Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>

Anything that prevents you from giving your acked-by?

NO.

I'll queue them for 3.18.

thanks,
rui

author maintainer
#69 lore raw

Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor

Hi Rui,

Quoted 12 lines · Zhang Rui
Quoted 11 lines · Peter Feuerer

Hi Rui,

Quoted 7 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>

Anything that prevents you from giving your acked-by?

NO.

I'll queue them for 3.18.

Are all 6 patches in for 3.18 as you promissed?

kind regards,
--peter;

author maintainer
#70 lore raw

Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor

Hi Rui,

I wonder whether you've had time to apply my set of patches already? Would you please be so kind to just send me a short reply?

thanks and kind regards,
--peter;

Quoted 29 lines · Peter Feuerer

Hi Rui,

Quoted 12 lines · Zhang Rui
Quoted 11 lines · Peter Feuerer

Hi Rui,

Quoted 7 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>

Anything that prevents you from giving your acked-by?

NO.

I'll queue them for 3.18.

Are all 6 patches in for 3.18 as you promissed?

kind regards,
--peter;

#71 lore raw

Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor

Quoted 4 lines · Peter Feuerer

Hi Rui,

I wonder whether you've had time to apply my set of patches already? Would you please be so kind to just send me a short reply?

The bang-bang governor was merged and is part of v3.18-rc2:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8264fce6de03f3915e2301f52f181a982718a8cb

Cheers,
Javi

Quoted 37 lines
Quoted 21 lines · Peter Feuerer

Hi Rui,

Quoted 17 lines · Zhang Rui
Quoted 16 lines · Peter Feuerer

Hi Rui,

Quoted 9 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>

Anything that prevents you from giving your acked-by?

Quoted 8 lines
Quoted 3 lines

NO.

I'll queue them for 3.18.

Are all 6 patches in for 3.18 as you promissed?

kind regards,
--peter;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author maintainer
#72 lore raw

Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor

Hi Javi,

Quoted 8 lines · Javi Merino
Quoted 3 lines · Peter Feuerer

Hi Rui,

I wonder whether you've had time to apply my set of patches already? Would you please be so kind to just send me a short reply?

The bang-bang governor was merged and is part of v3.18-rc2:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=8264fce6de03f3915e2301f52f181a982718a8cb

Thanks for your mail.

Seems like the other 5 patches of the series were not applied. So I need to take care again, or?

kind regards,
--peter;

Quoted 42 lines

Cheers,
Javi

Quoted 37 lines
Quoted 21 lines · Peter Feuerer

Hi Rui,

Quoted 17 lines · Zhang Rui
Quoted 16 lines · Peter Feuerer

Hi Rui,

Quoted 9 lines · Peter Feuerer

The bang-bang thermal governor uses a hysteresis to switch abruptly on or off a cooling device. It is intended to control fans, which can not be throttled but just switched on or off.
Bang-bang cannot be set as default governor as it is intended for special devices only. For those special devices the driver needs to explicitely request it.

Cc Andrew Morton <[email protected]>
Cc Zhang Rui <[email protected]>

Anything that prevents you from giving your acked-by?

Quoted 8 lines
Quoted 3 lines

NO.

I'll queue them for 3.18.

Are all 6 patches in for 3.18 as you promissed?

kind regards,
--peter;

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

author maintainer
#73 lore raw

PATCH v5 4/6 acerhdf: Use bang-bang thermal governor

In reply to Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +2 -1
index 172f26c..b5e80dc 100644
@@ -38,7 +38,8 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG
+	depends on ACPI
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +31 -5
index f30767f..7fe7dbf 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.7.0"
 
 /*
  * According to the Atom N270 datasheet,
@@ -258,6 +258,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -439,6 +447,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip != 0)
+		return -EINVAL;
+
+	*temp = fanon - fanoff;
+
+	return 0;
+}
+
 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 				 unsigned long *temp)
 {
@@ -463,6 +482,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
 };
@@ -515,9 +535,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 	}
 
 	if (state == 0) {
-		/* turn fan off only if below fanoff temperature */
-		if ((cur_state == ACERHDF_FAN_AUTO) &&
-		    (cur_temp < fanoff))
+		if (cur_state == ACERHDF_FAN_AUTO)
 			acerhdf_change_fanstate(ACERHDF_FAN_OFF);
 	} else {
 		if (cur_state == ACERHDF_FAN_OFF)
@@ -696,11 +714,19 @@ static int acerhdf_register_thermal(void)
 		return -EINVAL;
 
 	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+					      &acerhdf_dev_ops,
+					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
 	if (IS_ERR(thz_dev))
 		return -EINVAL;
 
+	if (strcmp(thz_dev->governor->name,
+				acerhdf_zone_params.governor_name)) {
+		pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",
+				acerhdf_zone_params.governor_name);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.0.2
reviewer
#74 lore raw

Re: [PATCH v5 4/6] acerhdf: Use bang-bang thermal governor

Quoted 11 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>

Peter,

will you take this patch, or do you want me to take this patch along with Patch 3/6?

thanks,
rui

Quoted 105 lines
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +2 -1
index 172f26c..b5e80dc 100644
@@ -38,7 +38,8 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG
+	depends on ACPI
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +31 -5
index f30767f..7fe7dbf 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.7.0"
 
 /*
  * According to the Atom N270 datasheet,
@@ -258,6 +258,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -439,6 +447,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip != 0)
+		return -EINVAL;
+
+	*temp = fanon - fanoff;
+
+	return 0;
+}
+
 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 				 unsigned long *temp)
 {
@@ -463,6 +482,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
 };
@@ -515,9 +535,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 	}
 
 	if (state == 0) {
-		/* turn fan off only if below fanoff temperature */
-		if ((cur_state == ACERHDF_FAN_AUTO) &&
-		    (cur_temp < fanoff))
+		if (cur_state == ACERHDF_FAN_AUTO)
 			acerhdf_change_fanstate(ACERHDF_FAN_OFF);
 	} else {
 		if (cur_state == ACERHDF_FAN_OFF)
@@ -696,11 +714,19 @@ static int acerhdf_register_thermal(void)
 		return -EINVAL;
 
 	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+					      &acerhdf_dev_ops,
+					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
 	if (IS_ERR(thz_dev))
 		return -EINVAL;
 
+	if (strcmp(thz_dev->governor->name,
+				acerhdf_zone_params.governor_name)) {
+		pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",
+				acerhdf_zone_params.governor_name);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
author maintainer
#75 lore raw

Re: [PATCH v5 4/6] acerhdf: Use bang-bang thermal governor

Quoted 13 lines · Zhang Rui
Quoted 11 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>
Quoted 4 lines

Peter,

will you take this patch, or do you want me to take this patch along with Patch 3/6?

Hi Rui,

please apply the whole series. I don't have a git repository where Linus pulls from.

thanks and kind regards,
--peter;

Quoted 110 lines

thanks,
rui

Quoted 105 lines
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +2 -1
index 172f26c..b5e80dc 100644
@@ -38,7 +38,8 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG
+	depends on ACPI
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +31 -5
index f30767f..7fe7dbf 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.7.0"
 
 /*
  * According to the Atom N270 datasheet,
@@ -258,6 +258,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -439,6 +447,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip != 0)
+		return -EINVAL;
+
+	*temp = fanon - fanoff;
+
+	return 0;
+}
+
 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 				 unsigned long *temp)
 {
@@ -463,6 +482,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
 };
@@ -515,9 +535,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 	}
 
 	if (state == 0) {
-		/* turn fan off only if below fanoff temperature */
-		if ((cur_state == ACERHDF_FAN_AUTO) &&
-		    (cur_temp < fanoff))
+		if (cur_state == ACERHDF_FAN_AUTO)
 			acerhdf_change_fanstate(ACERHDF_FAN_OFF);
 	} else {
 		if (cur_state == ACERHDF_FAN_OFF)
@@ -696,11 +714,19 @@ static int acerhdf_register_thermal(void)
 		return -EINVAL;
 
 	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+					      &acerhdf_dev_ops,
+					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
 	if (IS_ERR(thz_dev))
 		return -EINVAL;
 
+	if (strcmp(thz_dev->governor->name,
+				acerhdf_zone_params.governor_name)) {
+		pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",
+				acerhdf_zone_params.governor_name);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
reviewer
#76 lore raw

Re: [PATCH v5 4/6] acerhdf: Use bang-bang thermal governor

Quoted 17 lines · Peter Feuerer
Quoted 15 lines · Zhang Rui
Quoted 11 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>

Peter,

Quoted 8 lines
Quoted 2 lines

will you take this patch, or do you want me to take this patch along with Patch 3/6?

Hi Rui,

please apply the whole series. I don't have a git repository where Linus pulls from.

No, I can not apply the whole series.
I should take patch 3/6, and the others should goto Matthew Garrett' tree. Or I can take them with Matthew' Acked-by.

thanks,
rui

Quoted 114 lines

thanks and kind regards,
--peter;

Quoted 110 lines

thanks,
rui

Quoted 105 lines
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +2 -1
index 172f26c..b5e80dc 100644
@@ -38,7 +38,8 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG
+	depends on ACPI
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +31 -5
index f30767f..7fe7dbf 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.7.0"
 
 /*
  * According to the Atom N270 datasheet,
@@ -258,6 +258,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -439,6 +447,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip != 0)
+		return -EINVAL;
+
+	*temp = fanon - fanoff;
+
+	return 0;
+}
+
 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 				 unsigned long *temp)
 {
@@ -463,6 +482,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
 };
@@ -515,9 +535,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 	}
 
 	if (state == 0) {
-		/* turn fan off only if below fanoff temperature */
-		if ((cur_state == ACERHDF_FAN_AUTO) &&
-		    (cur_temp < fanoff))
+		if (cur_state == ACERHDF_FAN_AUTO)
 			acerhdf_change_fanstate(ACERHDF_FAN_OFF);
 	} else {
 		if (cur_state == ACERHDF_FAN_OFF)
@@ -696,11 +714,19 @@ static int acerhdf_register_thermal(void)
 		return -EINVAL;
 
 	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+					      &acerhdf_dev_ops,
+					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
 	if (IS_ERR(thz_dev))
 		return -EINVAL;
 
+	if (strcmp(thz_dev->governor->name,
+				acerhdf_zone_params.governor_name)) {
+		pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",
+				acerhdf_zone_params.governor_name);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
#77 lore raw

Re: [PATCH v5 4/6] acerhdf: Use bang-bang thermal governor

Quoted 3 lines · Zhang Rui

No, I can not apply the whole series.
I should take patch 3/6, and the others should goto Matthew Garrett' tree. Or I can take them with Matthew' Acked-by.

So put him on CC.

Matt, can you please ack those?

Btw, I've added the new maintainer too :-)

Thanks.

Signature · 5 lines
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--
author maintainer
#78 lore raw

PATCH v5 5/6 acerhdf: added critical trip point

In reply to Peter Feuerer

added critical trip point which represents the temperature limit. Added return -EINVAL in case wrong trip point is provided.

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +9 -1
index 7fe7dbf..91b16c8 100644
@@ -443,6 +443,10 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*type = THERMAL_TRIP_ACTIVE;
+	else if (trip == 1)
+		*type = THERMAL_TRIP_CRITICAL;
+	else
+		return -EINVAL;
 
 	return 0;
 }
@@ -463,6 +467,10 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*temp = fanon;
+	else if (trip == 1)
+		*temp = ACERHDF_TEMP_CRIT;
+	else
+		return -EINVAL;
 
 	return 0;
 }
@@ -713,7 +721,7 @@ static int acerhdf_register_thermal(void)
 	if (IS_ERR(cl_dev))
 		return -EINVAL;
 
-	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
+	thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL,
 					      &acerhdf_dev_ops,
 					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
Signature · 1 line
2.0.2
author maintainer
#79 lore raw

Re: [PATCH v5 5/6] acerhdf: added critical trip point

Hi Boris,

Quoted 6 lines · Peter Feuerer

added critical trip point which represents the temperature limit. Added return -EINVAL in case wrong trip point is provided.

Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>

Any concerns regarding this patch?

Signature · 1 line
--peter;
author maintainer
#80 lore raw

PATCH v5 6/6 acerhdf: minor clean up

In reply to Peter Feuerer

* renamed bios_settings_t to bios_settings, as it is no typedef
* replaced "unsigned char" by u8 in bios_settings struct for better readability.

---
 drivers/platform/x86/acerhdf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/platform/x86/acerhdf.c +6 -6
index 91b16c8..c07623c 100644
@@ -131,18 +131,18 @@ static const struct manualcmd mcmd = {
 };
 
 /* BIOS settings */
-struct bios_settings_t {
+struct bios_settings {
 	const char *vendor;
 	const char *product;
 	const char *version;
-	unsigned char fanreg;
-	unsigned char tempreg;
+	u8 fanreg;
+	u8 tempreg;
 	struct fancmd cmd;
 	int mcmd_enable;
 };
 
 /* Register addresses and values for different BIOS versions */
-static const struct bios_settings_t bios_tbl[] = {
+static const struct bios_settings bios_tbl[] = {
 	/* AOA110 */
 	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
 	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
@@ -256,7 +256,7 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"", "", "", 0, 0, {0, 0}, 0}
 };
 
-static const struct bios_settings_t *bios_cfg __read_mostly;
+static const struct bios_settings *bios_cfg __read_mostly;
 
 /*
  * this struct is used to instruct thermal layer to use bang_bang instead of
@@ -619,7 +619,7 @@ static int str_starts_with(const char *str, const char *start)
 static int acerhdf_check_hardware(void)
 {
 	char const *vendor, *version, *product;
-	const struct bios_settings_t *bt = NULL;
+	const struct bios_settings *bt = NULL;
 
 	/* get BIOS data */
 	vendor  = dmi_get_system_info(DMI_SYS_VENDOR);
Signature · 1 line
2.0.2
author maintainer
#81 lore raw

v5 cover acerhdf: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer

Hi Darren,

please apply this series of patches.

It is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

* Add an appropriate thermal governor (Patch 3). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 4)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 5)

Thanks and kind regards,
peter

Peter Feuerer (5):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
acerhdf: Use bang-bang thermal governor
acerhdf: added critical trip point
acerhdf: minor clean up

 drivers/platform/x86/Kconfig   |   3 +-
 drivers/platform/x86/acerhdf.c | 265 ++++++++++++++++++++++++++---------------
 2 files changed, 172 insertions(+), 96 deletions(-)
Signature · 1 line
2.1.3
author maintainer
#82 lore raw

PATCH RESEND v5 1/5 acerhdf: Adding support for "manual mode"

Some Acer models require an additional command to turn off the fan after bios mode has been enabled. Adding new section in bios table to allow support for those models, by writing an extra "manual mode" register.

---
 drivers/platform/x86/acerhdf.c | 186 ++++++++++++++++++++++-------------------
 1 file changed, 102 insertions(+), 84 deletions(-)
drivers/platform/x86/acerhdf.c +102 -84
index f94467c..2c58f10 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.26"
+#define DRV_VER "0.5.29"
 
 /*
  * According to the Atom N270 datasheet,
@@ -119,6 +119,17 @@ struct fancmd {
 	u8 cmd_auto;
 };
 
+struct manualcmd {
+	u8 mreg;
+	u8 moff;
+};
+
+/* default register and command to disable fan in manual mode */
+static const struct manualcmd mcmd = {
+	.mreg = 0x94,
+	.moff = 0xff,
+};
+
 /* BIOS settings */
 struct bios_settings_t {
 	const char *vendor;
@@ -127,105 +138,106 @@ struct bios_settings_t {
 	unsigned char fanreg;
 	unsigned char tempreg;
 	struct fancmd cmd;
+	int mcmd_enable;
 };
 
 /* Register addresses and values for different BIOS versions */
 static const struct bios_settings_t bios_tbl[] = {
 	/* AOA110 */
-	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00} },
-	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00} },
-	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3301", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3304", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3305", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3307", 0x55, 0x58, {0xaf, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3308", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3309", 0x55, 0x58, {0x21, 0x00}, 0},
+	{"Acer", "AOA110", "v0.3310", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* AOA150 */
-	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00} },
-	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AOA150", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3301", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3305", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3307", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3308", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3309", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AOA150", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* LT1005u */
-	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "LT-10Q", "v0.3310", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 1410 */
-	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1410", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1410", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 1810xx */
-	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1810TZ", "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3108", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3113", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3115", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3117", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3119", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v0.3120", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3204", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3303", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3308", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer 531 */
-	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00} },
-	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00} },
+	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
+	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
-	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00} },
+	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
 	/* Acer 1825 */
-	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00} },
-	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00} },
+	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Acer TravelMate 7730 */
-	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00} },
+	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
 	/* Gateway */
-	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00} },
-	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00} },
-	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
+	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3103",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Gateway", "LT31",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
 	/* Packard Bell */
-	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00} },
-	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00} },
-	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00} },
+	{"Packard Bell", "DOA150",  "v0.3104",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "DOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "AOA110",  "v0.3105",  0x55, 0x58, {0x21, 0x00}, 0},
+	{"Packard Bell", "AOA150",  "v0.3105",  0x55, 0x58, {0x20, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3118",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "ENBFT",   "V1.3127",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3303",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3120",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3108",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3113",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3115",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3117",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v0.3119",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMU",   "v1.3204",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3201",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3302",  0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTMA",   "v1.3303t", 0x55, 0x58, {0x9e, 0x00}, 0},
+	{"Packard Bell", "DOTVR46", "v1.3308",  0x55, 0x58, {0x9e, 0x00}, 0},
 	/* pewpew-terminator */
-	{"", "", "", 0, 0, {0, 0} }
+	{"", "", "", 0, 0, {0, 0}, 0}
 };
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
@@ -275,6 +287,12 @@ static void acerhdf_change_fanstate(int state)
 	fanstate = state;
 
 	ec_write(bios_cfg->fanreg, cmd);
+
+	if (bios_cfg->mcmd_enable && state == ACERHDF_FAN_OFF) {
+		if (verbose)
+			pr_notice("turning off fan manually\n");
+		ec_write(mcmd.mreg, mcmd.moff);
+	}
 }
 
 static void acerhdf_check_param(struct thermal_zone_device *thermal)
Signature · 1 line
2.1.3
author maintainer
#83 lore raw

PATCH RESEND v5 2/5 acerhdf: Adding support for new models

In reply to Peter Feuerer

added following new models:
* Aspire 5755G
* AO521
* AO751h
* Aspire One 753
* Extensa 5420
* Aspire 5315
* Aspire 5739G
* TravelMate TM8573T

---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +24 -1
index 2c58f10..f30767f 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.29"
+#define DRV_VER "0.5.30"
 
 /*
  * According to the Atom N270 datasheet,
@@ -199,17 +199,33 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"Acer", "Aspire 1810T",  "v1.3310", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810TZ", "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1810T",  "v1.3314", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer 5755G */
+	{"Acer", "Aspire 5755G",  "V1.20",   0xab, 0xb4, {0x00, 0x08}, 0},
+	{"Acer", "Aspire 5755G",  "V1.21",   0xab, 0xb3, {0x00, 0x08}, 0},
+	/* Acer 521 */
+	{"Acer", "AO521", "V1.11", 0x55, 0x58, {0x1f, 0x00}, 0},
 	/* Acer 531 */
 	{"Acer", "AO531h", "v0.3104", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3201", 0x55, 0x58, {0x20, 0x00}, 0},
 	{"Acer", "AO531h", "v0.3304", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer 751 */
+	{"Acer", "AO751h", "V0.3206", 0x55, 0x58, {0x21, 0x00}, 0},
 	{"Acer", "AO751h", "V0.3212", 0x55, 0x58, {0x21, 0x00}, 0},
+	/* Acer 753 */
+	{"Acer", "Aspire One 753", "V1.24", 0x93, 0xac, {0x14, 0x04}, 1},
 	/* Acer 1825 */
 	{"Acer", "Aspire 1825PTZ", "V1.3118", 0x55, 0x58, {0x9e, 0x00}, 0},
 	{"Acer", "Aspire 1825PTZ", "V1.3127", 0x55, 0x58, {0x9e, 0x00}, 0},
+	/* Acer Extensa 5420 */
+	{"Acer", "Extensa 5420", "V1.17", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5315 */
+	{"Acer", "Aspire 5315", "V1.19", 0x93, 0xac, {0x14, 0x04}, 1},
+	/* Acer Aspire 5739 */
+	{"Acer", "Aspire 5739G", "V1.3311", 0x55, 0x58, {0x20, 0x00}, 0},
 	/* Acer TravelMate 7730 */
 	{"Acer", "TravelMate 7730G", "v0.3509", 0x55, 0x58, {0xaf, 0x00}, 0},
+	/* Acer TravelMate TM8573T */
+	{"Acer", "TM8573T", "V1.13", 0x93, 0xa8, {0x14, 0x04}, 1},
 	/* Gateway */
 	{"Gateway", "AOA110", "v0.3103",  0x55, 0x58, {0x21, 0x00}, 0},
 	{"Gateway", "AOA150", "v0.3103",  0x55, 0x58, {0x20, 0x00}, 0},
@@ -741,9 +757,15 @@ MODULE_ALIAS("dmi:*:*Acer*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO751h*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1410*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1810*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5755G:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAspire*1825PTZ:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAO521*:");
 MODULE_ALIAS("dmi:*:*Acer*:pnAO531*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5739G:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*One*753:");
+MODULE_ALIAS("dmi:*:*Acer*:pnAspire*5315:");
 MODULE_ALIAS("dmi:*:*Acer*:TravelMate*7730G:");
+MODULE_ALIAS("dmi:*:*Acer*:TM8573T:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnAOA*:");
 MODULE_ALIAS("dmi:*:*Gateway*:pnLT31*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnAOA*:");
@@ -752,6 +774,7 @@ MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMU*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnENBFT*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTMA*:");
 MODULE_ALIAS("dmi:*:*Packard*Bell*:pnDOTVR46*:");
+MODULE_ALIAS("dmi:*:*Acer*:pnExtensa 5420*:");
 
 module_init(acerhdf_init);
 module_exit(acerhdf_exit);
Signature · 1 line
2.1.3
author maintainer
#84 lore raw

PATCH RESEND v5 3/5 acerhdf: Use bang-bang thermal governor

In reply to Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Darren Hart <[email protected]>
Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +2 -1
index a2eabe6..c173266 100644
@@ -38,7 +38,8 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG
+	depends on ACPI
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +31 -5
index f30767f..7fe7dbf 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.7.0"
 
 /*
  * According to the Atom N270 datasheet,
@@ -258,6 +258,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -439,6 +447,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip != 0)
+		return -EINVAL;
+
+	*temp = fanon - fanoff;
+
+	return 0;
+}
+
 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 				 unsigned long *temp)
 {
@@ -463,6 +482,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
 };
@@ -515,9 +535,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 	}
 
 	if (state == 0) {
-		/* turn fan off only if below fanoff temperature */
-		if ((cur_state == ACERHDF_FAN_AUTO) &&
-		    (cur_temp < fanoff))
+		if (cur_state == ACERHDF_FAN_AUTO)
 			acerhdf_change_fanstate(ACERHDF_FAN_OFF);
 	} else {
 		if (cur_state == ACERHDF_FAN_OFF)
@@ -696,11 +714,19 @@ static int acerhdf_register_thermal(void)
 		return -EINVAL;
 
 	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+					      &acerhdf_dev_ops,
+					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
 	if (IS_ERR(thz_dev))
 		return -EINVAL;
 
+	if (strcmp(thz_dev->governor->name,
+				acerhdf_zone_params.governor_name)) {
+		pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",
+				acerhdf_zone_params.governor_name);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.1.3
#85 lore raw

Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor

Quoted 23 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Darren Hart <[email protected]>
Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +0 -0
index a2eabe6..c173266 100644

drivers/platform/x86/Kconfig config ACER_WMI · line 41

Quoted 5 lines
drivers/platform/x86/Kconfig +1 -1
@@ -38,7 +38,8 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG

So we use select sparingly as it does implicit things.

I checked the THERMAL_GOV_BANG_BANG Kconfig entry, and the help says acerhdf already depends on it (which it doesn't appear to). Any particular reason to add select here instead of adding it as a depends.

Why did you drop THERMAL?

Quoted 18 lines
drivers/platform/x86/Kconfig +1 -0
+	depends on ACPI
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +1 -1
index f30767f..7fe7dbf 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.7.0"
 
 /*
  * According to the Atom N270 datasheet,

drivers/platform/x86/acerhdf.c static const struct bios_settings_t bios_tbl[] = { · line 263

Quoted 6 lines
drivers/platform/x86/acerhdf.c +3 -0
@@ -258,6 +258,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf

Please use sentence punctuation, particularly for block comments.

/*
* This struct...
* default ... for acerhdf.
*/

Quoted 50 lines
drivers/platform/x86/acerhdf.c +18 -4
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -439,6 +447,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip != 0)
+		return -EINVAL;
+
+	*temp = fanon - fanoff;
+
+	return 0;
+}
+
 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 				 unsigned long *temp)
 {
@@ -463,6 +482,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
 };
@@ -515,9 +535,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 	}
 
 	if (state == 0) {
-		/* turn fan off only if below fanoff temperature */
-		if ((cur_state == ACERHDF_FAN_AUTO) &&
-		    (cur_temp < fanoff))
+		if (cur_state == ACERHDF_FAN_AUTO)
 			acerhdf_change_fanstate(ACERHDF_FAN_OFF);
 	} else {
 		if (cur_state == ACERHDF_FAN_OFF)
@@ -696,11 +714,19 @@ static int acerhdf_register_thermal(void)
 		return -EINVAL;
 
 	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,

drivers/platform/x86/acerhdf.c static int acerhdf_register_thermal(void) · line 726

Quoted 10 lines
drivers/platform/x86/acerhdf.c +6 -0
+					      &acerhdf_dev_ops,
+					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
 	if (IS_ERR(thz_dev))
 		return -EINVAL;
 
+	if (strcmp(thz_dev->governor->name,
+				acerhdf_zone_params.governor_name)) {
+		pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",
+				acerhdf_zone_params.governor_name);

We've ensured it has to be compiled in, so that really can't be it. Right?

Quoted 10 lines
drivers/platform/x86/acerhdf.c +3 -0
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
Signature · 1 line
2.1.3
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
author maintainer
#86 lore raw

Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor

Hi Darren,

thank you very much for your reply.

Quoted 32 lines · Darren Hart
Quoted 23 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Darren Hart <[email protected]>
Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +0 -0
index a2eabe6..c173266 100644

drivers/platform/x86/Kconfig config ACER_WMI · line 41

Quoted 5 lines
drivers/platform/x86/Kconfig +1 -1
@@ -38,7 +38,8 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG

So we use select sparingly as it does implicit things.

Quoted 5 lines

I checked the THERMAL_GOV_BANG_BANG Kconfig entry, and the help says acerhdf already depends on it (which it doesn't appear to). Any particular reason to add select here instead of adding it as a depends.

Why did you drop THERMAL?

I had it like this in my first version of patches:
+ depends on THERMAL && ACPI && THERMAL_GOV_BANG_BANG

But after some discussion with lkml community we ended up with the select line and dropped THERMAL dependency, as it is implied by THEMAL_GOV_BANG_BANG. I'm not so experienced with Kconfig, so I must rely on the statements of the community in this case.

Quoted 19 lines
Quoted 19 lines
drivers/platform/x86/Kconfig +1 -0
+	depends on ACPI
 	---help---
 	  This is a driver for Acer Aspire One netbooks. It allows to access
 	  the temperature sensor and to control the fan.
drivers/platform/x86/acerhdf.c +1 -1
index f30767f..7fe7dbf 100644
@@ -50,7 +50,7 @@
  */
 #undef START_IN_KERNEL_MODE
 
-#define DRV_VER "0.5.30"
+#define DRV_VER "0.7.0"
 
 /*
  * According to the Atom N270 datasheet,
@@ -258,6 +258,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
Quoted 7 lines

drivers/platform/x86/acerhdf.c static const struct bios_settings_t bios_tbl[] = { · line 263

Quoted 5 lines
drivers/platform/x86/acerhdf.c +3 -0
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/*
+ * this struct is used to instruct thermal layer to use bang_bang instead of
+ * default governor for acerhdf

Please use sentence punctuation, particularly for block comments.

ok.

Quoted 61 lines

/*
* This struct...
* default ... for acerhdf.
*/

Quoted 56 lines
drivers/platform/x86/acerhdf.c +20 -4
+ */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -439,6 +447,17 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 	return 0;
 }
 
+static int acerhdf_get_trip_hyst(struct thermal_zone_device *thermal, int trip,
+				 unsigned long *temp)
+{
+	if (trip != 0)
+		return -EINVAL;
+
+	*temp = fanon - fanoff;
+
+	return 0;
+}
+
 static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 				 unsigned long *temp)
 {
@@ -463,6 +482,7 @@ static struct thermal_zone_device_ops acerhdf_dev_ops = {
 	.get_mode = acerhdf_get_mode,
 	.set_mode = acerhdf_set_mode,
 	.get_trip_type = acerhdf_get_trip_type,
+	.get_trip_hyst = acerhdf_get_trip_hyst,
 	.get_trip_temp = acerhdf_get_trip_temp,
 	.get_crit_temp = acerhdf_get_crit_temp,
 };
@@ -515,9 +535,7 @@ static int acerhdf_set_cur_state(struct thermal_cooling_device *cdev,
 	}
 
 	if (state == 0) {
-		/* turn fan off only if below fanoff temperature */
-		if ((cur_state == ACERHDF_FAN_AUTO) &&
-		    (cur_temp < fanoff))
+		if (cur_state == ACERHDF_FAN_AUTO)
 			acerhdf_change_fanstate(ACERHDF_FAN_OFF);
 	} else {
 		if (cur_state == ACERHDF_FAN_OFF)
@@ -696,11 +714,19 @@ static int acerhdf_register_thermal(void)
 		return -EINVAL;
 
 	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+					      &acerhdf_dev_ops,
+					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
 	if (IS_ERR(thz_dev))
 		return -EINVAL;
 
Quoted 6 lines

drivers/platform/x86/acerhdf.c static int acerhdf_register_thermal(void) · line 726

Quoted 4 lines
drivers/platform/x86/acerhdf.c +4 -0
+	if (strcmp(thz_dev->governor->name,
+				acerhdf_zone_params.governor_name)) {
+		pr_err("Didn't get thermal governor %s, perhaps not compiled into thermal subsystem.\n",
+				acerhdf_zone_params.governor_name);

We've ensured it has to be compiled in, so that really can't be it. Right?

Yes, you are right, but if it is no real blocker for you, I'd like to keep this code in as I'm providing the acerhdf.c code in a separate package for debugging / testing too and people could use the code without the Kconfig.

Signature · 2 lines
kind regards,
--peter;
author maintainer
#87 lore raw

Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor

Hi again,

Quoted 43 lines · Peter Feuerer

Hi Darren,

thank you very much for your reply.

Quoted 36 lines · Darren Hart
Quoted 23 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Darren Hart <[email protected]>
Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +0 -0
index a2eabe6..c173266 100644

drivers/platform/x86/Kconfig config ACER_WMI · line 41

Quoted 5 lines
drivers/platform/x86/Kconfig +1 -1
@@ -38,7 +38,8 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG

So we use select sparingly as it does implicit things.

I checked the THERMAL_GOV_BANG_BANG Kconfig entry, and the help says acerhdf already depends on it (which it doesn't appear to). Any particular reason to add select here instead of adding it as a depends.

Quoted 6 lines
Quoted 1 line

Why did you drop THERMAL?

I had it like this in my first version of patches:
+ depends on THERMAL && ACPI && THERMAL_GOV_BANG_BANG

But after some discussion with lkml community we ended up with the select line and dropped THERMAL dependency, as it is implied by THEMAL_GOV_BANG_BANG. I'm not so experienced with Kconfig, so I must rely on the statements of the community in this case.

Just found the link about this discussion I had with Rui and Boris:
http://linux-kernel.2935.n7.nabble.com/PATCH-0-4-acerhdf-thermal-adding-new-models-and-appropriate-governor-tp848572p908256.html

[...]

Signature · 2 lines
kind regards,
--peter;
#88 lore raw

Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor

Quoted 51 lines · Peter Feuerer

Hi again,

Quoted 47 lines · Peter Feuerer

Hi Darren,

thank you very much for your reply.

Quoted 31 lines · Darren Hart
Quoted 25 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Darren Hart <[email protected]>
Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>

---
drivers/platform/x86/Kconfig | 3 ++-
drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----

2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +0 -0
index a2eabe6..c173266 100644
@@ -38,7 +38,8 @@ config ACER_WMI

config ACERHDF
tristate "Acer Aspire One temperature and fan driver"

drivers/platform/x86/Kconfig config ACER_WMI · line 41

Quoted 2 lines
drivers/platform/x86/Kconfig +1 -1
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG

So we use select sparingly as it does implicit things.

Quoted 5 lines

I checked the THERMAL_GOV_BANG_BANG Kconfig entry, and the help says acerhdf already depends on it (which it doesn't appear to). Any particular reason to add select here instead of adding it as a depends.

Why did you drop THERMAL?

I had it like this in my first version of patches:
+ depends on THERMAL && ACPI && THERMAL_GOV_BANG_BANG

Quoted 8 lines
Quoted 4 lines

But after some discussion with lkml community we ended up with the select line and dropped THERMAL dependency, as it is implied by THEMAL_GOV_BANG_BANG. I'm not so experienced with Kconfig, so I must rely on the statements of the community in this case.

Just found the link about this discussion I had with Rui and Boris:
http://linux-kernel.2935.n7.nabble.com/PATCH-0-4-acerhdf-thermal-adding-new-models-and-appropriate-governor-tp848572p908256.html

Rui,

I see you said you agree with the approach to "select THERMAL_GOV_BANG_BANG", and I'm OK with that. But that doesn't ensure, as far as I can see, a sufficient set of Kconfig dependencies for ACERHDF as THERMAL_GOV_BANG_BANG doesn't in turn select THERMAL.

While it's unlikely to get ACERHDF available without THERMAL enabled, it does look possible. Should this driver also select or depends on THERMAL?

Maybe:

depends on ACPI
depends on THERMAL
select THERMAL_GOV_BANG_BANG

?

Quoted 6 lines

[...]

Signature · 2 lines
kind regards,
--peter;
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
author maintainer
#89 lore raw

Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor

In reply to Peter Feuerer

Hi Darren,

I know you are busy and I don't want to stress you, but have you had time to look to this? I'd be really happy to solve all issues in time and have those patches finally applied.

kind regards,
--peter;

Quoted 62 lines · Peter Feuerer

Hi again,

Quoted 43 lines · Peter Feuerer

Hi Darren,

thank you very much for your reply.

Quoted 36 lines · Darren Hart
Quoted 23 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Darren Hart <[email protected]>
Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +0 -0
index a2eabe6..c173266 100644

drivers/platform/x86/Kconfig config ACER_WMI · line 41

Quoted 5 lines
drivers/platform/x86/Kconfig +1 -1
@@ -38,7 +38,8 @@ config ACER_WMI
 
 config ACERHDF
 	tristate "Acer Aspire One temperature and fan driver"
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG

So we use select sparingly as it does implicit things.

I checked the THERMAL_GOV_BANG_BANG Kconfig entry, and the help says acerhdf already depends on it (which it doesn't appear to). Any particular reason to add select here instead of adding it as a depends.

Quoted 6 lines
Quoted 1 line

Why did you drop THERMAL?

I had it like this in my first version of patches:
+ depends on THERMAL && ACPI && THERMAL_GOV_BANG_BANG

But after some discussion with lkml community we ended up with the select line and dropped THERMAL dependency, as it is implied by THEMAL_GOV_BANG_BANG. I'm not so experienced with Kconfig, so I must rely on the statements of the community in this case.

Just found the link about this discussion I had with Rui and Boris:
http://linux-kernel.2935.n7.nabble.com/PATCH-0-4-acerhdf-thermal-adding-new-models-and-appropriate-governor-tp848572p908256.html

[...]

Signature · 2 lines
kind regards,
--peter;
#90 lore raw

Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor

Quoted 5 lines · Peter Feuerer

Hi Darren,

I know you are busy and I don't want to stress you, but have you had time to look to this? I'd be really happy to solve all issues in time and have those patches finally applied.

Not yet. I've been traveling to Mexico and wrapping up the current for-next patches. FYI, also dealing with a very sick kid these last couple of days, so I've been rather tied up. I hope to get to these in the next few days.

You've provided the link to the discussion which is what I needed, thanks.

Thanks,

Darren

Quoted 72 lines

kind regards,
--peter;

Quoted 64 lines · Peter Feuerer

Hi again,

Quoted 44 lines · Peter Feuerer

Hi Darren,

thank you very much for your reply.

Quoted 31 lines · Darren Hart
Quoted 25 lines · Peter Feuerer

acerhdf has been doing an on-off fan control using hysteresis by post-manipulating the outcome of thermal subsystem trip point handling. This patch enables acerhdf to use the bang-bang governor, which is intended for on-off controlled fans.

Cc Darren Hart <[email protected]>
Cc Andrew Morton <[email protected]>
CC Zhang Rui <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Javi Merino <[email protected]>

---
drivers/platform/x86/Kconfig | 3 ++-
drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----

2 files changed, 33 insertions(+), 6 deletions(-)
drivers/platform/x86/Kconfig +0 -0
index a2eabe6..c173266 100644
@@ -38,7 +38,8 @@ config ACER_WMI

config ACERHDF
tristate "Acer Aspire One temperature and fan driver"

drivers/platform/x86/Kconfig config ACER_WMI · line 41

Quoted 2 lines
drivers/platform/x86/Kconfig +1 -1
-	depends on THERMAL && ACPI
+	select THERMAL_GOV_BANG_BANG

So we use select sparingly as it does implicit things.

Quoted 5 lines

I checked the THERMAL_GOV_BANG_BANG Kconfig entry, and the help says acerhdf already depends on it (which it doesn't appear to). Any particular reason to add select here instead of adding it as a depends.

Why did you drop THERMAL?

Quoted 7 lines

I had it like this in my first version of patches:
+ depends on THERMAL && ACPI && THERMAL_GOV_BANG_BANG

But after some discussion with lkml community we ended up with the select line and dropped THERMAL dependency, as it is implied by THEMAL_GOV_BANG_BANG. I'm not so experienced with Kconfig, so I must rely on the statements of the community in this case.

Just found the link about this discussion I had with Rui and Boris:
http://linux-kernel.2935.n7.nabble.com/PATCH-0-4-acerhdf-thermal-adding-new-models-and-appropriate-governor-tp848572p908256.html

[...]

Signature · 2 lines
kind regards,
--peter;
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
author maintainer
#91 lore raw

PATCH RESEND v5 4/5 acerhdf: added critical trip point

In reply to Peter Feuerer

added critical trip point which represents the temperature limit. Added return -EINVAL in case wrong trip point is provided.

Cc Darren Hart <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +9 -1
index 7fe7dbf..91b16c8 100644
@@ -443,6 +443,10 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*type = THERMAL_TRIP_ACTIVE;
+	else if (trip == 1)
+		*type = THERMAL_TRIP_CRITICAL;
+	else
+		return -EINVAL;
 
 	return 0;
 }
@@ -463,6 +467,10 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*temp = fanon;
+	else if (trip == 1)
+		*temp = ACERHDF_TEMP_CRIT;
+	else
+		return -EINVAL;
 
 	return 0;
 }
@@ -713,7 +721,7 @@ static int acerhdf_register_thermal(void)
 	if (IS_ERR(cl_dev))
 		return -EINVAL;
 
-	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
+	thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL,
 					      &acerhdf_dev_ops,
 					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
Signature · 1 line
2.1.3
#92 lore raw

Re: [RESEND PATCH v5 4/5] acerhdf: added critical trip point

Quoted 1 line · Peter Feuerer

added critical trip point which represents the temperature limit.

Nitpic, Add ^

Quoted 1 line

Added return -EINVAL in case wrong trip point is provided.

Add (we are going to add it with this patch, it wasn't added previously). It's a nitpic. But this is more consistent with typical commit message language.

I might normally just fix that upon commit, but since I had a few questions on the last one, if that results in a V2, please correct this as well.

Quoted 51 lines
Cc Darren Hart <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Andreas Mohr <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Javi Merino <[email protected]>
---
 drivers/platform/x86/acerhdf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/platform/x86/acerhdf.c +9 -1
index 7fe7dbf..91b16c8 100644
@@ -443,6 +443,10 @@ static int acerhdf_get_trip_type(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*type = THERMAL_TRIP_ACTIVE;
+	else if (trip == 1)
+		*type = THERMAL_TRIP_CRITICAL;
+	else
+		return -EINVAL;
 
 	return 0;
 }
@@ -463,6 +467,10 @@ static int acerhdf_get_trip_temp(struct thermal_zone_device *thermal, int trip,
 {
 	if (trip == 0)
 		*temp = fanon;
+	else if (trip == 1)
+		*temp = ACERHDF_TEMP_CRIT;
+	else
+		return -EINVAL;
 
 	return 0;
 }
@@ -713,7 +721,7 @@ static int acerhdf_register_thermal(void)
 	if (IS_ERR(cl_dev))
 		return -EINVAL;
 
-	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
+	thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL,
 					      &acerhdf_dev_ops,
 					      &acerhdf_zone_params, 0,
 					      (kernelmode) ? interval*1000 : 0);
Signature · 1 line
2.1.3
Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
author maintainer
#93 lore raw

PATCH RESEND v5 5/5 acerhdf: minor clean up

In reply to Peter Feuerer

* renamed bios_settings_t to bios_settings, as it is no typedef
* replaced "unsigned char" by u8 in bios_settings struct for better readability.

---
 drivers/platform/x86/acerhdf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/platform/x86/acerhdf.c +6 -6
index 91b16c8..c07623c 100644
@@ -131,18 +131,18 @@ static const struct manualcmd mcmd = {
 };
 
 /* BIOS settings */
-struct bios_settings_t {
+struct bios_settings {
 	const char *vendor;
 	const char *product;
 	const char *version;
-	unsigned char fanreg;
-	unsigned char tempreg;
+	u8 fanreg;
+	u8 tempreg;
 	struct fancmd cmd;
 	int mcmd_enable;
 };
 
 /* Register addresses and values for different BIOS versions */
-static const struct bios_settings_t bios_tbl[] = {
+static const struct bios_settings bios_tbl[] = {
 	/* AOA110 */
 	{"Acer", "AOA110", "v0.3109", 0x55, 0x58, {0x1f, 0x00}, 0},
 	{"Acer", "AOA110", "v0.3114", 0x55, 0x58, {0x1f, 0x00}, 0},
@@ -256,7 +256,7 @@ static const struct bios_settings_t bios_tbl[] = {
 	{"", "", "", 0, 0, {0, 0}, 0}
 };
 
-static const struct bios_settings_t *bios_cfg __read_mostly;
+static const struct bios_settings *bios_cfg __read_mostly;
 
 /*
  * this struct is used to instruct thermal layer to use bang_bang instead of
@@ -619,7 +619,7 @@ static int str_starts_with(const char *str, const char *start)
 static int acerhdf_check_hardware(void)
 {
 	char const *vendor, *version, *product;
-	const struct bios_settings_t *bt = NULL;
+	const struct bios_settings *bt = NULL;
 
 	/* get BIOS data */
 	vendor  = dmi_get_system_info(DMI_SYS_VENDOR);
Signature · 1 line
2.1.3
author maintainer
#94 lore raw

Re: [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer

Hi Darren / platform-driver-x86 list,

Quoted 1 line · Peter Feuerer

please apply this series of patches.

did you find time for my patchseries already?
Is there any problem with it?

Signature · 2 lines
kind regards,
--peter;
#95 lore raw

Re: [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer
Quoted 3 lines · Peter Feuerer

Hi Darren,

please apply this series of patches.

Applied to testing, and given the level of review and testing already received, I will include in for-next for a late merge-window submission.

Thanks,

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center
Applied
#96 lore raw

Re: [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and minor clean up

In reply to Peter Feuerer
Quoted 23 lines · Peter Feuerer

Hi Darren,

please apply this series of patches.

It is intended to:

* Introduce "manual mode" support (Patch 1 & 2), which is needed to control the fan of a few new models.

* Add an appropriate thermal governor (Patch 3). Manipulating and fiddling around with the step-wise governor has been a very fragile thing in the past and as it broke again, I used the opportunity to add a two point thermal governor which implements the actual fan handling required by acerhdf and puts from my point of view things straight.

* Do some minor clean up like:
- adding second trip point for critical temperature (Patch 4)
- removing _t suffix from struct which isn't typedef and replace unsigned char by u8 (Patch 5)

Thanks and kind regards,
peter

Quoted 6 lines

Peter Feuerer (5):
acerhdf: Adding support for "manual mode"
acerhdf: Adding support for new models
acerhdf: Use bang-bang thermal governor
acerhdf: added critical trip point
acerhdf: minor clean up

Queued to for-next. Thanks!

Signature · 2 lines
Darren Hart
Intel Open Source Technology Center