]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
arm: tegra: soctherm: add interrupt threshold and filtering
authorTimo Alho <talho@nvidia.com>
Thu, 23 Jan 2014 13:12:52 +0000 (15:12 +0200)
committerJuha Tukkinen <jtukkinen@nvidia.com>
Thu, 30 Jan 2014 11:59:51 +0000 (03:59 -0800)
This patch makes OC_ALARM_*_CNT_THRESHOLD and OC_ALARM_*_FILTER
registers configurable from soc_therm platform data.

Also fix naming of ALARM_THRESHOLD_PERIOD to ALARM_THROTTLE_PERIOD as
per register description.

Bug 1444676

Change-Id: I2901e5cd0ccd893aabbf622169e20b90b5977ff7
Signed-off-by: Timo Alho <talho@nvidia.com>
(cherry picked from commit 81e6acf47d4493eea8f615f89a1cc23279037603)
Reviewed-on: http://git-master/r/359396
Reviewed-by: Juha Tukkinen <jtukkinen@nvidia.com>
arch/arm/mach-tegra/tegra11_soctherm.c
arch/arm/mach-tegra/tegra11_soctherm.h

index bf217e92bcda74a0316423cd1516cd41d77b82b4..b42ae8c576b83d2652c7054c38891498b9937630 100644 (file)
@@ -281,7 +281,7 @@ static const int precision; /* default 0 -> low precision */
 #define OC1_CFG_EN_THROTTLE_MASK       0x1
 
 #define OC1_CNT_THRESHOLD              0x314
-#define OC1_THRESHOLD_PERIOD           0x318
+#define OC1_THROTTLE_PERIOD            0x318
 #define OC1_ALARM_COUNT                        0x31c
 #define OC1_FILTER                     0x320
 
@@ -417,7 +417,7 @@ static const int precision; /* default 0 -> low precision */
 #define ALARM_CNT_THRESHOLD(throt)             (OC1_CNT_THRESHOLD + \
                                                (ALARM_OFFSET * (throt - \
                                                                THROTTLE_OC1)))
-#define ALARM_THRESHOLD_PERIOD(throt)          (OC1_THRESHOLD_PERIOD + \
+#define ALARM_THROTTLE_PERIOD(throt)           (OC1_THROTTLE_PERIOD + \
                                                (ALARM_OFFSET * (throt - \
                                                                THROTTLE_OC1)))
 #define ALARM_ALARM_COUNT(throt)               (OC1_ALARM_COUNT + \
@@ -2098,8 +2098,12 @@ static void soctherm_throttle_program(enum soctherm_throttle_id throt)
 
        soctherm_oc_intr_enable(throt, data->intr);
 
-       soctherm_writel(data->period, ALARM_THRESHOLD_PERIOD(throt)); /* usec */
-       soctherm_writel(0xffffffff, ALARM_FILTER(throt));
+       soctherm_writel(data->period, ALARM_THROTTLE_PERIOD(throt)); /* usec */
+       soctherm_writel(data->alarm_cnt_threshold, ALARM_CNT_THRESHOLD(throt));
+       if (data->alarm_filter)
+               soctherm_writel(data->alarm_filter, ALARM_FILTER(throt));
+       else
+               soctherm_writel(0xffffffff, ALARM_FILTER(throt));
 }
 
 /**
@@ -3408,7 +3412,7 @@ static int regs_show(struct seq_file *s, void *data)
 
                                r = soctherm_readl(ALARM_CNT_THRESHOLD(i));
                                seq_printf(s, "%8d  ", r);
-                               r = soctherm_readl(ALARM_THRESHOLD_PERIOD(i));
+                               r = soctherm_readl(ALARM_THROTTLE_PERIOD(i));
                                seq_printf(s, "%8d  ", r);
                                r = soctherm_readl(ALARM_ALARM_COUNT(i));
                                seq_printf(s, "%8d  ", r);
index 699d56c23948cd4a53fd522d942dd7587c8f30b8..60ac3bb665112a1a620e541a452a6c8d92751be7 100644 (file)
@@ -112,6 +112,8 @@ struct soctherm_throttle {
        u8 polarity;
        u8 priority;
        u8 period;
+       u32 alarm_cnt_threshold;
+       u32 alarm_filter;
        bool intr;
        struct soctherm_throttle_dev devs[THROTTLE_DEV_SIZE];
 };