#include #include #include #include #include #define TEMPERATURE_SENSOR_INDEX 0u static int cpu_temperature_callback(__maybe_unused void *handle, __maybe_unused void *context, int *value) { int temperature; static struct thermal_zone_device *tz; int ret; tz = thermal_zone_get_zone_by_name("broadcomThermalDrv"); if (IS_ERR_OR_NULL(tz)) return PTR_ERR(tz); ret = thermal_zone_get_temp(tz, &temperature); if (!ret) *value = temperature / 100; return ret; } static int __init cpu_temperature_init(void) { if (!TemperaturSensorRegister("CPU", cpu_temperature_callback, TEMPERATURE_SENSOR_INDEX)) { pr_err("Could not register CPU Temperature sensor to AVM Power driver.\n"); } return 0; } arch_initcall(cpu_temperature_init);