Fabio Estevam | 45f8b0d | 2018-05-23 16:24:40 -0300 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0 |
| 2 | // |
| 3 | // Copyright 2013 Freescale Semiconductor, Inc. |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 4 | |
Anson Huang | 329fe7b | 2013-12-23 15:49:22 -0500 | [diff] [blame] | 5 | #include <linux/clk.h> |
Viresh Kumar | 4d753aa | 2017-04-25 15:57:14 +0530 | [diff] [blame] | 6 | #include <linux/cpufreq.h> |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 7 | #include <linux/cpu_cooling.h> |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 8 | #include <linux/delay.h> |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 9 | #include <linux/interrupt.h> |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 10 | #include <linux/io.h> |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 11 | #include <linux/mfd/syscon.h> |
| 12 | #include <linux/module.h> |
| 13 | #include <linux/of.h> |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 14 | #include <linux/of_device.h> |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 15 | #include <linux/regmap.h> |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 16 | #include <linux/thermal.h> |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 17 | #include <linux/nvmem-consumer.h> |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 18 | |
| 19 | #define REG_SET 0x4 |
| 20 | #define REG_CLR 0x8 |
| 21 | #define REG_TOG 0xc |
| 22 | |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 23 | /* i.MX6 specific */ |
| 24 | #define IMX6_MISC0 0x0150 |
| 25 | #define IMX6_MISC0_REFTOP_SELBIASOFF (1 << 3) |
| 26 | #define IMX6_MISC1 0x0160 |
| 27 | #define IMX6_MISC1_IRQ_TEMPHIGH (1 << 29) |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 28 | /* Below LOW and PANIC bits are only for TEMPMON_IMX6SX */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 29 | #define IMX6_MISC1_IRQ_TEMPLOW (1 << 28) |
| 30 | #define IMX6_MISC1_IRQ_TEMPPANIC (1 << 27) |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 31 | |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 32 | #define IMX6_TEMPSENSE0 0x0180 |
| 33 | #define IMX6_TEMPSENSE0_ALARM_VALUE_SHIFT 20 |
| 34 | #define IMX6_TEMPSENSE0_ALARM_VALUE_MASK (0xfff << 20) |
| 35 | #define IMX6_TEMPSENSE0_TEMP_CNT_SHIFT 8 |
| 36 | #define IMX6_TEMPSENSE0_TEMP_CNT_MASK (0xfff << 8) |
| 37 | #define IMX6_TEMPSENSE0_FINISHED (1 << 2) |
| 38 | #define IMX6_TEMPSENSE0_MEASURE_TEMP (1 << 1) |
| 39 | #define IMX6_TEMPSENSE0_POWER_DOWN (1 << 0) |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 40 | |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 41 | #define IMX6_TEMPSENSE1 0x0190 |
| 42 | #define IMX6_TEMPSENSE1_MEASURE_FREQ 0xffff |
| 43 | #define IMX6_TEMPSENSE1_MEASURE_FREQ_SHIFT 0 |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 44 | |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 45 | #define OCOTP_MEM0 0x0480 |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 46 | #define OCOTP_ANA1 0x04e0 |
| 47 | |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 48 | /* Below TEMPSENSE2 is only for TEMPMON_IMX6SX */ |
| 49 | #define IMX6_TEMPSENSE2 0x0290 |
| 50 | #define IMX6_TEMPSENSE2_LOW_VALUE_SHIFT 0 |
| 51 | #define IMX6_TEMPSENSE2_LOW_VALUE_MASK 0xfff |
| 52 | #define IMX6_TEMPSENSE2_PANIC_VALUE_SHIFT 16 |
| 53 | #define IMX6_TEMPSENSE2_PANIC_VALUE_MASK 0xfff0000 |
| 54 | |
| 55 | /* i.MX7 specific */ |
| 56 | #define IMX7_ANADIG_DIGPROG 0x800 |
| 57 | #define IMX7_TEMPSENSE0 0x300 |
| 58 | #define IMX7_TEMPSENSE0_PANIC_ALARM_SHIFT 18 |
| 59 | #define IMX7_TEMPSENSE0_PANIC_ALARM_MASK (0x1ff << 18) |
| 60 | #define IMX7_TEMPSENSE0_HIGH_ALARM_SHIFT 9 |
| 61 | #define IMX7_TEMPSENSE0_HIGH_ALARM_MASK (0x1ff << 9) |
| 62 | #define IMX7_TEMPSENSE0_LOW_ALARM_SHIFT 0 |
| 63 | #define IMX7_TEMPSENSE0_LOW_ALARM_MASK 0x1ff |
| 64 | |
| 65 | #define IMX7_TEMPSENSE1 0x310 |
| 66 | #define IMX7_TEMPSENSE1_MEASURE_FREQ_SHIFT 16 |
| 67 | #define IMX7_TEMPSENSE1_MEASURE_FREQ_MASK (0xffff << 16) |
| 68 | #define IMX7_TEMPSENSE1_FINISHED (1 << 11) |
| 69 | #define IMX7_TEMPSENSE1_MEASURE_TEMP (1 << 10) |
| 70 | #define IMX7_TEMPSENSE1_POWER_DOWN (1 << 9) |
| 71 | #define IMX7_TEMPSENSE1_TEMP_VALUE_SHIFT 0 |
| 72 | #define IMX7_TEMPSENSE1_TEMP_VALUE_MASK 0x1ff |
| 73 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 74 | /* The driver supports 1 passive trip point and 1 critical trip point */ |
| 75 | enum imx_thermal_trip { |
| 76 | IMX_TRIP_PASSIVE, |
| 77 | IMX_TRIP_CRITICAL, |
| 78 | IMX_TRIP_NUM, |
| 79 | }; |
| 80 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 81 | #define IMX_POLLING_DELAY 2000 /* millisecond */ |
| 82 | #define IMX_PASSIVE_DELAY 1000 |
| 83 | |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 84 | #define TEMPMON_IMX6Q 1 |
| 85 | #define TEMPMON_IMX6SX 2 |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 86 | #define TEMPMON_IMX7D 3 |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 87 | |
| 88 | struct thermal_soc_data { |
| 89 | u32 version; |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 90 | |
| 91 | u32 sensor_ctrl; |
| 92 | u32 power_down_mask; |
| 93 | u32 measure_temp_mask; |
| 94 | |
| 95 | u32 measure_freq_ctrl; |
| 96 | u32 measure_freq_mask; |
| 97 | u32 measure_freq_shift; |
| 98 | |
| 99 | u32 temp_data; |
| 100 | u32 temp_value_mask; |
| 101 | u32 temp_value_shift; |
| 102 | u32 temp_valid_mask; |
| 103 | |
| 104 | u32 panic_alarm_ctrl; |
| 105 | u32 panic_alarm_mask; |
| 106 | u32 panic_alarm_shift; |
| 107 | |
| 108 | u32 high_alarm_ctrl; |
| 109 | u32 high_alarm_mask; |
| 110 | u32 high_alarm_shift; |
| 111 | |
| 112 | u32 low_alarm_ctrl; |
| 113 | u32 low_alarm_mask; |
| 114 | u32 low_alarm_shift; |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 115 | }; |
| 116 | |
| 117 | static struct thermal_soc_data thermal_imx6q_data = { |
| 118 | .version = TEMPMON_IMX6Q, |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 119 | |
| 120 | .sensor_ctrl = IMX6_TEMPSENSE0, |
| 121 | .power_down_mask = IMX6_TEMPSENSE0_POWER_DOWN, |
| 122 | .measure_temp_mask = IMX6_TEMPSENSE0_MEASURE_TEMP, |
| 123 | |
| 124 | .measure_freq_ctrl = IMX6_TEMPSENSE1, |
| 125 | .measure_freq_shift = IMX6_TEMPSENSE1_MEASURE_FREQ_SHIFT, |
| 126 | .measure_freq_mask = IMX6_TEMPSENSE1_MEASURE_FREQ, |
| 127 | |
| 128 | .temp_data = IMX6_TEMPSENSE0, |
| 129 | .temp_value_mask = IMX6_TEMPSENSE0_TEMP_CNT_MASK, |
| 130 | .temp_value_shift = IMX6_TEMPSENSE0_TEMP_CNT_SHIFT, |
| 131 | .temp_valid_mask = IMX6_TEMPSENSE0_FINISHED, |
| 132 | |
| 133 | .high_alarm_ctrl = IMX6_TEMPSENSE0, |
| 134 | .high_alarm_mask = IMX6_TEMPSENSE0_ALARM_VALUE_MASK, |
| 135 | .high_alarm_shift = IMX6_TEMPSENSE0_ALARM_VALUE_SHIFT, |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 136 | }; |
| 137 | |
| 138 | static struct thermal_soc_data thermal_imx6sx_data = { |
| 139 | .version = TEMPMON_IMX6SX, |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 140 | |
| 141 | .sensor_ctrl = IMX6_TEMPSENSE0, |
| 142 | .power_down_mask = IMX6_TEMPSENSE0_POWER_DOWN, |
| 143 | .measure_temp_mask = IMX6_TEMPSENSE0_MEASURE_TEMP, |
| 144 | |
| 145 | .measure_freq_ctrl = IMX6_TEMPSENSE1, |
| 146 | .measure_freq_shift = IMX6_TEMPSENSE1_MEASURE_FREQ_SHIFT, |
| 147 | .measure_freq_mask = IMX6_TEMPSENSE1_MEASURE_FREQ, |
| 148 | |
| 149 | .temp_data = IMX6_TEMPSENSE0, |
| 150 | .temp_value_mask = IMX6_TEMPSENSE0_TEMP_CNT_MASK, |
| 151 | .temp_value_shift = IMX6_TEMPSENSE0_TEMP_CNT_SHIFT, |
| 152 | .temp_valid_mask = IMX6_TEMPSENSE0_FINISHED, |
| 153 | |
| 154 | .high_alarm_ctrl = IMX6_TEMPSENSE0, |
| 155 | .high_alarm_mask = IMX6_TEMPSENSE0_ALARM_VALUE_MASK, |
| 156 | .high_alarm_shift = IMX6_TEMPSENSE0_ALARM_VALUE_SHIFT, |
| 157 | |
| 158 | .panic_alarm_ctrl = IMX6_TEMPSENSE2, |
| 159 | .panic_alarm_mask = IMX6_TEMPSENSE2_PANIC_VALUE_MASK, |
| 160 | .panic_alarm_shift = IMX6_TEMPSENSE2_PANIC_VALUE_SHIFT, |
| 161 | |
| 162 | .low_alarm_ctrl = IMX6_TEMPSENSE2, |
| 163 | .low_alarm_mask = IMX6_TEMPSENSE2_LOW_VALUE_MASK, |
| 164 | .low_alarm_shift = IMX6_TEMPSENSE2_LOW_VALUE_SHIFT, |
| 165 | }; |
| 166 | |
| 167 | static struct thermal_soc_data thermal_imx7d_data = { |
| 168 | .version = TEMPMON_IMX7D, |
| 169 | |
| 170 | .sensor_ctrl = IMX7_TEMPSENSE1, |
| 171 | .power_down_mask = IMX7_TEMPSENSE1_POWER_DOWN, |
| 172 | .measure_temp_mask = IMX7_TEMPSENSE1_MEASURE_TEMP, |
| 173 | |
| 174 | .measure_freq_ctrl = IMX7_TEMPSENSE1, |
| 175 | .measure_freq_shift = IMX7_TEMPSENSE1_MEASURE_FREQ_SHIFT, |
| 176 | .measure_freq_mask = IMX7_TEMPSENSE1_MEASURE_FREQ_MASK, |
| 177 | |
| 178 | .temp_data = IMX7_TEMPSENSE1, |
| 179 | .temp_value_mask = IMX7_TEMPSENSE1_TEMP_VALUE_MASK, |
| 180 | .temp_value_shift = IMX7_TEMPSENSE1_TEMP_VALUE_SHIFT, |
| 181 | .temp_valid_mask = IMX7_TEMPSENSE1_FINISHED, |
| 182 | |
| 183 | .panic_alarm_ctrl = IMX7_TEMPSENSE1, |
| 184 | .panic_alarm_mask = IMX7_TEMPSENSE0_PANIC_ALARM_MASK, |
| 185 | .panic_alarm_shift = IMX7_TEMPSENSE0_PANIC_ALARM_SHIFT, |
| 186 | |
| 187 | .high_alarm_ctrl = IMX7_TEMPSENSE0, |
| 188 | .high_alarm_mask = IMX7_TEMPSENSE0_HIGH_ALARM_MASK, |
| 189 | .high_alarm_shift = IMX7_TEMPSENSE0_HIGH_ALARM_SHIFT, |
| 190 | |
| 191 | .low_alarm_ctrl = IMX7_TEMPSENSE0, |
| 192 | .low_alarm_mask = IMX7_TEMPSENSE0_LOW_ALARM_MASK, |
| 193 | .low_alarm_shift = IMX7_TEMPSENSE0_LOW_ALARM_SHIFT, |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 194 | }; |
| 195 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 196 | struct imx_thermal_data { |
Viresh Kumar | 4d753aa | 2017-04-25 15:57:14 +0530 | [diff] [blame] | 197 | struct cpufreq_policy *policy; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 198 | struct thermal_zone_device *tz; |
| 199 | struct thermal_cooling_device *cdev; |
| 200 | enum thermal_device_mode mode; |
| 201 | struct regmap *tempmon; |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 202 | u32 c1, c2; /* See formula in imx_init_calib() */ |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 203 | int temp_passive; |
| 204 | int temp_critical; |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 205 | int temp_max; |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 206 | int alarm_temp; |
| 207 | int last_temp; |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 208 | bool irq_enabled; |
| 209 | int irq; |
Anson Huang | 329fe7b | 2013-12-23 15:49:22 -0500 | [diff] [blame] | 210 | struct clk *thermal_clk; |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 211 | const struct thermal_soc_data *socdata; |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 212 | const char *temp_grade; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 213 | }; |
| 214 | |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 215 | static void imx_set_panic_temp(struct imx_thermal_data *data, |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 216 | int panic_temp) |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 217 | { |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 218 | const struct thermal_soc_data *soc_data = data->socdata; |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 219 | struct regmap *map = data->tempmon; |
| 220 | int critical_value; |
| 221 | |
| 222 | critical_value = (data->c2 - panic_temp) / data->c1; |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 223 | |
| 224 | regmap_write(map, soc_data->panic_alarm_ctrl + REG_CLR, |
| 225 | soc_data->panic_alarm_mask); |
| 226 | regmap_write(map, soc_data->panic_alarm_ctrl + REG_SET, |
| 227 | critical_value << soc_data->panic_alarm_shift); |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 228 | } |
| 229 | |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 230 | static void imx_set_alarm_temp(struct imx_thermal_data *data, |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 231 | int alarm_temp) |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 232 | { |
| 233 | struct regmap *map = data->tempmon; |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 234 | const struct thermal_soc_data *soc_data = data->socdata; |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 235 | int alarm_value; |
| 236 | |
| 237 | data->alarm_temp = alarm_temp; |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 238 | |
| 239 | if (data->socdata->version == TEMPMON_IMX7D) |
| 240 | alarm_value = alarm_temp / 1000 + data->c1 - 25; |
| 241 | else |
| 242 | alarm_value = (data->c2 - alarm_temp) / data->c1; |
| 243 | |
| 244 | regmap_write(map, soc_data->high_alarm_ctrl + REG_CLR, |
| 245 | soc_data->high_alarm_mask); |
| 246 | regmap_write(map, soc_data->high_alarm_ctrl + REG_SET, |
| 247 | alarm_value << soc_data->high_alarm_shift); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 248 | } |
| 249 | |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 250 | static int imx_get_temp(struct thermal_zone_device *tz, int *temp) |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 251 | { |
| 252 | struct imx_thermal_data *data = tz->devdata; |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 253 | const struct thermal_soc_data *soc_data = data->socdata; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 254 | struct regmap *map = data->tempmon; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 255 | unsigned int n_meas; |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 256 | bool wait; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 257 | u32 val; |
| 258 | |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 259 | if (data->mode == THERMAL_DEVICE_ENABLED) { |
| 260 | /* Check if a measurement is currently in progress */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 261 | regmap_read(map, soc_data->temp_data, &val); |
| 262 | wait = !(val & soc_data->temp_valid_mask); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 263 | } else { |
| 264 | /* |
| 265 | * Every time we measure the temperature, we will power on the |
| 266 | * temperature sensor, enable measurements, take a reading, |
| 267 | * disable measurements, power off the temperature sensor. |
| 268 | */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 269 | regmap_write(map, soc_data->sensor_ctrl + REG_CLR, |
| 270 | soc_data->power_down_mask); |
| 271 | regmap_write(map, soc_data->sensor_ctrl + REG_SET, |
| 272 | soc_data->measure_temp_mask); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 273 | |
| 274 | wait = true; |
| 275 | } |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 276 | |
| 277 | /* |
| 278 | * According to the temp sensor designers, it may require up to ~17us |
| 279 | * to complete a measurement. |
| 280 | */ |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 281 | if (wait) |
| 282 | usleep_range(20, 50); |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 283 | |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 284 | regmap_read(map, soc_data->temp_data, &val); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 285 | |
| 286 | if (data->mode != THERMAL_DEVICE_ENABLED) { |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 287 | regmap_write(map, soc_data->sensor_ctrl + REG_CLR, |
| 288 | soc_data->measure_temp_mask); |
| 289 | regmap_write(map, soc_data->sensor_ctrl + REG_SET, |
| 290 | soc_data->power_down_mask); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 291 | } |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 292 | |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 293 | if ((val & soc_data->temp_valid_mask) == 0) { |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 294 | dev_dbg(&tz->device, "temp measurement never finished\n"); |
| 295 | return -EAGAIN; |
| 296 | } |
| 297 | |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 298 | n_meas = (val & soc_data->temp_value_mask) |
| 299 | >> soc_data->temp_value_shift; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 300 | |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 301 | /* See imx_init_calib() for formula derivation */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 302 | if (data->socdata->version == TEMPMON_IMX7D) |
| 303 | *temp = (n_meas - data->c1 + 25) * 1000; |
| 304 | else |
| 305 | *temp = data->c2 - n_meas * data->c1; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 306 | |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 307 | /* Update alarm value to next higher trip point for TEMPMON_IMX6Q */ |
| 308 | if (data->socdata->version == TEMPMON_IMX6Q) { |
| 309 | if (data->alarm_temp == data->temp_passive && |
| 310 | *temp >= data->temp_passive) |
| 311 | imx_set_alarm_temp(data, data->temp_critical); |
| 312 | if (data->alarm_temp == data->temp_critical && |
| 313 | *temp < data->temp_passive) { |
| 314 | imx_set_alarm_temp(data, data->temp_passive); |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 315 | dev_dbg(&tz->device, "thermal alarm off: T < %d\n", |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 316 | data->alarm_temp / 1000); |
| 317 | } |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 318 | } |
| 319 | |
| 320 | if (*temp != data->last_temp) { |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 321 | dev_dbg(&tz->device, "millicelsius: %d\n", *temp); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 322 | data->last_temp = *temp; |
| 323 | } |
| 324 | |
| 325 | /* Reenable alarm IRQ if temperature below alarm temperature */ |
| 326 | if (!data->irq_enabled && *temp < data->alarm_temp) { |
| 327 | data->irq_enabled = true; |
| 328 | enable_irq(data->irq); |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | return 0; |
| 332 | } |
| 333 | |
| 334 | static int imx_get_mode(struct thermal_zone_device *tz, |
| 335 | enum thermal_device_mode *mode) |
| 336 | { |
| 337 | struct imx_thermal_data *data = tz->devdata; |
| 338 | |
| 339 | *mode = data->mode; |
| 340 | |
| 341 | return 0; |
| 342 | } |
| 343 | |
| 344 | static int imx_set_mode(struct thermal_zone_device *tz, |
| 345 | enum thermal_device_mode mode) |
| 346 | { |
| 347 | struct imx_thermal_data *data = tz->devdata; |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 348 | struct regmap *map = data->tempmon; |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 349 | const struct thermal_soc_data *soc_data = data->socdata; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 350 | |
| 351 | if (mode == THERMAL_DEVICE_ENABLED) { |
| 352 | tz->polling_delay = IMX_POLLING_DELAY; |
| 353 | tz->passive_delay = IMX_PASSIVE_DELAY; |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 354 | |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 355 | regmap_write(map, soc_data->sensor_ctrl + REG_CLR, |
| 356 | soc_data->power_down_mask); |
| 357 | regmap_write(map, soc_data->sensor_ctrl + REG_SET, |
| 358 | soc_data->measure_temp_mask); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 359 | |
| 360 | if (!data->irq_enabled) { |
| 361 | data->irq_enabled = true; |
| 362 | enable_irq(data->irq); |
| 363 | } |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 364 | } else { |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 365 | regmap_write(map, soc_data->sensor_ctrl + REG_CLR, |
| 366 | soc_data->measure_temp_mask); |
| 367 | regmap_write(map, soc_data->sensor_ctrl + REG_SET, |
| 368 | soc_data->power_down_mask); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 369 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 370 | tz->polling_delay = 0; |
| 371 | tz->passive_delay = 0; |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 372 | |
| 373 | if (data->irq_enabled) { |
| 374 | disable_irq(data->irq); |
| 375 | data->irq_enabled = false; |
| 376 | } |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 377 | } |
| 378 | |
| 379 | data->mode = mode; |
Srinivas Pandruvada | 0e70f46 | 2016-08-26 16:21:16 -0700 | [diff] [blame] | 380 | thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 381 | |
| 382 | return 0; |
| 383 | } |
| 384 | |
| 385 | static int imx_get_trip_type(struct thermal_zone_device *tz, int trip, |
| 386 | enum thermal_trip_type *type) |
| 387 | { |
| 388 | *type = (trip == IMX_TRIP_PASSIVE) ? THERMAL_TRIP_PASSIVE : |
| 389 | THERMAL_TRIP_CRITICAL; |
| 390 | return 0; |
| 391 | } |
| 392 | |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 393 | static int imx_get_crit_temp(struct thermal_zone_device *tz, int *temp) |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 394 | { |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 395 | struct imx_thermal_data *data = tz->devdata; |
| 396 | |
| 397 | *temp = data->temp_critical; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 398 | return 0; |
| 399 | } |
| 400 | |
| 401 | static int imx_get_trip_temp(struct thermal_zone_device *tz, int trip, |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 402 | int *temp) |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 403 | { |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 404 | struct imx_thermal_data *data = tz->devdata; |
| 405 | |
| 406 | *temp = (trip == IMX_TRIP_PASSIVE) ? data->temp_passive : |
| 407 | data->temp_critical; |
| 408 | return 0; |
| 409 | } |
| 410 | |
| 411 | static int imx_set_trip_temp(struct thermal_zone_device *tz, int trip, |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 412 | int temp) |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 413 | { |
| 414 | struct imx_thermal_data *data = tz->devdata; |
| 415 | |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 416 | /* do not allow changing critical threshold */ |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 417 | if (trip == IMX_TRIP_CRITICAL) |
| 418 | return -EPERM; |
| 419 | |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 420 | /* do not allow passive to be set higher than critical */ |
| 421 | if (temp < 0 || temp > data->temp_critical) |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 422 | return -EINVAL; |
| 423 | |
| 424 | data->temp_passive = temp; |
| 425 | |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 426 | imx_set_alarm_temp(data, temp); |
| 427 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 428 | return 0; |
| 429 | } |
| 430 | |
| 431 | static int imx_bind(struct thermal_zone_device *tz, |
| 432 | struct thermal_cooling_device *cdev) |
| 433 | { |
| 434 | int ret; |
| 435 | |
| 436 | ret = thermal_zone_bind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev, |
| 437 | THERMAL_NO_LIMIT, |
Kapileshwar Singh | 6cd9e9f | 2015-02-18 16:04:21 +0000 | [diff] [blame] | 438 | THERMAL_NO_LIMIT, |
| 439 | THERMAL_WEIGHT_DEFAULT); |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 440 | if (ret) { |
| 441 | dev_err(&tz->device, |
| 442 | "binding zone %s with cdev %s failed:%d\n", |
| 443 | tz->type, cdev->type, ret); |
| 444 | return ret; |
| 445 | } |
| 446 | |
| 447 | return 0; |
| 448 | } |
| 449 | |
| 450 | static int imx_unbind(struct thermal_zone_device *tz, |
| 451 | struct thermal_cooling_device *cdev) |
| 452 | { |
| 453 | int ret; |
| 454 | |
| 455 | ret = thermal_zone_unbind_cooling_device(tz, IMX_TRIP_PASSIVE, cdev); |
| 456 | if (ret) { |
| 457 | dev_err(&tz->device, |
| 458 | "unbinding zone %s with cdev %s failed:%d\n", |
| 459 | tz->type, cdev->type, ret); |
| 460 | return ret; |
| 461 | } |
| 462 | |
| 463 | return 0; |
| 464 | } |
| 465 | |
Eduardo Valentin | cbb07bb | 2014-01-06 08:54:34 -0400 | [diff] [blame] | 466 | static struct thermal_zone_device_ops imx_tz_ops = { |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 467 | .bind = imx_bind, |
| 468 | .unbind = imx_unbind, |
| 469 | .get_temp = imx_get_temp, |
| 470 | .get_mode = imx_get_mode, |
| 471 | .set_mode = imx_set_mode, |
| 472 | .get_trip_type = imx_get_trip_type, |
| 473 | .get_trip_temp = imx_get_trip_temp, |
| 474 | .get_crit_temp = imx_get_crit_temp, |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 475 | .set_trip_temp = imx_set_trip_temp, |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 476 | }; |
| 477 | |
Uwe Kleine-König | e4bb224 | 2017-11-30 10:17:35 +0100 | [diff] [blame] | 478 | static int imx_init_calib(struct platform_device *pdev, u32 ocotp_ana1) |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 479 | { |
| 480 | struct imx_thermal_data *data = platform_get_drvdata(pdev); |
Uwe Kleine-König | 4e5f61c | 2017-11-30 10:17:38 +0100 | [diff] [blame] | 481 | int n1; |
Anson Huang | 749e8be | 2014-02-12 18:06:35 +0800 | [diff] [blame] | 482 | u64 temp64; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 483 | |
Uwe Kleine-König | e4bb224 | 2017-11-30 10:17:35 +0100 | [diff] [blame] | 484 | if (ocotp_ana1 == 0 || ocotp_ana1 == ~0) { |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 485 | dev_err(&pdev->dev, "invalid sensor calibration data\n"); |
| 486 | return -EINVAL; |
| 487 | } |
| 488 | |
| 489 | /* |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 490 | * On i.MX7D, we only use the calibration data at 25C to get the temp, |
| 491 | * Tmeas = ( Nmeas - n1) + 25; n1 is the fuse value for 25C. |
| 492 | */ |
| 493 | if (data->socdata->version == TEMPMON_IMX7D) { |
| 494 | data->c1 = (ocotp_ana1 >> 9) & 0x1ff; |
| 495 | return 0; |
| 496 | } |
| 497 | |
| 498 | /* |
Uwe Kleine-König | c5bbdb4 | 2017-11-30 10:17:36 +0100 | [diff] [blame] | 499 | * The sensor is calibrated at 25 °C (aka T1) and the value measured |
| 500 | * (aka N1) at this temperature is provided in bits [31:20] in the |
| 501 | * i.MX's OCOTP value ANA1. |
| 502 | * To find the actual temperature T, the following formula has to be used |
| 503 | * when reading value n from the sensor: |
| 504 | * |
Uwe Kleine-König | 4e5f61c | 2017-11-30 10:17:38 +0100 | [diff] [blame] | 505 | * T = T1 + (N - N1) / (0.4148468 - 0.0015423 * N1) °C + 3.580661 °C |
| 506 | * = [T1' - N1 / (0.4148468 - 0.0015423 * N1) °C] + N / (0.4148468 - 0.0015423 * N1) °C |
| 507 | * = [T1' + N1 / (0.0015423 * N1 - 0.4148468) °C] - N / (0.0015423 * N1 - 0.4148468) °C |
Uwe Kleine-König | c5bbdb4 | 2017-11-30 10:17:36 +0100 | [diff] [blame] | 508 | * = c2 - c1 * N |
| 509 | * |
| 510 | * with |
| 511 | * |
Uwe Kleine-König | 4e5f61c | 2017-11-30 10:17:38 +0100 | [diff] [blame] | 512 | * T1' = 28.580661 °C |
| 513 | * c1 = 1 / (0.0015423 * N1 - 0.4297157) °C |
| 514 | * c2 = T1' + N1 / (0.0015423 * N1 - 0.4148468) °C |
| 515 | * = T1' + N1 * c1 |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 516 | */ |
Uwe Kleine-König | e4bb224 | 2017-11-30 10:17:35 +0100 | [diff] [blame] | 517 | n1 = ocotp_ana1 >> 20; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 518 | |
Uwe Kleine-König | 4e5f61c | 2017-11-30 10:17:38 +0100 | [diff] [blame] | 519 | temp64 = 10000000; /* use 10^7 as fixed point constant for values in formula */ |
Uwe Kleine-König | c5bbdb4 | 2017-11-30 10:17:36 +0100 | [diff] [blame] | 520 | temp64 *= 1000; /* to get result in °mC */ |
Uwe Kleine-König | 4e5f61c | 2017-11-30 10:17:38 +0100 | [diff] [blame] | 521 | do_div(temp64, 15423 * n1 - 4148468); |
Anson Huang | 749e8be | 2014-02-12 18:06:35 +0800 | [diff] [blame] | 522 | data->c1 = temp64; |
Uwe Kleine-König | 4e5f61c | 2017-11-30 10:17:38 +0100 | [diff] [blame] | 523 | data->c2 = n1 * data->c1 + 28581; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 524 | |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 525 | return 0; |
| 526 | } |
| 527 | |
Uwe Kleine-König | e4bb224 | 2017-11-30 10:17:35 +0100 | [diff] [blame] | 528 | static void imx_init_temp_grade(struct platform_device *pdev, u32 ocotp_mem0) |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 529 | { |
| 530 | struct imx_thermal_data *data = platform_get_drvdata(pdev); |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 531 | |
| 532 | /* The maximum die temp is specified by the Temperature Grade */ |
Uwe Kleine-König | e4bb224 | 2017-11-30 10:17:35 +0100 | [diff] [blame] | 533 | switch ((ocotp_mem0 >> 6) & 0x3) { |
Uwe Kleine-König | 339d749 | 2017-11-30 10:17:37 +0100 | [diff] [blame] | 534 | case 0: /* Commercial (0 to 95 °C) */ |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 535 | data->temp_grade = "Commercial"; |
| 536 | data->temp_max = 95000; |
| 537 | break; |
Uwe Kleine-König | 339d749 | 2017-11-30 10:17:37 +0100 | [diff] [blame] | 538 | case 1: /* Extended Commercial (-20 °C to 105 °C) */ |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 539 | data->temp_grade = "Extended Commercial"; |
| 540 | data->temp_max = 105000; |
| 541 | break; |
Uwe Kleine-König | 339d749 | 2017-11-30 10:17:37 +0100 | [diff] [blame] | 542 | case 2: /* Industrial (-40 °C to 105 °C) */ |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 543 | data->temp_grade = "Industrial"; |
| 544 | data->temp_max = 105000; |
| 545 | break; |
Uwe Kleine-König | 339d749 | 2017-11-30 10:17:37 +0100 | [diff] [blame] | 546 | case 3: /* Automotive (-40 °C to 125 °C) */ |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 547 | data->temp_grade = "Automotive"; |
| 548 | data->temp_max = 125000; |
| 549 | break; |
| 550 | } |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 551 | |
| 552 | /* |
Uwe Kleine-König | 339d749 | 2017-11-30 10:17:37 +0100 | [diff] [blame] | 553 | * Set the critical trip point at 5 °C under max |
| 554 | * Set the passive trip point at 10 °C under max (changeable via sysfs) |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 555 | */ |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 556 | data->temp_critical = data->temp_max - (1000 * 5); |
| 557 | data->temp_passive = data->temp_max - (1000 * 10); |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 558 | } |
| 559 | |
| 560 | static int imx_init_from_tempmon_data(struct platform_device *pdev) |
| 561 | { |
| 562 | struct regmap *map; |
| 563 | int ret; |
| 564 | u32 val; |
| 565 | |
| 566 | map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, |
| 567 | "fsl,tempmon-data"); |
| 568 | if (IS_ERR(map)) { |
| 569 | ret = PTR_ERR(map); |
| 570 | dev_err(&pdev->dev, "failed to get sensor regmap: %d\n", ret); |
| 571 | return ret; |
| 572 | } |
| 573 | |
| 574 | ret = regmap_read(map, OCOTP_ANA1, &val); |
| 575 | if (ret) { |
| 576 | dev_err(&pdev->dev, "failed to read sensor data: %d\n", ret); |
| 577 | return ret; |
| 578 | } |
| 579 | ret = imx_init_calib(pdev, val); |
| 580 | if (ret) |
| 581 | return ret; |
| 582 | |
| 583 | ret = regmap_read(map, OCOTP_MEM0, &val); |
| 584 | if (ret) { |
| 585 | dev_err(&pdev->dev, "failed to read sensor data: %d\n", ret); |
| 586 | return ret; |
| 587 | } |
| 588 | imx_init_temp_grade(pdev, val); |
| 589 | |
| 590 | return 0; |
| 591 | } |
| 592 | |
| 593 | static int imx_init_from_nvmem_cells(struct platform_device *pdev) |
| 594 | { |
| 595 | int ret; |
| 596 | u32 val; |
| 597 | |
| 598 | ret = nvmem_cell_read_u32(&pdev->dev, "calib", &val); |
| 599 | if (ret) |
| 600 | return ret; |
Jean-Christophe Dubois | be926ce | 2018-07-01 00:10:50 +0200 | [diff] [blame] | 601 | |
| 602 | ret = imx_init_calib(pdev, val); |
| 603 | if (ret) |
| 604 | return ret; |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 605 | |
| 606 | ret = nvmem_cell_read_u32(&pdev->dev, "temp_grade", &val); |
| 607 | if (ret) |
| 608 | return ret; |
| 609 | imx_init_temp_grade(pdev, val); |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 610 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 611 | return 0; |
| 612 | } |
| 613 | |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 614 | static irqreturn_t imx_thermal_alarm_irq(int irq, void *dev) |
| 615 | { |
| 616 | struct imx_thermal_data *data = dev; |
| 617 | |
| 618 | disable_irq_nosync(irq); |
| 619 | data->irq_enabled = false; |
| 620 | |
| 621 | return IRQ_WAKE_THREAD; |
| 622 | } |
| 623 | |
| 624 | static irqreturn_t imx_thermal_alarm_irq_thread(int irq, void *dev) |
| 625 | { |
| 626 | struct imx_thermal_data *data = dev; |
| 627 | |
Sascha Hauer | 17e8351 | 2015-07-24 08:12:54 +0200 | [diff] [blame] | 628 | dev_dbg(&data->tz->device, "THERMAL ALARM: T > %d\n", |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 629 | data->alarm_temp / 1000); |
| 630 | |
Srinivas Pandruvada | 0e70f46 | 2016-08-26 16:21:16 -0700 | [diff] [blame] | 631 | thermal_zone_device_update(data->tz, THERMAL_EVENT_UNSPECIFIED); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 632 | |
| 633 | return IRQ_HANDLED; |
| 634 | } |
| 635 | |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 636 | static const struct of_device_id of_imx_thermal_match[] = { |
| 637 | { .compatible = "fsl,imx6q-tempmon", .data = &thermal_imx6q_data, }, |
| 638 | { .compatible = "fsl,imx6sx-tempmon", .data = &thermal_imx6sx_data, }, |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 639 | { .compatible = "fsl,imx7d-tempmon", .data = &thermal_imx7d_data, }, |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 640 | { /* end */ } |
| 641 | }; |
| 642 | MODULE_DEVICE_TABLE(of, of_imx_thermal_match); |
| 643 | |
Anson Huang | c589c56 | 2018-11-21 05:49:36 +0000 | [diff] [blame] | 644 | #ifdef CONFIG_CPU_FREQ |
Bastian Stender | a1d0015 | 2018-06-08 11:06:39 +0200 | [diff] [blame] | 645 | /* |
| 646 | * Create cooling device in case no #cooling-cells property is available in |
| 647 | * CPU node |
| 648 | */ |
| 649 | static int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data) |
| 650 | { |
Anson Huang | c589c56 | 2018-11-21 05:49:36 +0000 | [diff] [blame] | 651 | struct device_node *np; |
Bastian Stender | a1d0015 | 2018-06-08 11:06:39 +0200 | [diff] [blame] | 652 | int ret; |
| 653 | |
Anson Huang | c589c56 | 2018-11-21 05:49:36 +0000 | [diff] [blame] | 654 | data->policy = cpufreq_cpu_get(0); |
| 655 | if (!data->policy) { |
| 656 | pr_debug("%s: CPUFreq policy not found\n", __func__); |
| 657 | return -EPROBE_DEFER; |
| 658 | } |
| 659 | |
| 660 | np = of_get_cpu_node(data->policy->cpu, NULL); |
| 661 | |
Bastian Stender | a1d0015 | 2018-06-08 11:06:39 +0200 | [diff] [blame] | 662 | if (!np || !of_find_property(np, "#cooling-cells", NULL)) { |
| 663 | data->cdev = cpufreq_cooling_register(data->policy); |
| 664 | if (IS_ERR(data->cdev)) { |
| 665 | ret = PTR_ERR(data->cdev); |
| 666 | cpufreq_cpu_put(data->policy); |
| 667 | return ret; |
| 668 | } |
| 669 | } |
| 670 | |
| 671 | return 0; |
| 672 | } |
| 673 | |
Anson Huang | c589c56 | 2018-11-21 05:49:36 +0000 | [diff] [blame] | 674 | static void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data) |
| 675 | { |
| 676 | cpufreq_cooling_unregister(data->cdev); |
| 677 | cpufreq_cpu_put(data->policy); |
| 678 | } |
| 679 | |
| 680 | #else |
| 681 | |
| 682 | static inline int imx_thermal_register_legacy_cooling(struct imx_thermal_data *data) |
| 683 | { |
| 684 | return 0; |
| 685 | } |
| 686 | |
| 687 | static inline void imx_thermal_unregister_legacy_cooling(struct imx_thermal_data *data) |
| 688 | { |
| 689 | } |
| 690 | #endif |
| 691 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 692 | static int imx_thermal_probe(struct platform_device *pdev) |
| 693 | { |
| 694 | struct imx_thermal_data *data; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 695 | struct regmap *map; |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 696 | int measure_freq; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 697 | int ret; |
| 698 | |
| 699 | data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL); |
| 700 | if (!data) |
| 701 | return -ENOMEM; |
| 702 | |
| 703 | map = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "fsl,tempmon"); |
| 704 | if (IS_ERR(map)) { |
| 705 | ret = PTR_ERR(map); |
| 706 | dev_err(&pdev->dev, "failed to get tempmon regmap: %d\n", ret); |
| 707 | return ret; |
| 708 | } |
| 709 | data->tempmon = map; |
| 710 | |
Corentin LABBE | 829bc78a | 2016-08-16 10:51:38 +0200 | [diff] [blame] | 711 | data->socdata = of_device_get_match_data(&pdev->dev); |
Shailendra Verma | 8b051ec | 2017-01-30 10:34:58 +0530 | [diff] [blame] | 712 | if (!data->socdata) { |
| 713 | dev_err(&pdev->dev, "no device match found\n"); |
| 714 | return -ENODEV; |
| 715 | } |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 716 | |
| 717 | /* make sure the IRQ flag is clear before enabling irq on i.MX6SX */ |
| 718 | if (data->socdata->version == TEMPMON_IMX6SX) { |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 719 | regmap_write(map, IMX6_MISC1 + REG_CLR, |
| 720 | IMX6_MISC1_IRQ_TEMPHIGH | IMX6_MISC1_IRQ_TEMPLOW |
| 721 | | IMX6_MISC1_IRQ_TEMPPANIC); |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 722 | /* |
| 723 | * reset value of LOW ALARM is incorrect, set it to lowest |
| 724 | * value to avoid false trigger of low alarm. |
| 725 | */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 726 | regmap_write(map, data->socdata->low_alarm_ctrl + REG_SET, |
| 727 | data->socdata->low_alarm_mask); |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 728 | } |
| 729 | |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 730 | data->irq = platform_get_irq(pdev, 0); |
| 731 | if (data->irq < 0) |
| 732 | return data->irq; |
| 733 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 734 | platform_set_drvdata(pdev, data); |
| 735 | |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 736 | if (of_find_property(pdev->dev.of_node, "nvmem-cells", NULL)) { |
| 737 | ret = imx_init_from_nvmem_cells(pdev); |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 738 | if (ret) { |
Anson Huang | 925b383 | 2018-11-21 05:49:40 +0000 | [diff] [blame] | 739 | if (ret == -EPROBE_DEFER) |
| 740 | return ret; |
| 741 | |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 742 | dev_err(&pdev->dev, "failed to init from nvmem: %d\n", |
| 743 | ret); |
| 744 | return ret; |
| 745 | } |
| 746 | } else { |
| 747 | ret = imx_init_from_tempmon_data(pdev); |
| 748 | if (ret) { |
Anson Huang | 337a4ae | 2018-09-13 17:13:05 +0800 | [diff] [blame] | 749 | dev_err(&pdev->dev, "failed to init from fsl,tempmon-data\n"); |
Leonard Crestez | ae62155 | 2017-07-14 17:11:08 +0300 | [diff] [blame] | 750 | return ret; |
| 751 | } |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 752 | } |
| 753 | |
| 754 | /* Make sure sensor is in known good state for measurements */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 755 | regmap_write(map, data->socdata->sensor_ctrl + REG_CLR, |
| 756 | data->socdata->power_down_mask); |
| 757 | regmap_write(map, data->socdata->sensor_ctrl + REG_CLR, |
| 758 | data->socdata->measure_temp_mask); |
| 759 | regmap_write(map, data->socdata->measure_freq_ctrl + REG_CLR, |
| 760 | data->socdata->measure_freq_mask); |
| 761 | if (data->socdata->version != TEMPMON_IMX7D) |
| 762 | regmap_write(map, IMX6_MISC0 + REG_SET, |
| 763 | IMX6_MISC0_REFTOP_SELBIASOFF); |
| 764 | regmap_write(map, data->socdata->sensor_ctrl + REG_SET, |
| 765 | data->socdata->power_down_mask); |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 766 | |
Bastian Stender | a1d0015 | 2018-06-08 11:06:39 +0200 | [diff] [blame] | 767 | ret = imx_thermal_register_legacy_cooling(data); |
| 768 | if (ret) { |
Anson Huang | c589c56 | 2018-11-21 05:49:36 +0000 | [diff] [blame] | 769 | if (ret == -EPROBE_DEFER) |
| 770 | return ret; |
| 771 | |
Viresh Kumar | 4d753aa | 2017-04-25 15:57:14 +0530 | [diff] [blame] | 772 | dev_err(&pdev->dev, |
| 773 | "failed to register cpufreq cooling device: %d\n", ret); |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 774 | return ret; |
| 775 | } |
| 776 | |
Heiner Kallweit | 90a21ff | 2014-11-08 20:35:54 +0100 | [diff] [blame] | 777 | data->thermal_clk = devm_clk_get(&pdev->dev, NULL); |
| 778 | if (IS_ERR(data->thermal_clk)) { |
| 779 | ret = PTR_ERR(data->thermal_clk); |
| 780 | if (ret != -EPROBE_DEFER) |
| 781 | dev_err(&pdev->dev, |
| 782 | "failed to get thermal clk: %d\n", ret); |
Anson Huang | c589c56 | 2018-11-21 05:49:36 +0000 | [diff] [blame] | 783 | goto legacy_cleanup; |
Heiner Kallweit | 90a21ff | 2014-11-08 20:35:54 +0100 | [diff] [blame] | 784 | } |
| 785 | |
| 786 | /* |
| 787 | * Thermal sensor needs clk on to get correct value, normally |
| 788 | * we should enable its clk before taking measurement and disable |
| 789 | * clk after measurement is done, but if alarm function is enabled, |
| 790 | * hardware will auto measure the temperature periodically, so we |
| 791 | * need to keep the clk always on for alarm function. |
| 792 | */ |
| 793 | ret = clk_prepare_enable(data->thermal_clk); |
| 794 | if (ret) { |
| 795 | dev_err(&pdev->dev, "failed to enable thermal clk: %d\n", ret); |
Anson Huang | c589c56 | 2018-11-21 05:49:36 +0000 | [diff] [blame] | 796 | goto legacy_cleanup; |
Heiner Kallweit | 90a21ff | 2014-11-08 20:35:54 +0100 | [diff] [blame] | 797 | } |
| 798 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 799 | data->tz = thermal_zone_device_register("imx_thermal_zone", |
Philipp Zabel | 017e514 | 2013-08-01 18:33:11 +0200 | [diff] [blame] | 800 | IMX_TRIP_NUM, |
| 801 | BIT(IMX_TRIP_PASSIVE), data, |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 802 | &imx_tz_ops, NULL, |
| 803 | IMX_PASSIVE_DELAY, |
| 804 | IMX_POLLING_DELAY); |
| 805 | if (IS_ERR(data->tz)) { |
| 806 | ret = PTR_ERR(data->tz); |
| 807 | dev_err(&pdev->dev, |
| 808 | "failed to register thermal zone device %d\n", ret); |
Anson Huang | b6ad398 | 2018-09-13 17:13:06 +0800 | [diff] [blame] | 809 | goto clk_disable; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 810 | } |
| 811 | |
Tim Harvey | a2291ba | 2015-11-19 06:49:40 -0800 | [diff] [blame] | 812 | dev_info(&pdev->dev, "%s CPU temperature grade - max:%dC" |
| 813 | " critical:%dC passive:%dC\n", data->temp_grade, |
| 814 | data->temp_max / 1000, data->temp_critical / 1000, |
| 815 | data->temp_passive / 1000); |
| 816 | |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 817 | /* Enable measurements at ~ 10 Hz */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 818 | regmap_write(map, data->socdata->measure_freq_ctrl + REG_CLR, |
| 819 | data->socdata->measure_freq_mask); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 820 | measure_freq = DIV_ROUND_UP(32768, 10); /* 10 Hz */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 821 | regmap_write(map, data->socdata->measure_freq_ctrl + REG_SET, |
| 822 | measure_freq << data->socdata->measure_freq_shift); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 823 | imx_set_alarm_temp(data, data->temp_passive); |
Anson Huang | 3c94f17 | 2014-08-06 15:12:09 +0800 | [diff] [blame] | 824 | |
| 825 | if (data->socdata->version == TEMPMON_IMX6SX) |
| 826 | imx_set_panic_temp(data, data->temp_critical); |
| 827 | |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 828 | regmap_write(map, data->socdata->sensor_ctrl + REG_CLR, |
| 829 | data->socdata->power_down_mask); |
| 830 | regmap_write(map, data->socdata->sensor_ctrl + REG_SET, |
| 831 | data->socdata->measure_temp_mask); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 832 | |
Mikhail Lappo | cf1ba1d | 2018-02-02 16:17:46 -0200 | [diff] [blame] | 833 | data->irq_enabled = true; |
| 834 | data->mode = THERMAL_DEVICE_ENABLED; |
| 835 | |
Bai Ping | 84866ee | 2015-09-14 19:09:51 +0800 | [diff] [blame] | 836 | ret = devm_request_threaded_irq(&pdev->dev, data->irq, |
| 837 | imx_thermal_alarm_irq, imx_thermal_alarm_irq_thread, |
| 838 | 0, "imx_thermal", data); |
| 839 | if (ret < 0) { |
| 840 | dev_err(&pdev->dev, "failed to request alarm irq: %d\n", ret); |
Anson Huang | b6ad398 | 2018-09-13 17:13:06 +0800 | [diff] [blame] | 841 | goto thermal_zone_unregister; |
Bai Ping | 84866ee | 2015-09-14 19:09:51 +0800 | [diff] [blame] | 842 | } |
| 843 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 844 | return 0; |
Anson Huang | b6ad398 | 2018-09-13 17:13:06 +0800 | [diff] [blame] | 845 | |
| 846 | thermal_zone_unregister: |
| 847 | thermal_zone_device_unregister(data->tz); |
| 848 | clk_disable: |
| 849 | clk_disable_unprepare(data->thermal_clk); |
Anson Huang | c589c56 | 2018-11-21 05:49:36 +0000 | [diff] [blame] | 850 | legacy_cleanup: |
| 851 | imx_thermal_unregister_legacy_cooling(data); |
Anson Huang | b6ad398 | 2018-09-13 17:13:06 +0800 | [diff] [blame] | 852 | |
| 853 | return ret; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 854 | } |
| 855 | |
| 856 | static int imx_thermal_remove(struct platform_device *pdev) |
| 857 | { |
| 858 | struct imx_thermal_data *data = platform_get_drvdata(pdev); |
Philipp Zabel | 37713a1 | 2013-08-01 18:33:12 +0200 | [diff] [blame] | 859 | struct regmap *map = data->tempmon; |
| 860 | |
| 861 | /* Disable measurements */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 862 | regmap_write(map, data->socdata->sensor_ctrl + REG_SET, |
| 863 | data->socdata->power_down_mask); |
Anson Huang | 329fe7b | 2013-12-23 15:49:22 -0500 | [diff] [blame] | 864 | if (!IS_ERR(data->thermal_clk)) |
| 865 | clk_disable_unprepare(data->thermal_clk); |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 866 | |
| 867 | thermal_zone_device_unregister(data->tz); |
Anson Huang | 9db1101 | 2020-03-13 16:28:14 +0800 | [diff] [blame^] | 868 | imx_thermal_unregister_legacy_cooling(data); |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 869 | |
| 870 | return 0; |
| 871 | } |
| 872 | |
Anson Huang | b009514 | 2020-03-02 16:54:26 +0800 | [diff] [blame] | 873 | static int __maybe_unused imx_thermal_suspend(struct device *dev) |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 874 | { |
| 875 | struct imx_thermal_data *data = dev_get_drvdata(dev); |
| 876 | struct regmap *map = data->tempmon; |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 877 | |
Anson Huang | b46cce5 | 2013-12-24 09:43:24 -0500 | [diff] [blame] | 878 | /* |
| 879 | * Need to disable thermal sensor, otherwise, when thermal core |
| 880 | * try to get temperature before thermal sensor resume, a wrong |
| 881 | * temperature will be read as the thermal sensor is powered |
| 882 | * down. |
| 883 | */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 884 | regmap_write(map, data->socdata->sensor_ctrl + REG_CLR, |
| 885 | data->socdata->measure_temp_mask); |
| 886 | regmap_write(map, data->socdata->sensor_ctrl + REG_SET, |
| 887 | data->socdata->power_down_mask); |
Anson Huang | b46cce5 | 2013-12-24 09:43:24 -0500 | [diff] [blame] | 888 | data->mode = THERMAL_DEVICE_DISABLED; |
Anson Huang | d26eef8 | 2015-01-06 18:50:22 +0800 | [diff] [blame] | 889 | clk_disable_unprepare(data->thermal_clk); |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 890 | |
| 891 | return 0; |
| 892 | } |
| 893 | |
Anson Huang | b009514 | 2020-03-02 16:54:26 +0800 | [diff] [blame] | 894 | static int __maybe_unused imx_thermal_resume(struct device *dev) |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 895 | { |
Anson Huang | b46cce5 | 2013-12-24 09:43:24 -0500 | [diff] [blame] | 896 | struct imx_thermal_data *data = dev_get_drvdata(dev); |
| 897 | struct regmap *map = data->tempmon; |
Arvind Yadav | e3bdc8d | 2017-06-06 15:12:37 +0530 | [diff] [blame] | 898 | int ret; |
Anson Huang | b46cce5 | 2013-12-24 09:43:24 -0500 | [diff] [blame] | 899 | |
Arvind Yadav | e3bdc8d | 2017-06-06 15:12:37 +0530 | [diff] [blame] | 900 | ret = clk_prepare_enable(data->thermal_clk); |
| 901 | if (ret) |
| 902 | return ret; |
Anson Huang | b46cce5 | 2013-12-24 09:43:24 -0500 | [diff] [blame] | 903 | /* Enabled thermal sensor after resume */ |
Anson Huang | f085f67 | 2018-03-02 09:59:30 +0800 | [diff] [blame] | 904 | regmap_write(map, data->socdata->sensor_ctrl + REG_CLR, |
| 905 | data->socdata->power_down_mask); |
| 906 | regmap_write(map, data->socdata->sensor_ctrl + REG_SET, |
| 907 | data->socdata->measure_temp_mask); |
Anson Huang | b46cce5 | 2013-12-24 09:43:24 -0500 | [diff] [blame] | 908 | data->mode = THERMAL_DEVICE_ENABLED; |
| 909 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 910 | return 0; |
| 911 | } |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 912 | |
| 913 | static SIMPLE_DEV_PM_OPS(imx_thermal_pm_ops, |
| 914 | imx_thermal_suspend, imx_thermal_resume); |
| 915 | |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 916 | static struct platform_driver imx_thermal = { |
| 917 | .driver = { |
| 918 | .name = "imx_thermal", |
Shawn Guo | ca3de46 | 2013-06-24 14:30:44 +0800 | [diff] [blame] | 919 | .pm = &imx_thermal_pm_ops, |
| 920 | .of_match_table = of_imx_thermal_match, |
| 921 | }, |
| 922 | .probe = imx_thermal_probe, |
| 923 | .remove = imx_thermal_remove, |
| 924 | }; |
| 925 | module_platform_driver(imx_thermal); |
| 926 | |
| 927 | MODULE_AUTHOR("Freescale Semiconductor, Inc."); |
| 928 | MODULE_DESCRIPTION("Thermal driver for Freescale i.MX SoCs"); |
| 929 | MODULE_LICENSE("GPL v2"); |
| 930 | MODULE_ALIAS("platform:imx-thermal"); |