static int ab8500_read_sensor(struct abx500_temp *data, u8 sensor) { int val; /* * Special treatment for the BAT_CTRL node, since this * temperature measurement is more complex than just * an ADC readout * * DIE_TEMP input temperature reading is not supported * in AB8500 */ if (sensor == DIE_TEMP) val = 0; else if (sensor == BAT_CTRL) val = ab8500_btemp_get_batctrl_temp(data->ab8500_btemp); else val = ab8500_gpadc_convert(data->ab8500_gpadc, sensor); return val; }
static int ab8500_read_sensor(struct abx500_temp *data, u8 sensor, int *temp) { int voltage, ret; struct ab8500_temp *ab8500_data = data->plat_data; if (sensor == BAT_CTRL) { *temp = ab8500_btemp_get_batctrl_temp(ab8500_data->btemp); } else if (sensor == BTEMP_BALL) { *temp = ab8500_btemp_get_temp(ab8500_data->btemp); } else { voltage = ab8500_gpadc_convert(ab8500_data->gpadc, sensor); if (voltage < 0) return voltage; ret = ab8500_voltage_to_temp(&ab8500_data->cfg, voltage, temp); if (ret < 0) return ret; } return 0; }