Skip to content

Commit

Permalink
Merge branch 'rcar-3.9.8/thermal_ipa.rc1' into v4.14.75-ltsi/rcar-3.9.9
Browse files Browse the repository at this point in the history
* rcar-3.9.8/thermal_ipa.rc1:
  thermal: rcar_gen3_thermal: Fix missing rcar_gen3_thermal_set_irq_temp() in interrupt processing
  thermal: rcar_gen3_thermal: Correct the order of checking THSCP
  • Loading branch information
r-kataok committed May 22, 2020
2 parents c37ab32 + cee2f30 commit 4d2a32e
Showing 1 changed file with 33 additions and 30 deletions.
63 changes: 33 additions & 30 deletions drivers/thermal/rcar_gen3_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,19 +403,23 @@ static irqreturn_t rcar_gen3_thermal_irq(int irq, void *data)
REG_GEN3_IRQSTR);
rcar_gen3_thermal_write(priv->tscs[i],
REG_GEN3_IRQSTR, 0);
if (status)
if (status) {
rcar_gen3_thermal_set_irq_temp(priv->tscs[i]);
thermal_zone_device_update(priv->tscs[i]->zone,
THERMAL_EVENT_UNSPECIFIED);
}
}
} else {
for (i = 0; i < priv->num_tscs; i++) {
status = rcar_gen3_thermal_read(priv->tscs[i],
REG_GEN3_B_STR);
rcar_gen3_thermal_write(priv->tscs[i],
REG_GEN3_B_STR, 0);
if (status)
if (status) {
rcar_gen3_thermal_set_irq_temp(priv->tscs[i]);
thermal_zone_device_update(priv->tscs[i]->zone,
THERMAL_EVENT_UNSPECIFIED);
}
}
}

Expand Down Expand Up @@ -545,6 +549,33 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
priv->thermal_init = rcar_gen3_thermal_init_r8a77990;
}

platform_set_drvdata(pdev, priv);

/*
* Request 2 (of the 3 possible) IRQs, the driver only needs to
* to trigger on the low and high trip points of the current
* temp window at this point.
*/
for (i = 0; i < 2; i++) {
irq = platform_get_irq(pdev, i);
if (irq < 0)
return irq;

irqname = devm_kasprintf(dev, GFP_KERNEL, "%s:ch%d",
dev_name(dev), i);
if (!irqname)
return -ENOMEM;

ret = devm_request_threaded_irq(dev, irq, NULL,
rcar_gen3_thermal_irq,
IRQF_ONESHOT, irqname, priv);
if (ret)
return ret;
}

pm_runtime_enable(dev);
pm_runtime_get_sync(dev);

if (is_ths_typeA) {
/* Use FUSE default values if they are missing.
* If not, fetch them from registers.
Expand Down Expand Up @@ -573,34 +604,6 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
iounmap(ptat_base);
}


platform_set_drvdata(pdev, priv);

/*
* Request 2 (of the 3 possible) IRQs, the driver only needs to
* to trigger on the low and high trip points of the current
* temp window at this point.
*/
for (i = 0; i < 2; i++) {
irq = platform_get_irq(pdev, i);
if (irq < 0)
return irq;

irqname = devm_kasprintf(dev, GFP_KERNEL, "%s:ch%d",
dev_name(dev), i);
if (!irqname)
return -ENOMEM;

ret = devm_request_threaded_irq(dev, irq, NULL,
rcar_gen3_thermal_irq,
IRQF_ONESHOT, irqname, priv);
if (ret)
return ret;
}

pm_runtime_enable(dev);
pm_runtime_get_sync(dev);

for (i = 0; i < TSC_MAX_NUM; i++) {
struct rcar_gen3_thermal_tsc *tsc;

Expand Down

0 comments on commit 4d2a32e

Please sign in to comment.