Lines Matching refs:data
196 void (*tmu_set_trip_temp)(struct exynos_tmu_data *data, int trip,
198 void (*tmu_set_trip_hyst)(struct exynos_tmu_data *data, int trip,
202 int (*tmu_read)(struct exynos_tmu_data *data);
203 void (*tmu_set_emulation)(struct exynos_tmu_data *data, int temp);
204 void (*tmu_clear_irqs)(struct exynos_tmu_data *data);
211 static int temp_to_code(struct exynos_tmu_data *data, u8 temp) in temp_to_code() argument
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()
217 (data->temp_error2 - data->temp_error1) / in temp_to_code()
219 data->temp_error1; in temp_to_code()
226 static int code_to_temp(struct exynos_tmu_data *data, u16 temp_code) in code_to_temp() argument
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()
233 (data->temp_error2 - data->temp_error1) + in code_to_temp()
237 static void sanitize_temp_error(struct exynos_tmu_data *data, u32 trim_info) in sanitize_temp_error() argument
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()
260 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos_tmu_initialize() local
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()
273 if (num_trips > data->ntrip) { 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()
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()
320 static u32 get_con_reg(struct exynos_tmu_data *data, u32 con) in get_con_reg() argument
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()
340 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos_tmu_control() local
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()
350 static void exynos4210_tmu_set_trip_temp(struct exynos_tmu_data *data, in exynos4210_tmu_set_trip_temp() argument
356 if (thermal_zone_get_trip(data->tzd, 0, &trip)) in exynos4210_tmu_set_trip_temp()
362 th_code = temp_to_code(data, ref); in exynos4210_tmu_set_trip_temp()
363 writeb(th_code, data->base + EXYNOS4210_TMU_REG_THRESHOLD_TEMP); 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()
371 static void exynos4210_tmu_set_trip_hyst(struct exynos_tmu_data *data, in exynos4210_tmu_set_trip_hyst() argument
378 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos4210_tmu_initialize() local
380 sanitize_temp_error(data, readl(data->base + EXYNOS_TMU_REG_TRIMINFO)); in exynos4210_tmu_initialize()
383 static void exynos4412_tmu_set_trip_temp(struct exynos_tmu_data *data, in exynos4412_tmu_set_trip_temp() argument
388 th = readl(data->base + EXYNOS_THD_TEMP_RISE); in exynos4412_tmu_set_trip_temp()
390 th |= temp_to_code(data, temp) << 8 * trip; 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()
400 static void exynos4412_tmu_set_trip_hyst(struct exynos_tmu_data *data, in exynos4412_tmu_set_trip_hyst() argument
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()
414 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos4412_tmu_initialize() local
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()
436 sanitize_temp_error(data, trim_info); in exynos4412_tmu_initialize()
439 static void exynos5433_tmu_set_trip_temp(struct exynos_tmu_data *data, in exynos5433_tmu_set_trip_temp() argument
453 th = readl(data->base + reg_off); in exynos5433_tmu_set_trip_temp()
455 th |= (temp_to_code(data, temp) << j * 8); in exynos5433_tmu_set_trip_temp()
456 writel(th, data->base + reg_off); in exynos5433_tmu_set_trip_temp()
459 static void exynos5433_tmu_set_trip_hyst(struct exynos_tmu_data *data, in exynos5433_tmu_set_trip_hyst() argument
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()
481 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos5433_tmu_initialize() local
485 trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO); in exynos5433_tmu_initialize()
486 sanitize_temp_error(data, trim_info); 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()
512 static void exynos7_tmu_set_trip_temp(struct exynos_tmu_data *data, in exynos7_tmu_set_trip_temp() argument
521 th = readl(data->base + EXYNOS7_THD_TEMP_RISE7_6 + reg_off); in exynos7_tmu_set_trip_temp()
523 th |= temp_to_code(data, temp) << (16 * bit_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()
527 static void exynos7_tmu_set_trip_hyst(struct exynos_tmu_data *data, in exynos7_tmu_set_trip_hyst() argument
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()
544 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos7_tmu_initialize() local
547 trim_info = readl(data->base + EXYNOS_TMU_REG_TRIMINFO); in exynos7_tmu_initialize()
548 sanitize_temp_error(data, trim_info); in exynos7_tmu_initialize()
553 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos4210_tmu_control() local
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()
584 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos5433_tmu_control() local
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()
616 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos7_tmu_control() local
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()
648 struct exynos_tmu_data *data = thermal_zone_device_priv(tz); in exynos_get_temp() local
651 if (!data || !data->tmu_read) in exynos_get_temp()
653 else if (!data->enabled) 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()
667 *temp = code_to_temp(data, value) * MCELSIUS; in exynos_get_temp()
669 clk_disable(data->clk); in exynos_get_temp()
670 mutex_unlock(&data->lock); in exynos_get_temp()
676 static u32 get_emul_con_reg(struct exynos_tmu_data *data, unsigned int val, in get_emul_con_reg() argument
684 if (data->soc == SOC_ARCH_EXYNOS7) { in get_emul_con_reg()
687 val |= (temp_to_code(data, temp) << in get_emul_con_reg()
693 val |= (temp_to_code(data, temp) << in get_emul_con_reg()
704 static void exynos4412_tmu_set_emulation(struct exynos_tmu_data *data, in exynos4412_tmu_set_emulation() argument
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()
720 val = get_emul_con_reg(data, val, temp); in exynos4412_tmu_set_emulation()
721 writel(val, data->base + emul_con); in exynos4412_tmu_set_emulation()
726 struct exynos_tmu_data *data = thermal_zone_device_priv(tz); in exynos_tmu_set_emulation() local
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()
750 static int exynos4210_tmu_read(struct exynos_tmu_data *data) in exynos4210_tmu_read() argument
752 int ret = readb(data->base + EXYNOS_TMU_REG_CURRENT_TEMP); in exynos4210_tmu_read()
758 static int exynos4412_tmu_read(struct exynos_tmu_data *data) in exynos4412_tmu_read() argument
760 return readb(data->base + EXYNOS_TMU_REG_CURRENT_TEMP); in exynos4412_tmu_read()
763 static int exynos7_tmu_read(struct exynos_tmu_data *data) in exynos7_tmu_read() argument
765 return readw(data->base + EXYNOS_TMU_REG_CURRENT_TEMP) & in exynos7_tmu_read()
771 struct exynos_tmu_data *data = container_of(work, in exynos_tmu_work() local
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()
787 static void exynos4210_tmu_clear_irqs(struct exynos_tmu_data *data) in exynos4210_tmu_clear_irqs() argument
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()
815 writel(val_irq, data->base + tmu_intclear); in exynos4210_tmu_clear_irqs()
820 struct exynos_tmu_data *data = id; in exynos_tmu_irq() local
823 schedule_work(&data->irq_work); in exynos_tmu_irq()
831 .data = (const void *)SOC_ARCH_EXYNOS3250,
834 .data = (const void *)SOC_ARCH_EXYNOS4210,
837 .data = (const void *)SOC_ARCH_EXYNOS4412,
840 .data = (const void *)SOC_ARCH_EXYNOS5250,
843 .data = (const void *)SOC_ARCH_EXYNOS5260,
846 .data = (const void *)SOC_ARCH_EXYNOS5420,
849 .data = (const void *)SOC_ARCH_EXYNOS5420_TRIMINFO,
852 .data = (const void *)SOC_ARCH_EXYNOS5433,
855 .data = (const void *)SOC_ARCH_EXYNOS7,
863 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos_map_dt_data() local
866 if (!data || !pdev->dev.of_node) 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()
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()
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()
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()
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()
1000 struct exynos_tmu_data *data; in exynos_tmu_probe() local
1003 data = devm_kzalloc(&pdev->dev, sizeof(struct exynos_tmu_data), in exynos_tmu_probe()
1005 if (!data) in exynos_tmu_probe()
1008 platform_set_drvdata(pdev, data); 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()
1024 if (PTR_ERR(data->regulator) == -EPROBE_DEFER) 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()
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()
1046 ret = PTR_ERR(data->clk_sec); in exynos_tmu_probe()
1050 ret = clk_prepare(data->clk_sec); in exynos_tmu_probe()
1057 ret = clk_prepare(data->clk); 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()
1069 ret = PTR_ERR(data->sclk); in exynos_tmu_probe()
1072 ret = clk_prepare_enable(data->sclk); 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()
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()
1129 struct exynos_tmu_data *data = platform_get_drvdata(pdev); in exynos_tmu_remove() local
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()