]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/thermal/rcar_thermal.c
Merge tag 'rtc-5.5' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
[linux.git] / drivers / thermal / rcar_thermal.c
index 97462e9b40d8b8da91694aca523f4dde5796d963..d0873de718da92189d57b1510a72dac504ef77cf 100644 (file)
@@ -52,6 +52,7 @@ struct rcar_thermal_chip {
        unsigned int irq_per_ch : 1;
        unsigned int needs_suspend_resume : 1;
        unsigned int nirqs;
+       unsigned int ctemp_bands;
 };
 
 static const struct rcar_thermal_chip rcar_thermal = {
@@ -60,6 +61,7 @@ static const struct rcar_thermal_chip rcar_thermal = {
        .irq_per_ch = 0,
        .needs_suspend_resume = 0,
        .nirqs = 1,
+       .ctemp_bands = 1,
 };
 
 static const struct rcar_thermal_chip rcar_gen2_thermal = {
@@ -68,6 +70,7 @@ static const struct rcar_thermal_chip rcar_gen2_thermal = {
        .irq_per_ch = 0,
        .needs_suspend_resume = 0,
        .nirqs = 1,
+       .ctemp_bands = 1,
 };
 
 static const struct rcar_thermal_chip rcar_gen3_thermal = {
@@ -80,6 +83,7 @@ static const struct rcar_thermal_chip rcar_gen3_thermal = {
         * interrupts to detect a temperature change, rise or fall.
         */
        .nirqs = 2,
+       .ctemp_bands = 2,
 };
 
 struct rcar_thermal_priv {
@@ -263,7 +267,12 @@ static int rcar_thermal_get_current_temp(struct rcar_thermal_priv *priv,
                return ret;
 
        mutex_lock(&priv->lock);
-       tmp =  MCELSIUS((priv->ctemp * 5) - 65);
+       if (priv->chip->ctemp_bands == 1)
+               tmp = MCELSIUS((priv->ctemp * 5) - 65);
+       else if (priv->ctemp < 24)
+               tmp = MCELSIUS(((priv->ctemp * 55) - 720) / 10);
+       else
+               tmp = MCELSIUS((priv->ctemp * 5) - 60);
        mutex_unlock(&priv->lock);
 
        if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {