drivers/thermal/intel/int340x_thermal/processor_thermal_device.c

Source file repositories/reference/linux-study-clean/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c

File Facts

System
Linux kernel
Corpus path
drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
Extension
.c
Size
12841 bytes
Lines
497
Domain
Driver Families
Bucket
drivers/thermal
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

if (ret) {
			dev_err(&pdev->dev, "failed to add RAPL MMIO interface\n");
			return ret;
		}
	}

	if (feature_mask & PROC_THERMAL_FEATURE_PTC) {
		ret = proc_thermal_ptc_add(pdev, proc_priv);
		if (ret) {
			dev_err(&pdev->dev, "failed to add PTC MMIO interface\n");
			goto err_rem_rapl;
		}
	}

	if (feature_mask & PROC_THERMAL_FEATURE_FIVR ||
	    feature_mask & PROC_THERMAL_FEATURE_DVFS ||
	    feature_mask & PROC_THERMAL_FEATURE_DLVR) {
		ret = proc_thermal_rfim_add(pdev, proc_priv);
		if (ret) {
			dev_err(&pdev->dev, "failed to add RFIM interface\n");
			goto err_rem_ptc;
		}
	}

	if (feature_mask & PROC_THERMAL_FEATURE_WT_REQ) {
		ret = proc_thermal_wt_req_add(pdev, proc_priv);
		if (ret) {
			dev_err(&pdev->dev, "failed to add MBOX interface\n");
			goto err_rem_rfim;
		}
	} else if (feature_mask & PROC_THERMAL_FEATURE_WT_HINT) {
		ret = proc_thermal_wt_hint_add(pdev, proc_priv);
		if (ret) {
			dev_err(&pdev->dev, "failed to add WT Hint\n");
			goto err_rem_rfim;
		}
	}

	if (feature_mask & PROC_THERMAL_FEATURE_SOC_POWER_SLIDER) {
		ret = proc_thermal_soc_power_slider_add(pdev, proc_priv);
		if (ret) {
			dev_info(&pdev->dev, "failed to add soc power efficiency slider\n");
			goto err_rem_wlt;
		}
	}

	return 0;

err_rem_wlt:
	proc_thermal_wt_hint_remove(pdev);
err_rem_rfim:
	proc_thermal_rfim_remove(pdev);
err_rem_ptc:
	proc_thermal_ptc_remove(pdev);
err_rem_rapl:
	proc_thermal_rapl_remove();

	return ret;
}
EXPORT_SYMBOL_GPL(proc_thermal_mmio_add);

void proc_thermal_mmio_remove(struct pci_dev *pdev, struct proc_thermal_device *proc_priv)
{
	if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_RAPL)
		proc_thermal_rapl_remove();

	if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_PTC)
		proc_thermal_ptc_remove(pdev);

	if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_FIVR ||
	    proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_DVFS ||
	    proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_DLVR)
		proc_thermal_rfim_remove(pdev);

	if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_POWER_FLOOR)
		proc_thermal_power_floor_set_state(proc_priv, false);

	if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_WT_REQ)
		proc_thermal_wt_req_remove(pdev);
	else if (proc_priv->mmio_feature_mask & PROC_THERMAL_FEATURE_WT_HINT)
		proc_thermal_wt_hint_remove(pdev);
}
EXPORT_SYMBOL_GPL(proc_thermal_mmio_remove);

MODULE_IMPORT_NS("INTEL_TCC");
MODULE_IMPORT_NS("INT340X_THERMAL");
MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
MODULE_LICENSE("GPL v2");

Annotation

Implementation Notes