|
14 | 14 | #include <linux/of_device.h> |
15 | 15 | #include <linux/platform_device.h> |
16 | 16 | #include <linux/pm_runtime.h> |
17 | | -#include <linux/sys_soc.h> |
18 | 17 | #include <linux/thermal.h> |
19 | 18 |
|
20 | 19 | #include "thermal_hwmon.h" |
|
27 | 26 | #define REG_GEN3_IRQTEMP1 0x14 |
28 | 27 | #define REG_GEN3_IRQTEMP2 0x18 |
29 | 28 | #define REG_GEN3_IRQTEMP3 0x1C |
30 | | -#define REG_GEN3_CTSR 0x20 |
31 | 29 | #define REG_GEN3_THCTR 0x20 |
32 | 30 | #define REG_GEN3_TEMP 0x28 |
33 | 31 | #define REG_GEN3_THCODE1 0x50 |
|
46 | 44 | #define IRQ_TEMPD2 BIT(4) |
47 | 45 | #define IRQ_TEMPD3 BIT(5) |
48 | 46 |
|
49 | | -/* CTSR bits */ |
50 | | -#define CTSR_PONM BIT(8) |
51 | | -#define CTSR_AOUT BIT(7) |
52 | | -#define CTSR_THBGR BIT(5) |
53 | | -#define CTSR_VMEN BIT(4) |
54 | | -#define CTSR_VMST BIT(1) |
55 | | -#define CTSR_THSST BIT(0) |
56 | | - |
57 | 47 | /* THCTR bits */ |
58 | 48 | #define THCTR_PONM BIT(6) |
59 | 49 | #define THCTR_THSST BIT(0) |
@@ -88,8 +78,6 @@ struct rcar_gen3_thermal_priv { |
88 | 78 | struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM]; |
89 | 79 | struct thermal_zone_device_ops ops; |
90 | 80 | unsigned int num_tscs; |
91 | | - void (*thermal_init)(struct rcar_gen3_thermal_priv *priv, |
92 | | - struct rcar_gen3_thermal_tsc *tsc); |
93 | 81 | int ptat[3]; |
94 | 82 | }; |
95 | 83 |
|
@@ -248,11 +236,6 @@ static irqreturn_t rcar_gen3_thermal_irq(int irq, void *data) |
248 | 236 | return IRQ_HANDLED; |
249 | 237 | } |
250 | 238 |
|
251 | | -static const struct soc_device_attribute r8a7795es1[] = { |
252 | | - { .soc_id = "r8a7795", .revision = "ES1.*" }, |
253 | | - { /* sentinel */ } |
254 | | -}; |
255 | | - |
256 | 239 | static bool rcar_gen3_thermal_read_fuses(struct rcar_gen3_thermal_priv *priv) |
257 | 240 | { |
258 | 241 | unsigned int i; |
@@ -311,34 +294,6 @@ static bool rcar_gen3_thermal_read_fuses(struct rcar_gen3_thermal_priv *priv) |
311 | 294 | return true; |
312 | 295 | } |
313 | 296 |
|
314 | | -static void rcar_gen3_thermal_init_r8a7795es1(struct rcar_gen3_thermal_priv *priv, |
315 | | - struct rcar_gen3_thermal_tsc *tsc) |
316 | | -{ |
317 | | - rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, CTSR_THBGR); |
318 | | - rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, 0x0); |
319 | | - |
320 | | - usleep_range(1000, 2000); |
321 | | - |
322 | | - rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, CTSR_PONM); |
323 | | - |
324 | | - rcar_gen3_thermal_write(tsc, REG_GEN3_IRQCTL, 0x3F); |
325 | | - rcar_gen3_thermal_write(tsc, REG_GEN3_IRQMSK, 0); |
326 | | - if (priv->ops.set_trips) |
327 | | - rcar_gen3_thermal_write(tsc, REG_GEN3_IRQEN, |
328 | | - IRQ_TEMPD1 | IRQ_TEMP2); |
329 | | - |
330 | | - rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, |
331 | | - CTSR_PONM | CTSR_AOUT | CTSR_THBGR | CTSR_VMEN); |
332 | | - |
333 | | - usleep_range(100, 200); |
334 | | - |
335 | | - rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, |
336 | | - CTSR_PONM | CTSR_AOUT | CTSR_THBGR | CTSR_VMEN | |
337 | | - CTSR_VMST | CTSR_THSST); |
338 | | - |
339 | | - usleep_range(1000, 2000); |
340 | | -} |
341 | | - |
342 | 297 | static void rcar_gen3_thermal_init(struct rcar_gen3_thermal_priv *priv, |
343 | 298 | struct rcar_gen3_thermal_tsc *tsc) |
344 | 299 | { |
@@ -474,9 +429,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) |
474 | 429 | return -ENOMEM; |
475 | 430 |
|
476 | 431 | priv->ops = rcar_gen3_tz_of_ops; |
477 | | - priv->thermal_init = rcar_gen3_thermal_init; |
478 | | - if (soc_device_match(r8a7795es1)) |
479 | | - priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1; |
480 | 432 |
|
481 | 433 | platform_set_drvdata(pdev, priv); |
482 | 434 |
|
@@ -516,7 +468,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev) |
516 | 468 | for (i = 0; i < priv->num_tscs; i++) { |
517 | 469 | struct rcar_gen3_thermal_tsc *tsc = priv->tscs[i]; |
518 | 470 |
|
519 | | - priv->thermal_init(priv, tsc); |
| 471 | + rcar_gen3_thermal_init(priv, tsc); |
520 | 472 | rcar_gen3_thermal_calc_coefs(priv, tsc, *ths_tj_1); |
521 | 473 |
|
522 | 474 | zone = devm_thermal_of_zone_register(dev, i, tsc, &priv->ops); |
@@ -563,7 +515,7 @@ static int __maybe_unused rcar_gen3_thermal_resume(struct device *dev) |
563 | 515 | for (i = 0; i < priv->num_tscs; i++) { |
564 | 516 | struct rcar_gen3_thermal_tsc *tsc = priv->tscs[i]; |
565 | 517 |
|
566 | | - priv->thermal_init(priv, tsc); |
| 518 | + rcar_gen3_thermal_init(priv, tsc); |
567 | 519 | } |
568 | 520 |
|
569 | 521 | return 0; |
|
0 commit comments