소스 검색

[PATCH] w83781d: Don't reset the chip by default

Stop resetting the chip on load by default, so as to preserve the BIOS
initializations. Same was done in the w83627hf driver some times ago
for the same reasons.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Jean Delvare 19 년 전
부모
커밋
fabddcd49d
2개의 변경된 파일26개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 0
      Documentation/hwmon/w83781d
  2. 21 1
      drivers/hwmon/w83781d.c

+ 5 - 0
Documentation/hwmon/w83781d

@@ -36,6 +36,11 @@ Module parameters
   Use 'init=0' to bypass initializing the chip.
   Use 'init=0' to bypass initializing the chip.
   Try this if your computer crashes when you load the module.
   Try this if your computer crashes when you load the module.
 
 
+* reset int
+  (default 0)
+  The driver used to reset the chip on load, but does no more. Use
+  'reset=1' to restore the old behavior. Report if you need to do this.
+
 force_subclients=bus,caddr,saddr,saddr
 force_subclients=bus,caddr,saddr,saddr
   This is used to force the i2c addresses for subclients of
   This is used to force the i2c addresses for subclients of
   a certain chip. Typical usage is `force_subclients=0,0x2d,0x4a,0x4b'
   a certain chip. Typical usage is `force_subclients=0,0x2d,0x4a,0x4b'

+ 21 - 1
drivers/hwmon/w83781d.c

@@ -57,6 +57,10 @@ I2C_CLIENT_INSMOD_5(w83781d, w83782d, w83783s, w83627hf, as99127f);
 I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: "
 I2C_CLIENT_MODULE_PARM(force_subclients, "List of subclient addresses: "
 		    "{bus, clientaddr, subclientaddr1, subclientaddr2}");
 		    "{bus, clientaddr, subclientaddr1, subclientaddr2}");
 
 
+static int reset;
+module_param(reset, bool, 0);
+MODULE_PARM_DESC(reset, "Set to one to reset chip on load");
+
 static int init = 1;
 static int init = 1;
 module_param(init, bool, 0);
 module_param(init, bool, 0);
 MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
 MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization");
@@ -1460,8 +1464,17 @@ w83781d_init_client(struct i2c_client *client)
 	int type = data->type;
 	int type = data->type;
 	u8 tmp;
 	u8 tmp;
 
 
-	if (init && type != as99127f) {	/* this resets registers we don't have
+	if (reset && type != as99127f) { /* this resets registers we don't have
 					   documentation for on the as99127f */
 					   documentation for on the as99127f */
+		/* Resetting the chip has been the default for a long time,
+		   but it causes the BIOS initializations (fan clock dividers,
+		   thermal sensor types...) to be lost, so it is now optional.
+		   It might even go away if nobody reports it as being useful,
+		   as I see very little reason why this would be needed at
+		   all. */
+		dev_info(&client->dev, "If reset=1 solved a problem you were "
+			 "having, please report!\n");
+
 		/* save these registers */
 		/* save these registers */
 		i = w83781d_read_value(client, W83781D_REG_BEEP_CONFIG);
 		i = w83781d_read_value(client, W83781D_REG_BEEP_CONFIG);
 		p = w83781d_read_value(client, W83781D_REG_PWMCLK12);
 		p = w83781d_read_value(client, W83781D_REG_PWMCLK12);
@@ -1478,6 +1491,13 @@ w83781d_init_client(struct i2c_client *client)
 		w83781d_write_value(client, W83781D_REG_BEEP_INTS2, 0);
 		w83781d_write_value(client, W83781D_REG_BEEP_INTS2, 0);
 	}
 	}
 
 
+	/* Disable power-on abnormal beep, as advised by the datasheet.
+	   Already done if reset=1. */
+	if (init && !reset && type != as99127f) {
+		i = w83781d_read_value(client, W83781D_REG_BEEP_CONFIG);
+		w83781d_write_value(client, W83781D_REG_BEEP_CONFIG, i | 0x80);
+	}
+
 	data->vrm = vid_which_vrm();
 	data->vrm = vid_which_vrm();
 
 
 	if ((type != w83781d) && (type != as99127f)) {
 	if ((type != w83781d) && (type != as99127f)) {