gpu: nvgpu: Implement Thermal Alert for PG189

PG189 has multiple sensors which can provide interrupt when board
temperature reaches programmed threshold.
This Interrupt is implemented in nvgpu and provide events via clk_arb.
Support is enabled for TU104 with NVGPU_SUPPORT_DGPU_THERMAL_ALERT flag.
Board specific config is added in DT which will be parsed by nvgpu.
Nvgpu does the following.
1.Read gpio line number, interrupt type, and event delay from DT.
2.Call kernel methods and register the interrupt with kernel.
3.Create work queue which will process the interrupt in process context.
4.When interrupt occurs disable interrupt, add work to work queue.
5.In work queue post events and sleep for delay time then enable
  Interrupt

Bug 2492512

Change-Id: Ic5694fe366ca492f8afe8a67de4350e9a51af2af
Signed-off-by: Abdul Salam <absalam@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2119411
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Abdul Salam
2019-05-23 23:44:05 +05:30
committed by mobile promotions
parent 20fcf813dd
commit 25eb392fd1
7 changed files with 122 additions and 5 deletions

View File

@@ -558,6 +558,19 @@ err_free_l:
return err;
}
static void nvgpu_thermal_deinit(struct gk20a *g)
{
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
struct device *dev = dev_from_gk20a(g);
devm_free_irq(dev, l->thermal_alert.therm_alert_irq, g);
if (l->thermal_alert.workqueue != NULL) {
cancel_work_sync(&l->thermal_alert.work);
destroy_workqueue(l->thermal_alert.workqueue);
l->thermal_alert.workqueue = NULL;
}
}
static void nvgpu_pci_remove(struct pci_dev *pdev)
{
struct gk20a *g = get_gk20a(&pdev->dev);
@@ -576,6 +589,11 @@ static void nvgpu_pci_remove(struct pci_dev *pdev)
gk20a_driver_start_unload(g);
if (nvgpu_is_enabled(g, NVGPU_SUPPORT_DGPU_THERMAL_ALERT) &&
nvgpu_platform_is_silicon(g)) {
nvgpu_thermal_deinit(g);
}
err = nvgpu_quiesce(g);
/* TODO: handle failure to idle */
WARN(err, "gpu failed to idle during driver removal");