aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei Ni <wni@nvidia.com>2016-05-11 06:20:18 -0400
committerZhang Rui <rui.zhang@intel.com>2016-09-27 02:02:32 -0400
commit6c7c324570847a459c21e7298bc5c92a40577103 (patch)
tree7dfd5c5de374537f1dc8a57205782640b02c3336
parentce0dbf04f685d48ffdec64a17ebb4965f828c3ff (diff)
thermal: tegra: add hw-throttle for Tegra132
Tegra132 use CCROC throttle registers to configure pulse skiper, set these registers to enable throttle function for Tegra132. Signed-off-by: Wei Ni <wni@nvidia.com> Signed-off-by: Zhang Rui <rui.zhang@intel.com>
-rw-r--r--drivers/thermal/tegra/soctherm.c234
-rw-r--r--drivers/thermal/tegra/tegra132-soctherm.c17
-rw-r--r--include/dt-bindings/thermal/tegra124-soctherm.h5
3 files changed, 226 insertions, 30 deletions
diff --git a/drivers/thermal/tegra/soctherm.c b/drivers/thermal/tegra/soctherm.c
index dc75f92e1d8e..7d2db23d71a3 100644
--- a/drivers/thermal/tegra/soctherm.c
+++ b/drivers/thermal/tegra/soctherm.c
@@ -136,6 +136,21 @@
136#define CAR_SUPER_CCLKG_DIVIDER 0x36c 136#define CAR_SUPER_CCLKG_DIVIDER 0x36c
137#define CDIVG_USE_THERM_CONTROLS_MASK BIT(30) 137#define CDIVG_USE_THERM_CONTROLS_MASK BIT(30)
138 138
139/* ccroc register offsets needed for enabling HW throttling for Tegra132 */
140#define CCROC_SUPER_CCLKG_DIVIDER 0x024
141
142#define CCROC_GLOBAL_CFG 0x148
143
144#define CCROC_THROT_PSKIP_RAMP_CPU 0x150
145#define CCROC_THROT_PSKIP_RAMP_SEQ_BYPASS_MODE_MASK BIT(31)
146#define CCROC_THROT_PSKIP_RAMP_DURATION_MASK (0xffff << 8)
147#define CCROC_THROT_PSKIP_RAMP_STEP_MASK 0xff
148
149#define CCROC_THROT_PSKIP_CTRL_CPU 0x154
150#define CCROC_THROT_PSKIP_CTRL_ENB_MASK BIT(31)
151#define CCROC_THROT_PSKIP_CTRL_DIVIDEND_MASK (0xff << 8)
152#define CCROC_THROT_PSKIP_CTRL_DIVISOR_MASK 0xff
153
139/* get val from register(r) mask bits(m) */ 154/* get val from register(r) mask bits(m) */
140#define REG_GET_MASK(r, m) (((r) & (m)) >> (ffs(m) - 1)) 155#define REG_GET_MASK(r, m) (((r) & (m)) >> (ffs(m) - 1))
141/* set val(v) to mask bits(m) of register(r) */ 156/* set val(v) to mask bits(m) of register(r) */
@@ -158,6 +173,13 @@
158#define THROT_DELAY_CTRL(throt) (THROT_DELAY_LITE + \ 173#define THROT_DELAY_CTRL(throt) (THROT_DELAY_LITE + \
159 (THROT_OFFSET * throt)) 174 (THROT_OFFSET * throt))
160 175
176/* get CCROC_THROT_PSKIP_xxx offset per HIGH/MED/LOW vect*/
177#define CCROC_THROT_OFFSET 0x0c
178#define CCROC_THROT_PSKIP_CTRL_CPU_REG(vect) (CCROC_THROT_PSKIP_CTRL_CPU + \
179 (CCROC_THROT_OFFSET * vect))
180#define CCROC_THROT_PSKIP_RAMP_CPU_REG(vect) (CCROC_THROT_PSKIP_RAMP_CPU + \
181 (CCROC_THROT_OFFSET * vect))
182
161/* get THERMCTL_LEVELx offset per CPU/GPU/MEM/TSENSE rg and LEVEL0~3 lv */ 183/* get THERMCTL_LEVELx offset per CPU/GPU/MEM/TSENSE rg and LEVEL0~3 lv */
162#define THERMCTL_LVL_REGS_SIZE 0x20 184#define THERMCTL_LVL_REGS_SIZE 0x20
163#define THERMCTL_LVL_REG(rg, lv) ((rg) + ((lv) * THERMCTL_LVL_REGS_SIZE)) 185#define THERMCTL_LVL_REG(rg, lv) ((rg) + ((lv) * THERMCTL_LVL_REGS_SIZE))
@@ -195,6 +217,7 @@ struct soctherm_throt_cfg {
195 const char *name; 217 const char *name;
196 unsigned int id; 218 unsigned int id;
197 u8 priority; 219 u8 priority;
220 u8 cpu_throt_level;
198 u32 cpu_throt_depth; 221 u32 cpu_throt_depth;
199 struct thermal_cooling_device *cdev; 222 struct thermal_cooling_device *cdev;
200 bool init; 223 bool init;
@@ -206,6 +229,7 @@ struct tegra_soctherm {
206 struct clk *clock_soctherm; 229 struct clk *clock_soctherm;
207 void __iomem *regs; 230 void __iomem *regs;
208 void __iomem *clk_regs; 231 void __iomem *clk_regs;
232 void __iomem *ccroc_regs;
209 233
210 u32 *calib; 234 u32 *calib;
211 struct thermal_zone_device **thermctl_tzs; 235 struct thermal_zone_device **thermctl_tzs;
@@ -241,6 +265,31 @@ static inline u32 clk_readl(struct tegra_soctherm *ts, u32 reg)
241 return readl(ts->clk_regs + reg); 265 return readl(ts->clk_regs + reg);
242} 266}
243 267
268/**
269 * ccroc_writel() - writes a value to a CCROC register
270 * @ts: pointer to a struct tegra_soctherm
271 * @v: the value to write
272 * @reg: the register offset
273 *
274 * Writes @v to @reg. No return value.
275 */
276static inline void ccroc_writel(struct tegra_soctherm *ts, u32 value, u32 reg)
277{
278 writel(value, (ts->ccroc_regs + reg));
279}
280
281/**
282 * ccroc_readl() - reads specified register from CCROC IP block
283 * @ts: pointer to a struct tegra_soctherm
284 * @reg: register address to be read
285 *
286 * Return: the value of the register
287 */
288static inline u32 ccroc_readl(struct tegra_soctherm *ts, u32 reg)
289{
290 return readl(ts->ccroc_regs + reg);
291}
292
244static void enable_tsensor(struct tegra_soctherm *tegra, unsigned int i) 293static void enable_tsensor(struct tegra_soctherm *tegra, unsigned int i)
245{ 294{
246 const struct tegra_tsensor *sensor = &tegra->soc->tsensors[i]; 295 const struct tegra_tsensor *sensor = &tegra->soc->tsensors[i];
@@ -552,9 +601,6 @@ static int tegra_soctherm_set_hwtrips(struct device *dev,
552 sg->name, temperature); 601 sg->name, temperature);
553 602
554set_throttle: 603set_throttle:
555 if (ts->soc->use_ccroc)
556 return 0;
557
558 ret = get_hot_temp(tz, &trip, &temperature); 604 ret = get_hot_temp(tz, &trip, &temperature);
559 if (ret) { 605 if (ret) {
560 dev_warn(dev, "throttrip: %s: missing hot temperature\n", 606 dev_warn(dev, "throttrip: %s: missing hot temperature\n",
@@ -676,9 +722,6 @@ static int regs_show(struct seq_file *s, void *data)
676 state = REG_GET_MASK(r, SENSOR_TEMP2_MEM_TEMP_MASK); 722 state = REG_GET_MASK(r, SENSOR_TEMP2_MEM_TEMP_MASK);
677 seq_printf(s, " MEM(%d)\n", translate_temp(state)); 723 seq_printf(s, " MEM(%d)\n", translate_temp(state));
678 724
679 if (ts->soc->use_ccroc)
680 return 0;
681
682 for (i = 0; i < ts->soc->num_ttgs; i++) { 725 for (i = 0; i < ts->soc->num_ttgs; i++) {
683 seq_printf(s, "%s:\n", ttgs[i]->name); 726 seq_printf(s, "%s:\n", ttgs[i]->name);
684 for (level = 0; level < 4; level++) { 727 for (level = 0; level < 4; level++) {
@@ -779,12 +822,17 @@ static int regs_show(struct seq_file *s, void *data)
779 seq_printf(s, "enabled(%d)\n", state); 822 seq_printf(s, "enabled(%d)\n", state);
780 823
781 r = readl(ts->regs + CPU_PSKIP_STATUS); 824 r = readl(ts->regs + CPU_PSKIP_STATUS);
782 state = REG_GET_MASK(r, XPU_PSKIP_STATUS_M_MASK); 825 if (ts->soc->use_ccroc) {
783 seq_printf(s, "CPU PSKIP STATUS: M(%d) ", state); 826 state = REG_GET_MASK(r, XPU_PSKIP_STATUS_ENABLED_MASK);
784 state = REG_GET_MASK(r, XPU_PSKIP_STATUS_N_MASK); 827 seq_printf(s, "CPU PSKIP STATUS: enabled(%d)\n", state);
785 seq_printf(s, "N(%d) ", state); 828 } else {
786 state = REG_GET_MASK(r, XPU_PSKIP_STATUS_ENABLED_MASK); 829 state = REG_GET_MASK(r, XPU_PSKIP_STATUS_M_MASK);
787 seq_printf(s, "enabled(%d)\n", state); 830 seq_printf(s, "CPU PSKIP STATUS: M(%d) ", state);
831 state = REG_GET_MASK(r, XPU_PSKIP_STATUS_N_MASK);
832 seq_printf(s, "N(%d) ", state);
833 state = REG_GET_MASK(r, XPU_PSKIP_STATUS_ENABLED_MASK);
834 seq_printf(s, "enabled(%d)\n", state);
835 }
788 836
789 return 0; 837 return 0;
790} 838}
@@ -939,15 +987,29 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev)
939 } 987 }
940 stc->priority = val; 988 stc->priority = val;
941 989
942 r = of_property_read_u32(np_stcc, "nvidia,cpu-throt-percent", 990 if (ts->soc->use_ccroc) {
943 &val); 991 r = of_property_read_u32(np_stcc,
944 if (r) { 992 "nvidia,cpu-throt-level",
945 dev_info(dev, 993 &val);
946 "throttle-cfg: %s: missing cpu-throt-percent\n", 994 if (r) {
947 name); 995 dev_info(dev,
948 continue; 996 "throttle-cfg: %s: missing cpu-throt-level\n",
997 name);
998 continue;
999 }
1000 stc->cpu_throt_level = val;
1001 } else {
1002 r = of_property_read_u32(np_stcc,
1003 "nvidia,cpu-throt-percent",
1004 &val);
1005 if (r) {
1006 dev_info(dev,
1007 "throttle-cfg: %s: missing cpu-throt-percent\n",
1008 name);
1009 continue;
1010 }
1011 stc->cpu_throt_depth = val;
949 } 1012 }
950 stc->cpu_throt_depth = val;
951 1013
952 tcd = thermal_of_cooling_device_register(np_stcc, 1014 tcd = thermal_of_cooling_device_register(np_stcc,
953 (char *)name, ts, 1015 (char *)name, ts,
@@ -968,6 +1030,96 @@ static void soctherm_init_hw_throt_cdev(struct platform_device *pdev)
968} 1030}
969 1031
970/** 1032/**
1033 * throttlectl_cpu_level_cfg() - programs CCROC NV_THERM level config
1034 * @level: describing the level LOW/MED/HIGH of throttling
1035 *
1036 * It's necessary to set up the CPU-local CCROC NV_THERM instance with
1037 * the M/N values desired for each level. This function does this.
1038 *
1039 * This function pre-programs the CCROC NV_THERM levels in terms of
1040 * pre-configured "Low", "Medium" or "Heavy" throttle levels which are
1041 * mapped to THROT_LEVEL_LOW, THROT_LEVEL_MED and THROT_LEVEL_HVY.
1042 */
1043static void throttlectl_cpu_level_cfg(struct tegra_soctherm *ts, int level)
1044{
1045 u8 depth, dividend;
1046 u32 r;
1047
1048 switch (level) {
1049 case TEGRA_SOCTHERM_THROT_LEVEL_LOW:
1050 depth = 50;
1051 break;
1052 case TEGRA_SOCTHERM_THROT_LEVEL_MED:
1053 depth = 75;
1054 break;
1055 case TEGRA_SOCTHERM_THROT_LEVEL_HIGH:
1056 depth = 80;
1057 break;
1058 case TEGRA_SOCTHERM_THROT_LEVEL_NONE:
1059 return;
1060 default:
1061 return;
1062 }
1063
1064 dividend = THROT_DEPTH_DIVIDEND(depth);
1065
1066 /* setup PSKIP in ccroc nv_therm registers */
1067 r = ccroc_readl(ts, CCROC_THROT_PSKIP_RAMP_CPU_REG(level));
1068 r = REG_SET_MASK(r, CCROC_THROT_PSKIP_RAMP_DURATION_MASK, 0xff);
1069 r = REG_SET_MASK(r, CCROC_THROT_PSKIP_RAMP_STEP_MASK, 0xf);
1070 ccroc_writel(ts, r, CCROC_THROT_PSKIP_RAMP_CPU_REG(level));
1071
1072 r = ccroc_readl(ts, CCROC_THROT_PSKIP_CTRL_CPU_REG(level));
1073 r = REG_SET_MASK(r, CCROC_THROT_PSKIP_CTRL_ENB_MASK, 1);
1074 r = REG_SET_MASK(r, CCROC_THROT_PSKIP_CTRL_DIVIDEND_MASK, dividend);
1075 r = REG_SET_MASK(r, CCROC_THROT_PSKIP_CTRL_DIVISOR_MASK, 0xff);
1076 ccroc_writel(ts, r, CCROC_THROT_PSKIP_CTRL_CPU_REG(level));
1077}
1078
1079/**
1080 * throttlectl_cpu_level_select() - program CPU pulse skipper config
1081 * @throt: the LIGHT/HEAVY of throttle event id
1082 *
1083 * Pulse skippers are used to throttle clock frequencies. This
1084 * function programs the pulse skippers based on @throt and platform
1085 * data. This function is used on SoCs which have CPU-local pulse
1086 * skipper control, such as T13x. It programs soctherm's interface to
1087 * Denver:CCROC NV_THERM in terms of Low, Medium and HIGH throttling
1088 * vectors. PSKIP_BYPASS mode is set as required per HW spec.
1089 */
1090static void throttlectl_cpu_level_select(struct tegra_soctherm *ts,
1091 enum soctherm_throttle_id throt)
1092{
1093 u32 r, throt_vect;
1094
1095 /* Denver:CCROC NV_THERM interface N:3 Mapping */
1096 switch (ts->throt_cfgs[throt].cpu_throt_level) {
1097 case TEGRA_SOCTHERM_THROT_LEVEL_LOW:
1098 throt_vect = THROT_VECT_LOW;
1099 break;
1100 case TEGRA_SOCTHERM_THROT_LEVEL_MED:
1101 throt_vect = THROT_VECT_MED;
1102 break;
1103 case TEGRA_SOCTHERM_THROT_LEVEL_HIGH:
1104 throt_vect = THROT_VECT_HIGH;
1105 break;
1106 default:
1107 throt_vect = THROT_VECT_NONE;
1108 break;
1109 }
1110
1111 r = readl(ts->regs + THROT_PSKIP_CTRL(throt, THROTTLE_DEV_CPU));
1112 r = REG_SET_MASK(r, THROT_PSKIP_CTRL_ENABLE_MASK, 1);
1113 r = REG_SET_MASK(r, THROT_PSKIP_CTRL_VECT_CPU_MASK, throt_vect);
1114 r = REG_SET_MASK(r, THROT_PSKIP_CTRL_VECT2_CPU_MASK, throt_vect);
1115 writel(r, ts->regs + THROT_PSKIP_CTRL(throt, THROTTLE_DEV_CPU));
1116
1117 /* bypass sequencer in soc_therm as it is programmed in ccroc */
1118 r = REG_SET_MASK(0, THROT_PSKIP_RAMP_SEQ_BYPASS_MODE_MASK, 1);
1119 writel(r, ts->regs + THROT_PSKIP_RAMP(throt, THROTTLE_DEV_CPU));
1120}
1121
1122/**
971 * throttlectl_cpu_mn() - program CPU pulse skipper configuration 1123 * throttlectl_cpu_mn() - program CPU pulse skipper configuration
972 * @throt: the LIGHT/HEAVY of throttle event id 1124 * @throt: the LIGHT/HEAVY of throttle event id
973 * 1125 *
@@ -1017,7 +1169,10 @@ static void soctherm_throttle_program(struct tegra_soctherm *ts,
1017 return; 1169 return;
1018 1170
1019 /* Setup PSKIP parameters */ 1171 /* Setup PSKIP parameters */
1020 throttlectl_cpu_mn(ts, throt); 1172 if (ts->soc->use_ccroc)
1173 throttlectl_cpu_level_select(ts, throt);
1174 else
1175 throttlectl_cpu_mn(ts, throt);
1021 1176
1022 r = REG_SET_MASK(0, THROT_PRIORITY_LITE_PRIO_MASK, stc.priority); 1177 r = REG_SET_MASK(0, THROT_PRIORITY_LITE_PRIO_MASK, stc.priority);
1023 writel(r, ts->regs + THROT_PRIORITY_CTRL(throt)); 1178 writel(r, ts->regs + THROT_PRIORITY_CTRL(throt));
@@ -1040,16 +1195,31 @@ static void tegra_soctherm_throttle(struct device *dev)
1040 u32 v; 1195 u32 v;
1041 int i; 1196 int i;
1042 1197
1198 /* configure LOW, MED and HIGH levels for CCROC NV_THERM */
1199 if (ts->soc->use_ccroc) {
1200 throttlectl_cpu_level_cfg(ts, TEGRA_SOCTHERM_THROT_LEVEL_LOW);
1201 throttlectl_cpu_level_cfg(ts, TEGRA_SOCTHERM_THROT_LEVEL_MED);
1202 throttlectl_cpu_level_cfg(ts, TEGRA_SOCTHERM_THROT_LEVEL_HIGH);
1203 }
1204
1043 /* Thermal HW throttle programming */ 1205 /* Thermal HW throttle programming */
1044 for (i = 0; i < THROTTLE_SIZE; i++) 1206 for (i = 0; i < THROTTLE_SIZE; i++)
1045 soctherm_throttle_program(ts, i); 1207 soctherm_throttle_program(ts, i);
1046 1208
1047 v = REG_SET_MASK(0, THROT_GLOBAL_ENB_MASK, 1); 1209 v = REG_SET_MASK(0, THROT_GLOBAL_ENB_MASK, 1);
1048 writel(v, ts->regs + THROT_GLOBAL_CFG); 1210 if (ts->soc->use_ccroc) {
1211 ccroc_writel(ts, v, CCROC_GLOBAL_CFG);
1049 1212
1050 v = clk_readl(ts, CAR_SUPER_CCLKG_DIVIDER); 1213 v = ccroc_readl(ts, CCROC_SUPER_CCLKG_DIVIDER);
1051 v = REG_SET_MASK(v, CDIVG_USE_THERM_CONTROLS_MASK, 1); 1214 v = REG_SET_MASK(v, CDIVG_USE_THERM_CONTROLS_MASK, 1);
1052 clk_writel(ts, v, CAR_SUPER_CCLKG_DIVIDER); 1215 ccroc_writel(ts, v, CCROC_SUPER_CCLKG_DIVIDER);
1216 } else {
1217 writel(v, ts->regs + THROT_GLOBAL_CFG);
1218
1219 v = clk_readl(ts, CAR_SUPER_CCLKG_DIVIDER);
1220 v = REG_SET_MASK(v, CDIVG_USE_THERM_CONTROLS_MASK, 1);
1221 clk_writel(ts, v, CAR_SUPER_CCLKG_DIVIDER);
1222 }
1053 1223
1054 /* initialize stats collection */ 1224 /* initialize stats collection */
1055 v = STATS_CTL_CLR_DN | STATS_CTL_EN_DN | 1225 v = STATS_CTL_CLR_DN | STATS_CTL_EN_DN |
@@ -1084,9 +1254,6 @@ static void soctherm_init(struct platform_device *pdev)
1084 writel(pdiv, tegra->regs + SENSOR_PDIV); 1254 writel(pdiv, tegra->regs + SENSOR_PDIV);
1085 writel(hotspot, tegra->regs + SENSOR_HOTSPOT_OFF); 1255 writel(hotspot, tegra->regs + SENSOR_HOTSPOT_OFF);
1086 1256
1087 if (tegra->soc->use_ccroc)
1088 return;
1089
1090 /* Configure hw throttle */ 1257 /* Configure hw throttle */
1091 tegra_soctherm_throttle(&pdev->dev); 1258 tegra_soctherm_throttle(&pdev->dev);
1092} 1259}
@@ -1157,6 +1324,14 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
1157 dev_err(&pdev->dev, "can't get car clk registers"); 1324 dev_err(&pdev->dev, "can't get car clk registers");
1158 return PTR_ERR(tegra->clk_regs); 1325 return PTR_ERR(tegra->clk_regs);
1159 } 1326 }
1327 } else {
1328 res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
1329 "ccroc-reg");
1330 tegra->ccroc_regs = devm_ioremap_resource(&pdev->dev, res);
1331 if (IS_ERR(tegra->ccroc_regs)) {
1332 dev_err(&pdev->dev, "can't get ccroc registers");
1333 return PTR_ERR(tegra->ccroc_regs);
1334 }
1160 } 1335 }
1161 1336
1162 tegra->reset = devm_reset_control_get(&pdev->dev, "soctherm"); 1337 tegra->reset = devm_reset_control_get(&pdev->dev, "soctherm");
@@ -1207,8 +1382,7 @@ static int tegra_soctherm_probe(struct platform_device *pdev)
1207 if (err) 1382 if (err)
1208 return err; 1383 return err;
1209 1384
1210 if (!tegra->soc->use_ccroc) 1385 soctherm_init_hw_throt_cdev(pdev);
1211 soctherm_init_hw_throt_cdev(pdev);
1212 1386
1213 soctherm_init(pdev); 1387 soctherm_init(pdev);
1214 1388
diff --git a/drivers/thermal/tegra/tegra132-soctherm.c b/drivers/thermal/tegra/tegra132-soctherm.c
index ae5d61af2df3..97fa30501eb1 100644
--- a/drivers/thermal/tegra/tegra132-soctherm.c
+++ b/drivers/thermal/tegra/tegra132-soctherm.c
@@ -28,7 +28,11 @@
28#define TEGRA132_THERMTRIP_CPU_THRESH_MASK (0xff << 8) 28#define TEGRA132_THERMTRIP_CPU_THRESH_MASK (0xff << 8)
29#define TEGRA132_THERMTRIP_TSENSE_THRESH_MASK 0xff 29#define TEGRA132_THERMTRIP_TSENSE_THRESH_MASK 0xff
30 30
31#define TEGRA132_THERMCTL_LVL0_UP_THRESH_MASK (0xff << 17)
32#define TEGRA132_THERMCTL_LVL0_DN_THRESH_MASK (0xff << 9)
33
31#define TEGRA132_THRESH_GRAIN 1000 34#define TEGRA132_THRESH_GRAIN 1000
35#define TEGRA132_BPTT 8
32 36
33static const struct tegra_tsensor_configuration tegra132_tsensor_config = { 37static const struct tegra_tsensor_configuration tegra132_tsensor_config = {
34 .tall = 16300, 38 .tall = 16300,
@@ -51,6 +55,9 @@ static const struct tegra_tsensor_group tegra132_tsensor_group_cpu = {
51 .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK, 55 .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK,
52 .thermtrip_enable_mask = TEGRA132_THERMTRIP_CPU_EN_MASK, 56 .thermtrip_enable_mask = TEGRA132_THERMTRIP_CPU_EN_MASK,
53 .thermtrip_threshold_mask = TEGRA132_THERMTRIP_CPU_THRESH_MASK, 57 .thermtrip_threshold_mask = TEGRA132_THERMTRIP_CPU_THRESH_MASK,
58 .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_CPU,
59 .thermctl_lvl0_up_thresh_mask = TEGRA132_THERMCTL_LVL0_UP_THRESH_MASK,
60 .thermctl_lvl0_dn_thresh_mask = TEGRA132_THERMCTL_LVL0_DN_THRESH_MASK,
54}; 61};
55 62
56static const struct tegra_tsensor_group tegra132_tsensor_group_gpu = { 63static const struct tegra_tsensor_group tegra132_tsensor_group_gpu = {
@@ -66,6 +73,9 @@ static const struct tegra_tsensor_group tegra132_tsensor_group_gpu = {
66 .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK, 73 .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK,
67 .thermtrip_enable_mask = TEGRA132_THERMTRIP_GPU_EN_MASK, 74 .thermtrip_enable_mask = TEGRA132_THERMTRIP_GPU_EN_MASK,
68 .thermtrip_threshold_mask = TEGRA132_THERMTRIP_GPUMEM_THRESH_MASK, 75 .thermtrip_threshold_mask = TEGRA132_THERMTRIP_GPUMEM_THRESH_MASK,
76 .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_GPU,
77 .thermctl_lvl0_up_thresh_mask = TEGRA132_THERMCTL_LVL0_UP_THRESH_MASK,
78 .thermctl_lvl0_dn_thresh_mask = TEGRA132_THERMCTL_LVL0_DN_THRESH_MASK,
69}; 79};
70 80
71static const struct tegra_tsensor_group tegra132_tsensor_group_pll = { 81static const struct tegra_tsensor_group tegra132_tsensor_group_pll = {
@@ -79,6 +89,9 @@ static const struct tegra_tsensor_group tegra132_tsensor_group_pll = {
79 .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK, 89 .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK,
80 .thermtrip_enable_mask = TEGRA132_THERMTRIP_TSENSE_EN_MASK, 90 .thermtrip_enable_mask = TEGRA132_THERMTRIP_TSENSE_EN_MASK,
81 .thermtrip_threshold_mask = TEGRA132_THERMTRIP_TSENSE_THRESH_MASK, 91 .thermtrip_threshold_mask = TEGRA132_THERMTRIP_TSENSE_THRESH_MASK,
92 .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_TSENSE,
93 .thermctl_lvl0_up_thresh_mask = TEGRA132_THERMCTL_LVL0_UP_THRESH_MASK,
94 .thermctl_lvl0_dn_thresh_mask = TEGRA132_THERMCTL_LVL0_DN_THRESH_MASK,
82}; 95};
83 96
84static const struct tegra_tsensor_group tegra132_tsensor_group_mem = { 97static const struct tegra_tsensor_group tegra132_tsensor_group_mem = {
@@ -94,6 +107,9 @@ static const struct tegra_tsensor_group tegra132_tsensor_group_mem = {
94 .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK, 107 .thermtrip_any_en_mask = TEGRA132_THERMTRIP_ANY_EN_MASK,
95 .thermtrip_enable_mask = TEGRA132_THERMTRIP_MEM_EN_MASK, 108 .thermtrip_enable_mask = TEGRA132_THERMTRIP_MEM_EN_MASK,
96 .thermtrip_threshold_mask = TEGRA132_THERMTRIP_GPUMEM_THRESH_MASK, 109 .thermtrip_threshold_mask = TEGRA132_THERMTRIP_GPUMEM_THRESH_MASK,
110 .thermctl_lvl0_offset = THERMCTL_LEVEL0_GROUP_MEM,
111 .thermctl_lvl0_up_thresh_mask = TEGRA132_THERMCTL_LVL0_UP_THRESH_MASK,
112 .thermctl_lvl0_dn_thresh_mask = TEGRA132_THERMCTL_LVL0_DN_THRESH_MASK,
97}; 113};
98 114
99static const struct tegra_tsensor_group *tegra132_tsensor_groups[] = { 115static const struct tegra_tsensor_group *tegra132_tsensor_groups[] = {
@@ -193,5 +209,6 @@ const struct tegra_soctherm_soc tegra132_soctherm = {
193 .num_ttgs = ARRAY_SIZE(tegra132_tsensor_groups), 209 .num_ttgs = ARRAY_SIZE(tegra132_tsensor_groups),
194 .tfuse = &tegra132_soctherm_fuse, 210 .tfuse = &tegra132_soctherm_fuse,
195 .thresh_grain = TEGRA132_THRESH_GRAIN, 211 .thresh_grain = TEGRA132_THRESH_GRAIN,
212 .bptt = TEGRA132_BPTT,
196 .use_ccroc = true, 213 .use_ccroc = true,
197}; 214};
diff --git a/include/dt-bindings/thermal/tegra124-soctherm.h b/include/dt-bindings/thermal/tegra124-soctherm.h
index 729ab9fc325e..2a99f1d52bb5 100644
--- a/include/dt-bindings/thermal/tegra124-soctherm.h
+++ b/include/dt-bindings/thermal/tegra124-soctherm.h
@@ -11,4 +11,9 @@
11#define TEGRA124_SOCTHERM_SENSOR_PLLX 3 11#define TEGRA124_SOCTHERM_SENSOR_PLLX 3
12#define TEGRA124_SOCTHERM_SENSOR_NUM 4 12#define TEGRA124_SOCTHERM_SENSOR_NUM 4
13 13
14#define TEGRA_SOCTHERM_THROT_LEVEL_LOW 0
15#define TEGRA_SOCTHERM_THROT_LEVEL_MED 1
16#define TEGRA_SOCTHERM_THROT_LEVEL_HIGH 2
17#define TEGRA_SOCTHERM_THROT_LEVEL_NONE -1
18
14#endif 19#endif