Lines Matching +full:exynos5260 +full:- +full:clk

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * exynos_tmu.c - Samsung Exynos TMU (Thermal Management Unit)
14 #include <linux/clk.h>
25 #include <dt-bindings/thermal/thermal_exynos.h>
73 /* Exynos5260 specific */
148 * @clk: pointer to the clock structure.
150 * @sclk: pointer to the clock structure for accessing the tmu special clk.
157 * @gain: gain of amplifier in the positive-TC generator block
160 * in the positive-TC generator block
183 struct clk *clk, *clk_sec, *sclk; member
213 if (data->cal_type == TYPE_ONE_POINT_TRIMMING) in temp_to_code()
214 return temp + data->temp_error1 - EXYNOS_FIRST_POINT_TRIM; in temp_to_code()
216 return (temp - EXYNOS_FIRST_POINT_TRIM) * in temp_to_code()
217 (data->temp_error2 - data->temp_error1) / in temp_to_code()
218 (EXYNOS_SECOND_POINT_TRIM - EXYNOS_FIRST_POINT_TRIM) + in temp_to_code()
219 data->temp_error1; in temp_to_code()
228 if (data->cal_type == TYPE_ONE_POINT_TRIMMING) in code_to_temp()
229 return temp_code - data->temp_error1 + EXYNOS_FIRST_POINT_TRIM; in code_to_temp()
231 return (temp_code - data->temp_error1) * in code_to_temp()
232 (EXYNOS_SECOND_POINT_TRIM - EXYNOS_FIRST_POINT_TRIM) / in code_to_temp()
233 (data->temp_error2 - data->temp_error1) + in code_to_temp()
240 (data->soc == SOC_ARCH_EXYNOS7) ? EXYNOS7_TMU_TEMP_MASK in sanitize_temp_error()
243 data->temp_error1 = trim_info & tmu_temp_mask; in sanitize_temp_error()
244 data->temp_error2 = ((trim_info >> EXYNOS_TRIMINFO_85_SHIFT) & in sanitize_temp_error()
247 if (!data->temp_error1 || in sanitize_temp_error()
248 (data->min_efuse_value > data->temp_error1) || in sanitize_temp_error()
249 (data->temp_error1 > data->max_efuse_value)) in sanitize_temp_error()
250 data->temp_error1 = data->efuse_value & EXYNOS_TMU_TEMP_MASK; in sanitize_temp_error()
252 if (!data->temp_error2) in sanitize_temp_error()
253 data->temp_error2 = in sanitize_temp_error()
254 (data->efuse_value >> EXYNOS_TRIMINFO_85_SHIFT) & in sanitize_temp_error()
261 struct thermal_zone_device *tzd = data->tzd; in exynos_tmu_initialize()
267 if (ret && data->soc != SOC_ARCH_EXYNOS5433) { /* FIXME */ in exynos_tmu_initialize()
268 dev_err(&pdev->dev, in exynos_tmu_initialize()
273 if (num_trips > data->ntrip) { in exynos_tmu_initialize()
274 dev_info(&pdev->dev, in exynos_tmu_initialize()
276 dev_info(&pdev->dev, in exynos_tmu_initialize()
278 num_trips - data->ntrip); in exynos_tmu_initialize()
281 mutex_lock(&data->lock); in exynos_tmu_initialize()
282 clk_enable(data->clk); in exynos_tmu_initialize()
283 if (!IS_ERR(data->clk_sec)) in exynos_tmu_initialize()
284 clk_enable(data->clk_sec); in exynos_tmu_initialize()
286 status = readb(data->base + EXYNOS_TMU_REG_STATUS); in exynos_tmu_initialize()
288 ret = -EBUSY; in exynos_tmu_initialize()
291 min_t(int, num_trips, data->ntrip); in exynos_tmu_initialize()
293 data->tmu_initialize(pdev); in exynos_tmu_initialize()
304 data->tmu_set_trip_temp(data, i, trip.temperature / MCELSIUS); in exynos_tmu_initialize()
305 data->tmu_set_trip_hyst(data, i, trip.temperature / MCELSIUS, in exynos_tmu_initialize()
309 data->tmu_clear_irqs(data); in exynos_tmu_initialize()
312 clk_disable(data->clk); in exynos_tmu_initialize()
313 mutex_unlock(&data->lock); in exynos_tmu_initialize()
314 if (!IS_ERR(data->clk_sec)) in exynos_tmu_initialize()
315 clk_disable(data->clk_sec); in exynos_tmu_initialize()
322 if (data->soc == SOC_ARCH_EXYNOS4412 || in get_con_reg()
323 data->soc == SOC_ARCH_EXYNOS3250) in get_con_reg()
327 con |= data->reference_voltage << EXYNOS_TMU_REF_VOLTAGE_SHIFT; in get_con_reg()
330 con |= (data->gain << EXYNOS_TMU_BUF_SLOPE_SEL_SHIFT); in get_con_reg()
342 mutex_lock(&data->lock); in exynos_tmu_control()
343 clk_enable(data->clk); in exynos_tmu_control()
344 data->tmu_control(pdev, on); in exynos_tmu_control()
345 data->enabled = on; in exynos_tmu_control()
346 clk_disable(data->clk); in exynos_tmu_control()
347 mutex_unlock(&data->lock); in exynos_tmu_control()
356 if (thermal_zone_get_trip(data->tzd, 0, &trip)) in exynos4210_tmu_set_trip_temp()
363 writeb(th_code, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP); in exynos4210_tmu_set_trip_temp()
366 temp -= ref; in exynos4210_tmu_set_trip_temp()
367 writeb(temp, data->base + EXYNOS4210_TMU_REG_TRIG_LEVEL0 + trip_id * 4); in exynos4210_tmu_set_trip_temp()
380 sanitize_temp_error(data, readl(data->base + EXYNOS_TMU_REG_TRIMINFO)); in exynos4210_tmu_initialize()
388 th = readl(data->base + EXYNOS_THD_TEMP_RISE); in exynos4412_tmu_set_trip_temp()
391 writel(th, data->base + EXYNOS_THD_TEMP_RISE); in exynos4412_tmu_set_trip_temp()
394 con = readl(data->base + EXYNOS_TMU_REG_CONTROL); in exynos4412_tmu_set_trip_temp()
396 writel(con, data->base + EXYNOS_TMU_REG_CONTROL); in exynos4412_tmu_set_trip_temp()
405 th = readl(data->base + EXYNOS_THD_TEMP_FALL); in exynos4412_tmu_set_trip_hyst()
408 th |= temp_to_code(data, temp - hyst) << 8 * trip; in exynos4412_tmu_set_trip_hyst()
409 writel(th, data->base + EXYNOS_THD_TEMP_FALL); in exynos4412_tmu_set_trip_hyst()
417 if (data->soc == SOC_ARCH_EXYNOS3250 || in exynos4412_tmu_initialize()
418 data->soc == SOC_ARCH_EXYNOS4412 || in exynos4412_tmu_initialize()
419 data->soc == SOC_ARCH_EXYNOS5250) { in exynos4412_tmu_initialize()
420 if (data->soc == SOC_ARCH_EXYNOS3250) { in exynos4412_tmu_initialize()
421 ctrl = readl(data->base + EXYNOS_TMU_TRIMINFO_CON1); in exynos4412_tmu_initialize()
423 writel(ctrl, data->base + EXYNOS_TMU_TRIMINFO_CON1); in exynos4412_tmu_initialize()
425 ctrl = readl(data->base + EXYNOS_TMU_TRIMINFO_CON2); in exynos4412_tmu_initialize()
427 writel(ctrl, data->base + EXYNOS_TMU_TRIMINFO_CON2); in exynos4412_tmu_initialize()
431 if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) in exynos4412_tmu_initialize()
432 trim_info = readl(data->base_second + EXYNOS_TMU_REG_TRIMINFO); in exynos4412_tmu_initialize()
434 trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO); in exynos4412_tmu_initialize()
447 j = trip - 4; in exynos5433_tmu_set_trip_temp()
453 th = readl(data->base + reg_off); in exynos5433_tmu_set_trip_temp()
456 writel(th, data->base + reg_off); in exynos5433_tmu_set_trip_temp()
467 j = trip - 4; in exynos5433_tmu_set_trip_hyst()
473 th = readl(data->base + reg_off); in exynos5433_tmu_set_trip_hyst()
475 th |= (temp_to_code(data, temp - hyst) << j * 8); in exynos5433_tmu_set_trip_hyst()
476 writel(th, data->base + reg_off); in exynos5433_tmu_set_trip_hyst()
485 trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO); in exynos5433_tmu_initialize()
491 dev_info(&pdev->dev, "Temperature sensor ID: 0x%x\n", sensor_id); in exynos5433_tmu_initialize()
494 writel(trim_info, data->base + EXYNOS_TMU_REG_TRIMINFO); in exynos5433_tmu_initialize()
500 data->cal_type = TYPE_TWO_POINT_TRIMMING; in exynos5433_tmu_initialize()
504 data->cal_type = TYPE_ONE_POINT_TRIMMING; in exynos5433_tmu_initialize()
508 dev_info(&pdev->dev, "Calibration type is %d-point calibration\n", in exynos5433_tmu_initialize()
518 reg_off = ((7 - trip) / 2) * 4; in exynos7_tmu_set_trip_temp()
519 bit_off = ((8 - trip) % 2); in exynos7_tmu_set_trip_temp()
521 th = readl(data->base + EXYNOS7_THD_TEMP_RISE7_6 + reg_off); in exynos7_tmu_set_trip_temp()
524 writel(th, data->base + EXYNOS7_THD_TEMP_RISE7_6 + reg_off); in exynos7_tmu_set_trip_temp()
533 reg_off = ((7 - trip) / 2) * 4; in exynos7_tmu_set_trip_hyst()
534 bit_off = ((8 - trip) % 2); in exynos7_tmu_set_trip_hyst()
536 th = readl(data->base + EXYNOS7_THD_TEMP_FALL7_6 + reg_off); in exynos7_tmu_set_trip_hyst()
538 th |= temp_to_code(data, temp - hyst) << (16 * bit_off); in exynos7_tmu_set_trip_hyst()
539 writel(th, data->base + EXYNOS7_THD_TEMP_FALL7_6 + reg_off); in exynos7_tmu_set_trip_hyst()
547 trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO); in exynos7_tmu_initialize()
554 struct thermal_zone_device *tz = data->tzd; in exynos4210_tmu_control()
558 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL)); in exynos4210_tmu_control()
561 for (i = 0; i < data->ntrip; i++) { in exynos4210_tmu_control()
569 if (data->soc != SOC_ARCH_EXYNOS4210) in exynos4210_tmu_control()
578 writel(interrupt_en, data->base + EXYNOS_TMU_REG_INTEN); in exynos4210_tmu_control()
579 writel(con, data->base + EXYNOS_TMU_REG_CONTROL); in exynos4210_tmu_control()
585 struct thermal_zone_device *tz = data->tzd; in exynos5433_tmu_control()
589 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL)); in exynos5433_tmu_control()
592 for (i = 0; i < data->ntrip; i++) { in exynos5433_tmu_control()
609 writel(pd_det_en, data->base + EXYNOS5433_TMU_PD_DET_EN); in exynos5433_tmu_control()
610 writel(interrupt_en, data->base + EXYNOS5433_TMU_REG_INTEN); in exynos5433_tmu_control()
611 writel(con, data->base + EXYNOS_TMU_REG_CONTROL); in exynos5433_tmu_control()
617 struct thermal_zone_device *tz = data->tzd; in exynos7_tmu_control()
621 con = get_con_reg(data, readl(data->base + EXYNOS_TMU_REG_CONTROL)); in exynos7_tmu_control()
624 for (i = 0; i < data->ntrip; i++) { in exynos7_tmu_control()
642 writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN); in exynos7_tmu_control()
643 writel(con, data->base + EXYNOS_TMU_REG_CONTROL); in exynos7_tmu_control()
651 if (!data || !data->tmu_read) in exynos_get_temp()
652 return -EINVAL; in exynos_get_temp()
653 else if (!data->enabled) in exynos_get_temp()
658 return -EAGAIN; in exynos_get_temp()
660 mutex_lock(&data->lock); in exynos_get_temp()
661 clk_enable(data->clk); in exynos_get_temp()
663 value = data->tmu_read(data); in exynos_get_temp()
669 clk_disable(data->clk); in exynos_get_temp()
670 mutex_unlock(&data->lock); in exynos_get_temp()
684 if (data->soc == SOC_ARCH_EXYNOS7) { in get_emul_con_reg()
710 if (data->soc == SOC_ARCH_EXYNOS5260) in exynos4412_tmu_set_emulation()
712 else if (data->soc == SOC_ARCH_EXYNOS5433) in exynos4412_tmu_set_emulation()
714 else if (data->soc == SOC_ARCH_EXYNOS7) in exynos4412_tmu_set_emulation()
719 val = readl(data->base + emul_con); in exynos4412_tmu_set_emulation()
721 writel(val, data->base + emul_con); in exynos4412_tmu_set_emulation()
727 int ret = -EINVAL; in exynos_tmu_set_emulation()
729 if (data->soc == SOC_ARCH_EXYNOS4210) in exynos_tmu_set_emulation()
735 mutex_lock(&data->lock); in exynos_tmu_set_emulation()
736 clk_enable(data->clk); in exynos_tmu_set_emulation()
737 data->tmu_set_emulation(data, temp); in exynos_tmu_set_emulation()
738 clk_disable(data->clk); in exynos_tmu_set_emulation()
739 mutex_unlock(&data->lock); in exynos_tmu_set_emulation()
747 { return -EINVAL; } in exynos_tmu_set_emulation()
752 int ret = readb(data->base + EXYNOS_TMU_REG_CURRENT_TEMP); in exynos4210_tmu_read()
755 return (ret < 75 || ret > 175) ? -ENODATA : ret; in exynos4210_tmu_read()
760 return readb(data->base + EXYNOS_TMU_REG_CURRENT_TEMP); in exynos4412_tmu_read()
765 return readw(data->base + EXYNOS_TMU_REG_CURRENT_TEMP) & in exynos7_tmu_read()
774 thermal_zone_device_update(data->tzd, THERMAL_EVENT_UNSPECIFIED); in exynos_tmu_work()
776 mutex_lock(&data->lock); in exynos_tmu_work()
777 clk_enable(data->clk); in exynos_tmu_work()
780 data->tmu_clear_irqs(data); in exynos_tmu_work()
782 clk_disable(data->clk); in exynos_tmu_work()
783 mutex_unlock(&data->lock); in exynos_tmu_work()
784 enable_irq(data->irq); in exynos_tmu_work()
792 if (data->soc == SOC_ARCH_EXYNOS5260) { in exynos4210_tmu_clear_irqs()
795 } else if (data->soc == SOC_ARCH_EXYNOS7) { in exynos4210_tmu_clear_irqs()
798 } else if (data->soc == SOC_ARCH_EXYNOS5433) { in exynos4210_tmu_clear_irqs()
806 val_irq = readl(data->base + tmu_intstat); in exynos4210_tmu_clear_irqs()
809 * Exynos3250, Exynos4412, Exynos5250 and Exynos5260 incorrectly in exynos4210_tmu_clear_irqs()
815 writel(val_irq, data->base + tmu_intclear); in exynos4210_tmu_clear_irqs()
823 schedule_work(&data->irq_work); in exynos_tmu_irq()
830 .compatible = "samsung,exynos3250-tmu",
833 .compatible = "samsung,exynos4210-tmu",
836 .compatible = "samsung,exynos4412-tmu",
839 .compatible = "samsung,exynos5250-tmu",
842 .compatible = "samsung,exynos5260-tmu",
845 .compatible = "samsung,exynos5420-tmu",
848 .compatible = "samsung,exynos5420-tmu-ext-triminfo",
851 .compatible = "samsung,exynos5433-tmu",
854 .compatible = "samsung,exynos7-tmu",
866 if (!data || !pdev->dev.of_node) in exynos_map_dt_data()
867 return -ENODEV; in exynos_map_dt_data()
869 data->id = of_alias_get_id(pdev->dev.of_node, "tmuctrl"); in exynos_map_dt_data()
870 if (data->id < 0) in exynos_map_dt_data()
871 data->id = 0; in exynos_map_dt_data()
873 data->irq = irq_of_parse_and_map(pdev->dev.of_node, 0); in exynos_map_dt_data()
874 if (data->irq <= 0) { in exynos_map_dt_data()
875 dev_err(&pdev->dev, "failed to get IRQ\n"); in exynos_map_dt_data()
876 return -ENODEV; in exynos_map_dt_data()
879 if (of_address_to_resource(pdev->dev.of_node, 0, &res)) { in exynos_map_dt_data()
880 dev_err(&pdev->dev, "failed to get Resource 0\n"); in exynos_map_dt_data()
881 return -ENODEV; in exynos_map_dt_data()
884 data->base = devm_ioremap(&pdev->dev, res.start, resource_size(&res)); in exynos_map_dt_data()
885 if (!data->base) { in exynos_map_dt_data()
886 dev_err(&pdev->dev, "Failed to ioremap memory\n"); in exynos_map_dt_data()
887 return -EADDRNOTAVAIL; in exynos_map_dt_data()
890 data->soc = (uintptr_t)of_device_get_match_data(&pdev->dev); in exynos_map_dt_data()
892 switch (data->soc) { in exynos_map_dt_data()
894 data->tmu_set_trip_temp = exynos4210_tmu_set_trip_temp; in exynos_map_dt_data()
895 data->tmu_set_trip_hyst = exynos4210_tmu_set_trip_hyst; in exynos_map_dt_data()
896 data->tmu_initialize = exynos4210_tmu_initialize; in exynos_map_dt_data()
897 data->tmu_control = exynos4210_tmu_control; in exynos_map_dt_data()
898 data->tmu_read = exynos4210_tmu_read; in exynos_map_dt_data()
899 data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; in exynos_map_dt_data()
900 data->ntrip = 4; in exynos_map_dt_data()
901 data->gain = 15; in exynos_map_dt_data()
902 data->reference_voltage = 7; in exynos_map_dt_data()
903 data->efuse_value = 55; in exynos_map_dt_data()
904 data->min_efuse_value = 40; in exynos_map_dt_data()
905 data->max_efuse_value = 100; in exynos_map_dt_data()
913 data->tmu_set_trip_temp = exynos4412_tmu_set_trip_temp; in exynos_map_dt_data()
914 data->tmu_set_trip_hyst = exynos4412_tmu_set_trip_hyst; in exynos_map_dt_data()
915 data->tmu_initialize = exynos4412_tmu_initialize; in exynos_map_dt_data()
916 data->tmu_control = exynos4210_tmu_control; in exynos_map_dt_data()
917 data->tmu_read = exynos4412_tmu_read; in exynos_map_dt_data()
918 data->tmu_set_emulation = exynos4412_tmu_set_emulation; in exynos_map_dt_data()
919 data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; in exynos_map_dt_data()
920 data->ntrip = 4; in exynos_map_dt_data()
921 data->gain = 8; in exynos_map_dt_data()
922 data->reference_voltage = 16; in exynos_map_dt_data()
923 data->efuse_value = 55; in exynos_map_dt_data()
924 if (data->soc != SOC_ARCH_EXYNOS5420 && in exynos_map_dt_data()
925 data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO) in exynos_map_dt_data()
926 data->min_efuse_value = 40; in exynos_map_dt_data()
928 data->min_efuse_value = 0; in exynos_map_dt_data()
929 data->max_efuse_value = 100; in exynos_map_dt_data()
932 data->tmu_set_trip_temp = exynos5433_tmu_set_trip_temp; in exynos_map_dt_data()
933 data->tmu_set_trip_hyst = exynos5433_tmu_set_trip_hyst; in exynos_map_dt_data()
934 data->tmu_initialize = exynos5433_tmu_initialize; in exynos_map_dt_data()
935 data->tmu_control = exynos5433_tmu_control; in exynos_map_dt_data()
936 data->tmu_read = exynos4412_tmu_read; in exynos_map_dt_data()
937 data->tmu_set_emulation = exynos4412_tmu_set_emulation; in exynos_map_dt_data()
938 data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; in exynos_map_dt_data()
939 data->ntrip = 8; in exynos_map_dt_data()
940 data->gain = 8; in exynos_map_dt_data()
942 data->reference_voltage = 23; in exynos_map_dt_data()
944 data->reference_voltage = 16; in exynos_map_dt_data()
945 data->efuse_value = 75; in exynos_map_dt_data()
946 data->min_efuse_value = 40; in exynos_map_dt_data()
947 data->max_efuse_value = 150; in exynos_map_dt_data()
950 data->tmu_set_trip_temp = exynos7_tmu_set_trip_temp; in exynos_map_dt_data()
951 data->tmu_set_trip_hyst = exynos7_tmu_set_trip_hyst; in exynos_map_dt_data()
952 data->tmu_initialize = exynos7_tmu_initialize; in exynos_map_dt_data()
953 data->tmu_control = exynos7_tmu_control; in exynos_map_dt_data()
954 data->tmu_read = exynos7_tmu_read; in exynos_map_dt_data()
955 data->tmu_set_emulation = exynos4412_tmu_set_emulation; in exynos_map_dt_data()
956 data->tmu_clear_irqs = exynos4210_tmu_clear_irqs; in exynos_map_dt_data()
957 data->ntrip = 8; in exynos_map_dt_data()
958 data->gain = 9; in exynos_map_dt_data()
959 data->reference_voltage = 17; in exynos_map_dt_data()
960 data->efuse_value = 75; in exynos_map_dt_data()
961 data->min_efuse_value = 15; in exynos_map_dt_data()
962 data->max_efuse_value = 100; in exynos_map_dt_data()
965 dev_err(&pdev->dev, "Platform not supported\n"); in exynos_map_dt_data()
966 return -EINVAL; in exynos_map_dt_data()
969 data->cal_type = TYPE_ONE_POINT_TRIMMING; in exynos_map_dt_data()
975 if (data->soc != SOC_ARCH_EXYNOS5420_TRIMINFO) in exynos_map_dt_data()
978 if (of_address_to_resource(pdev->dev.of_node, 1, &res)) { in exynos_map_dt_data()
979 dev_err(&pdev->dev, "failed to get Resource 1\n"); in exynos_map_dt_data()
980 return -ENODEV; in exynos_map_dt_data()
983 data->base_second = devm_ioremap(&pdev->dev, res.start, in exynos_map_dt_data()
985 if (!data->base_second) { in exynos_map_dt_data()
986 dev_err(&pdev->dev, "Failed to ioremap memory\n"); in exynos_map_dt_data()
987 return -ENOMEM; in exynos_map_dt_data()
1003 data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data), in exynos_tmu_probe()
1006 return -ENOMEM; in exynos_tmu_probe()
1009 mutex_init(&data->lock); in exynos_tmu_probe()
1016 data->regulator = devm_regulator_get_optional(&pdev->dev, "vtmu"); in exynos_tmu_probe()
1017 if (!IS_ERR(data->regulator)) { in exynos_tmu_probe()
1018 ret = regulator_enable(data->regulator); in exynos_tmu_probe()
1020 dev_err(&pdev->dev, "failed to enable vtmu\n"); in exynos_tmu_probe()
1024 if (PTR_ERR(data->regulator) == -EPROBE_DEFER) in exynos_tmu_probe()
1025 return -EPROBE_DEFER; in exynos_tmu_probe()
1026 dev_info(&pdev->dev, "Regulator node (vtmu) not found\n"); in exynos_tmu_probe()
1033 INIT_WORK(&data->irq_work, exynos_tmu_work); in exynos_tmu_probe()
1035 data->clk = devm_clk_get(&pdev->dev, "tmu_apbif"); in exynos_tmu_probe()
1036 if (IS_ERR(data->clk)) { in exynos_tmu_probe()
1037 dev_err(&pdev->dev, "Failed to get clock\n"); in exynos_tmu_probe()
1038 ret = PTR_ERR(data->clk); in exynos_tmu_probe()
1042 data->clk_sec = devm_clk_get(&pdev->dev, "tmu_triminfo_apbif"); in exynos_tmu_probe()
1043 if (IS_ERR(data->clk_sec)) { in exynos_tmu_probe()
1044 if (data->soc == SOC_ARCH_EXYNOS5420_TRIMINFO) { in exynos_tmu_probe()
1045 dev_err(&pdev->dev, "Failed to get triminfo clock\n"); in exynos_tmu_probe()
1046 ret = PTR_ERR(data->clk_sec); in exynos_tmu_probe()
1050 ret = clk_prepare(data->clk_sec); in exynos_tmu_probe()
1052 dev_err(&pdev->dev, "Failed to get clock\n"); in exynos_tmu_probe()
1057 ret = clk_prepare(data->clk); in exynos_tmu_probe()
1059 dev_err(&pdev->dev, "Failed to get clock\n"); in exynos_tmu_probe()
1063 switch (data->soc) { in exynos_tmu_probe()
1066 data->sclk = devm_clk_get(&pdev->dev, "tmu_sclk"); in exynos_tmu_probe()
1067 if (IS_ERR(data->sclk)) { in exynos_tmu_probe()
1068 dev_err(&pdev->dev, "Failed to get sclk\n"); in exynos_tmu_probe()
1069 ret = PTR_ERR(data->sclk); in exynos_tmu_probe()
1072 ret = clk_prepare_enable(data->sclk); in exynos_tmu_probe()
1074 dev_err(&pdev->dev, "Failed to enable sclk\n"); in exynos_tmu_probe()
1084 * data->tzd must be registered before calling exynos_tmu_initialize(), in exynos_tmu_probe()
1087 data->tzd = devm_thermal_of_zone_register(&pdev->dev, 0, data, in exynos_tmu_probe()
1089 if (IS_ERR(data->tzd)) { in exynos_tmu_probe()
1090 ret = PTR_ERR(data->tzd); in exynos_tmu_probe()
1091 if (ret != -EPROBE_DEFER) in exynos_tmu_probe()
1092 dev_err(&pdev->dev, "Failed to register sensor: %d\n", in exynos_tmu_probe()
1099 dev_err(&pdev->dev, "Failed to initialize TMU\n"); in exynos_tmu_probe()
1103 ret = devm_request_irq(&pdev->dev, data->irq, exynos_tmu_irq, in exynos_tmu_probe()
1104 IRQF_TRIGGER_RISING | IRQF_SHARED, dev_name(&pdev->dev), data); in exynos_tmu_probe()
1106 dev_err(&pdev->dev, "Failed to request irq: %d\n", data->irq); in exynos_tmu_probe()
1114 clk_disable_unprepare(data->sclk); in exynos_tmu_probe()
1116 clk_unprepare(data->clk); in exynos_tmu_probe()
1118 if (!IS_ERR(data->clk_sec)) in exynos_tmu_probe()
1119 clk_unprepare(data->clk_sec); in exynos_tmu_probe()
1121 if (!IS_ERR(data->regulator)) in exynos_tmu_probe()
1122 regulator_disable(data->regulator); in exynos_tmu_probe()
1133 clk_disable_unprepare(data->sclk); in exynos_tmu_remove()
1134 clk_unprepare(data->clk); in exynos_tmu_remove()
1135 if (!IS_ERR(data->clk_sec)) in exynos_tmu_remove()
1136 clk_unprepare(data->clk_sec); in exynos_tmu_remove()
1138 if (!IS_ERR(data->regulator)) in exynos_tmu_remove()
1139 regulator_disable(data->regulator); in exynos_tmu_remove()
1171 .name = "exynos-tmu",
1184 MODULE_ALIAS("platform:exynos-tmu");