exynos_tmu.c (5838d18955b52467f4b30486e62a31727b39998d) exynos_tmu.c (42b696e808bbea3a4ebf8029e1965d2314612402)
1/*
2 * exynos_tmu.c - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2014 Samsung Electronics
5 * Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
6 * Lukasz Majewski <l.majewski@samsung.com>
7 *
8 * Copyright (C) 2011 Samsung Electronics

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

677 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
678 struct thermal_zone_device *tz = data->tzd;
679 unsigned int con, interrupt_en;
680
681 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
682
683 if (on) {
684 con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
1/*
2 * exynos_tmu.c - Samsung EXYNOS TMU (Thermal Management Unit)
3 *
4 * Copyright (C) 2014 Samsung Electronics
5 * Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
6 * Lukasz Majewski <l.majewski@samsung.com>
7 *
8 * Copyright (C) 2011 Samsung Electronics

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

677 struct exynos_tmu_data *data = platform_get_drvdata(pdev);
678 struct thermal_zone_device *tz = data->tzd;
679 unsigned int con, interrupt_en;
680
681 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL));
682
683 if (on) {
684 con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
685 con |= (1 << EXYNOS7_PD_DET_EN_SHIFT);
685 interrupt_en =
686 (of_thermal_is_trip_valid(tz, 7)
687 << EXYNOS7_TMU_INTEN_RISE7_SHIFT) |
688 (of_thermal_is_trip_valid(tz, 6)
689 << EXYNOS7_TMU_INTEN_RISE6_SHIFT) |
690 (of_thermal_is_trip_valid(tz, 5)
691 << EXYNOS7_TMU_INTEN_RISE5_SHIFT) |
692 (of_thermal_is_trip_valid(tz, 4)

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

699 << EXYNOS7_TMU_INTEN_RISE1_SHIFT) |
700 (of_thermal_is_trip_valid(tz, 0)
701 << EXYNOS7_TMU_INTEN_RISE0_SHIFT);
702
703 interrupt_en |=
704 interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;
705 } else {
706 con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
686 interrupt_en =
687 (of_thermal_is_trip_valid(tz, 7)
688 << EXYNOS7_TMU_INTEN_RISE7_SHIFT) |
689 (of_thermal_is_trip_valid(tz, 6)
690 << EXYNOS7_TMU_INTEN_RISE6_SHIFT) |
691 (of_thermal_is_trip_valid(tz, 5)
692 << EXYNOS7_TMU_INTEN_RISE5_SHIFT) |
693 (of_thermal_is_trip_valid(tz, 4)

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

700 << EXYNOS7_TMU_INTEN_RISE1_SHIFT) |
701 (of_thermal_is_trip_valid(tz, 0)
702 << EXYNOS7_TMU_INTEN_RISE0_SHIFT);
703
704 interrupt_en |=
705 interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;
706 } else {
707 con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
708 con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT);
707 interrupt_en = 0; /* Disable all interrupts */
708 }
709 interrupt_en = 0; /* Disable all interrupts */
710 }
709 con |= 1 << EXYNOS7_PD_DET_EN_SHIFT;
710
711 writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN);
712 writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
713}
714
715static int exynos_get_temp(void *p, long *temp)
716{
717 struct exynos_tmu_data *data = p;

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

913
914 disable_irq_nosync(irq);
915 schedule_work(&data->irq_work);
916
917 return IRQ_HANDLED;
918}
919
920static const struct of_device_id exynos_tmu_match[] = {
711
712 writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN);
713 writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
714}
715
716static int exynos_get_temp(void *p, long *temp)
717{
718 struct exynos_tmu_data *data = p;

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

914
915 disable_irq_nosync(irq);
916 schedule_work(&data->irq_work);
917
918 return IRQ_HANDLED;
919}
920
921static const struct of_device_id exynos_tmu_match[] = {
921 {
922 .compatible = "samsung,exynos3250-tmu",
923 },
924 {
925 .compatible = "samsung,exynos4210-tmu",
926 },
927 {
928 .compatible = "samsung,exynos4412-tmu",
929 },
930 {
931 .compatible = "samsung,exynos5250-tmu",
932 },
933 {
934 .compatible = "samsung,exynos5260-tmu",
935 },
936 {
937 .compatible = "samsung,exynos5420-tmu",
938 },
939 {
940 .compatible = "samsung,exynos5420-tmu-ext-triminfo",
941 },
942 {
943 .compatible = "samsung,exynos5440-tmu",
944 },
945 {
946 .compatible = "samsung,exynos7-tmu",
947 },
948 {},
922 { .compatible = "samsung,exynos3250-tmu", },
923 { .compatible = "samsung,exynos4210-tmu", },
924 { .compatible = "samsung,exynos4412-tmu", },
925 { .compatible = "samsung,exynos5250-tmu", },
926 { .compatible = "samsung,exynos5260-tmu", },
927 { .compatible = "samsung,exynos5420-tmu", },
928 { .compatible = "samsung,exynos5420-tmu-ext-triminfo", },
929 { .compatible = "samsung,exynos5440-tmu", },
930 { .compatible = "samsung,exynos7-tmu", },
931 { /* sentinel */ },
949};
950MODULE_DEVICE_TABLE(of, exynos_tmu_match);
951
952static int exynos_of_get_soc_type(struct device_node *np)
953{
954 if (of_device_is_compatible(np, "samsung,exynos3250-tmu"))
955 return SOC_ARCH_EXYNOS3250;
956 else if (of_device_is_compatible(np, "samsung,exynos4210-tmu"))

--- 337 unchanged lines hidden ---
932};
933MODULE_DEVICE_TABLE(of, exynos_tmu_match);
934
935static int exynos_of_get_soc_type(struct device_node *np)
936{
937 if (of_device_is_compatible(np, "samsung,exynos3250-tmu"))
938 return SOC_ARCH_EXYNOS3250;
939 else if (of_device_is_compatible(np, "samsung,exynos4210-tmu"))

--- 337 unchanged lines hidden ---