diff options
author | Amit Daniel Kachhap <amit.daniel@samsung.com> | 2013-06-24 06:50:39 -0400 |
---|---|---|
committer | Eduardo Valentin <eduardo.valentin@ti.com> | 2013-08-13 09:52:02 -0400 |
commit | cebe7373a7e659d29e939ed2ce379b478684793c (patch) | |
tree | 38657ccfd28ee88e9542e42bbf6116482df7c709 | |
parent | 1cd1ecb611d8be48df571a46950411ecee1fe3a1 (diff) |
thermal: exynos: Add support to handle many instances of TMU
This patch adds support to handle multiple instances of the TMU controllers.
This is done by removing the static structure to register with the core thermal
and creating it dynamically for each instance of the TMU controller. The
interrupt is made shared type to handle shared interrupts. Now since the ISR needs
the core thermal framework to be registered so request_irq is moved after the core
registration is done.
Also the identifier of the TMU controller is extracted from device tree alias. This
will be used for TMU specific initialisation.
Acked-by: Kukjin Kim <kgene.kim@samsung.com>
Acked-by: Jonghwa Lee <jonghwa3.lee@samsung.com>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Acked-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
-rw-r--r-- | drivers/thermal/samsung/exynos_thermal_common.h | 1 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu.c | 158 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu.h | 13 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu_data.c | 145 | ||||
-rw-r--r-- | drivers/thermal/samsung/exynos_tmu_data.h | 4 |
5 files changed, 203 insertions, 118 deletions
diff --git a/drivers/thermal/samsung/exynos_thermal_common.h b/drivers/thermal/samsung/exynos_thermal_common.h index bfcf69ecd123..bc3016e6e9d6 100644 --- a/drivers/thermal/samsung/exynos_thermal_common.h +++ b/drivers/thermal/samsung/exynos_thermal_common.h | |||
@@ -85,6 +85,7 @@ struct thermal_sensor_conf { | |||
85 | struct thermal_cooling_conf cooling_data; | 85 | struct thermal_cooling_conf cooling_data; |
86 | void *driver_data; | 86 | void *driver_data; |
87 | void *pzone_data; | 87 | void *pzone_data; |
88 | struct device *dev; | ||
88 | }; | 89 | }; |
89 | 90 | ||
90 | /*Functions used exynos based thermal sensor driver*/ | 91 | /*Functions used exynos based thermal sensor driver*/ |
diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c index 4356118bab01..7f65fe088d24 100644 --- a/drivers/thermal/samsung/exynos_tmu.c +++ b/drivers/thermal/samsung/exynos_tmu.c | |||
@@ -26,15 +26,32 @@ | |||
26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/of.h> | 28 | #include <linux/of.h> |
29 | #include <linux/of_address.h> | ||
30 | #include <linux/of_irq.h> | ||
29 | #include <linux/platform_device.h> | 31 | #include <linux/platform_device.h> |
30 | 32 | ||
31 | #include "exynos_thermal_common.h" | 33 | #include "exynos_thermal_common.h" |
32 | #include "exynos_tmu.h" | 34 | #include "exynos_tmu.h" |
33 | #include "exynos_tmu_data.h" | 35 | #include "exynos_tmu_data.h" |
34 | 36 | ||
37 | /** | ||
38 | * struct exynos_tmu_data : A structure to hold the private data of the TMU | ||
39 | driver | ||
40 | * @id: identifier of the one instance of the TMU controller. | ||
41 | * @pdata: pointer to the tmu platform/configuration data | ||
42 | * @base: base address of the single instance of the TMU controller. | ||
43 | * @irq: irq number of the TMU controller. | ||
44 | * @soc: id of the SOC type. | ||
45 | * @irq_work: pointer to the irq work structure. | ||
46 | * @lock: lock to implement synchronization. | ||
47 | * @clk: pointer to the clock structure. | ||
48 | * @temp_error1: fused value of the first point trim. | ||
49 | * @temp_error2: fused value of the second point trim. | ||
50 | * @reg_conf: pointer to structure to register with core thermal. | ||
51 | */ | ||
35 | struct exynos_tmu_data { | 52 | struct exynos_tmu_data { |
53 | int id; | ||
36 | struct exynos_tmu_platform_data *pdata; | 54 | struct exynos_tmu_platform_data *pdata; |
37 | struct resource *mem; | ||
38 | void __iomem *base; | 55 | void __iomem *base; |
39 | int irq; | 56 | int irq; |
40 | enum soc_type soc; | 57 | enum soc_type soc; |
@@ -42,6 +59,7 @@ struct exynos_tmu_data { | |||
42 | struct mutex lock; | 59 | struct mutex lock; |
43 | struct clk *clk; | 60 | struct clk *clk; |
44 | u8 temp_error1, temp_error2; | 61 | u8 temp_error1, temp_error2; |
62 | struct thermal_sensor_conf *reg_conf; | ||
45 | }; | 63 | }; |
46 | 64 | ||
47 | /* | 65 | /* |
@@ -345,12 +363,6 @@ static int exynos_tmu_set_emulation(void *drv_data, unsigned long temp) | |||
345 | { return -EINVAL; } | 363 | { return -EINVAL; } |
346 | #endif/*CONFIG_THERMAL_EMULATION*/ | 364 | #endif/*CONFIG_THERMAL_EMULATION*/ |
347 | 365 | ||
348 | static struct thermal_sensor_conf exynos_sensor_conf = { | ||
349 | .name = "exynos-therm", | ||
350 | .read_temperature = (int (*)(void *))exynos_tmu_read, | ||
351 | .write_emul_temp = exynos_tmu_set_emulation, | ||
352 | }; | ||
353 | |||
354 | static void exynos_tmu_work(struct work_struct *work) | 366 | static void exynos_tmu_work(struct work_struct *work) |
355 | { | 367 | { |
356 | struct exynos_tmu_data *data = container_of(work, | 368 | struct exynos_tmu_data *data = container_of(work, |
@@ -359,7 +371,7 @@ static void exynos_tmu_work(struct work_struct *work) | |||
359 | const struct exynos_tmu_registers *reg = pdata->registers; | 371 | const struct exynos_tmu_registers *reg = pdata->registers; |
360 | unsigned int val_irq; | 372 | unsigned int val_irq; |
361 | 373 | ||
362 | exynos_report_trigger(&exynos_sensor_conf); | 374 | exynos_report_trigger(data->reg_conf); |
363 | mutex_lock(&data->lock); | 375 | mutex_lock(&data->lock); |
364 | clk_enable(data->clk); | 376 | clk_enable(data->clk); |
365 | 377 | ||
@@ -404,33 +416,73 @@ MODULE_DEVICE_TABLE(of, exynos_tmu_match); | |||
404 | #endif | 416 | #endif |
405 | 417 | ||
406 | static inline struct exynos_tmu_platform_data *exynos_get_driver_data( | 418 | static inline struct exynos_tmu_platform_data *exynos_get_driver_data( |
407 | struct platform_device *pdev) | 419 | struct platform_device *pdev, int id) |
408 | { | 420 | { |
409 | #ifdef CONFIG_OF | 421 | #ifdef CONFIG_OF |
422 | struct exynos_tmu_init_data *data_table; | ||
423 | struct exynos_tmu_platform_data *tmu_data; | ||
410 | if (pdev->dev.of_node) { | 424 | if (pdev->dev.of_node) { |
411 | const struct of_device_id *match; | 425 | const struct of_device_id *match; |
412 | match = of_match_node(exynos_tmu_match, pdev->dev.of_node); | 426 | match = of_match_node(exynos_tmu_match, pdev->dev.of_node); |
413 | if (!match) | 427 | if (!match) |
414 | return NULL; | 428 | return NULL; |
415 | return (struct exynos_tmu_platform_data *) match->data; | 429 | data_table = (struct exynos_tmu_init_data *) match->data; |
430 | if (!data_table || id >= data_table->tmu_count) | ||
431 | return NULL; | ||
432 | tmu_data = data_table->tmu_data; | ||
433 | return (struct exynos_tmu_platform_data *) (tmu_data + id); | ||
416 | } | 434 | } |
417 | #endif | 435 | #endif |
418 | return NULL; | 436 | return NULL; |
419 | } | 437 | } |
420 | 438 | ||
421 | static int exynos_tmu_probe(struct platform_device *pdev) | 439 | static int exynos_map_dt_data(struct platform_device *pdev) |
422 | { | 440 | { |
423 | struct exynos_tmu_data *data; | 441 | struct exynos_tmu_data *data = platform_get_drvdata(pdev); |
424 | struct exynos_tmu_platform_data *pdata = pdev->dev.platform_data; | 442 | struct exynos_tmu_platform_data *pdata; |
425 | int ret, i; | 443 | struct resource res; |
444 | |||
445 | if (!data) | ||
446 | return -ENODEV; | ||
426 | 447 | ||
427 | if (!pdata) | 448 | data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl"); |
428 | pdata = exynos_get_driver_data(pdev); | 449 | if (data->id < 0) |
450 | data->id = 0; | ||
429 | 451 | ||
452 | data->irq = irq_of_parse_and_map(pdev->dev.of_node, 0); | ||
453 | if (data->irq <= 0) { | ||
454 | dev_err(&pdev->dev, "failed to get IRQ\n"); | ||
455 | return -ENODEV; | ||
456 | } | ||
457 | |||
458 | if (of_address_to_resource(pdev->dev.of_node, 0, &res)) { | ||
459 | dev_err(&pdev->dev, "failed to get Resource 0\n"); | ||
460 | return -ENODEV; | ||
461 | } | ||
462 | |||
463 | data->base = devm_ioremap(&pdev->dev, res.start, resource_size(&res)); | ||
464 | if (!data->base) { | ||
465 | dev_err(&pdev->dev, "Failed to ioremap memory\n"); | ||
466 | return -EADDRNOTAVAIL; | ||
467 | } | ||
468 | |||
469 | pdata = exynos_get_driver_data(pdev, data->id); | ||
430 | if (!pdata) { | 470 | if (!pdata) { |
431 | dev_err(&pdev->dev, "No platform init data supplied.\n"); | 471 | dev_err(&pdev->dev, "No platform init data supplied.\n"); |
432 | return -ENODEV; | 472 | return -ENODEV; |
433 | } | 473 | } |
474 | data->pdata = pdata; | ||
475 | |||
476 | return 0; | ||
477 | } | ||
478 | |||
479 | static int exynos_tmu_probe(struct platform_device *pdev) | ||
480 | { | ||
481 | struct exynos_tmu_data *data; | ||
482 | struct exynos_tmu_platform_data *pdata; | ||
483 | struct thermal_sensor_conf *sensor_conf; | ||
484 | int ret, i; | ||
485 | |||
434 | data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data), | 486 | data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data), |
435 | GFP_KERNEL); | 487 | GFP_KERNEL); |
436 | if (!data) { | 488 | if (!data) { |
@@ -438,25 +490,16 @@ static int exynos_tmu_probe(struct platform_device *pdev) | |||
438 | return -ENOMEM; | 490 | return -ENOMEM; |
439 | } | 491 | } |
440 | 492 | ||
441 | data->irq = platform_get_irq(pdev, 0); | 493 | platform_set_drvdata(pdev, data); |
442 | if (data->irq < 0) { | 494 | mutex_init(&data->lock); |
443 | dev_err(&pdev->dev, "Failed to get platform irq\n"); | ||
444 | return data->irq; | ||
445 | } | ||
446 | 495 | ||
447 | INIT_WORK(&data->irq_work, exynos_tmu_work); | 496 | ret = exynos_map_dt_data(pdev); |
497 | if (ret) | ||
498 | return ret; | ||
448 | 499 | ||
449 | data->mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 500 | pdata = data->pdata; |
450 | data->base = devm_ioremap_resource(&pdev->dev, data->mem); | ||
451 | if (IS_ERR(data->base)) | ||
452 | return PTR_ERR(data->base); | ||
453 | 501 | ||
454 | ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, | 502 | INIT_WORK(&data->irq_work, exynos_tmu_work); |
455 | IRQF_TRIGGER_RISING, "exynos-tmu", data); | ||
456 | if (ret) { | ||
457 | dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); | ||
458 | return ret; | ||
459 | } | ||
460 | 503 | ||
461 | data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); | 504 | data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); |
462 | if (IS_ERR(data->clk)) { | 505 | if (IS_ERR(data->clk)) { |
@@ -477,10 +520,6 @@ static int exynos_tmu_probe(struct platform_device *pdev) | |||
477 | goto err_clk; | 520 | goto err_clk; |
478 | } | 521 | } |
479 | 522 | ||
480 | data->pdata = pdata; | ||
481 | platform_set_drvdata(pdev, data); | ||
482 | mutex_init(&data->lock); | ||
483 | |||
484 | ret = exynos_tmu_initialize(pdev); | 523 | ret = exynos_tmu_initialize(pdev); |
485 | if (ret) { | 524 | if (ret) { |
486 | dev_err(&pdev->dev, "Failed to initialize TMU\n"); | 525 | dev_err(&pdev->dev, "Failed to initialize TMU\n"); |
@@ -489,35 +528,54 @@ static int exynos_tmu_probe(struct platform_device *pdev) | |||
489 | 528 | ||
490 | exynos_tmu_control(pdev, true); | 529 | exynos_tmu_control(pdev, true); |
491 | 530 | ||
492 | /* Register the sensor with thermal management interface */ | 531 | /* Allocate a structure to register with the exynos core thermal */ |
493 | (&exynos_sensor_conf)->driver_data = data; | 532 | sensor_conf = devm_kzalloc(&pdev->dev, |
494 | exynos_sensor_conf.trip_data.trip_count = pdata->trigger_enable[0] + | 533 | sizeof(struct thermal_sensor_conf), GFP_KERNEL); |
534 | if (!sensor_conf) { | ||
535 | dev_err(&pdev->dev, "Failed to allocate registration struct\n"); | ||
536 | ret = -ENOMEM; | ||
537 | goto err_clk; | ||
538 | } | ||
539 | sprintf(sensor_conf->name, "therm_zone%d", data->id); | ||
540 | sensor_conf->read_temperature = (int (*)(void *))exynos_tmu_read; | ||
541 | sensor_conf->write_emul_temp = | ||
542 | (int (*)(void *, unsigned long))exynos_tmu_set_emulation; | ||
543 | sensor_conf->driver_data = data; | ||
544 | sensor_conf->trip_data.trip_count = pdata->trigger_enable[0] + | ||
495 | pdata->trigger_enable[1] + pdata->trigger_enable[2]+ | 545 | pdata->trigger_enable[1] + pdata->trigger_enable[2]+ |
496 | pdata->trigger_enable[3]; | 546 | pdata->trigger_enable[3]; |
497 | 547 | ||
498 | for (i = 0; i < exynos_sensor_conf.trip_data.trip_count; i++) { | 548 | for (i = 0; i < sensor_conf->trip_data.trip_count; i++) { |
499 | exynos_sensor_conf.trip_data.trip_val[i] = | 549 | sensor_conf->trip_data.trip_val[i] = |
500 | pdata->threshold + pdata->trigger_levels[i]; | 550 | pdata->threshold + pdata->trigger_levels[i]; |
501 | exynos_sensor_conf.trip_data.trip_type[i] = | 551 | sensor_conf->trip_data.trip_type[i] = |
502 | pdata->trigger_type[i]; | 552 | pdata->trigger_type[i]; |
503 | } | 553 | } |
504 | 554 | ||
505 | exynos_sensor_conf.trip_data.trigger_falling = pdata->threshold_falling; | 555 | sensor_conf->trip_data.trigger_falling = pdata->threshold_falling; |
506 | 556 | ||
507 | exynos_sensor_conf.cooling_data.freq_clip_count = | 557 | sensor_conf->cooling_data.freq_clip_count = pdata->freq_tab_count; |
508 | pdata->freq_tab_count; | ||
509 | for (i = 0; i < pdata->freq_tab_count; i++) { | 558 | for (i = 0; i < pdata->freq_tab_count; i++) { |
510 | exynos_sensor_conf.cooling_data.freq_data[i].freq_clip_max = | 559 | sensor_conf->cooling_data.freq_data[i].freq_clip_max = |
511 | pdata->freq_tab[i].freq_clip_max; | 560 | pdata->freq_tab[i].freq_clip_max; |
512 | exynos_sensor_conf.cooling_data.freq_data[i].temp_level = | 561 | sensor_conf->cooling_data.freq_data[i].temp_level = |
513 | pdata->freq_tab[i].temp_level; | 562 | pdata->freq_tab[i].temp_level; |
514 | } | 563 | } |
515 | 564 | sensor_conf->dev = &pdev->dev; | |
516 | ret = exynos_register_thermal(&exynos_sensor_conf); | 565 | /* Register the sensor with thermal management interface */ |
566 | ret = exynos_register_thermal(sensor_conf); | ||
517 | if (ret) { | 567 | if (ret) { |
518 | dev_err(&pdev->dev, "Failed to register thermal interface\n"); | 568 | dev_err(&pdev->dev, "Failed to register thermal interface\n"); |
519 | goto err_clk; | 569 | goto err_clk; |
520 | } | 570 | } |
571 | data->reg_conf = sensor_conf; | ||
572 | |||
573 | ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, | ||
574 | IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); | ||
575 | if (ret) { | ||
576 | dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); | ||
577 | goto err_clk; | ||
578 | } | ||
521 | 579 | ||
522 | return 0; | 580 | return 0; |
523 | err_clk: | 581 | err_clk: |
@@ -531,7 +589,7 @@ static int exynos_tmu_remove(struct platform_device *pdev) | |||
531 | 589 | ||
532 | exynos_tmu_control(pdev, false); | 590 | exynos_tmu_control(pdev, false); |
533 | 591 | ||
534 | exynos_unregister_thermal(&exynos_sensor_conf); | 592 | exynos_unregister_thermal(data->reg_conf); |
535 | 593 | ||
536 | clk_unprepare(data->clk); | 594 | clk_unprepare(data->clk); |
537 | 595 | ||
diff --git a/drivers/thermal/samsung/exynos_tmu.h b/drivers/thermal/samsung/exynos_tmu.h index ef5dc0ebff75..53fa7024090a 100644 --- a/drivers/thermal/samsung/exynos_tmu.h +++ b/drivers/thermal/samsung/exynos_tmu.h | |||
@@ -250,4 +250,17 @@ struct exynos_tmu_platform_data { | |||
250 | unsigned int freq_tab_count; | 250 | unsigned int freq_tab_count; |
251 | const struct exynos_tmu_registers *registers; | 251 | const struct exynos_tmu_registers *registers; |
252 | }; | 252 | }; |
253 | |||
254 | /** | ||
255 | * struct exynos_tmu_init_data | ||
256 | * @tmu_count: number of TMU instances. | ||
257 | * @tmu_data: platform data of all TMU instances. | ||
258 | * This structure is required to store data for multi-instance exynos tmu | ||
259 | * driver. | ||
260 | */ | ||
261 | struct exynos_tmu_init_data { | ||
262 | int tmu_count; | ||
263 | struct exynos_tmu_platform_data tmu_data[]; | ||
264 | }; | ||
265 | |||
253 | #endif /* _EXYNOS_TMU_H */ | 266 | #endif /* _EXYNOS_TMU_H */ |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.c b/drivers/thermal/samsung/exynos_tmu_data.c index 217b8f522d32..a5c25b4bb0c0 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.c +++ b/drivers/thermal/samsung/exynos_tmu_data.c | |||
@@ -48,38 +48,44 @@ static const struct exynos_tmu_registers exynos4210_tmu_registers = { | |||
48 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, | 48 | .tmu_intstat = EXYNOS_TMU_REG_INTSTAT, |
49 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, | 49 | .tmu_intclear = EXYNOS_TMU_REG_INTCLEAR, |
50 | }; | 50 | }; |
51 | struct exynos_tmu_platform_data const exynos4210_default_tmu_data = { | 51 | |
52 | .threshold = 80, | 52 | struct exynos_tmu_init_data const exynos4210_default_tmu_data = { |
53 | .trigger_levels[0] = 5, | 53 | .tmu_data = { |
54 | .trigger_levels[1] = 20, | 54 | { |
55 | .trigger_levels[2] = 30, | 55 | .threshold = 80, |
56 | .trigger_enable[0] = true, | 56 | .trigger_levels[0] = 5, |
57 | .trigger_enable[1] = true, | 57 | .trigger_levels[1] = 20, |
58 | .trigger_enable[2] = true, | 58 | .trigger_levels[2] = 30, |
59 | .trigger_enable[3] = false, | 59 | .trigger_enable[0] = true, |
60 | .trigger_type[0] = THROTTLE_ACTIVE, | 60 | .trigger_enable[1] = true, |
61 | .trigger_type[1] = THROTTLE_ACTIVE, | 61 | .trigger_enable[2] = true, |
62 | .trigger_type[2] = SW_TRIP, | 62 | .trigger_enable[3] = false, |
63 | .max_trigger_level = 4, | 63 | .trigger_type[0] = THROTTLE_ACTIVE, |
64 | .gain = 15, | 64 | .trigger_type[1] = THROTTLE_ACTIVE, |
65 | .reference_voltage = 7, | 65 | .trigger_type[2] = SW_TRIP, |
66 | .cal_type = TYPE_ONE_POINT_TRIMMING, | 66 | .max_trigger_level = 4, |
67 | .min_efuse_value = 40, | 67 | .gain = 15, |
68 | .max_efuse_value = 100, | 68 | .reference_voltage = 7, |
69 | .first_point_trim = 25, | 69 | .cal_type = TYPE_ONE_POINT_TRIMMING, |
70 | .second_point_trim = 85, | 70 | .min_efuse_value = 40, |
71 | .default_temp_offset = 50, | 71 | .max_efuse_value = 100, |
72 | .freq_tab[0] = { | 72 | .first_point_trim = 25, |
73 | .freq_clip_max = 800 * 1000, | 73 | .second_point_trim = 85, |
74 | .temp_level = 85, | 74 | .default_temp_offset = 50, |
75 | }, | 75 | .freq_tab[0] = { |
76 | .freq_tab[1] = { | 76 | .freq_clip_max = 800 * 1000, |
77 | .freq_clip_max = 200 * 1000, | 77 | .temp_level = 85, |
78 | .temp_level = 100, | 78 | }, |
79 | .freq_tab[1] = { | ||
80 | .freq_clip_max = 200 * 1000, | ||
81 | .temp_level = 100, | ||
82 | }, | ||
83 | .freq_tab_count = 2, | ||
84 | .type = SOC_ARCH_EXYNOS4210, | ||
85 | .registers = &exynos4210_tmu_registers, | ||
86 | }, | ||
79 | }, | 87 | }, |
80 | .freq_tab_count = 2, | 88 | .tmu_count = 1, |
81 | .type = SOC_ARCH_EXYNOS4210, | ||
82 | .registers = &exynos4210_tmu_registers, | ||
83 | }; | 89 | }; |
84 | #endif | 90 | #endif |
85 | 91 | ||
@@ -120,41 +126,48 @@ static const struct exynos_tmu_registers exynos5250_tmu_registers = { | |||
120 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, | 126 | .emul_time_shift = EXYNOS_EMUL_TIME_SHIFT, |
121 | .emul_time_mask = EXYNOS_EMUL_TIME_MASK, | 127 | .emul_time_mask = EXYNOS_EMUL_TIME_MASK, |
122 | }; | 128 | }; |
123 | struct exynos_tmu_platform_data const exynos5250_default_tmu_data = { | 129 | |
124 | .threshold_falling = 10, | 130 | #define EXYNOS5250_TMU_DATA \ |
125 | .trigger_levels[0] = 85, | 131 | .threshold_falling = 10, \ |
126 | .trigger_levels[1] = 103, | 132 | .trigger_levels[0] = 85, \ |
127 | .trigger_levels[2] = 110, | 133 | .trigger_levels[1] = 103, \ |
128 | .trigger_levels[3] = 120, | 134 | .trigger_levels[2] = 110, \ |
129 | .trigger_enable[0] = true, | 135 | .trigger_levels[3] = 120, \ |
130 | .trigger_enable[1] = true, | 136 | .trigger_enable[0] = true, \ |
131 | .trigger_enable[2] = true, | 137 | .trigger_enable[1] = true, \ |
132 | .trigger_enable[3] = false, | 138 | .trigger_enable[2] = true, \ |
133 | .trigger_type[0] = THROTTLE_ACTIVE, | 139 | .trigger_enable[3] = false, \ |
134 | .trigger_type[1] = THROTTLE_ACTIVE, | 140 | .trigger_type[0] = THROTTLE_ACTIVE, \ |
135 | .trigger_type[2] = SW_TRIP, | 141 | .trigger_type[1] = THROTTLE_ACTIVE, \ |
136 | .trigger_type[3] = HW_TRIP, | 142 | .trigger_type[2] = SW_TRIP, \ |
137 | .max_trigger_level = 4, | 143 | .trigger_type[3] = HW_TRIP, \ |
138 | .gain = 8, | 144 | .max_trigger_level = 4, \ |
139 | .reference_voltage = 16, | 145 | .gain = 8, \ |
140 | .noise_cancel_mode = 4, | 146 | .reference_voltage = 16, \ |
141 | .cal_type = TYPE_ONE_POINT_TRIMMING, | 147 | .noise_cancel_mode = 4, \ |
142 | .efuse_value = 55, | 148 | .cal_type = TYPE_ONE_POINT_TRIMMING, \ |
143 | .min_efuse_value = 40, | 149 | .efuse_value = 55, \ |
144 | .max_efuse_value = 100, | 150 | .min_efuse_value = 40, \ |
145 | .first_point_trim = 25, | 151 | .max_efuse_value = 100, \ |
146 | .second_point_trim = 85, | 152 | .first_point_trim = 25, \ |
147 | .default_temp_offset = 50, | 153 | .second_point_trim = 85, \ |
148 | .freq_tab[0] = { | 154 | .default_temp_offset = 50, \ |
149 | .freq_clip_max = 800 * 1000, | 155 | .freq_tab[0] = { \ |
150 | .temp_level = 85, | 156 | .freq_clip_max = 800 * 1000, \ |
151 | }, | 157 | .temp_level = 85, \ |
152 | .freq_tab[1] = { | 158 | }, \ |
153 | .freq_clip_max = 200 * 1000, | 159 | .freq_tab[1] = { \ |
154 | .temp_level = 103, | 160 | .freq_clip_max = 200 * 1000, \ |
155 | }, | 161 | .temp_level = 103, \ |
156 | .freq_tab_count = 2, | 162 | }, \ |
157 | .type = SOC_ARCH_EXYNOS, | 163 | .freq_tab_count = 2, \ |
164 | .type = SOC_ARCH_EXYNOS, \ | ||
158 | .registers = &exynos5250_tmu_registers, | 165 | .registers = &exynos5250_tmu_registers, |
166 | |||
167 | struct exynos_tmu_init_data const exynos5250_default_tmu_data = { | ||
168 | .tmu_data = { | ||
169 | { EXYNOS5250_TMU_DATA }, | ||
170 | }, | ||
171 | .tmu_count = 1, | ||
159 | }; | 172 | }; |
160 | #endif | 173 | #endif |
diff --git a/drivers/thermal/samsung/exynos_tmu_data.h b/drivers/thermal/samsung/exynos_tmu_data.h index 4acf070c4817..139dbbb1e264 100644 --- a/drivers/thermal/samsung/exynos_tmu_data.h +++ b/drivers/thermal/samsung/exynos_tmu_data.h | |||
@@ -94,14 +94,14 @@ | |||
94 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 | 94 | #define EXYNOS_MAX_TRIGGER_PER_REG 4 |
95 | 95 | ||
96 | #if defined(CONFIG_CPU_EXYNOS4210) | 96 | #if defined(CONFIG_CPU_EXYNOS4210) |
97 | extern struct exynos_tmu_platform_data const exynos4210_default_tmu_data; | 97 | extern struct exynos_tmu_init_data const exynos4210_default_tmu_data; |
98 | #define EXYNOS4210_TMU_DRV_DATA (&exynos4210_default_tmu_data) | 98 | #define EXYNOS4210_TMU_DRV_DATA (&exynos4210_default_tmu_data) |
99 | #else | 99 | #else |
100 | #define EXYNOS4210_TMU_DRV_DATA (NULL) | 100 | #define EXYNOS4210_TMU_DRV_DATA (NULL) |
101 | #endif | 101 | #endif |
102 | 102 | ||
103 | #if (defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)) | 103 | #if (defined(CONFIG_SOC_EXYNOS5250) || defined(CONFIG_SOC_EXYNOS4412)) |
104 | extern struct exynos_tmu_platform_data const exynos5250_default_tmu_data; | 104 | extern struct exynos_tmu_init_data const exynos5250_default_tmu_data; |
105 | #define EXYNOS5250_TMU_DRV_DATA (&exynos5250_default_tmu_data) | 105 | #define EXYNOS5250_TMU_DRV_DATA (&exynos5250_default_tmu_data) |
106 | #else | 106 | #else |
107 | #define EXYNOS5250_TMU_DRV_DATA (NULL) | 107 | #define EXYNOS5250_TMU_DRV_DATA (NULL) |