Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thermal: Intel SoC DTS: Add Braswell support

Added Intel Braswell CPU id for SOC DTS. Since this doesn't support
APIC IRQ, the driver is modified to have capability to not register
any modifiable trips.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>

authored by

Srinivas Pandruvada and committed by
Zhang Rui
6c355faf ec6f34e5

+30 -16
+30 -16
drivers/thermal/intel_soc_dts_thermal.c
··· 309 309 return ret; 310 310 } 311 311 312 - static struct soc_sensor_entry *alloc_soc_dts(int id, u32 tj_max) 312 + static struct soc_sensor_entry *alloc_soc_dts(int id, u32 tj_max, 313 + bool notification_support) 313 314 { 314 315 struct soc_sensor_entry *aux_entry; 315 316 char name[10]; 317 + int trip_count = 0; 318 + int trip_mask = 0; 316 319 int err; 317 320 318 321 aux_entry = kzalloc(sizeof(*aux_entry), GFP_KERNEL); ··· 335 332 aux_entry->tj_max = tj_max; 336 333 aux_entry->temp_mask = 0x00FF << (id * 8); 337 334 aux_entry->temp_shift = id * 8; 335 + if (notification_support) { 336 + trip_count = SOC_MAX_DTS_TRIPS; 337 + trip_mask = 0x02; 338 + } 338 339 snprintf(name, sizeof(name), "soc_dts%d", id); 339 340 aux_entry->tzone = thermal_zone_device_register(name, 340 - SOC_MAX_DTS_TRIPS, 341 - 0x02, 342 - aux_entry, &tzone_ops, NULL, 0, 0); 341 + trip_count, 342 + trip_mask, 343 + aux_entry, &tzone_ops, 344 + NULL, 0, 0); 343 345 if (IS_ERR(aux_entry->tzone)) { 344 346 err = PTR_ERR(aux_entry->tzone); 345 347 goto err_ret; ··· 410 402 411 403 static const struct x86_cpu_id soc_thermal_ids[] = { 412 404 { X86_VENDOR_INTEL, X86_FAMILY_ANY, 0x37, 0, BYT_SOC_DTS_APIC_IRQ}, 405 + { X86_VENDOR_INTEL, X86_FAMILY_ANY, 0x4c, 0, 0}, 413 406 {} 414 407 }; 415 408 MODULE_DEVICE_TABLE(x86cpu, soc_thermal_ids); ··· 429 420 if (get_tj_max(&tj_max)) 430 421 return -EINVAL; 431 422 423 + soc_dts_thres_irq = (int)match_cpu->driver_data; 424 + 432 425 for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) { 433 - soc_dts[i] = alloc_soc_dts(i, tj_max); 426 + soc_dts[i] = alloc_soc_dts(i, tj_max, 427 + soc_dts_thres_irq ? true : false); 434 428 if (IS_ERR(soc_dts[i])) { 435 429 err = PTR_ERR(soc_dts[i]); 436 430 goto err_free; ··· 442 430 443 431 spin_lock_init(&intr_notify_lock); 444 432 445 - soc_dts_thres_irq = (int)match_cpu->driver_data; 446 - 447 - err = request_threaded_irq(soc_dts_thres_irq, NULL, 448 - soc_irq_thread_fn, 449 - IRQF_TRIGGER_RISING | IRQF_ONESHOT, 450 - "soc_dts", soc_dts); 451 - if (err) { 452 - pr_err("request_threaded_irq ret %d\n", err); 453 - goto err_free; 433 + if (soc_dts_thres_irq) { 434 + err = request_threaded_irq(soc_dts_thres_irq, NULL, 435 + soc_irq_thread_fn, 436 + IRQF_TRIGGER_RISING | IRQF_ONESHOT, 437 + "soc_dts", soc_dts); 438 + if (err) { 439 + pr_err("request_threaded_irq ret %d\n", err); 440 + goto err_free; 441 + } 454 442 } 455 443 456 444 for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) { ··· 463 451 464 452 err_trip_temp: 465 453 i = SOC_MAX_DTS_SENSORS; 466 - free_irq(soc_dts_thres_irq, soc_dts); 454 + if (soc_dts_thres_irq) 455 + free_irq(soc_dts_thres_irq, soc_dts); 467 456 err_free: 468 457 while (--i >= 0) 469 458 free_soc_dts(soc_dts[i]); ··· 479 466 for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) 480 467 update_trip_temp(soc_dts[i], 0, 0); 481 468 482 - free_irq(soc_dts_thres_irq, soc_dts); 469 + if (soc_dts_thres_irq) 470 + free_irq(soc_dts_thres_irq, soc_dts); 483 471 484 472 for (i = 0; i < SOC_MAX_DTS_SENSORS; ++i) 485 473 free_soc_dts(soc_dts[i]);