exynos_tmu.c (2b2426a72702b04fffe359bfbabeec4a4e41d9c7) | exynos_tmu.c (b43e3cfe232ab01f7cf1f60179a1d005f62d6cc0) |
---|---|
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 --- 202 unchanged lines hidden (view full) --- 211 u8 temp, u8 hyst); 212 void (*tmu_initialize)(struct platform_device *pdev); 213 void (*tmu_control)(struct platform_device *pdev, bool on); 214 int (*tmu_read)(struct exynos_tmu_data *data); 215 void (*tmu_set_emulation)(struct exynos_tmu_data *data, int temp); 216 void (*tmu_clear_irqs)(struct exynos_tmu_data *data); 217}; 218 | 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 --- 202 unchanged lines hidden (view full) --- 211 u8 temp, u8 hyst); 212 void (*tmu_initialize)(struct platform_device *pdev); 213 void (*tmu_control)(struct platform_device *pdev, bool on); 214 int (*tmu_read)(struct exynos_tmu_data *data); 215 void (*tmu_set_emulation)(struct exynos_tmu_data *data, int temp); 216 void (*tmu_clear_irqs)(struct exynos_tmu_data *data); 217}; 218 |
219static void exynos_report_trigger(struct exynos_tmu_data *p) 220{ 221 char data[10], *envp[] = { data, NULL }; 222 struct thermal_zone_device *tz = p->tzd; 223 int temp; 224 unsigned int i; 225 226 if (!tz) { 227 pr_err("No thermal zone device defined\n"); 228 return; 229 } 230 231 thermal_zone_device_update(tz, THERMAL_EVENT_UNSPECIFIED); 232 233 mutex_lock(&tz->lock); 234 /* Find the level for which trip happened */ 235 for (i = 0; i < of_thermal_get_ntrips(tz); i++) { 236 tz->ops->get_trip_temp(tz, i, &temp); 237 if (tz->last_temperature < temp) 238 break; 239 } 240 241 snprintf(data, sizeof(data), "%u", i); 242 kobject_uevent_env(&tz->device.kobj, KOBJ_CHANGE, envp); 243 mutex_unlock(&tz->lock); 244} 245 | |
246/* 247 * TMU treats temperature as a mapped temperature code. 248 * The temperature is converted differently depending on the calibration type. 249 */ 250static int temp_to_code(struct exynos_tmu_data *data, u8 temp) 251{ 252 if (data->cal_type == TYPE_ONE_POINT_TRIMMING) 253 return temp + data->temp_error1 - EXYNOS_FIRST_POINT_TRIM; --- 556 unchanged lines hidden (view full) --- 810 struct exynos_tmu_data *data = container_of(work, 811 struct exynos_tmu_data, irq_work); 812 813 if (!IS_ERR(data->clk_sec)) 814 clk_enable(data->clk_sec); 815 if (!IS_ERR(data->clk_sec)) 816 clk_disable(data->clk_sec); 817 | 219/* 220 * TMU treats temperature as a mapped temperature code. 221 * The temperature is converted differently depending on the calibration type. 222 */ 223static int temp_to_code(struct exynos_tmu_data *data, u8 temp) 224{ 225 if (data->cal_type == TYPE_ONE_POINT_TRIMMING) 226 return temp + data->temp_error1 - EXYNOS_FIRST_POINT_TRIM; --- 556 unchanged lines hidden (view full) --- 783 struct exynos_tmu_data *data = container_of(work, 784 struct exynos_tmu_data, irq_work); 785 786 if (!IS_ERR(data->clk_sec)) 787 clk_enable(data->clk_sec); 788 if (!IS_ERR(data->clk_sec)) 789 clk_disable(data->clk_sec); 790 |
818 exynos_report_trigger(data); | 791 thermal_zone_device_update(data->tzd, THERMAL_EVENT_UNSPECIFIED); 792 |
819 mutex_lock(&data->lock); 820 clk_enable(data->clk); 821 822 /* TODO: take action based on particular interrupt */ 823 data->tmu_clear_irqs(data); 824 825 clk_disable(data->clk); 826 mutex_unlock(&data->lock); --- 402 unchanged lines hidden --- | 793 mutex_lock(&data->lock); 794 clk_enable(data->clk); 795 796 /* TODO: take action based on particular interrupt */ 797 data->tmu_clear_irqs(data); 798 799 clk_disable(data->clk); 800 mutex_unlock(&data->lock); --- 402 unchanged lines hidden --- |