Commit 5b3b5921bad8617ff0b3fbfc2a2c6617f2525fd9

Authored by Linus Torvalds

Merge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal

Pull thermal management fixes from Eduardo Valentin:
 "Specifics:

   - adding Lukasz as maintainer of samsung thermal driver.
   - driver fixes: exynos and int430x.
   - one fix in the exynos cpufreq driver related to cpu cooling (acked
     by cpufreq maintainer).
   - fix default sysfs attributes of cooling devices

  Note: I am sending this pull on Rui's behalf while he fixes issues in his Linux box"

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/evalenti/linux-soc-thermal:
  thermal: Make sysfs attributes of cooling devices default attributes
  Thermal/int340x: Fix memleak for aux trip
  MAINTAINERS: Add entry for SAMSUNG THERMAL DRIVER
  cpufreq: exynos: Use simple approach to asses if cpu cooling can be used
  thermal: exynos: Fix wrong control of power down detection mode for Exynos7

Showing 5 changed files Side-by-side Diff

... ... @@ -8480,6 +8480,14 @@
8480 8480 L: netdev@vger.kernel.org
8481 8481 F: drivers/net/ethernet/samsung/sxgbe/
8482 8482  
  8483 +SAMSUNG THERMAL DRIVER
  8484 +M: Lukasz Majewski <l.majewski@samsung.com>
  8485 +L: linux-pm@vger.kernel.org
  8486 +L: linux-samsung-soc@vger.kernel.org
  8487 +S: Supported
  8488 +T: https://github.com/lmajewski/linux-samsung-thermal.git
  8489 +F: drivers/thermal/samsung/
  8490 +
8483 8491 SAMSUNG USB2 PHY DRIVER
8484 8492 M: Kamil Debski <k.debski@samsung.com>
8485 8493 L: linux-kernel@vger.kernel.org
drivers/cpufreq/exynos-cpufreq.c
... ... @@ -159,7 +159,7 @@
159 159  
160 160 static int exynos_cpufreq_probe(struct platform_device *pdev)
161 161 {
162   - struct device_node *cpus, *np;
  162 + struct device_node *cpu0;
163 163 int ret = -EINVAL;
164 164  
165 165 exynos_info = kzalloc(sizeof(*exynos_info), GFP_KERNEL);
166 166  
167 167  
... ... @@ -206,28 +206,19 @@
206 206 if (ret)
207 207 goto err_cpufreq_reg;
208 208  
209   - cpus = of_find_node_by_path("/cpus");
210   - if (!cpus) {
211   - pr_err("failed to find cpus node\n");
  209 + cpu0 = of_get_cpu_node(0, NULL);
  210 + if (!cpu0) {
  211 + pr_err("failed to find cpu0 node\n");
212 212 return 0;
213 213 }
214 214  
215   - np = of_get_next_child(cpus, NULL);
216   - if (!np) {
217   - pr_err("failed to find cpus child node\n");
218   - of_node_put(cpus);
219   - return 0;
220   - }
221   -
222   - if (of_find_property(np, "#cooling-cells", NULL)) {
223   - cdev = of_cpufreq_cooling_register(np,
  215 + if (of_find_property(cpu0, "#cooling-cells", NULL)) {
  216 + cdev = of_cpufreq_cooling_register(cpu0,
224 217 cpu_present_mask);
225 218 if (IS_ERR(cdev))
226 219 pr_err("running cpufreq without cooling device: %ld\n",
227 220 PTR_ERR(cdev));
228 221 }
229   - of_node_put(np);
230   - of_node_put(cpus);
231 222  
232 223 return 0;
233 224  
drivers/thermal/int340x_thermal/int340x_thermal_zone.c
... ... @@ -208,7 +208,7 @@
208 208 trip_cnt, GFP_KERNEL);
209 209 if (!int34x_thermal_zone->aux_trips) {
210 210 ret = -ENOMEM;
211   - goto free_mem;
  211 + goto err_trip_alloc;
212 212 }
213 213 trip_mask = BIT(trip_cnt) - 1;
214 214 int34x_thermal_zone->aux_trip_nr = trip_cnt;
215 215  
216 216  
... ... @@ -248,14 +248,15 @@
248 248 0, 0);
249 249 if (IS_ERR(int34x_thermal_zone->zone)) {
250 250 ret = PTR_ERR(int34x_thermal_zone->zone);
251   - goto free_lpat;
  251 + goto err_thermal_zone;
252 252 }
253 253  
254 254 return int34x_thermal_zone;
255 255  
256   -free_lpat:
  256 +err_thermal_zone:
257 257 acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table);
258   -free_mem:
  258 + kfree(int34x_thermal_zone->aux_trips);
  259 +err_trip_alloc:
259 260 kfree(int34x_thermal_zone);
260 261 return ERR_PTR(ret);
261 262 }
... ... @@ -266,6 +267,7 @@
266 267 {
267 268 thermal_zone_device_unregister(int34x_thermal_zone->zone);
268 269 acpi_lpat_free_conversion_table(int34x_thermal_zone->lpat_table);
  270 + kfree(int34x_thermal_zone->aux_trips);
269 271 kfree(int34x_thermal_zone);
270 272 }
271 273 EXPORT_SYMBOL_GPL(int340x_thermal_zone_remove);
drivers/thermal/samsung/exynos_tmu.c
... ... @@ -682,6 +682,7 @@
682 682  
683 683 if (on) {
684 684 con |= (1 << EXYNOS_TMU_CORE_EN_SHIFT);
  685 + con |= (1 << EXYNOS7_PD_DET_EN_SHIFT);
685 686 interrupt_en =
686 687 (of_thermal_is_trip_valid(tz, 7)
687 688 << EXYNOS7_TMU_INTEN_RISE7_SHIFT) |
688 689  
... ... @@ -704,9 +705,9 @@
704 705 interrupt_en << EXYNOS_TMU_INTEN_FALL0_SHIFT;
705 706 } else {
706 707 con &= ~(1 << EXYNOS_TMU_CORE_EN_SHIFT);
  708 + con &= ~(1 << EXYNOS7_PD_DET_EN_SHIFT);
707 709 interrupt_en = 0; /* Disable all interrupts */
708 710 }
709   - con |= 1 << EXYNOS7_PD_DET_EN_SHIFT;
710 711  
711 712 writel(interrupt_en, data->base + EXYNOS7_TMU_REG_INTEN);
712 713 writel(con, data->base + EXYNOS_TMU_REG_CONTROL);
drivers/thermal/thermal_core.c
... ... @@ -899,6 +899,22 @@
899 899 return sprintf(buf, "%d\n", instance->trip);
900 900 }
901 901  
  902 +static struct attribute *cooling_device_attrs[] = {
  903 + &dev_attr_cdev_type.attr,
  904 + &dev_attr_max_state.attr,
  905 + &dev_attr_cur_state.attr,
  906 + NULL,
  907 +};
  908 +
  909 +static const struct attribute_group cooling_device_attr_group = {
  910 + .attrs = cooling_device_attrs,
  911 +};
  912 +
  913 +static const struct attribute_group *cooling_device_attr_groups[] = {
  914 + &cooling_device_attr_group,
  915 + NULL,
  916 +};
  917 +
902 918 /* Device management */
903 919  
904 920 /**
... ... @@ -1130,6 +1146,7 @@
1130 1146 cdev->ops = ops;
1131 1147 cdev->updated = false;
1132 1148 cdev->device.class = &thermal_class;
  1149 + cdev->device.groups = cooling_device_attr_groups;
1133 1150 cdev->devdata = devdata;
1134 1151 dev_set_name(&cdev->device, "cooling_device%d", cdev->id);
1135 1152 result = device_register(&cdev->device);
... ... @@ -1139,21 +1156,6 @@
1139 1156 return ERR_PTR(result);
1140 1157 }
1141 1158  
1142   - /* sys I/F */
1143   - if (type) {
1144   - result = device_create_file(&cdev->device, &dev_attr_cdev_type);
1145   - if (result)
1146   - goto unregister;
1147   - }
1148   -
1149   - result = device_create_file(&cdev->device, &dev_attr_max_state);
1150   - if (result)
1151   - goto unregister;
1152   -
1153   - result = device_create_file(&cdev->device, &dev_attr_cur_state);
1154   - if (result)
1155   - goto unregister;
1156   -
1157 1159 /* Add 'this' new cdev to the global cdev list */
1158 1160 mutex_lock(&thermal_list_lock);
1159 1161 list_add(&cdev->node, &thermal_cdev_list);
... ... @@ -1163,11 +1165,6 @@
1163 1165 bind_cdev(cdev);
1164 1166  
1165 1167 return cdev;
1166   -
1167   -unregister:
1168   - release_idr(&thermal_cdev_idr, &thermal_idr_lock, cdev->id);
1169   - device_unregister(&cdev->device);
1170   - return ERR_PTR(result);
1171 1168 }
1172 1169  
1173 1170 /**