/* ------------------------------------------------------------------------*//** * @FUNCTION temp_sensor_is_available * @BRIEF check if temperature sensor is available. * @RETURNS 1 if temperature sensor is available * 0 if temperature sensor is NOT available * @param[in] sensor: generic temperature sensor name * @DESCRIPTION check if temperature sensor is available * (platform-dependent). *//*------------------------------------------------------------------------ */ int temp_sensor_is_available(const char *sensor) { int id; CHECK_NULL_ARG(sensor, 0); id = temp_sensor_s2id(sensor); if (id >= 0) { dprintf("%s(): %s is available.\n", __func__, sensor); return 1; } else { dprintf("%s(): %s is NOT available.\n", __func__, sensor); return 0; } }
/* ------------------------------------------------------------------------*//** * @FUNCTION temp_sensor_get * @BRIEF return temperature measured by temperature sensor. * @RETURNS temperature measured by temperature sensor (Celcius) * TEMP_ABSOLUTE_ZERO in case of error * @param[in] sensor: generic temperature sensor name * @DESCRIPTION return temperature measured by temperature sensor * in Celcius degrees. *//*------------------------------------------------------------------------ */ int temp_sensor_get(const char *sensor) { int id, temp; CHECK_NULL_ARG(sensor, TEMP_ABSOLUTE_ZERO); id = temp_sensor_s2id(sensor); if (id < 0) temp = TEMP_ABSOLUTE_ZERO; else if (cpu_is_omap44xx()) { temp = temp44xx_get(id); } else if (cpu_is_omap54xx()) { temp = temp54xx_get(id); } else { fprintf(stderr, "omapconf: %s(): cpu not supported!!!\n", __func__); temp = TEMP_ABSOLUTE_ZERO; } dprintf("%s(%s) = %d\n", __func__, sensor, temp); return temp; }