platform/x86: GPD pocket fan: Set speed to max on get_temp failure
When we fail to get the temperature, assume the worst and set the speed to max. While at it introduce a define for MAX_SPEED. Cc: James <kernel@madingley.org> Suggested-by: James <kernel@madingley.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
This commit is contained in:
parent
00f8b2fce4
commit
d890acf728
@ -13,6 +13,8 @@
|
|||||||
#include <linux/thermal.h>
|
#include <linux/thermal.h>
|
||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
|
|
||||||
|
#define MAX_SPEED 3
|
||||||
|
|
||||||
static int temp_limits[3] = { 55000, 60000, 65000 };
|
static int temp_limits[3] = { 55000, 60000, 65000 };
|
||||||
module_param_array(temp_limits, int, NULL, 0444);
|
module_param_array(temp_limits, int, NULL, 0444);
|
||||||
MODULE_PARM_DESC(temp_limits,
|
MODULE_PARM_DESC(temp_limits,
|
||||||
@ -53,9 +55,8 @@ static void gpd_pocket_fan_worker(struct work_struct *work)
|
|||||||
if (thermal_zone_get_temp(fan->dts0, &t0) ||
|
if (thermal_zone_get_temp(fan->dts0, &t0) ||
|
||||||
thermal_zone_get_temp(fan->dts1, &t1)) {
|
thermal_zone_get_temp(fan->dts1, &t1)) {
|
||||||
dev_warn(fan->dev, "Error getting temperature\n");
|
dev_warn(fan->dev, "Error getting temperature\n");
|
||||||
queue_delayed_work(system_wq, &fan->work,
|
speed = MAX_SPEED;
|
||||||
msecs_to_jiffies(1000));
|
goto set_speed;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = max(t0, t1);
|
temp = max(t0, t1);
|
||||||
@ -79,8 +80,9 @@ static void gpd_pocket_fan_worker(struct work_struct *work)
|
|||||||
speed = i;
|
speed = i;
|
||||||
|
|
||||||
if (fan->last_speed <= 0 && speed)
|
if (fan->last_speed <= 0 && speed)
|
||||||
speed = 3; /* kick start motor */
|
speed = MAX_SPEED; /* kick start motor */
|
||||||
|
|
||||||
|
set_speed:
|
||||||
gpd_pocket_fan_set_speed(fan, speed);
|
gpd_pocket_fan_set_speed(fan, speed);
|
||||||
|
|
||||||
/* When mostly idle (low temp/speed), slow down the poll interval. */
|
/* When mostly idle (low temp/speed), slow down the poll interval. */
|
||||||
|
Loading…
Reference in New Issue
Block a user