static void tsens8960_get_temp(int sensor_num, unsigned long *temp) { unsigned int code, offset = 0, sensor_addr; #if defined(CONFIG_MACH_LGE) && defined(CONFIG_DEBUG_FS) if (debug_temp[sensor_num] != 0) { *temp = debug_temp[sensor_num]; return; } #endif if (!tmdev->prev_reading_avail) { while (!(readl_relaxed(TSENS_INT_STATUS_ADDR) & TSENS_TRDY_MASK)) usleep_range(TSENS_TRDY_RDY_MIN_TIME, TSENS_TRDY_RDY_MAX_TIME); tmdev->prev_reading_avail = true; } sensor_addr = (unsigned int)TSENS_S0_STATUS_ADDR; if (tmdev->hw_type == APQ_8064 && sensor_num >= TSENS_8064_SEQ_SENSORS) offset = TSENS_8064_S4_S5_OFFSET; code = readl_relaxed(sensor_addr + offset + (sensor_num << TSENS_STATUS_ADDR_OFFSET)); *temp = tsens_tz_code_to_degC(code, sensor_num); }
static void tsens8960_get_temp(int sensor_num, unsigned long *temp) { unsigned int code; if (!tmdev->prev_reading_avail) { while (!(readl_relaxed(TSENS_INT_STATUS_ADDR) & TSENS_TRDY_MASK)) usleep_range(TSENS_TRDY_RDY_MIN_TIME, TSENS_TRDY_RDY_MAX_TIME); tmdev->prev_reading_avail = true; } code = readl_relaxed(TSENS_S0_STATUS_ADDR + (sensor_num << TSENS_STATUS_ADDR_OFFSET)); *temp = tsens_tz_code_to_degC(code, sensor_num); }
static int tsens_tz_get_temp(struct thermal_zone_device *thermal, unsigned long *temp) { struct tsens_tm_device_sensor *tm_sensor = thermal->devdata; unsigned int code; if (!tm_sensor || tm_sensor->mode != THERMAL_DEVICE_ENABLED || !temp) return -EINVAL; if (!tmdev->prev_reading_avail) { while (!(readl(TSENS_INT_STATUS_ADDR) & TSENS_TRDY_MASK)) msleep(1); tmdev->prev_reading_avail = 1; } code = readl(TSENS_S0_STATUS_ADDR + (tm_sensor->sensor_num << 2)); *temp = tsens_tz_code_to_degC(code); return 0; }
static void tsens8960_get_temp(int sensor_num, unsigned long *temp) { unsigned int code, offset = 0, sensor_addr; if (!tmdev->prev_reading_avail) { while (!(readl_relaxed(TSENS_INT_STATUS_ADDR) & TSENS_TRDY_MASK)) usleep_range(TSENS_TRDY_RDY_MIN_TIME, TSENS_TRDY_RDY_MAX_TIME); tmdev->prev_reading_avail = true; } sensor_addr = (unsigned int)TSENS_S0_STATUS_ADDR; if ((tmdev->hw_type == APQ_8064 || tmdev->hw_type == IPQ_806X) && sensor_num >= TSENS_8064_SEQ_SENSORS) offset = TSENS_8064_S4_S5_OFFSET; code = readl_relaxed(sensor_addr + offset + (sensor_num << TSENS_STATUS_ADDR_OFFSET)); *temp = tsens_tz_code_to_degC(code, sensor_num); }
static void tsens8x60_get_temp(int sensor_num, unsigned long *temp) { unsigned int code; if (!tmdev->prev_reading_avail) { while (!(readl_relaxed(TSENS_INT_STATUS_ADDR) & TSENS_TRDY_MASK)) usleep_range(TSENS_TRDY_RDY_MIN_TIME, TSENS_TRDY_RDY_MAX_TIME); tmdev->prev_reading_avail = true; } code = readl_relaxed(TSENS_S0_STATUS_ADDR + (sensor_num << TSENS_STATUS_ADDR_OFFSET)); *temp = tsens_tz_code_to_degC(code, sensor_num); tsens_log_count++; if ((tsens_log_count % 20) == 0) { pr_warn("TSENS: Current CPU Temperature is: %lu\n", *temp); tsens_log_count = 0; } }
static int tsens_tz_get_temp(struct thermal_zone_device *thermal, unsigned long *temp) { struct tsens_tm_device_sensor *tm_sensor = thermal->devdata; unsigned int code; if (!tm_sensor || tm_sensor->mode != THERMAL_DEVICE_ENABLED || !temp) return -EINVAL; if (!tmdev->prev_reading_avail) { while (!(readl_relaxed(TSENS_INT_STATUS_ADDR) & TSENS_TRDY_MASK)) usleep_range(TSENS_TRDY_RDY_MIN_TIME, TSENS_TRDY_RDY_MAX_TIME); tmdev->prev_reading_avail = true; } code = readl_relaxed(TSENS_S0_STATUS_ADDR + (tm_sensor->sensor_num << TSENS_STATUS_ADDR_OFFSET)); *temp = tsens_tz_code_to_degC(code, tm_sensor->sensor_num); return 0; }