if (ret < 0)
                return ret;
 
-       val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), 0, index ? 255 : 127);
+       val = DIV_ROUND_CLOSEST(clamp_val(val, 0, (index ? 255 : 127) * 1000),
+                               1000);
 
        mutex_lock(&data->update_lock);
        data->tcrit2[index] = val;
        if (ret < 0)
                return ret;
 
-       val = clamp_val(DIV_ROUND_CLOSEST(val, 1000), 0, 255);
+       val = DIV_ROUND_CLOSEST(clamp_val(val, 0, 255000), 1000);
 
        mutex_lock(&data->update_lock);
        data->tcrit1[index] = val;
        if (ret < 0)
                return ret;
 
-       val = DIV_ROUND_CLOSEST(val, 1000);
+       val = DIV_ROUND_CLOSEST(clamp_val(val, -255000, 255000), 1000);
        val = clamp_val((int)data->tcrit1[index] - val, 0, 31);
 
        mutex_lock(&data->update_lock);
                return ret;
 
        /* Accuracy is 1/2 degrees C */
-       val = clamp_val(DIV_ROUND_CLOSEST(val, 500), -128, 127);
+       val = DIV_ROUND_CLOSEST(clamp_val(val, -64000, 63500), 500);
 
        mutex_lock(&data->update_lock);
        data->toffset[index] = val;