All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor
@ 2014-04-27  1:23 Peter Feuerer
  2014-04-27  1:23 ` [PATCH 1/4] acerhdf: Adding support for "manual mode" Peter Feuerer
                   ` (9 more replies)
  0 siblings, 10 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-04-27  1:23 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andreas Mohr, Borislav Petkov, Zhang Rui

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 <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Zhang Rui <rui.zhang@intel.com>

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

-- 
1.9.2


^ permalink raw reply	[flat|nested] 97+ messages in thread

* [PATCH 1/4] acerhdf: Adding support for "manual mode"
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
@ 2014-04-27  1:23 ` Peter Feuerer
  2014-04-27 21:03   ` Borislav Petkov
  2014-04-27  1:23 ` [PATCH 2/4] acerhdf: Adding support for new models Peter Feuerer
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-04-27  1:23 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andreas Mohr, Borislav Petkov

From: Peter Feuerer <peter@piie.net>

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 <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 181 ++++++++++++++++++++++-------------------
 1 file changed, 97 insertions(+), 84 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index f94467c..eb9c94f 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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)
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH 2/4] acerhdf: Adding support for new models
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
  2014-04-27  1:23 ` [PATCH 1/4] acerhdf: Adding support for "manual mode" Peter Feuerer
@ 2014-04-27  1:23 ` Peter Feuerer
  2014-04-27  1:23 ` [PATCH 3/4] thermal: Added Bang-bang thermal governor Peter Feuerer
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-04-27  1:23 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andreas Mohr, Borislav Petkov

From: Peter Feuerer <peter@piie.net>

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

Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index eb9c94f..8b6466b 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH 3/4] thermal: Added Bang-bang thermal governor
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
  2014-04-27  1:23 ` [PATCH 1/4] acerhdf: Adding support for "manual mode" Peter Feuerer
  2014-04-27  1:23 ` [PATCH 2/4] acerhdf: Adding support for new models Peter Feuerer
@ 2014-04-27  1:23 ` Peter Feuerer
  2014-04-27  1:23 ` [PATCH 4/4] acerhdf: Use bang-bang " Peter Feuerer
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-04-27  1:23 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Zhang Rui, Andreas Mohr, Borislav Petkov

From: Peter Feuerer <peter@piie.net>

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 <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 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

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 2d51912..2ede94f 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -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
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 54e4ec9..1c32a5d 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
 
diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
new file mode 100644
index 0000000..96f314d
--- /dev/null
+++ b/drivers/thermal/gov_bang_bang.c
@@ -0,0 +1,124 @@
+/*
+ *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
+ *
+ *  Copyright (C) 2014 Peter Feuerer <peter@piie.net>
+ *
+ *  Based on step_wise.c with following Copyrights:
+ *  Copyright (C) 2012 Intel Corp
+ *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
+ *
+ *
+ * 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;
+
+		/* in case fan is neither on nor off set the fan to active */
+		if (instance->target != 0 && instance->target != 1)
+			instance->target = 1;
+
+		/*
+		 * enable fan when temperature exceeds trip_temp and disable
+		 * the fan in case it falls below trip_temp minus hysteresis
+		 */
+		if (instance->target == 0 && tz->temperature >= trip_temp)
+			instance->target = 1;
+		else if (instance->target == 1 &&
+				tz->temperature < trip_temp - trip_hyst)
+			instance->target = 0;
+
+		dev_dbg(&instance->cdev->device, "target=%d\n",
+					(int)instance->target);
+
+		instance->cdev->updated = false; /* cdev needs update */
+	}
+
+	mutex_unlock(&tz->lock);
+}
+
+/**
+ * bang_bang_throttle - throttles devices asscciated with the given zone
+ * @tz - thermal_zone_device
+ * @trip - the trip point
+ *
+ * Throttling Logic: a two point regulation, deliver cooling state depending
+ * on the previous state shown in this diagram:
+ *
+ *                Fan:   OFF    ON
+ *
+ *                              |
+ *                              |
+ *          trip_temp:    +---->+
+ *                        |     |        ^
+ *                        |     |        |
+ *                        |     |   Temperature
+ * (trip_temp - hyst):    +<----+
+ *                        |
+ *                        |
+ *                        |
+ *
+ *   * If the fan is not running and temperature exceeds trip_temp, the fan
+ *     gets turned on.
+ *   * In case the fan is running, temperature must fall below
+ *     (trip_temp - hyst) so that the fan gets turned off again.
+ *
+ */
+static int bang_bang_throttle(struct thermal_zone_device *tz, int trip)
+{
+	struct thermal_instance *instance;
+
+	thermal_zone_trip_update(tz, trip);
+
+	mutex_lock(&tz->lock);
+
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node)
+		thermal_cdev_update(instance->cdev);
+
+	mutex_unlock(&tz->lock);
+
+	return 0;
+}
+
+static struct thermal_governor thermal_gov_bang_bang = {
+	.name		= "bang_bang",
+	.throttle	= bang_bang_throttle,
+};
+
+int thermal_gov_bang_bang_register(void)
+{
+	return thermal_register_governor(&thermal_gov_bang_bang);
+}
+
+void thermal_gov_bang_bang_unregister(void)
+{
+	thermal_unregister_governor(&thermal_gov_bang_bang);
+}
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 71b0ec0..4c2726b 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -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();
 }
 
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 3db339f..d15d243 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -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);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH 4/4] acerhdf: Use bang-bang thermal governor
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
                   ` (2 preceding siblings ...)
  2014-04-27  1:23 ` [PATCH 3/4] thermal: Added Bang-bang thermal governor Peter Feuerer
@ 2014-04-27  1:23 ` Peter Feuerer
  2014-04-27 18:57 ` [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Andreas Mohr
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-04-27  1:23 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Zhang Rui, Andreas Mohr, Borislav Petkov

From: Peter Feuerer <peter@piie.net>

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 <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 45 ++++++++++++++++++++++++++++++++++--------
 2 files changed, 38 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 27df2c5..bbc5dd2 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -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.
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 8b6466b..acba516 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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,
@@ -130,8 +130,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;
 	struct manualcmd mcmd;
 };
@@ -253,6 +253,14 @@ static const struct bios_settings_t bios_tbl[] = {
 
 static const struct bios_settings_t *bios_cfg __read_mostly;
 
+/* used to force thermal to use bang_bang governor for acerhdf */
+static struct thermal_zone_params acerhdf_zone_params = {
+	.governor_name = "bang_bang",
+	.no_hwmon = 0,
+	.num_tbps = 0,
+	.tbp = 0,
+};
+
 static int acerhdf_get_temp(int *temp)
 {
 	u8 read_temp;
@@ -430,6 +438,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;
+
+	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;
 }
@@ -439,6 +458,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;
 }
@@ -458,8 +479,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,
 };
 
 
@@ -510,9 +533,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)
@@ -690,12 +711,20 @@ static int acerhdf_register_thermal(void)
 	if (IS_ERR(cl_dev))
 		return -EINVAL;
 
-	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+	thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL,
+					      &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("Thermal governor %s is not compiled into thermal subsystem\n",
+				acerhdf_zone_params.governor_name);
+		return -EINVAL;
+	}
+
 	return 0;
 }
 
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* Re: [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
                   ` (3 preceding siblings ...)
  2014-04-27  1:23 ` [PATCH 4/4] acerhdf: Use bang-bang " Peter Feuerer
@ 2014-04-27 18:57 ` Andreas Mohr
  2014-04-27 23:13   ` Peter Feuerer
  2014-04-29  9:17 ` [PATCH v2 " Peter Feuerer
                   ` (4 subsequent siblings)
  9 siblings, 1 reply; 97+ messages in thread
From: Andreas Mohr @ 2014-04-27 18:57 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andreas Mohr, Borislav Petkov, Zhang Rui

Hi,

On Sun, Apr 27, 2014 at 03:23:31AM +0200, Peter Feuerer wrote:
> 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

> 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 ;)]


>   * 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").




> 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)


> Thanks and kind regards,

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

Andreas Mohr

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH 1/4] acerhdf: Adding support for "manual mode"
  2014-04-27  1:23 ` [PATCH 1/4] acerhdf: Adding support for "manual mode" Peter Feuerer
@ 2014-04-27 21:03   ` Borislav Petkov
  2014-04-27 22:22     ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Borislav Petkov @ 2014-04-27 21:03 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andreas Mohr

On Sun, Apr 27, 2014 at 03:23:32AM +0200, Peter Feuerer wrote:
> From: Peter Feuerer <peter@piie.net>
> 
> 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. :-)

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH 1/4] acerhdf: Adding support for "manual mode"
  2014-04-27 21:03   ` Borislav Petkov
@ 2014-04-27 22:22     ` Peter Feuerer
  0 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-04-27 22:22 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: LKML, Andreas Mohr

Borislav Petkov writes:

> On Sun, Apr 27, 2014 at 03:23:32AM +0200, Peter Feuerer wrote:
>> From: Peter Feuerer <peter@piie.net>
>> 
>> 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?

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.


> 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 :)

-- 
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor
  2014-04-27 18:57 ` [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Andreas Mohr
@ 2014-04-27 23:13   ` Peter Feuerer
  2014-04-28  4:58     ` Andreas Mohr
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-04-27 23:13 UTC (permalink / raw)
  To: Andreas Mohr; +Cc: LKML, Borislav Petkov, Zhang Rui

Hi,

Andreas Mohr writes:

> On Sun, Apr 27, 2014 at 03:23:31AM +0200, Peter Feuerer wrote:
>> 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...)

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.


> 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.


>>   * 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.


> -       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.


> "bang_bang_throttle - throttles devices asscciated with the given zone"
> 
> Typo ;)

c != o, got it.


> "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
 */


> 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.


>> 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.

-- 
kind regards,
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor
  2014-04-27 23:13   ` Peter Feuerer
@ 2014-04-28  4:58     ` Andreas Mohr
  0 siblings, 0 replies; 97+ messages in thread
From: Andreas Mohr @ 2014-04-28  4:58 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: Andreas Mohr, LKML, Borislav Petkov, Zhang Rui

Hi,

On Mon, Apr 28, 2014 at 01:13:19AM +0200, Peter Feuerer wrote:
> Hi,
> 
> Andreas Mohr writes:
> 
> > { "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...)
> 
> 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...]]


> > -       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.

> > "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

^ permalink raw reply	[flat|nested] 97+ messages in thread

* [PATCH v2 0/4] acerhdf/thermal: adding new models and appropriate governor
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
                   ` (4 preceding siblings ...)
  2014-04-27 18:57 ` [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Andreas Mohr
@ 2014-04-29  9:17 ` Peter Feuerer
  2014-04-29  9:17   ` [PATCH v2 1/4] acerhdf: Adding support for "manual mode" Peter Feuerer
                     ` (4 more replies)
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
                   ` (3 subsequent siblings)
  9 siblings, 5 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-04-29  9:17 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andreas Mohr, Borislav Petkov, Zhang Rui

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 <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Zhang Rui <rui.zhang@intel.com>



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

-- 
1.9.2


^ permalink raw reply	[flat|nested] 97+ messages in thread

* [PATCH v2 1/4] acerhdf: Adding support for "manual mode"
  2014-04-29  9:17 ` [PATCH v2 " Peter Feuerer
@ 2014-04-29  9:17   ` Peter Feuerer
  2014-04-29  9:17   ` [PATCH v2 2/4] acerhdf: Adding support for new models Peter Feuerer
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-04-29  9:17 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andreas Mohr, Borislav Petkov

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 <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 187 +++++++++++++++++++++++------------------
 1 file changed, 103 insertions(+), 84 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index f94467c..dd63e93 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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)
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v2 2/4] acerhdf: Adding support for new models
  2014-04-29  9:17 ` [PATCH v2 " Peter Feuerer
  2014-04-29  9:17   ` [PATCH v2 1/4] acerhdf: Adding support for "manual mode" Peter Feuerer
@ 2014-04-29  9:17   ` Peter Feuerer
  2014-04-29  9:17   ` [PATCH v2 3/4] thermal: Added Bang-bang thermal governor Peter Feuerer
                     ` (2 subsequent siblings)
  4 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-04-29  9:17 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andreas Mohr, Borislav Petkov

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

Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index dd63e93..176edbd 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v2 3/4] thermal: Added Bang-bang thermal governor
  2014-04-29  9:17 ` [PATCH v2 " Peter Feuerer
  2014-04-29  9:17   ` [PATCH v2 1/4] acerhdf: Adding support for "manual mode" Peter Feuerer
  2014-04-29  9:17   ` [PATCH v2 2/4] acerhdf: Adding support for new models Peter Feuerer
@ 2014-04-29  9:17   ` Peter Feuerer
  2014-04-29 15:53     ` Javi Merino
  2014-04-29  9:17   ` [PATCH v2 4/4] acerhdf: Use bang-bang " Peter Feuerer
  2014-05-01 18:36   ` [PATCH v2 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
  4 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-04-29  9:17 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Zhang Rui, Andreas Mohr, Borislav Petkov

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 <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 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

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 2d51912..2ede94f 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -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
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 54e4ec9..1c32a5d 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
 
diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
new file mode 100644
index 0000000..328dde0
--- /dev/null
+++ b/drivers/thermal/gov_bang_bang.c
@@ -0,0 +1,124 @@
+/*
+ *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
+ *
+ *  Copyright (C) 2014 Peter Feuerer <peter@piie.net>
+ *
+ *  Based on step_wise.c with following Copyrights:
+ *  Copyright (C) 2012 Intel Corp
+ *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
+ *
+ *
+ * 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;
+
+		/* in case fan is neither on nor off set the fan to active */
+		if (instance->target != 0 && instance->target != 1)
+			instance->target = 1;
+
+		/*
+		 * enable fan when temperature exceeds trip_temp and disable
+		 * the fan in case it falls below trip_temp minus hysteresis
+		 */
+		if (instance->target == 0 && tz->temperature >= trip_temp)
+			instance->target = 1;
+		else if (instance->target == 1 &&
+				tz->temperature < trip_temp - trip_hyst)
+			instance->target = 0;
+
+		dev_dbg(&instance->cdev->device, "target=%d\n",
+					(int)instance->target);
+
+		instance->cdev->updated = false; /* cdev needs update */
+	}
+
+	mutex_unlock(&tz->lock);
+}
+
+/**
+ * bang_bang_throttle - throttles devices associated with the given zone
+ * @tz - thermal_zone_device
+ * @trip - the trip point
+ *
+ * Throttling Logic: a two point regulation, deliver cooling state depending
+ * on the previous state shown in this diagram:
+ *
+ *                Fan:   OFF    ON
+ *
+ *                              |
+ *                              |
+ *          trip_temp:    +---->+
+ *                        |     |        ^
+ *                        |     |        |
+ *                        |     |   Temperature
+ * (trip_temp - hyst):    +<----+
+ *                        |
+ *                        |
+ *                        |
+ *
+ *   * If the fan is not running and temperature exceeds trip_temp, the fan
+ *     gets turned on.
+ *   * In case the fan is running, temperature must fall below
+ *     (trip_temp - hyst) so that the fan gets turned off again.
+ *
+ */
+static int bang_bang_throttle(struct thermal_zone_device *tz, int trip)
+{
+	struct thermal_instance *instance;
+
+	thermal_zone_trip_update(tz, trip);
+
+	mutex_lock(&tz->lock);
+
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node)
+		thermal_cdev_update(instance->cdev);
+
+	mutex_unlock(&tz->lock);
+
+	return 0;
+}
+
+static struct thermal_governor thermal_gov_bang_bang = {
+	.name		= "bang_bang",
+	.throttle	= bang_bang_throttle,
+};
+
+int thermal_gov_bang_bang_register(void)
+{
+	return thermal_register_governor(&thermal_gov_bang_bang);
+}
+
+void thermal_gov_bang_bang_unregister(void)
+{
+	thermal_unregister_governor(&thermal_gov_bang_bang);
+}
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 71b0ec0..4c2726b 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -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();
 }
 
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 3db339f..d15d243 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -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);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v2 4/4] acerhdf: Use bang-bang thermal governor
  2014-04-29  9:17 ` [PATCH v2 " Peter Feuerer
                     ` (2 preceding siblings ...)
  2014-04-29  9:17   ` [PATCH v2 3/4] thermal: Added Bang-bang thermal governor Peter Feuerer
@ 2014-04-29  9:17   ` Peter Feuerer
  2014-04-29 16:00     ` Javi Merino
  2014-05-01 18:36   ` [PATCH v2 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
  4 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-04-29  9:17 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Zhang Rui, Andreas Mohr, Borislav Petkov

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 <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 48 +++++++++++++++++++++++++++++++++++-------
 2 files changed, 41 insertions(+), 9 deletions(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 27df2c5..0c15d89 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -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.
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 176edbd..f3884f9 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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;
 
+/*
+ * 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,
+};
+
 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;
+
+	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;
 }
@@ -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,
 };
 
 
@@ -516,9 +542,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,12 +720,20 @@ static int acerhdf_register_thermal(void)
 	if (IS_ERR(cl_dev))
 		return -EINVAL;
 
-	thz_dev = thermal_zone_device_register("acerhdf", 1, 0, NULL,
-					      &acerhdf_dev_ops, NULL, 0,
+	thz_dev = thermal_zone_device_register("acerhdf", 2, 0, NULL,
+					      &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;
 }
 
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* Re: [PATCH v2 3/4] thermal: Added Bang-bang thermal governor
  2014-04-29  9:17   ` [PATCH v2 3/4] thermal: Added Bang-bang thermal governor Peter Feuerer
@ 2014-04-29 15:53     ` Javi Merino
  2014-04-29 16:37       ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Javi Merino @ 2014-04-29 15:53 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Zhang Rui, Andreas Mohr, Borislav Petkov

On Tue, Apr 29, 2014 at 10:17:56AM +0100, Peter Feuerer wrote:
> 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.

[...]
> diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
> new file mode 100644
> index 0000000..328dde0
> --- /dev/null
> +++ b/drivers/thermal/gov_bang_bang.c
> @@ -0,0 +1,124 @@
> +/*
> + *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
> + *
> + *  Copyright (C) 2014 Peter Feuerer <peter@piie.net>
> + *
> + *  Based on step_wise.c with following Copyrights:
> + *  Copyright (C) 2012 Intel Corp
> + *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
> + *
> + *
> + * 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;
> +
> +		/* 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


^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v2 4/4] acerhdf: Use bang-bang thermal governor
  2014-04-29  9:17   ` [PATCH v2 4/4] acerhdf: Use bang-bang " Peter Feuerer
@ 2014-04-29 16:00     ` Javi Merino
  2014-04-29 16:43       ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Javi Merino @ 2014-04-29 16:00 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Zhang Rui, Andreas Mohr, Borislav Petkov

On Tue, Apr 29, 2014 at 10:17:57AM +0100, Peter Feuerer wrote:
> 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 <rui.zhang@intel.com>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>
> Signed-off-by: Peter Feuerer <peter@piie.net>
> ---
>  drivers/platform/x86/Kconfig   |  2 +-
>  drivers/platform/x86/acerhdf.c | 48 +++++++++++++++++++++++++++++++++++-------
>  2 files changed, 41 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 27df2c5..0c15d89 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -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.
> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
> index 176edbd..f3884f9 100644
> --- a/drivers/platform/x86/acerhdf.c
> +++ b/drivers/platform/x86/acerhdf.c
> @@ -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;
>  
> +/*
> + * 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.

> +
>  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.

> +
> +	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;
>  }
> @@ -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


^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v2 3/4] thermal: Added Bang-bang thermal governor
  2014-04-29 15:53     ` Javi Merino
@ 2014-04-29 16:37       ` Peter Feuerer
  2014-04-29 21:31         ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-04-29 16:37 UTC (permalink / raw)
  To: Javi Merino; +Cc: LKML, Zhang Rui, Andreas Mohr, Borislav Petkov

Javi Merino writes:

> On Tue, Apr 29, 2014 at 10:17:56AM +0100, Peter Feuerer wrote:
>> 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.


> [...]
>> diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
>> new file mode 100644
>> index 0000000..328dde0
>> --- /dev/null
>> +++ b/drivers/thermal/gov_bang_bang.c
>> @@ -0,0 +1,124 @@
>> +/*
>> + *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
>> + *
>> + *  Copyright (C) 2014 Peter Feuerer <peter@piie.net>
>> + *
>> + *  Based on step_wise.c with following Copyrights:
>> + *  Copyright (C) 2012 Intel Corp
>> + *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
>> + *
>> + *
>> + * 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;
>> +
>> +		/* 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.

-- 
kind regards,
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v2 4/4] acerhdf: Use bang-bang thermal governor
  2014-04-29 16:00     ` Javi Merino
@ 2014-04-29 16:43       ` Peter Feuerer
  0 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-04-29 16:43 UTC (permalink / raw)
  To: Javi Merino; +Cc: LKML, Zhang Rui, Andreas Mohr, Borislav Petkov

Javi Merino writes:

> On Tue, Apr 29, 2014 at 10:17:57AM +0100, Peter Feuerer wrote:
>> 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 <rui.zhang@intel.com>
>> Cc: Andreas Mohr <andi@lisas.de>
>> Cc: Borislav Petkov <bp@suse.de>
>> Signed-off-by: Peter Feuerer <peter@piie.net>
>> ---
>>  drivers/platform/x86/Kconfig   |  2 +-
>>  drivers/platform/x86/acerhdf.c | 48 +++++++++++++++++++++++++++++++++++-------
>>  2 files changed, 41 insertions(+), 9 deletions(-)
>> 
>> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
>> index 27df2c5..0c15d89 100644
>> --- a/drivers/platform/x86/Kconfig
>> +++ b/drivers/platform/x86/Kconfig
>> @@ -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.
>> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
>> index 176edbd..f3884f9 100644
>> --- a/drivers/platform/x86/acerhdf.c
>> +++ b/drivers/platform/x86/acerhdf.c
>> @@ -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;
>>  
>> +/*
>> + * 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.


>> +
>>  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.

Yes, will do so.



>> +
>> +	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;
>>  }
>> @@ -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.

-- 
kind regards,
--peter; 

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v2 3/4] thermal: Added Bang-bang thermal governor
  2014-04-29 16:37       ` Peter Feuerer
@ 2014-04-29 21:31         ` Peter Feuerer
  2014-04-30  9:01           ` Javi Merino
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-04-29 21:31 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: Javi Merino, LKML, Zhang Rui, Andreas Mohr, Borislav Petkov

Hi Javi,

Peter Feuerer writes:

> Javi Merino writes:
[...]

>>> diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
>>> new file mode 100644
>>> index 0000000..328dde0
>>> --- /dev/null
>>> +++ b/drivers/thermal/gov_bang_bang.c
>>> @@ -0,0 +1,124 @@
>>> +/*
>>> + *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
>>> + *
>>> + *  Copyright (C) 2014 Peter Feuerer <peter@piie.net>
>>> + *
>>> + *  Based on step_wise.c with following Copyrights:
>>> + *  Copyright (C) 2012 Intel Corp
>>> + *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
>>> + *
>>> + *
>>> + * 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;
>>> +
>>> +		/* 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.

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;
+               }


-- 
kind regards,
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v2 3/4] thermal: Added Bang-bang thermal governor
  2014-04-29 21:31         ` Peter Feuerer
@ 2014-04-30  9:01           ` Javi Merino
  0 siblings, 0 replies; 97+ messages in thread
From: Javi Merino @ 2014-04-30  9:01 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Zhang Rui, Andreas Mohr, Borislav Petkov

Hi Peter,

On Tue, Apr 29, 2014 at 10:31:42PM +0100, Peter Feuerer wrote:
> Peter Feuerer writes:
> 
> > Javi Merino writes:
> [...]
> 
> >>> diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
> >>> new file mode 100644
> >>> index 0000000..328dde0
> >>> --- /dev/null
> >>> +++ b/drivers/thermal/gov_bang_bang.c
> >>> @@ -0,0 +1,124 @@
> >>> +/*
> >>> + *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
> >>> + *
> >>> + *  Copyright (C) 2014 Peter Feuerer <peter@piie.net>
> >>> + *
> >>> + *  Based on step_wise.c with following Copyrights:
> >>> + *  Copyright (C) 2012 Intel Corp
> >>> + *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
> >>> + *
> >>> + *
> >>> + * 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;
> >>> +
> >>> +		/* 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.
> 
> 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;
> +               }

That sounds like a better solution, thanks!
Javi


^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v2 0/4] acerhdf/thermal: adding new models and appropriate governor
  2014-04-29  9:17 ` [PATCH v2 " Peter Feuerer
                     ` (3 preceding siblings ...)
  2014-04-29  9:17   ` [PATCH v2 4/4] acerhdf: Use bang-bang " Peter Feuerer
@ 2014-05-01 18:36   ` Peter Feuerer
  4 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-05-01 18:36 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andreas Mohr, Borislav Petkov, Zhang Rui, Javi Merino

Hi all,

Peter Feuerer writes:
> 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.

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?

[...]


-- 
kind regards,
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
                   ` (5 preceding siblings ...)
  2014-04-29  9:17 ` [PATCH v2 " Peter Feuerer
@ 2014-05-03 17:59 ` Peter Feuerer
  2014-05-03 17:59   ` [PATCH v3 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
                     ` (7 more replies)
  2014-07-20  0:51 ` [PATCH v4 " Peter Feuerer
                   ` (2 subsequent siblings)
  9 siblings, 8 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-05-03 17:59 UTC (permalink / raw)
  To: LKML
  Cc: Peter Feuerer, Andrew Morton, Andreas Mohr, Borislav Petkov,
	Zhang Rui, Javi Merino


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 <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Javi Merino <javi.merino@arm.com>


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

-- 
1.9.2


^ permalink raw reply	[flat|nested] 97+ messages in thread

* [PATCH v3 1/6] acerhdf: Adding support for "manual mode"
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
@ 2014-05-03 17:59   ` Peter Feuerer
  2014-07-17  9:44     ` Borislav Petkov
  2014-05-03 17:59   ` [PATCH v3 2/6] acerhdf: Adding support for new models Peter Feuerer
                     ` (6 subsequent siblings)
  7 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-05-03 17:59 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Andreas Mohr, Borislav Petkov

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 <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 187 +++++++++++++++++++++++------------------
 1 file changed, 103 insertions(+), 84 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index f94467c..dd63e93 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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)
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v3 2/6] acerhdf: Adding support for new models
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
  2014-05-03 17:59   ` [PATCH v3 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
@ 2014-05-03 17:59   ` Peter Feuerer
  2014-07-17  9:46     ` Borislav Petkov
  2014-05-03 17:59   ` [PATCH v3 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
                     ` (5 subsequent siblings)
  7 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-05-03 17:59 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Andreas Mohr, Borislav Petkov

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

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index dd63e93..176edbd 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v3 3/6] thermal: Added Bang-bang thermal governor
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
  2014-05-03 17:59   ` [PATCH v3 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
  2014-05-03 17:59   ` [PATCH v3 2/6] acerhdf: Adding support for new models Peter Feuerer
@ 2014-05-03 17:59   ` Peter Feuerer
  2014-07-17  9:58     ` Borislav Petkov
  2014-05-03 17:59   ` [PATCH v3 4/6] acerhdf: Use bang-bang " Peter Feuerer
                     ` (4 subsequent siblings)
  7 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-05-03 17:59 UTC (permalink / raw)
  To: LKML
  Cc: Peter Feuerer, Andrew Morton, Zhang Rui, Andreas Mohr,
	Borislav Petkov, Javi Merino

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 <akpm@linux-foundation.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Javi Merino <javi.merino@arm.com>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 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

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 2d51912..2ede94f 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -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
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 54e4ec9..1c32a5d 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
 
diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
new file mode 100644
index 0000000..228d0a6
--- /dev/null
+++ b/drivers/thermal/gov_bang_bang.c
@@ -0,0 +1,131 @@
+/*
+ *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
+ *
+ *  Copyright (C) 2014 Peter Feuerer <peter@piie.net>
+ *
+ *  Based on step_wise.c with following Copyrights:
+ *  Copyright (C) 2012 Intel Corp
+ *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
+ *
+ *
+ * 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;
+
+		/* 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;
+		}
+
+		/*
+		 * enable fan when temperature exceeds trip_temp and disable
+		 * the fan in case it falls below trip_temp minus hysteresis
+		 */
+		if (instance->target == 0 && tz->temperature >= trip_temp)
+			instance->target = 1;
+		else if (instance->target == 1 &&
+				tz->temperature < trip_temp - trip_hyst)
+			instance->target = 0;
+
+		dev_dbg(&instance->cdev->device, "target=%d\n",
+					(int)instance->target);
+
+		instance->cdev->updated = false; /* cdev needs update */
+	}
+
+	mutex_unlock(&tz->lock);
+}
+
+/**
+ * bang_bang_throttle - controls devices associated with the given zone
+ * @tz - thermal_zone_device
+ * @trip - the trip point
+ *
+ * Regulation Logic: a two point regulation, deliver cooling state depending
+ * on the previous state shown in this diagram:
+ *
+ *                Fan:   OFF    ON
+ *
+ *                              |
+ *                              |
+ *          trip_temp:    +---->+
+ *                        |     |        ^
+ *                        |     |        |
+ *                        |     |   Temperature
+ * (trip_temp - hyst):    +<----+
+ *                        |
+ *                        |
+ *                        |
+ *
+ *   * If the fan is not running and temperature exceeds trip_temp, the fan
+ *     gets turned on.
+ *   * In case the fan is running, temperature must fall below
+ *     (trip_temp - hyst) so that the fan gets turned off again.
+ *
+ */
+static int bang_bang_throttle(struct thermal_zone_device *tz, int trip)
+{
+	struct thermal_instance *instance;
+
+	thermal_zone_trip_update(tz, trip);
+
+	mutex_lock(&tz->lock);
+
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node)
+		thermal_cdev_update(instance->cdev);
+
+	mutex_unlock(&tz->lock);
+
+	return 0;
+}
+
+static struct thermal_governor thermal_gov_bang_bang = {
+	.name		= "bang_bang",
+	.throttle	= bang_bang_throttle,
+};
+
+int thermal_gov_bang_bang_register(void)
+{
+	return thermal_register_governor(&thermal_gov_bang_bang);
+}
+
+void thermal_gov_bang_bang_unregister(void)
+{
+	thermal_unregister_governor(&thermal_gov_bang_bang);
+}
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 71b0ec0..4c2726b 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -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();
 }
 
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 3db339f..d15d243 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -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);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v3 4/6] acerhdf: Use bang-bang thermal governor
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
                     ` (2 preceding siblings ...)
  2014-05-03 17:59   ` [PATCH v3 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
@ 2014-05-03 17:59   ` Peter Feuerer
  2014-05-06 10:50     ` Javi Merino
  2014-05-03 17:59   ` [PATCH v3 5/6] acerhdf: added critical trip point Peter Feuerer
                     ` (3 subsequent siblings)
  7 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-05-03 17:59 UTC (permalink / raw)
  To: LKML
  Cc: Peter Feuerer, Andrew Morton, Zhang Rui, Andreas Mohr,
	Borislav Petkov, Javi Merino

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 <akpm@linux-foundation.org>
CC: Zhang Rui <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Javi Merino <javi.merino@arm.com>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 34 +++++++++++++++++++++++++++++-----
 2 files changed, 30 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 27df2c5..0c15d89 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -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.
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 176edbd..afaa849 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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;
 }
 
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v3 5/6] acerhdf: added critical trip point
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
                     ` (3 preceding siblings ...)
  2014-05-03 17:59   ` [PATCH v3 4/6] acerhdf: Use bang-bang " Peter Feuerer
@ 2014-05-03 17:59   ` Peter Feuerer
  2014-05-03 17:59   ` [PATCH v3 6/6] acerhdf: minor clean up Peter Feuerer
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-05-03 17:59 UTC (permalink / raw)
  To: LKML
  Cc: Peter Feuerer, Andrew Morton, Andreas Mohr, Borislav Petkov, Javi Merino

added critical trip point which represents the temperature limit.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Javi Merino <javi.merino@arm.com>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index afaa849..bc10260 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v3 6/6] acerhdf: minor clean up
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
                     ` (4 preceding siblings ...)
  2014-05-03 17:59   ` [PATCH v3 5/6] acerhdf: added critical trip point Peter Feuerer
@ 2014-05-03 17:59   ` Peter Feuerer
  2014-07-17 10:12     ` Borislav Petkov
  2014-05-15 16:05   ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and " Eduardo Valentin
  2014-07-16 22:24   ` Borislav Petkov
  7 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-05-03 17:59 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Andreas Mohr, Borislav Petkov

  * 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 <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index bc10260..4ecea81 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
1.9.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 4/6] acerhdf: Use bang-bang thermal governor
  2014-05-03 17:59   ` [PATCH v3 4/6] acerhdf: Use bang-bang " Peter Feuerer
@ 2014-05-06 10:50     ` Javi Merino
  2014-05-12 10:27       ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Javi Merino @ 2014-05-06 10:50 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, Andrew Morton, Zhang Rui, Andreas Mohr, Borislav Petkov

Hi Peter,

On Sat, May 03, 2014 at 06:59:24PM +0100, Peter Feuerer wrote:
> 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 <akpm@linux-foundation.org>
> CC: Zhang Rui <rui.zhang@intel.com>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Javi Merino <javi.merino@arm.com>
> Signed-off-by: Peter Feuerer <peter@piie.net>
> ---
>  drivers/platform/x86/Kconfig   |  2 +-
>  drivers/platform/x86/acerhdf.c | 34 +++++++++++++++++++++++++++++-----
>  2 files changed, 30 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 27df2c5..0c15d89 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -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.
> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
> index 176edbd..afaa849 100644
> --- a/drivers/platform/x86/acerhdf.c
> +++ b/drivers/platform/x86/acerhdf.c
> @@ -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;
> +}
> +

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


^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 4/6] acerhdf: Use bang-bang thermal governor
  2014-05-06 10:50     ` Javi Merino
@ 2014-05-12 10:27       ` Peter Feuerer
  2014-05-12 12:03         ` Javi Merino
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-05-12 10:27 UTC (permalink / raw)
  To: Javi Merino; +Cc: LKML, Andrew Morton, Zhang Rui, Andreas Mohr, Borislav Petkov

Hi Javi,

Javi Merino writes:

> Hi Peter,
> 
> On Sat, May 03, 2014 at 06:59:24PM +0100, Peter Feuerer wrote:
>> 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 <akpm@linux-foundation.org>
>> CC: Zhang Rui <rui.zhang@intel.com>
>> Cc: Andreas Mohr <andi@lisas.de>
>> Cc: Borislav Petkov <bp@suse.de>
>> Cc: Javi Merino <javi.merino@arm.com>
>> Signed-off-by: Peter Feuerer <peter@piie.net>
>> ---
>>  drivers/platform/x86/Kconfig   |  2 +-
>>  drivers/platform/x86/acerhdf.c | 34 +++++++++++++++++++++++++++++-----
>>  2 files changed, 30 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
>> index 27df2c5..0c15d89 100644
>> --- a/drivers/platform/x86/Kconfig
>> +++ b/drivers/platform/x86/Kconfig
>> @@ -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.
>> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
>> index 176edbd..afaa849 100644
>> --- a/drivers/platform/x86/acerhdf.c
>> +++ b/drivers/platform/x86/acerhdf.c
>> @@ -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;
>> +}
>> +
> 
> 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;

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;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 4/6] acerhdf: Use bang-bang thermal governor
  2014-05-12 10:27       ` Peter Feuerer
@ 2014-05-12 12:03         ` Javi Merino
  0 siblings, 0 replies; 97+ messages in thread
From: Javi Merino @ 2014-05-12 12:03 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, Andrew Morton, Zhang Rui, Andreas Mohr, Borislav Petkov

Hi Peter,

On Mon, May 12, 2014 at 11:27:08AM +0100, Peter Feuerer wrote:
> Javi Merino writes:
> > On Sat, May 03, 2014 at 06:59:24PM +0100, Peter Feuerer wrote:
> >> 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 <akpm@linux-foundation.org>
> >> CC: Zhang Rui <rui.zhang@intel.com>
> >> Cc: Andreas Mohr <andi@lisas.de>
> >> Cc: Borislav Petkov <bp@suse.de>
> >> Cc: Javi Merino <javi.merino@arm.com>
> >> Signed-off-by: Peter Feuerer <peter@piie.net>
> >> ---
> >>  drivers/platform/x86/Kconfig   |  2 +-
> >>  drivers/platform/x86/acerhdf.c | 34 +++++++++++++++++++++++++++++-----
> >>  2 files changed, 30 insertions(+), 6 deletions(-)
> >> 
> >> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> >> index 27df2c5..0c15d89 100644
> >> --- a/drivers/platform/x86/Kconfig
> >> +++ b/drivers/platform/x86/Kconfig
> >> @@ -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.
> >> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
> >> index 176edbd..afaa849 100644
> >> --- a/drivers/platform/x86/acerhdf.c
> >> +++ b/drivers/platform/x86/acerhdf.c
> >> @@ -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;
> >> +}
> >> +
> > 
> > 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;
> 
> 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


^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
                     ` (5 preceding siblings ...)
  2014-05-03 17:59   ` [PATCH v3 6/6] acerhdf: minor clean up Peter Feuerer
@ 2014-05-15 16:05   ` Eduardo Valentin
  2014-05-15 22:53     ` Peter Feuerer
  2014-07-16 22:24   ` Borislav Petkov
  7 siblings, 1 reply; 97+ messages in thread
From: Eduardo Valentin @ 2014-05-15 16:05 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov, Zhang Rui,
	Javi Merino

Hello Peter,

On Sat, May 03, 2014 at 07:59:20PM +0200, Peter Feuerer wrote:
> 
> 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.
> 

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.




>   * 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 <akpm@linux-foundation.org>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Javi Merino <javi.merino@arm.com>
> 
> 
> 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
> 
> -- 
> 1.9.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up
  2014-05-15 16:05   ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and " Eduardo Valentin
@ 2014-05-15 22:53     ` Peter Feuerer
  2014-06-15 22:39       ` Felix Deichmann
  2014-07-30 13:16       ` Eduardo Valentin
  0 siblings, 2 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-05-15 22:53 UTC (permalink / raw)
  To: Eduardo Valentin
  Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov, Zhang Rui,
	Javi Merino

Hi Eduardo,

Eduardo Valentin writes:

> Hello Peter,
> 
> On Sat, May 03, 2014 at 07:59:20PM +0200, Peter Feuerer wrote:
>> 
>> 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.
>> 
> 
> 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.


> 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.


> 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;

> 
> 
> 
> 
>>   * 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 <akpm@linux-foundation.org>
>> Cc: Andreas Mohr <andi@lisas.de>
>> Cc: Borislav Petkov <bp@suse.de>
>> Cc: Zhang Rui <rui.zhang@intel.com>
>> Cc: Javi Merino <javi.merino@arm.com>
>> 
>> 
>> 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
>> 
>> -- 
>> 1.9.2
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate         governor and minor clean up
  2014-05-15 22:53     ` Peter Feuerer
@ 2014-06-15 22:39       ` Felix Deichmann
  2014-07-30 13:16       ` Eduardo Valentin
  1 sibling, 0 replies; 97+ messages in thread
From: Felix Deichmann @ 2014-06-15 22:39 UTC (permalink / raw)
  To: linux-kernel

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

 


^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
                     ` (6 preceding siblings ...)
  2014-05-15 16:05   ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and " Eduardo Valentin
@ 2014-07-16 22:24   ` Borislav Petkov
  2014-07-16 22:34     ` Peter Feuerer
  7 siblings, 1 reply; 97+ messages in thread
From: Borislav Petkov @ 2014-07-16 22:24 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov, Zhang Rui,
	Javi Merino

Hi Peter,

On Sat, May 03, 2014 at 07:59:20PM +0200, Peter Feuerer wrote:
> 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)

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.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up
  2014-07-16 22:24   ` Borislav Petkov
@ 2014-07-16 22:34     ` Peter Feuerer
  2014-07-17  8:46       ` Borislav Petkov
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-16 22:34 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov, Zhang Rui,
	Javi Merino

Hi Boris,

nice to hear from you.


Borislav Petkov writes:

> Hi Peter,
> 
> On Sat, May 03, 2014 at 07:59:20PM +0200, Peter Feuerer wrote:
>> 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)
> 
> 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.

-- 
kind regards,
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up
  2014-07-16 22:34     ` Peter Feuerer
@ 2014-07-17  8:46       ` Borislav Petkov
  0 siblings, 0 replies; 97+ messages in thread
From: Borislav Petkov @ 2014-07-17  8:46 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andrew Morton, Andreas Mohr, Zhang Rui, Javi Merino

On Thu, Jul 17, 2014 at 12:34:32AM +0200, Peter Feuerer wrote:
> 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.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 1/6] acerhdf: Adding support for "manual mode"
  2014-05-03 17:59   ` [PATCH v3 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
@ 2014-07-17  9:44     ` Borislav Petkov
  0 siblings, 0 replies; 97+ messages in thread
From: Borislav Petkov @ 2014-07-17  9:44 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov

On Sat, May 03, 2014 at 07:59:21PM +0200, Peter Feuerer wrote:
> 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 <akpm@linux-foundation.org>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>
> Signed-off-by: Peter Feuerer <peter@piie.net>

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.

Acked-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 2/6] acerhdf: Adding support for new models
  2014-05-03 17:59   ` [PATCH v3 2/6] acerhdf: Adding support for new models Peter Feuerer
@ 2014-07-17  9:46     ` Borislav Petkov
  2014-07-18 16:06       ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Borislav Petkov @ 2014-07-17  9:46 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov

On Sat, May 03, 2014 at 07:59:22PM +0200, Peter Feuerer wrote:
> added following new models:
>    * Aspire 5755G
>    * AO521
>    * AO751h
>    * Aspire One 753
>    * Extensa 5420
>    * Aspire 5315
>    * Aspire 5739G
>    * TravelMate TM8573T
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>
> Signed-off-by: Peter Feuerer <peter@piie.net>

Acked-by: Borislav Petkov <bp@suse.de>

> ---
>  drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
> index dd63e93..176edbd 100644
> --- a/drivers/platform/x86/acerhdf.c
> +++ b/drivers/platform/x86/acerhdf.c
> @@ -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?

:-)

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 3/6] thermal: Added Bang-bang thermal governor
  2014-05-03 17:59   ` [PATCH v3 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
@ 2014-07-17  9:58     ` Borislav Petkov
  2014-07-18 16:24       ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Borislav Petkov @ 2014-07-17  9:58 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, Andrew Morton, Zhang Rui, Andreas Mohr, Borislav Petkov,
	Javi Merino

On Sat, May 03, 2014 at 07:59:23PM +0200, Peter Feuerer wrote:
> 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 <akpm@linux-foundation.org>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Javi Merino <javi.merino@arm.com>
> Signed-off-by: Peter Feuerer <peter@piie.net>

...

> +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;
> +
> +		/* 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).

> +			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?

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 6/6] acerhdf: minor clean up
  2014-05-03 17:59   ` [PATCH v3 6/6] acerhdf: minor clean up Peter Feuerer
@ 2014-07-17 10:12     ` Borislav Petkov
  0 siblings, 0 replies; 97+ messages in thread
From: Borislav Petkov @ 2014-07-17 10:12 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov

On Sat, May 03, 2014 at 07:59:26PM +0200, Peter Feuerer wrote:
>   * 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 <akpm@linux-foundation.org>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>
> Signed-off-by: Peter Feuerer <peter@piie.net>

Acked-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 2/6] acerhdf: Adding support for new models
  2014-07-17  9:46     ` Borislav Petkov
@ 2014-07-18 16:06       ` Peter Feuerer
  2014-07-18 16:17         ` Borislav Petkov
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-18 16:06 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov

Borislav Petkov writes:

> On Sat, May 03, 2014 at 07:59:22PM +0200, Peter Feuerer wrote:
>> added following new models:
>>    * Aspire 5755G
>>    * AO521
>>    * AO751h
>>    * Aspire One 753
>>    * Extensa 5420
>>    * Aspire 5315
>>    * Aspire 5739G
>>    * TravelMate TM8573T
>> 
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Andreas Mohr <andi@lisas.de>
>> Cc: Borislav Petkov <bp@suse.de>
>> Signed-off-by: Peter Feuerer <peter@piie.net>
> 
> Acked-by: Borislav Petkov <bp@suse.de>
> 
>> ---
>>  drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
>>  1 file changed, 24 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
>> index dd63e93..176edbd 100644
>> --- a/drivers/platform/x86/acerhdf.c
>> +++ b/drivers/platform/x86/acerhdf.c
>> @@ -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?

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.

-- 
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 2/6] acerhdf: Adding support for new models
  2014-07-18 16:06       ` Peter Feuerer
@ 2014-07-18 16:17         ` Borislav Petkov
  2014-07-18 16:25           ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Borislav Petkov @ 2014-07-18 16:17 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andrew Morton, Andreas Mohr

On Fri, Jul 18, 2014 at 06:06:53PM +0200, Peter Feuerer wrote:
> 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.

> 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 :-)

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 3/6] thermal: Added Bang-bang thermal governor
  2014-07-17  9:58     ` Borislav Petkov
@ 2014-07-18 16:24       ` Peter Feuerer
  0 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-18 16:24 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: LKML, Andrew Morton, Zhang Rui, Andreas Mohr, Borislav Petkov,
	Javi Merino

Borislav Petkov writes:

> On Sat, May 03, 2014 at 07:59:23PM +0200, Peter Feuerer wrote:
>> 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 <akpm@linux-foundation.org>
>> Cc: Zhang Rui <rui.zhang@intel.com>
>> Cc: Andreas Mohr <andi@lisas.de>
>> Cc: Borislav Petkov <bp@suse.de>
>> Cc: Javi Merino <javi.merino@arm.com>
>> Signed-off-by: Peter Feuerer <peter@piie.net>
> 
> ...
> 
>> +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;
>> +
>> +		/* 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)

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


> (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.

> 
>> +			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.

-- 
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 2/6] acerhdf: Adding support for new models
  2014-07-18 16:17         ` Borislav Petkov
@ 2014-07-18 16:25           ` Peter Feuerer
  0 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-18 16:25 UTC (permalink / raw)
  To: Borislav Petkov; +Cc: LKML, Andrew Morton, Andreas Mohr

Borislav Petkov writes:
>> 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 ;)

-- 
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* [PATCH v4 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
                   ` (6 preceding siblings ...)
  2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
@ 2014-07-20  0:51 ` Peter Feuerer
  2014-07-20  0:51   ` [PATCH v4 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
                     ` (5 more replies)
  2014-07-22 15:37 ` [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and " Peter Feuerer
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
  9 siblings, 6 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-20  0:51 UTC (permalink / raw)
  To: LKML; +Cc: 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

-- 
2.0.2


^ permalink raw reply	[flat|nested] 97+ messages in thread

* [PATCH v4 1/6] acerhdf: Adding support for "manual mode"
  2014-07-20  0:51 ` [PATCH v4 " Peter Feuerer
@ 2014-07-20  0:51   ` Peter Feuerer
  2014-07-20  8:04     ` Andreas Mohr
  2014-07-20  0:51   ` [PATCH v4 2/6] acerhdf: Adding support for new models Peter Feuerer
                     ` (4 subsequent siblings)
  5 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-20  0:51 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Andreas Mohr

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 <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 187 +++++++++++++++++++++++------------------
 1 file changed, 103 insertions(+), 84 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index f94467c..dd63e93 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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)
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v4 2/6] acerhdf: Adding support for new models
  2014-07-20  0:51 ` [PATCH v4 " Peter Feuerer
  2014-07-20  0:51   ` [PATCH v4 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
@ 2014-07-20  0:51   ` Peter Feuerer
  2014-07-20  0:51   ` [PATCH v4 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-20  0:51 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Andreas Mohr

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

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index dd63e93..176edbd 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v4 3/6] thermal: Added Bang-bang thermal governor
  2014-07-20  0:51 ` [PATCH v4 " Peter Feuerer
  2014-07-20  0:51   ` [PATCH v4 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
  2014-07-20  0:51   ` [PATCH v4 2/6] acerhdf: Adding support for new models Peter Feuerer
@ 2014-07-20  0:51   ` Peter Feuerer
  2014-07-21  9:29     ` Borislav Petkov
  2014-07-20  0:51   ` [PATCH v4 4/6] acerhdf: Use bang-bang " Peter Feuerer
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-20  0:51 UTC (permalink / raw)
  To: LKML
  Cc: Peter Feuerer, Andrew Morton, Zhang Rui, Andreas Mohr,
	Borislav Petkov, Javi Merino

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 <akpm@linux-foundation.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Javi Merino <javi.merino@arm.com>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 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

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index f9a1386..cdddf09 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -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
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index de0636a..a675980 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
 
diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
new file mode 100644
index 0000000..c5dd76b
--- /dev/null
+++ b/drivers/thermal/gov_bang_bang.c
@@ -0,0 +1,131 @@
+/*
+ *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
+ *
+ *  Copyright (C) 2014 Peter Feuerer <peter@piie.net>
+ *
+ *  Based on step_wise.c with following Copyrights:
+ *  Copyright (C) 2012 Intel Corp
+ *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
+ *
+ *
+ * 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;
+
+		/* 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;
+		}
+
+		/*
+		 * enable fan when temperature exceeds trip_temp and disable
+		 * the fan in case it falls below trip_temp minus hysteresis
+		 */
+		if (instance->target == 0 && tz->temperature >= trip_temp)
+			instance->target = 1;
+		else if (instance->target == 1 &&
+				tz->temperature < trip_temp - trip_hyst)
+			instance->target = 0;
+
+		dev_dbg(&instance->cdev->device, "target=%d\n",
+					(int)instance->target);
+
+		instance->cdev->updated = false; /* cdev needs update */
+	}
+
+	mutex_unlock(&tz->lock);
+}
+
+/**
+ * bang_bang_control - controls devices associated with the given zone
+ * @tz - thermal_zone_device
+ * @trip - the trip point
+ *
+ * Regulation Logic: a two point regulation, deliver cooling state depending
+ * on the previous state shown in this diagram:
+ *
+ *                Fan:   OFF    ON
+ *
+ *                              |
+ *                              |
+ *          trip_temp:    +---->+
+ *                        |     |        ^
+ *                        |     |        |
+ *                        |     |   Temperature
+ * (trip_temp - hyst):    +<----+
+ *                        |
+ *                        |
+ *                        |
+ *
+ *   * If the fan is not running and temperature exceeds trip_temp, the fan
+ *     gets turned on.
+ *   * In case the fan is running, temperature must fall below
+ *     (trip_temp - hyst) so that the fan gets turned off again.
+ *
+ */
+static int bang_bang_control(struct thermal_zone_device *tz, int trip)
+{
+	struct thermal_instance *instance;
+
+	thermal_zone_trip_update(tz, trip);
+
+	mutex_lock(&tz->lock);
+
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node)
+		thermal_cdev_update(instance->cdev);
+
+	mutex_unlock(&tz->lock);
+
+	return 0;
+}
+
+static struct thermal_governor thermal_gov_bang_bang = {
+	.name		= "bang_bang",
+	.throttle	= bang_bang_control,
+};
+
+int thermal_gov_bang_bang_register(void)
+{
+	return thermal_register_governor(&thermal_gov_bang_bang);
+}
+
+void thermal_gov_bang_bang_unregister(void)
+{
+	thermal_unregister_governor(&thermal_gov_bang_bang);
+}
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 71b0ec0..4c2726b 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -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();
 }
 
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 3db339f..d15d243 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -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);
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v4 4/6] acerhdf: Use bang-bang thermal governor
  2014-07-20  0:51 ` [PATCH v4 " Peter Feuerer
                     ` (2 preceding siblings ...)
  2014-07-20  0:51   ` [PATCH v4 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
@ 2014-07-20  0:51   ` Peter Feuerer
  2014-07-21 10:23     ` Borislav Petkov
  2014-07-20  0:51   ` [PATCH v4 5/6] acerhdf: added critical trip point Peter Feuerer
  2014-07-20  0:51   ` [PATCH v4 6/6] acerhdf: minor clean up Peter Feuerer
  5 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-20  0:51 UTC (permalink / raw)
  To: LKML
  Cc: Peter Feuerer, Andrew Morton, Zhang Rui, Andreas Mohr,
	Borislav Petkov, Javi Merino

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 <akpm@linux-foundation.org>
CC: Zhang Rui <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Javi Merino <javi.merino@arm.com>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/Kconfig   |  2 +-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 172f26c..d89252a 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -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.
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 176edbd..e8c3111 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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;
 }
 
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v4 5/6] acerhdf: added critical trip point
  2014-07-20  0:51 ` [PATCH v4 " Peter Feuerer
                     ` (3 preceding siblings ...)
  2014-07-20  0:51   ` [PATCH v4 4/6] acerhdf: Use bang-bang " Peter Feuerer
@ 2014-07-20  0:51   ` Peter Feuerer
  2014-07-20  0:51   ` [PATCH v4 6/6] acerhdf: minor clean up Peter Feuerer
  5 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-20  0:51 UTC (permalink / raw)
  To: LKML
  Cc: Peter Feuerer, Andrew Morton, Andreas Mohr, Borislav Petkov, Javi Merino

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

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Javi Merino <javi.merino@arm.com>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index e8c3111..0d521ea 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v4 6/6] acerhdf: minor clean up
  2014-07-20  0:51 ` [PATCH v4 " Peter Feuerer
                     ` (4 preceding siblings ...)
  2014-07-20  0:51   ` [PATCH v4 5/6] acerhdf: added critical trip point Peter Feuerer
@ 2014-07-20  0:51   ` Peter Feuerer
  5 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-20  0:51 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Andreas Mohr

  * 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 <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 0d521ea..e608ef1 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* Re: [PATCH v4 1/6] acerhdf: Adding support for "manual mode"
  2014-07-20  0:51   ` [PATCH v4 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
@ 2014-07-20  8:04     ` Andreas Mohr
  2014-07-20 10:42       ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Andreas Mohr @ 2014-07-20  8:04 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andrew Morton, Andreas Mohr

Hi,

On Sun, Jul 20, 2014 at 02:51:15AM +0200, Peter Feuerer wrote:
> @@ -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

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v4 1/6] acerhdf: Adding support for "manual mode"
  2014-07-20  8:04     ` Andreas Mohr
@ 2014-07-20 10:42       ` Peter Feuerer
  2014-07-20 20:20         ` Andreas Mohr
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-20 10:42 UTC (permalink / raw)
  To: Andreas Mohr; +Cc: LKML, Andrew Morton

Hi Andreas,

Andreas Mohr writes:

> Hi
> 
> On Sun, Jul 20, 2014 at 02:51:15AM +0200, Peter Feuerer wrote:
>> @@ -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.

You mean this newline?


> 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?


> 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;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v4 1/6] acerhdf: Adding support for "manual mode"
  2014-07-20 10:42       ` Peter Feuerer
@ 2014-07-20 20:20         ` Andreas Mohr
  0 siblings, 0 replies; 97+ messages in thread
From: Andreas Mohr @ 2014-07-20 20:20 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: Andreas Mohr, LKML, Andrew Morton

Hi,

On Sun, Jul 20, 2014 at 12:42:53PM +0200, Peter Feuerer wrote:
> Hi Andreas,
> 
> Andreas Mohr writes:
> >On Sun, Jul 20, 2014 at 02:51:15AM +0200, Peter Feuerer wrote:
> >>@@ -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.
> 
> You mean this newline?

Yup.

> >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?

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

> >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

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor
  2014-07-20  0:51   ` [PATCH v4 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
@ 2014-07-21  9:29     ` Borislav Petkov
  2014-07-21  9:37       ` Zhang Rui
  2014-07-21  9:40       ` Zhang Rui
  0 siblings, 2 replies; 97+ messages in thread
From: Borislav Petkov @ 2014-07-21  9:29 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, Andrew Morton, Zhang Rui, Andreas Mohr, Borislav Petkov,
	Javi Merino

On Sun, Jul 20, 2014 at 02:51:17AM +0200, Peter Feuerer wrote:
> 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 <akpm@linux-foundation.org>
> Cc: Zhang Rui <rui.zhang@intel.com>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Javi Merino <javi.merino@arm.com>
> Signed-off-by: Peter Feuerer <peter@piie.net>
> ---
>  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
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index f9a1386..cdddf09 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -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.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor
  2014-07-21  9:29     ` Borislav Petkov
@ 2014-07-21  9:37       ` Zhang Rui
  2014-07-21  9:40       ` Zhang Rui
  1 sibling, 0 replies; 97+ messages in thread
From: Zhang Rui @ 2014-07-21  9:37 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Peter Feuerer, LKML, Andrew Morton, Andreas Mohr,
	Borislav Petkov, Javi Merino

On Mon, 2014-07-21 at 11:29 +0200, Borislav Petkov wrote:
> On Sun, Jul 20, 2014 at 02:51:17AM +0200, Peter Feuerer wrote:
> > 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 <akpm@linux-foundation.org>
> > Cc: Zhang Rui <rui.zhang@intel.com>
> > Cc: Andreas Mohr <andi@lisas.de>
> > Cc: Borislav Petkov <bp@suse.de>
> > Cc: Javi Merino <javi.merino@arm.com>
> > Signed-off-by: Peter Feuerer <peter@piie.net>

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

thanks,
rui
> > ---
> >  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
> > 
> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> > index f9a1386..cdddf09 100644
> > --- a/drivers/thermal/Kconfig
> > +++ b/drivers/thermal/Kconfig
> > @@ -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.
> 



^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor
  2014-07-21  9:29     ` Borislav Petkov
  2014-07-21  9:37       ` Zhang Rui
@ 2014-07-21  9:40       ` Zhang Rui
  2014-07-22 14:59         ` Peter Feuerer
  1 sibling, 1 reply; 97+ messages in thread
From: Zhang Rui @ 2014-07-21  9:40 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Peter Feuerer, LKML, Andrew Morton, Andreas Mohr,
	Borislav Petkov, Javi Merino

On Mon, 2014-07-21 at 11:29 +0200, Borislav Petkov wrote:
> On Sun, Jul 20, 2014 at 02:51:17AM +0200, Peter Feuerer wrote:
> > 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 <akpm@linux-foundation.org>
> > Cc: Zhang Rui <rui.zhang@intel.com>
> > Cc: Andreas Mohr <andi@lisas.de>
> > Cc: Borislav Petkov <bp@suse.de>
> > Cc: Javi Merino <javi.merino@arm.com>
> > Signed-off-by: Peter Feuerer <peter@piie.net>
> > ---
> >  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
> > 
> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> > index f9a1386..cdddf09 100644
> > --- a/drivers/thermal/Kconfig
> > +++ b/drivers/thermal/Kconfig
> > @@ -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.
> 
I agree with this approach.

thanks,
rui



^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v4 4/6] acerhdf: Use bang-bang thermal governor
  2014-07-20  0:51   ` [PATCH v4 4/6] acerhdf: Use bang-bang " Peter Feuerer
@ 2014-07-21 10:23     ` Borislav Petkov
  0 siblings, 0 replies; 97+ messages in thread
From: Borislav Petkov @ 2014-07-21 10:23 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, Andrew Morton, Zhang Rui, Andreas Mohr, Borislav Petkov,
	Javi Merino

On Sun, Jul 20, 2014 at 02:51:18AM +0200, Peter Feuerer wrote:
> 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 :-)

Acked-and-tested-by: Borislav Petkov <bp@suse.de>

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor
  2014-07-21  9:40       ` Zhang Rui
@ 2014-07-22 14:59         ` Peter Feuerer
  2014-07-22 16:09           ` Borislav Petkov
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-22 14:59 UTC (permalink / raw)
  To: Zhang Rui
  Cc: Borislav Petkov, LKML, Andrew Morton, Andreas Mohr,
	Borislav Petkov, Javi Merino

Hi,

Zhang Rui writes:

> On Mon, 2014-07-21 at 11:29 +0200, Borislav Petkov wrote:
>> On Sun, Jul 20, 2014 at 02:51:17AM +0200, Peter Feuerer wrote:
>> > 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 <akpm@linux-foundation.org>
>> > Cc: Zhang Rui <rui.zhang@intel.com>
>> > Cc: Andreas Mohr <andi@lisas.de>
>> > Cc: Borislav Petkov <bp@suse.de>
>> > Cc: Javi Merino <javi.merino@arm.com>
>> > Signed-off-by: Peter Feuerer <peter@piie.net>
>> > ---
>> >  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
>> > 
>> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
>> > index f9a1386..cdddf09 100644
>> > --- a/drivers/thermal/Kconfig
>> > +++ b/drivers/thermal/Kconfig
>> > @@ -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.
>> 
> 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?

-- 
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
                   ` (7 preceding siblings ...)
  2014-07-20  0:51 ` [PATCH v4 " Peter Feuerer
@ 2014-07-22 15:37 ` Peter Feuerer
  2014-07-22 15:37   ` [PATCH v5 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
                     ` (5 more replies)
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
  9 siblings, 6 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-22 15:37 UTC (permalink / raw)
  To: LKML; +Cc: 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

-- 
2.0.2


^ permalink raw reply	[flat|nested] 97+ messages in thread

* [PATCH v5 1/6] acerhdf: Adding support for "manual mode"
  2014-07-22 15:37 ` [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and " Peter Feuerer
@ 2014-07-22 15:37   ` Peter Feuerer
  2014-07-22 15:37   ` [PATCH v5 2/6] acerhdf: Adding support for new models Peter Feuerer
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-22 15:37 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Andreas Mohr

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 <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 186 ++++++++++++++++++++++-------------------
 1 file changed, 102 insertions(+), 84 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index f94467c..2c58f10 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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)
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v5 2/6] acerhdf: Adding support for new models
  2014-07-22 15:37 ` [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and " Peter Feuerer
  2014-07-22 15:37   ` [PATCH v5 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
@ 2014-07-22 15:37   ` Peter Feuerer
  2014-07-22 15:37   ` [PATCH v5 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-22 15:37 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Andreas Mohr

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

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 2c58f10..f30767f 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v5 3/6] thermal: Added Bang-bang thermal governor
  2014-07-22 15:37 ` [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and " Peter Feuerer
  2014-07-22 15:37   ` [PATCH v5 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
  2014-07-22 15:37   ` [PATCH v5 2/6] acerhdf: Adding support for new models Peter Feuerer
@ 2014-07-22 15:37   ` Peter Feuerer
  2014-07-26 14:14     ` Peter Feuerer
  2014-07-22 15:37   ` [PATCH v5 4/6] acerhdf: Use bang-bang " Peter Feuerer
                     ` (2 subsequent siblings)
  5 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-22 15:37 UTC (permalink / raw)
  To: LKML
  Cc: Peter Feuerer, Andrew Morton, Zhang Rui, Andreas Mohr,
	Borislav Petkov, Javi Merino, linux-pm

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 <akpm@linux-foundation.org>
Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Javi Merino <javi.merino@arm.com>
Cc: linux-pm@vger.kernel.org
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 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

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index f9a1386..fa14d56 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -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
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index de0636a..a675980 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -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
 
diff --git a/drivers/thermal/gov_bang_bang.c b/drivers/thermal/gov_bang_bang.c
new file mode 100644
index 0000000..c5dd76b
--- /dev/null
+++ b/drivers/thermal/gov_bang_bang.c
@@ -0,0 +1,131 @@
+/*
+ *  gov_bang_bang.c - A simple thermal throttling governor using hysteresis
+ *
+ *  Copyright (C) 2014 Peter Feuerer <peter@piie.net>
+ *
+ *  Based on step_wise.c with following Copyrights:
+ *  Copyright (C) 2012 Intel Corp
+ *  Copyright (C) 2012 Durgadoss R <durgadoss.r@intel.com>
+ *
+ *
+ * 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;
+
+		/* 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;
+		}
+
+		/*
+		 * enable fan when temperature exceeds trip_temp and disable
+		 * the fan in case it falls below trip_temp minus hysteresis
+		 */
+		if (instance->target == 0 && tz->temperature >= trip_temp)
+			instance->target = 1;
+		else if (instance->target == 1 &&
+				tz->temperature < trip_temp - trip_hyst)
+			instance->target = 0;
+
+		dev_dbg(&instance->cdev->device, "target=%d\n",
+					(int)instance->target);
+
+		instance->cdev->updated = false; /* cdev needs update */
+	}
+
+	mutex_unlock(&tz->lock);
+}
+
+/**
+ * bang_bang_control - controls devices associated with the given zone
+ * @tz - thermal_zone_device
+ * @trip - the trip point
+ *
+ * Regulation Logic: a two point regulation, deliver cooling state depending
+ * on the previous state shown in this diagram:
+ *
+ *                Fan:   OFF    ON
+ *
+ *                              |
+ *                              |
+ *          trip_temp:    +---->+
+ *                        |     |        ^
+ *                        |     |        |
+ *                        |     |   Temperature
+ * (trip_temp - hyst):    +<----+
+ *                        |
+ *                        |
+ *                        |
+ *
+ *   * If the fan is not running and temperature exceeds trip_temp, the fan
+ *     gets turned on.
+ *   * In case the fan is running, temperature must fall below
+ *     (trip_temp - hyst) so that the fan gets turned off again.
+ *
+ */
+static int bang_bang_control(struct thermal_zone_device *tz, int trip)
+{
+	struct thermal_instance *instance;
+
+	thermal_zone_trip_update(tz, trip);
+
+	mutex_lock(&tz->lock);
+
+	list_for_each_entry(instance, &tz->thermal_instances, tz_node)
+		thermal_cdev_update(instance->cdev);
+
+	mutex_unlock(&tz->lock);
+
+	return 0;
+}
+
+static struct thermal_governor thermal_gov_bang_bang = {
+	.name		= "bang_bang",
+	.throttle	= bang_bang_control,
+};
+
+int thermal_gov_bang_bang_register(void)
+{
+	return thermal_register_governor(&thermal_gov_bang_bang);
+}
+
+void thermal_gov_bang_bang_unregister(void)
+{
+	thermal_unregister_governor(&thermal_gov_bang_bang);
+}
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 71b0ec0..4c2726b 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -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();
 }
 
diff --git a/drivers/thermal/thermal_core.h b/drivers/thermal/thermal_core.h
index 3db339f..d15d243 100644
--- a/drivers/thermal/thermal_core.h
+++ b/drivers/thermal/thermal_core.h
@@ -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);
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v5 4/6] acerhdf: Use bang-bang thermal governor
  2014-07-22 15:37 ` [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and " Peter Feuerer
                     ` (2 preceding siblings ...)
  2014-07-22 15:37   ` [PATCH v5 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
@ 2014-07-22 15:37   ` Peter Feuerer
  2014-08-27  7:48     ` Zhang Rui
  2014-07-22 15:37   ` [PATCH v5 5/6] acerhdf: added critical trip point Peter Feuerer
  2014-07-22 15:37   ` [PATCH v5 6/6] acerhdf: minor clean up Peter Feuerer
  5 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-22 15:37 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Zhang Rui, Andreas Mohr, Javi Merino

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 <akpm@linux-foundation.org>
CC: Zhang Rui <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Javi Merino <javi.merino@arm.com>
Acked-and-tested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index 172f26c..b5e80dc 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -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.
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index f30767f..7fe7dbf 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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;
 }
 
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v5 5/6] acerhdf: added critical trip point
  2014-07-22 15:37 ` [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and " Peter Feuerer
                     ` (3 preceding siblings ...)
  2014-07-22 15:37   ` [PATCH v5 4/6] acerhdf: Use bang-bang " Peter Feuerer
@ 2014-07-22 15:37   ` Peter Feuerer
  2014-07-26 14:16     ` Peter Feuerer
  2014-07-22 15:37   ` [PATCH v5 6/6] acerhdf: minor clean up Peter Feuerer
  5 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-22 15:37 UTC (permalink / raw)
  To: LKML
  Cc: Peter Feuerer, Andrew Morton, Andreas Mohr, Borislav Petkov, Javi Merino

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

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Javi Merino <javi.merino@arm.com>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 7fe7dbf..91b16c8 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [PATCH v5 6/6] acerhdf: minor clean up
  2014-07-22 15:37 ` [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and " Peter Feuerer
                     ` (4 preceding siblings ...)
  2014-07-22 15:37   ` [PATCH v5 5/6] acerhdf: added critical trip point Peter Feuerer
@ 2014-07-22 15:37   ` Peter Feuerer
  5 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-22 15:37 UTC (permalink / raw)
  To: LKML; +Cc: Peter Feuerer, Andrew Morton, Andreas Mohr

  * 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 <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 91b16c8..c07623c 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
2.0.2


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* Re: [PATCH v4 3/6] thermal: Added Bang-bang thermal governor
  2014-07-22 14:59         ` Peter Feuerer
@ 2014-07-22 16:09           ` Borislav Petkov
  0 siblings, 0 replies; 97+ messages in thread
From: Borislav Petkov @ 2014-07-22 16:09 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: Zhang Rui, LKML, Andrew Morton, Andreas Mohr, Borislav Petkov,
	Javi Merino

On Tue, Jul 22, 2014 at 04:59:02PM +0200, Peter Feuerer wrote:
> 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.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor
  2014-07-22 15:37   ` [PATCH v5 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
@ 2014-07-26 14:14     ` Peter Feuerer
  2014-07-28  2:26       ` Zhang Rui
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-07-26 14:14 UTC (permalink / raw)
  To: Peter Feuerer, Zhang Rui, linux-pm
  Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov, Javi Merino

Hi Rui,

Peter Feuerer writes:

> 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 <akpm@linux-foundation.org>
> Cc: Zhang Rui <rui.zhang@intel.com>

Anything that prevents you from giving your acked-by?

[...]

-- 
kind regards,
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 5/6] acerhdf: added critical trip point
  2014-07-22 15:37   ` [PATCH v5 5/6] acerhdf: added critical trip point Peter Feuerer
@ 2014-07-26 14:16     ` Peter Feuerer
  0 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-07-26 14:16 UTC (permalink / raw)
  To: Peter Feuerer, Borislav Petkov
  Cc: LKML, Andrew Morton, Andreas Mohr, Javi Merino

Hi Boris,

Peter Feuerer writes:

> added critical trip point which represents the temperature limit.
> Added return -EINVAL in case wrong trip point is provided.
> 
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>

Any concerns regarding this patch?

-- 
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor
  2014-07-26 14:14     ` Peter Feuerer
@ 2014-07-28  2:26       ` Zhang Rui
  2014-10-21 10:29         ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Zhang Rui @ 2014-07-28  2:26 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: linux-pm, LKML, Andrew Morton, Andreas Mohr, Borislav Petkov,
	Javi Merino

On Sat, 2014-07-26 at 16:14 +0200, Peter Feuerer wrote:
> Hi Rui,
> 
> Peter Feuerer writes:
> 
> > 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 <akpm@linux-foundation.org>
> > Cc: Zhang Rui <rui.zhang@intel.com>
> 
> Anything that prevents you from giving your acked-by?
> 
NO.

I'll queue them for 3.18.

thanks,
rui


^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up
  2014-05-15 22:53     ` Peter Feuerer
  2014-06-15 22:39       ` Felix Deichmann
@ 2014-07-30 13:16       ` Eduardo Valentin
  1 sibling, 0 replies; 97+ messages in thread
From: Eduardo Valentin @ 2014-07-30 13:16 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, Andrew Morton, Andreas Mohr, Borislav Petkov, Zhang Rui,
	Javi Merino

Hello Peter,

On Fri, May 16, 2014 at 12:53:51AM +0200, Peter Feuerer wrote:
> Hi Eduardo,
> 
> Eduardo Valentin writes:
> 
> > Hello Peter,
> > 
> > On Sat, May 03, 2014 at 07:59:20PM +0200, Peter Feuerer wrote:
> >> 
> >> 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.
> >> 
> > 
> > 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.
> 

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.

> 
> > 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.
> 
> 
> > 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;
> 
> > 
> > 
> > 
> > 
> >>   * 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 <akpm@linux-foundation.org>
> >> Cc: Andreas Mohr <andi@lisas.de>
> >> Cc: Borislav Petkov <bp@suse.de>
> >> Cc: Zhang Rui <rui.zhang@intel.com>
> >> Cc: Javi Merino <javi.merino@arm.com>
> >> 
> >> 
> >> 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
> >> 
> >> -- 
> >> 1.9.2
> >> 
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >> Please read the FAQ at  http://www.tux.org/lkml/

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 4/6] acerhdf: Use bang-bang thermal governor
  2014-07-22 15:37   ` [PATCH v5 4/6] acerhdf: Use bang-bang " Peter Feuerer
@ 2014-08-27  7:48     ` Zhang Rui
  2014-08-27  8:01       ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Zhang Rui @ 2014-08-27  7:48 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andrew Morton, Andreas Mohr, Javi Merino

On Tue, 2014-07-22 at 17:37 +0200, Peter Feuerer wrote:
> 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 <akpm@linux-foundation.org>
> CC: Zhang Rui <rui.zhang@intel.com>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Javi Merino <javi.merino@arm.com>
> Acked-and-tested-by: Borislav Petkov <bp@suse.de>
> Signed-off-by: Peter Feuerer <peter@piie.net>

Peter,

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

thanks,
rui
> ---
>  drivers/platform/x86/Kconfig   |  3 ++-
>  drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
>  2 files changed, 33 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index 172f26c..b5e80dc 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -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.
> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
> index f30767f..7fe7dbf 100644
> --- a/drivers/platform/x86/acerhdf.c
> +++ b/drivers/platform/x86/acerhdf.c
> @@ -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;
>  }
>  



^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 4/6] acerhdf: Use bang-bang thermal governor
  2014-08-27  7:48     ` Zhang Rui
@ 2014-08-27  8:01       ` Peter Feuerer
  2014-08-28  1:17         ` Zhang Rui
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-08-27  8:01 UTC (permalink / raw)
  To: Zhang Rui; +Cc: LKML, Andrew Morton, Andreas Mohr, Javi Merino

Zhang Rui writes:

> On Tue, 2014-07-22 at 17:37 +0200, Peter Feuerer wrote:
>> 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 <akpm@linux-foundation.org>
>> CC: Zhang Rui <rui.zhang@intel.com>
>> Cc: Andreas Mohr <andi@lisas.de>
>> Cc: Javi Merino <javi.merino@arm.com>
>> Acked-and-tested-by: Borislav Petkov <bp@suse.de>
>> Signed-off-by: Peter Feuerer <peter@piie.net>
> 
> 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;


> 
> thanks,
> rui
>> ---
>>  drivers/platform/x86/Kconfig   |  3 ++-
>>  drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
>>  2 files changed, 33 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
>> index 172f26c..b5e80dc 100644
>> --- a/drivers/platform/x86/Kconfig
>> +++ b/drivers/platform/x86/Kconfig
>> @@ -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.
>> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
>> index f30767f..7fe7dbf 100644
>> --- a/drivers/platform/x86/acerhdf.c
>> +++ b/drivers/platform/x86/acerhdf.c
>> @@ -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;
>>  }
>>  
> 
> 

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 4/6] acerhdf: Use bang-bang thermal governor
  2014-08-27  8:01       ` Peter Feuerer
@ 2014-08-28  1:17         ` Zhang Rui
  2014-08-28  6:05           ` Borislav Petkov
  0 siblings, 1 reply; 97+ messages in thread
From: Zhang Rui @ 2014-08-28  1:17 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Andrew Morton, Andreas Mohr, Javi Merino

On Wed, 2014-08-27 at 10:01 +0200, Peter Feuerer wrote:
> Zhang Rui writes:
> 
> > On Tue, 2014-07-22 at 17:37 +0200, Peter Feuerer wrote:
> >> 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 <akpm@linux-foundation.org>
> >> CC: Zhang Rui <rui.zhang@intel.com>
> >> Cc: Andreas Mohr <andi@lisas.de>
> >> Cc: Javi Merino <javi.merino@arm.com>
> >> Acked-and-tested-by: Borislav Petkov <bp@suse.de>
> >> Signed-off-by: Peter Feuerer <peter@piie.net>
> > 
> > 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.
> 
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

> thanks and kind regards,
> --peter;
> 
> 
> > 
> > thanks,
> > rui
> >> ---
> >>  drivers/platform/x86/Kconfig   |  3 ++-
> >>  drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
> >>  2 files changed, 33 insertions(+), 6 deletions(-)
> >> 
> >> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> >> index 172f26c..b5e80dc 100644
> >> --- a/drivers/platform/x86/Kconfig
> >> +++ b/drivers/platform/x86/Kconfig
> >> @@ -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.
> >> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
> >> index f30767f..7fe7dbf 100644
> >> --- a/drivers/platform/x86/acerhdf.c
> >> +++ b/drivers/platform/x86/acerhdf.c
> >> @@ -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;
> >>  }
> >>  
> > 
> > 



^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 4/6] acerhdf: Use bang-bang thermal governor
  2014-08-28  1:17         ` Zhang Rui
@ 2014-08-28  6:05           ` Borislav Petkov
  0 siblings, 0 replies; 97+ messages in thread
From: Borislav Petkov @ 2014-08-28  6:05 UTC (permalink / raw)
  To: Zhang Rui
  Cc: Peter Feuerer, LKML, Andrew Morton, Andreas Mohr, Javi Merino,
	Matthew Garrett, Darren Hart

On Thu, Aug 28, 2014 at 09:17:52AM +0800, Zhang Rui wrote:
> 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.

-- 
Regards/Gruss,
    Boris.

Sent from a fat crate under my desk. Formatting is fine.
--

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor
  2014-07-28  2:26       ` Zhang Rui
@ 2014-10-21 10:29         ` Peter Feuerer
  2014-10-28 19:33           ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-10-21 10:29 UTC (permalink / raw)
  To: Zhang Rui
  Cc: linux-pm, LKML, Andrew Morton, Andreas Mohr, Borislav Petkov,
	Javi Merino

Hi Rui,

Zhang Rui writes:

> On Sat, 2014-07-26 at 16:14 +0200, Peter Feuerer wrote:
>> Hi Rui,
>> 
>> Peter Feuerer writes:
>> 
>> > 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 <akpm@linux-foundation.org>
>> > Cc: Zhang Rui <rui.zhang@intel.com>
>> 
>> 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;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor
  2014-10-21 10:29         ` Peter Feuerer
@ 2014-10-28 19:33           ` Peter Feuerer
  2014-10-29  9:44             ` Javi Merino
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-10-28 19:33 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: Zhang Rui, linux-pm, LKML, Andrew Morton, Andreas Mohr,
	Borislav Petkov, Javi Merino

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;


Peter Feuerer writes:

> Hi Rui,
> 
> Zhang Rui writes:
> 
>> On Sat, 2014-07-26 at 16:14 +0200, Peter Feuerer wrote:
>>> Hi Rui,
>>> 
>>> Peter Feuerer writes:
>>> 
>>> > 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 <akpm@linux-foundation.org>
>>> > Cc: Zhang Rui <rui.zhang@intel.com>
>>> 
>>> 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;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor
  2014-10-28 19:33           ` Peter Feuerer
@ 2014-10-29  9:44             ` Javi Merino
  2014-10-29 10:14               ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Javi Merino @ 2014-10-29  9:44 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: Zhang Rui, linux-pm, LKML

On Tue, Oct 28, 2014 at 07:33:39PM +0000, Peter Feuerer wrote:
> 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

> Peter Feuerer writes:
> 
> > Hi Rui,
> > 
> > Zhang Rui writes:
> > 
> >> On Sat, 2014-07-26 at 16:14 +0200, Peter Feuerer wrote:
> >>> Hi Rui,
> >>> 
> >>> Peter Feuerer writes:
> >>> 
> >>> > 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 <akpm@linux-foundation.org>
> >>> > Cc: Zhang Rui <rui.zhang@intel.com>
> >>> 
> >>> 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;
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [PATCH v5 3/6] thermal: Added Bang-bang thermal governor
  2014-10-29  9:44             ` Javi Merino
@ 2014-10-29 10:14               ` Peter Feuerer
  0 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-10-29 10:14 UTC (permalink / raw)
  To: Javi Merino; +Cc: Zhang Rui, linux-pm, LKML

Hi Javi,

Javi Merino writes:

> On Tue, Oct 28, 2014 at 07:33:39PM +0000, Peter Feuerer wrote:
>> 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;


> 
> Cheers,
> Javi
> 
>> Peter Feuerer writes:
>> 
>> > Hi Rui,
>> > 
>> > Zhang Rui writes:
>> > 
>> >> On Sat, 2014-07-26 at 16:14 +0200, Peter Feuerer wrote:
>> >>> Hi Rui,
>> >>> 
>> >>> Peter Feuerer writes:
>> >>> 
>> >>> > 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 <akpm@linux-foundation.org>
>> >>> > Cc: Zhang Rui <rui.zhang@intel.com>
>> >>> 
>> >>> 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;
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>> Please read the FAQ at  http://www.tux.org/lkml/
>> 
> 

^ permalink raw reply	[flat|nested] 97+ messages in thread

* [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and minor clean up
  2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
                   ` (8 preceding siblings ...)
  2014-07-22 15:37 ` [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and " Peter Feuerer
@ 2014-11-28 14:20 ` Peter Feuerer
  2014-11-28 14:20   ` [RESEND PATCH v5 1/5] acerhdf: Adding support for "manual mode" Peter Feuerer
                     ` (7 more replies)
  9 siblings, 8 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-11-28 14:20 UTC (permalink / raw)
  To: LKML, Darren Hart, platform-driver-x86; +Cc: 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(-)

-- 
2.1.3


^ permalink raw reply	[flat|nested] 97+ messages in thread

* [RESEND PATCH v5 1/5] acerhdf: Adding support for "manual mode"
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
@ 2014-11-28 14:20   ` Peter Feuerer
  2014-11-28 14:20   ` [RESEND PATCH v5 2/5] acerhdf: Adding support for new models Peter Feuerer
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-11-28 14:20 UTC (permalink / raw)
  To: LKML, Darren Hart, platform-driver-x86
  Cc: Peter Feuerer, Andrew Morton, Andreas Mohr

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: platform-driver-x86@vger.kernel.org
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 186 ++++++++++++++++++++++-------------------
 1 file changed, 102 insertions(+), 84 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index f94467c..2c58f10 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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)
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [RESEND PATCH v5 2/5] acerhdf: Adding support for new models
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
  2014-11-28 14:20   ` [RESEND PATCH v5 1/5] acerhdf: Adding support for "manual mode" Peter Feuerer
@ 2014-11-28 14:20   ` Peter Feuerer
  2014-11-28 14:20   ` [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor Peter Feuerer
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-11-28 14:20 UTC (permalink / raw)
  To: LKML, Darren Hart, platform-driver-x86
  Cc: Peter Feuerer, Andrew Morton, Andreas Mohr

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

Cc: platform-driver-x86@vger.kernel.org
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 2c58f10..f30767f 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
  2014-11-28 14:20   ` [RESEND PATCH v5 1/5] acerhdf: Adding support for "manual mode" Peter Feuerer
  2014-11-28 14:20   ` [RESEND PATCH v5 2/5] acerhdf: Adding support for new models Peter Feuerer
@ 2014-11-28 14:20   ` Peter Feuerer
  2014-12-03  9:04     ` Darren Hart
  2014-11-28 14:20   ` [RESEND PATCH v5 4/5] acerhdf: added critical trip point Peter Feuerer
                     ` (4 subsequent siblings)
  7 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-11-28 14:20 UTC (permalink / raw)
  To: LKML, Darren Hart, platform-driver-x86
  Cc: Peter Feuerer, Andrew Morton, Zhang Rui, Andreas Mohr, Javi Merino

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: platform-driver-x86@vger.kernel.org
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
CC: Zhang Rui <rui.zhang@intel.com>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Javi Merino <javi.merino@arm.com>
Acked-and-tested-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/Kconfig   |  3 ++-
 drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
 2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
index a2eabe6..c173266 100644
--- a/drivers/platform/x86/Kconfig
+++ b/drivers/platform/x86/Kconfig
@@ -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.
diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index f30767f..7fe7dbf 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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;
 }
 
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [RESEND PATCH v5 4/5] acerhdf: added critical trip point
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
                     ` (2 preceding siblings ...)
  2014-11-28 14:20   ` [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor Peter Feuerer
@ 2014-11-28 14:20   ` Peter Feuerer
  2014-12-03  9:08     ` Darren Hart
  2014-11-28 14:20   ` [RESEND PATCH v5 5/5] acerhdf: minor clean up Peter Feuerer
                     ` (3 subsequent siblings)
  7 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-11-28 14:20 UTC (permalink / raw)
  To: LKML, Darren Hart, platform-driver-x86
  Cc: Peter Feuerer, Andrew Morton, Andreas Mohr, Borislav Petkov, Javi Merino

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

Cc: platform-driver-x86@vger.kernel.org
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Cc: Borislav Petkov <bp@suse.de>
Cc: Javi Merino <javi.merino@arm.com>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 7fe7dbf..91b16c8 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* [RESEND PATCH v5 5/5] acerhdf: minor clean up
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
                     ` (3 preceding siblings ...)
  2014-11-28 14:20   ` [RESEND PATCH v5 4/5] acerhdf: added critical trip point Peter Feuerer
@ 2014-11-28 14:20   ` Peter Feuerer
  2014-12-03 21:46   ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-11-28 14:20 UTC (permalink / raw)
  To: LKML, Darren Hart, platform-driver-x86
  Cc: Peter Feuerer, Andrew Morton, Andreas Mohr

  * 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: platform-driver-x86@vger.kernel.org
Cc: Darren Hart <dvhart@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andreas Mohr <andi@lisas.de>
Acked-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Peter Feuerer <peter@piie.net>
---
 drivers/platform/x86/acerhdf.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
index 91b16c8..c07623c 100644
--- a/drivers/platform/x86/acerhdf.c
+++ b/drivers/platform/x86/acerhdf.c
@@ -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);
-- 
2.1.3


^ permalink raw reply related	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor
  2014-11-28 14:20   ` [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor Peter Feuerer
@ 2014-12-03  9:04     ` Darren Hart
  2014-12-04  7:10       ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Darren Hart @ 2014-12-03  9:04 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, platform-driver-x86, Andrew Morton, Zhang Rui,
	Andreas Mohr, Javi Merino

On Fri, Nov 28, 2014 at 03:20:50PM +0100, Peter Feuerer wrote:
> 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: platform-driver-x86@vger.kernel.org
> Cc: Darren Hart <dvhart@infradead.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> CC: Zhang Rui <rui.zhang@intel.com>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Javi Merino <javi.merino@arm.com>
> Acked-and-tested-by: Borislav Petkov <bp@suse.de>
> Signed-off-by: Peter Feuerer <peter@piie.net>
> ---
>  drivers/platform/x86/Kconfig   |  3 ++-
>  drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
>  2 files changed, 33 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> index a2eabe6..c173266 100644
> --- a/drivers/platform/x86/Kconfig
> +++ b/drivers/platform/x86/Kconfig
> @@ -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?

> +	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.
> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
> index f30767f..7fe7dbf 100644
> --- a/drivers/platform/x86/acerhdf.c
> +++ b/drivers/platform/x86/acerhdf.c
> @@ -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

Please use sentence punctuation, particularly for block comments.

/*
 * This struct...
 * default ... 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);

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

> +		return -EINVAL;
> +	}
> +
>  	return 0;
>  }
>  
> -- 
> 2.1.3
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 4/5] acerhdf: added critical trip point
  2014-11-28 14:20   ` [RESEND PATCH v5 4/5] acerhdf: added critical trip point Peter Feuerer
@ 2014-12-03  9:08     ` Darren Hart
  0 siblings, 0 replies; 97+ messages in thread
From: Darren Hart @ 2014-12-03  9:08 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, platform-driver-x86, Andrew Morton, Andreas Mohr,
	Borislav Petkov, Javi Merino

On Fri, Nov 28, 2014 at 03:20:51PM +0100, Peter Feuerer wrote:
> added critical trip point which represents the temperature limit.

Nitpic, Add ^

> 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.

> 
> Cc: platform-driver-x86@vger.kernel.org
> Cc: Darren Hart <dvhart@infradead.org>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Andreas Mohr <andi@lisas.de>
> Cc: Borislav Petkov <bp@suse.de>
> Cc: Javi Merino <javi.merino@arm.com>
> Signed-off-by: Peter Feuerer <peter@piie.net>
> ---
>  drivers/platform/x86/acerhdf.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
> index 7fe7dbf..91b16c8 100644
> --- a/drivers/platform/x86/acerhdf.c
> +++ b/drivers/platform/x86/acerhdf.c
> @@ -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);
> -- 
> 2.1.3
> 
> 

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and minor clean up
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
                     ` (4 preceding siblings ...)
  2014-11-28 14:20   ` [RESEND PATCH v5 5/5] acerhdf: minor clean up Peter Feuerer
@ 2014-12-03 21:46   ` Peter Feuerer
  2014-12-11  4:27   ` Darren Hart
  2014-12-11  4:59   ` Darren Hart
  7 siblings, 0 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-12-03 21:46 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, Darren Hart, platform-driver-x86

Hi Darren / platform-driver-x86 list,

Peter Feuerer writes:
> please apply this series of patches.

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

-- 
kind regards,
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor
  2014-12-03  9:04     ` Darren Hart
@ 2014-12-04  7:10       ` Peter Feuerer
  2014-12-04  7:21         ` Peter Feuerer
  0 siblings, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-12-04  7:10 UTC (permalink / raw)
  To: Darren Hart
  Cc: LKML, platform-driver-x86, Andrew Morton, Zhang Rui,
	Andreas Mohr, Javi Merino

Hi Darren,

thank you very much for your reply.


Darren Hart writes:

> On Fri, Nov 28, 2014 at 03:20:50PM +0100, Peter Feuerer wrote:
>> 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: platform-driver-x86@vger.kernel.org
>> Cc: Darren Hart <dvhart@infradead.org>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> CC: Zhang Rui <rui.zhang@intel.com>
>> Cc: Andreas Mohr <andi@lisas.de>
>> Cc: Javi Merino <javi.merino@arm.com>
>> Acked-and-tested-by: Borislav Petkov <bp@suse.de>
>> Signed-off-by: Peter Feuerer <peter@piie.net>
>> ---
>>  drivers/platform/x86/Kconfig   |  3 ++-
>>  drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
>>  2 files changed, 33 insertions(+), 6 deletions(-)
>> 
>> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
>> index a2eabe6..c173266 100644
>> --- a/drivers/platform/x86/Kconfig
>> +++ b/drivers/platform/x86/Kconfig
>> @@ -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?

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.


>> +	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.
>> diff --git a/drivers/platform/x86/acerhdf.c b/drivers/platform/x86/acerhdf.c
>> index f30767f..7fe7dbf 100644
>> --- a/drivers/platform/x86/acerhdf.c
>> +++ b/drivers/platform/x86/acerhdf.c
>> @@ -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
> 
> Please use sentence punctuation, particularly for block comments.

ok.


 
> /*
>  * This struct...
>  * default ... 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);
> 
> 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.

-- 
kind regards,
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor
  2014-12-04  7:10       ` Peter Feuerer
@ 2014-12-04  7:21         ` Peter Feuerer
  2014-12-04 11:40           ` Darren Hart
  2014-12-08  7:45           ` Peter Feuerer
  0 siblings, 2 replies; 97+ messages in thread
From: Peter Feuerer @ 2014-12-04  7:21 UTC (permalink / raw)
  To: Darren Hart
  Cc: LKML, platform-driver-x86, Andrew Morton, Zhang Rui,
	Andreas Mohr, Javi Merino

Hi again,

Peter Feuerer writes:

> Hi Darren,
> 
> thank you very much for your reply.
> 
> 
> Darren Hart writes:
> 
>> On Fri, Nov 28, 2014 at 03:20:50PM +0100, Peter Feuerer wrote:
>>> 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: platform-driver-x86@vger.kernel.org
>>> Cc: Darren Hart <dvhart@infradead.org>
>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>> CC: Zhang Rui <rui.zhang@intel.com>
>>> Cc: Andreas Mohr <andi@lisas.de>
>>> Cc: Javi Merino <javi.merino@arm.com>
>>> Acked-and-tested-by: Borislav Petkov <bp@suse.de>
>>> Signed-off-by: Peter Feuerer <peter@piie.net>
>>> ---
>>>  drivers/platform/x86/Kconfig   |  3 ++-
>>>  drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
>>>  2 files changed, 33 insertions(+), 6 deletions(-)
>>> 
>>> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
>>> index a2eabe6..c173266 100644
>>> --- a/drivers/platform/x86/Kconfig
>>> +++ b/drivers/platform/x86/Kconfig
>>> @@ -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?
> 
> 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

[...]

-- 
kind regards,
--peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor
  2014-12-08  7:45           ` Peter Feuerer
@ 2014-12-04 11:18             ` Darren Hart
  0 siblings, 0 replies; 97+ messages in thread
From: Darren Hart @ 2014-12-04 11:18 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, platform-driver-x86, Andrew Morton, Zhang Rui,
	Andreas Mohr, Javi Merino

On Mon, Dec 08, 2014 at 08:45:58AM +0100, Peter Feuerer wrote:
> 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

> 
> kind regards,
> --peter;
> 
> 
> Peter Feuerer writes:
> 
> >Hi again,
> >
> >Peter Feuerer writes:
> >
> >>Hi Darren,
> >>
> >>thank you very much for your reply.
> >>
> >>
> >>Darren Hart writes:
> >>
> >>>On Fri, Nov 28, 2014 at 03:20:50PM +0100, Peter Feuerer wrote:
> >>>>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: platform-driver-x86@vger.kernel.org
> >>>>Cc: Darren Hart <dvhart@infradead.org>
> >>>>Cc: Andrew Morton <akpm@linux-foundation.org>
> >>>>CC: Zhang Rui <rui.zhang@intel.com>
> >>>>Cc: Andreas Mohr <andi@lisas.de>
> >>>>Cc: Javi Merino <javi.merino@arm.com>
> >>>>Acked-and-tested-by: Borislav Petkov <bp@suse.de>
> >>>>Signed-off-by: Peter Feuerer <peter@piie.net>
> >>>>---
> >>>> drivers/platform/x86/Kconfig   |  3 ++-
> >>>> drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
> >>>> 2 files changed, 33 insertions(+), 6 deletions(-)
> >>>>
> >>>>diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> >>>>index a2eabe6..c173266 100644
> >>>>--- a/drivers/platform/x86/Kconfig
> >>>>+++ b/drivers/platform/x86/Kconfig
> >>>>@@ -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?
> >>
> >>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
> >
> >[...]
> >
> >-- 
> >kind regards,
> >--peter;
> 

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor
  2014-12-04  7:21         ` Peter Feuerer
@ 2014-12-04 11:40           ` Darren Hart
  2014-12-08  7:45           ` Peter Feuerer
  1 sibling, 0 replies; 97+ messages in thread
From: Darren Hart @ 2014-12-04 11:40 UTC (permalink / raw)
  To: Peter Feuerer
  Cc: LKML, platform-driver-x86, Andrew Morton, Zhang Rui,
	Andreas Mohr, Javi Merino, linux-pm

On Thu, Dec 04, 2014 at 08:21:06AM +0100, Peter Feuerer wrote:
> Hi again,
> 
> Peter Feuerer writes:
> 
> >Hi Darren,
> >
> >thank you very much for your reply.
> >
> >
> >Darren Hart writes:
> >
> >>On Fri, Nov 28, 2014 at 03:20:50PM +0100, Peter Feuerer wrote:
> >>>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: platform-driver-x86@vger.kernel.org
> >>>Cc: Darren Hart <dvhart@infradead.org>
> >>>Cc: Andrew Morton <akpm@linux-foundation.org>
> >>>CC: Zhang Rui <rui.zhang@intel.com>
> >>>Cc: Andreas Mohr <andi@lisas.de>
> >>>Cc: Javi Merino <javi.merino@arm.com>
> >>>Acked-and-tested-by: Borislav Petkov <bp@suse.de>
> >>>Signed-off-by: Peter Feuerer <peter@piie.net>
> >>>---
> >>> drivers/platform/x86/Kconfig   |  3 ++-
> >>> drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
> >>> 2 files changed, 33 insertions(+), 6 deletions(-)
> >>>
> >>>diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
> >>>index a2eabe6..c173266 100644
> >>>--- a/drivers/platform/x86/Kconfig
> >>>+++ b/drivers/platform/x86/Kconfig
> >>>@@ -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?
> >
> >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
> 

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

?

> [...]
> 
> -- 
> kind regards,
> --peter;
> 

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor
  2014-12-04  7:21         ` Peter Feuerer
  2014-12-04 11:40           ` Darren Hart
@ 2014-12-08  7:45           ` Peter Feuerer
  2014-12-04 11:18             ` Darren Hart
  1 sibling, 1 reply; 97+ messages in thread
From: Peter Feuerer @ 2014-12-08  7:45 UTC (permalink / raw)
  To: Darren Hart
  Cc: peter, LKML, platform-driver-x86, Andrew Morton, Zhang Rui,
	Andreas Mohr, Javi Merino

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;


Peter Feuerer writes:

> Hi again,
> 
> Peter Feuerer writes:
> 
>> Hi Darren,
>> 
>> thank you very much for your reply.
>> 
>> 
>> Darren Hart writes:
>> 
>>> On Fri, Nov 28, 2014 at 03:20:50PM +0100, Peter Feuerer wrote:
>>>> 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: platform-driver-x86@vger.kernel.org
>>>> Cc: Darren Hart <dvhart@infradead.org>
>>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>>> CC: Zhang Rui <rui.zhang@intel.com>
>>>> Cc: Andreas Mohr <andi@lisas.de>
>>>> Cc: Javi Merino <javi.merino@arm.com>
>>>> Acked-and-tested-by: Borislav Petkov <bp@suse.de>
>>>> Signed-off-by: Peter Feuerer <peter@piie.net>
>>>> ---
>>>>  drivers/platform/x86/Kconfig   |  3 ++-
>>>>  drivers/platform/x86/acerhdf.c | 36 +++++++++++++++++++++++++++++++-----
>>>>  2 files changed, 33 insertions(+), 6 deletions(-)
>>>> 
>>>> diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
>>>> index a2eabe6..c173266 100644
>>>> --- a/drivers/platform/x86/Kconfig
>>>> +++ b/drivers/platform/x86/Kconfig
>>>> @@ -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?
>> 
>> 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
> 
> [...]
> 
> -- 
> kind regards,
> --peter;

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and minor clean up
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
                     ` (5 preceding siblings ...)
  2014-12-03 21:46   ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
@ 2014-12-11  4:27   ` Darren Hart
  2014-12-11  4:59   ` Darren Hart
  7 siblings, 0 replies; 97+ messages in thread
From: Darren Hart @ 2014-12-11  4:27 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, platform-driver-x86

On Fri, Nov 28, 2014 at 03:20:47PM +0100, Peter Feuerer wrote:
> 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,

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 97+ messages in thread

* Re: [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and minor clean up
  2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
                     ` (6 preceding siblings ...)
  2014-12-11  4:27   ` Darren Hart
@ 2014-12-11  4:59   ` Darren Hart
  7 siblings, 0 replies; 97+ messages in thread
From: Darren Hart @ 2014-12-11  4:59 UTC (permalink / raw)
  To: Peter Feuerer; +Cc: LKML, platform-driver-x86

On Fri, Nov 28, 2014 at 03:20:47PM +0100, Peter Feuerer wrote:
> 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

Queued to for-next. Thanks!

-- 
Darren Hart
Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 97+ messages in thread

end of thread, other threads:[~2014-12-11  4:59 UTC | newest]

Thread overview: 97+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-27  1:23 [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
2014-04-27  1:23 ` [PATCH 1/4] acerhdf: Adding support for "manual mode" Peter Feuerer
2014-04-27 21:03   ` Borislav Petkov
2014-04-27 22:22     ` Peter Feuerer
2014-04-27  1:23 ` [PATCH 2/4] acerhdf: Adding support for new models Peter Feuerer
2014-04-27  1:23 ` [PATCH 3/4] thermal: Added Bang-bang thermal governor Peter Feuerer
2014-04-27  1:23 ` [PATCH 4/4] acerhdf: Use bang-bang " Peter Feuerer
2014-04-27 18:57 ` [PATCH 0/4] acerhdf/thermal: adding new models and appropriate governor Andreas Mohr
2014-04-27 23:13   ` Peter Feuerer
2014-04-28  4:58     ` Andreas Mohr
2014-04-29  9:17 ` [PATCH v2 " Peter Feuerer
2014-04-29  9:17   ` [PATCH v2 1/4] acerhdf: Adding support for "manual mode" Peter Feuerer
2014-04-29  9:17   ` [PATCH v2 2/4] acerhdf: Adding support for new models Peter Feuerer
2014-04-29  9:17   ` [PATCH v2 3/4] thermal: Added Bang-bang thermal governor Peter Feuerer
2014-04-29 15:53     ` Javi Merino
2014-04-29 16:37       ` Peter Feuerer
2014-04-29 21:31         ` Peter Feuerer
2014-04-30  9:01           ` Javi Merino
2014-04-29  9:17   ` [PATCH v2 4/4] acerhdf: Use bang-bang " Peter Feuerer
2014-04-29 16:00     ` Javi Merino
2014-04-29 16:43       ` Peter Feuerer
2014-05-01 18:36   ` [PATCH v2 0/4] acerhdf/thermal: adding new models and appropriate governor Peter Feuerer
2014-05-03 17:59 ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and minor clean up Peter Feuerer
2014-05-03 17:59   ` [PATCH v3 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
2014-07-17  9:44     ` Borislav Petkov
2014-05-03 17:59   ` [PATCH v3 2/6] acerhdf: Adding support for new models Peter Feuerer
2014-07-17  9:46     ` Borislav Petkov
2014-07-18 16:06       ` Peter Feuerer
2014-07-18 16:17         ` Borislav Petkov
2014-07-18 16:25           ` Peter Feuerer
2014-05-03 17:59   ` [PATCH v3 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
2014-07-17  9:58     ` Borislav Petkov
2014-07-18 16:24       ` Peter Feuerer
2014-05-03 17:59   ` [PATCH v3 4/6] acerhdf: Use bang-bang " Peter Feuerer
2014-05-06 10:50     ` Javi Merino
2014-05-12 10:27       ` Peter Feuerer
2014-05-12 12:03         ` Javi Merino
2014-05-03 17:59   ` [PATCH v3 5/6] acerhdf: added critical trip point Peter Feuerer
2014-05-03 17:59   ` [PATCH v3 6/6] acerhdf: minor clean up Peter Feuerer
2014-07-17 10:12     ` Borislav Petkov
2014-05-15 16:05   ` [PATCH v3 0/6] acerhdf/thermal: adding new models, appropriate governor and " Eduardo Valentin
2014-05-15 22:53     ` Peter Feuerer
2014-06-15 22:39       ` Felix Deichmann
2014-07-30 13:16       ` Eduardo Valentin
2014-07-16 22:24   ` Borislav Petkov
2014-07-16 22:34     ` Peter Feuerer
2014-07-17  8:46       ` Borislav Petkov
2014-07-20  0:51 ` [PATCH v4 " Peter Feuerer
2014-07-20  0:51   ` [PATCH v4 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
2014-07-20  8:04     ` Andreas Mohr
2014-07-20 10:42       ` Peter Feuerer
2014-07-20 20:20         ` Andreas Mohr
2014-07-20  0:51   ` [PATCH v4 2/6] acerhdf: Adding support for new models Peter Feuerer
2014-07-20  0:51   ` [PATCH v4 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
2014-07-21  9:29     ` Borislav Petkov
2014-07-21  9:37       ` Zhang Rui
2014-07-21  9:40       ` Zhang Rui
2014-07-22 14:59         ` Peter Feuerer
2014-07-22 16:09           ` Borislav Petkov
2014-07-20  0:51   ` [PATCH v4 4/6] acerhdf: Use bang-bang " Peter Feuerer
2014-07-21 10:23     ` Borislav Petkov
2014-07-20  0:51   ` [PATCH v4 5/6] acerhdf: added critical trip point Peter Feuerer
2014-07-20  0:51   ` [PATCH v4 6/6] acerhdf: minor clean up Peter Feuerer
2014-07-22 15:37 ` [PATCH v5 0/6] acerhdf/thermal: adding new models, appropriate governor and " Peter Feuerer
2014-07-22 15:37   ` [PATCH v5 1/6] acerhdf: Adding support for "manual mode" Peter Feuerer
2014-07-22 15:37   ` [PATCH v5 2/6] acerhdf: Adding support for new models Peter Feuerer
2014-07-22 15:37   ` [PATCH v5 3/6] thermal: Added Bang-bang thermal governor Peter Feuerer
2014-07-26 14:14     ` Peter Feuerer
2014-07-28  2:26       ` Zhang Rui
2014-10-21 10:29         ` Peter Feuerer
2014-10-28 19:33           ` Peter Feuerer
2014-10-29  9:44             ` Javi Merino
2014-10-29 10:14               ` Peter Feuerer
2014-07-22 15:37   ` [PATCH v5 4/6] acerhdf: Use bang-bang " Peter Feuerer
2014-08-27  7:48     ` Zhang Rui
2014-08-27  8:01       ` Peter Feuerer
2014-08-28  1:17         ` Zhang Rui
2014-08-28  6:05           ` Borislav Petkov
2014-07-22 15:37   ` [PATCH v5 5/6] acerhdf: added critical trip point Peter Feuerer
2014-07-26 14:16     ` Peter Feuerer
2014-07-22 15:37   ` [PATCH v5 6/6] acerhdf: minor clean up Peter Feuerer
2014-11-28 14:20 ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
2014-11-28 14:20   ` [RESEND PATCH v5 1/5] acerhdf: Adding support for "manual mode" Peter Feuerer
2014-11-28 14:20   ` [RESEND PATCH v5 2/5] acerhdf: Adding support for new models Peter Feuerer
2014-11-28 14:20   ` [RESEND PATCH v5 3/5] acerhdf: Use bang-bang thermal governor Peter Feuerer
2014-12-03  9:04     ` Darren Hart
2014-12-04  7:10       ` Peter Feuerer
2014-12-04  7:21         ` Peter Feuerer
2014-12-04 11:40           ` Darren Hart
2014-12-08  7:45           ` Peter Feuerer
2014-12-04 11:18             ` Darren Hart
2014-11-28 14:20   ` [RESEND PATCH v5 4/5] acerhdf: added critical trip point Peter Feuerer
2014-12-03  9:08     ` Darren Hart
2014-11-28 14:20   ` [RESEND PATCH v5 5/5] acerhdf: minor clean up Peter Feuerer
2014-12-03 21:46   ` [RESEND PATCH v5 0/5] acerhdf: adding new models, appropriate governor and " Peter Feuerer
2014-12-11  4:27   ` Darren Hart
2014-12-11  4:59   ` Darren Hart

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.