Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

hwmon: (g762) Initialize fans after configuring clock

Adding support for G761 included adding support for an internal clock.
Enabling the internal clock requires setting a bit in the FAN_CMD2
register. This is implemented in g762_fan_init(). However, g762_fan_init()
is called before clock support is selected, and the flag indicating that
the internal clock should be used is not yet set.

Initialize the clock before initializing the fan to solve the problem.
While at it, also add "g7621" to the i2c_device_id array.

Cc: Christian Marangi <ansuelsmth@gmail.com>
Fixes: 6ce402327a6f ("hwmon: g672: add support for g761")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>

+6 -4
+6 -4
drivers/hwmon/g762.c
··· 44 44 #define DRVNAME "g762" 45 45 46 46 static const struct i2c_device_id g762_id[] = { 47 + { "g761" }, 47 48 { "g762" }, 48 49 { "g763" }, 49 50 { } ··· 1084 1083 data->client = client; 1085 1084 mutex_init(&data->update_lock); 1086 1085 1086 + /* Get configuration via DT ... */ 1087 + ret = g762_of_clock_enable(client); 1088 + if (ret) 1089 + return ret; 1090 + 1087 1091 /* Enable fan failure detection and fan out of control protection */ 1088 1092 ret = g762_fan_init(dev); 1089 1093 if (ret) 1090 1094 return ret; 1091 1095 1092 - /* Get configuration via DT ... */ 1093 - ret = g762_of_clock_enable(client); 1094 - if (ret) 1095 - return ret; 1096 1096 ret = g762_of_prop_import(client); 1097 1097 if (ret) 1098 1098 return ret;