exynos_tmu.c (a3b3dd381a0806cf19dab07a16f066e64d70a32d) exynos_tmu.c (03ef4855a825f9ba7195454f6498e0f056be995a)
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * exynos_tmu.c - Samsung Exynos TMU (Thermal Management Unit)
4 *
5 * Copyright (C) 2014 Samsung Electronics
6 * Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 * Lukasz Majewski <l.majewski@samsung.com>
8 *

--- 540 unchanged lines hidden (view full) ---

549 trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
550 sanitize_temp_error(data, trim_info);
551}
552
553static void exynos4210_tmu_control(struct platform_device *pdev, bool on)
554{
555 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
556 struct thermal_zone_device *tz = data->tzd;
1// SPDX-License-Identifier: GPL-2.0-or-later
2/*
3 * exynos_tmu.c - Samsung Exynos TMU (Thermal Management Unit)
4 *
5 * Copyright (C) 2014 Samsung Electronics
6 * Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
7 * Lukasz Majewski <l.majewski@samsung.com>
8 *

--- 540 unchanged lines hidden (view full) ---

549 trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO);
550 sanitize_temp_error(data, trim_info);
551}
552
553static void exynos4210_tmu_control(struct platform_device *pdev, bool on)
554{
555 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
556 struct thermal_zone_device *tz = data->tzd;
557 struct thermal_trip trip;
557 unsigned int con, interrupt_en = 0, i;
558
559 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
560
561 if (on) {
562 for (i = 0; i < data->ntrip; i++) {
558 unsigned int con, interrupt_en = 0, i;
559
560 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
561
562 if (on) {
563 for (i = 0; i < data->ntrip; i++) {
563 if (!of_thermal_is_trip_valid(tz, i))
564 if (thermal_zone_get_trip(tz, i, &trip))
564 continue;
565
566 interrupt_en |=
567 (1 << (EXYNOS_TMU_INTEN_RISE0_SHIFT + i * 4));
568 }
569
570 if (data->soc != SOC_ARCH_EXYNOS4210)
571 interrupt_en |=

--- 7 unchanged lines hidden (view full) ---

579 writel(interrupt_en, data->base + EXYNOS_TMU_REG_INTEN);
580 writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
581}
582
583static void exynos5433_tmu_control(struct platform_device *pdev, bool on)
584{
585 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
586 struct thermal_zone_device *tz = data->tzd;
565 continue;
566
567 interrupt_en |=
568 (1 << (EXYNOS_TMU_INTEN_RISE0_SHIFT + i * 4));
569 }
570
571 if (data->soc != SOC_ARCH_EXYNOS4210)
572 interrupt_en |=

--- 7 unchanged lines hidden (view full) ---

580 writel(interrupt_en, data->base + EXYNOS_TMU_REG_INTEN);
581 writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
582}
583
584static void exynos5433_tmu_control(struct platform_device *pdev, bool on)
585{
586 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
587 struct thermal_zone_device *tz = data->tzd;
588 struct thermal_trip trip;
587 unsigned int con, interrupt_en = 0, pd_det_en, i;
588
589 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
590
591 if (on) {
592 for (i = 0; i < data->ntrip; i++) {
589 unsigned int con, interrupt_en = 0, pd_det_en, i;
590
591 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
592
593 if (on) {
594 for (i = 0; i < data->ntrip; i++) {
593 if (!of_thermal_is_trip_valid(tz, i))
595 if (thermal_zone_get_trip(tz, i, &trip))
594 continue;
595
596 interrupt_en |=
597 (1 << (EXYNOS7_TMU_INTEN_RISE0_SHIFT + i));
598 }
599
600 interrupt_en |=
601 interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;

--- 8 unchanged lines hidden (view full) ---

610 writel(interrupt_en, data->base + EXYNOS5433_TMU_REG_INTEN);
611 writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
612}
613
614static void exynos7_tmu_control(struct platform_device *pdev, bool on)
615{
616 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
617 struct thermal_zone_device *tz = data->tzd;
596 continue;
597
598 interrupt_en |=
599 (1 << (EXYNOS7_TMU_INTEN_RISE0_SHIFT + i));
600 }
601
602 interrupt_en |=
603 interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;

--- 8 unchanged lines hidden (view full) ---

612 writel(interrupt_en, data->base + EXYNOS5433_TMU_REG_INTEN);
613 writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
614}
615
616static void exynos7_tmu_control(struct platform_device *pdev, bool on)
617{
618 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
619 struct thermal_zone_device *tz = data->tzd;
620 struct thermal_trip trip;
618 unsigned int con, interrupt_en = 0, i;
619
620 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
621
622 if (on) {
623 for (i = 0; i < data->ntrip; i++) {
621 unsigned int con, interrupt_en = 0, i;
622
623 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
624
625 if (on) {
626 for (i = 0; i < data->ntrip; i++) {
624 if (!of_thermal_is_trip_valid(tz, i))
627 if (thermal_zone_get_trip(tz, i, &trip))
625 continue;
626
627 interrupt_en |=
628 (1 << (EXYNOS7_TMU_INTEN_RISE0_SHIFT + i));
629 }
630
631 interrupt_en |=
632 interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;

--- 551 unchanged lines hidden ---
628 continue;
629
630 interrupt_en |=
631 (1 << (EXYNOS7_TMU_INTEN_RISE0_SHIFT + i));
632 }
633
634 interrupt_en |=
635 interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;

--- 551 unchanged lines hidden ---