Lines Matching +full:inverted +full:- +full:out
1 /*-
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
67 boolean_t inverted; member
89 .inverted = TRUE,
137 if (ofw_bus_is_compatible(dev, "marvell,armada380-thermal")) { in armada_thermal_probe()
139 sc->tdata = &armada380_tdata; in armada_thermal_probe()
161 sc->stat_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in armada_thermal_attach()
163 if (sc->stat_res == NULL) { in armada_thermal_attach()
170 sc->ctrl_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in armada_thermal_attach()
172 if (sc->ctrl_res == NULL) { in armada_thermal_attach()
176 rman_get_rid(sc->stat_res), sc->stat_res); in armada_thermal_attach()
177 sc->stat_res = NULL; in armada_thermal_attach()
182 tdata = sc->tdata; in armada_thermal_attach()
183 tdata->tsen_init(sc); in armada_thermal_attach()
185 for (timeout = 1000; timeout > 0; timeout--) { in armada_thermal_attach()
186 if (armada_tsen_get_temp(sc, &sc->chip_temperature) == 0) in armada_thermal_attach()
192 rman_get_rid(sc->stat_res), sc->stat_res); in armada_thermal_attach()
193 sc->stat_res = NULL; in armada_thermal_attach()
195 rman_get_rid(sc->ctrl_res), sc->ctrl_res); in armada_thermal_attach()
196 sc->ctrl_res = NULL; in armada_thermal_attach()
200 mtx_init(&sc->temp_upd_mtx, "Armada Thermal", NULL, MTX_DEF); in armada_thermal_attach()
202 callout_init_mtx(&sc->temp_upd, &sc->temp_upd_mtx, 0); in armada_thermal_attach()
204 callout_reset(&sc->temp_upd, hz, armada_temp_update, sc); in armada_thermal_attach()
209 CTLFLAG_RD, &sc->chip_temperature, "SoC temperature"); in armada_thermal_attach()
224 callout_drain(&sc->temp_upd); in armada_thermal_detach()
226 sc->chip_temperature = 0; in armada_thermal_detach()
229 rman_get_rid(sc->stat_res), sc->stat_res); in armada_thermal_detach()
230 sc->stat_res = NULL; in armada_thermal_detach()
233 rman_get_rid(sc->ctrl_res), sc->ctrl_res); in armada_thermal_detach()
234 sc->ctrl_res = NULL; in armada_thermal_detach()
246 tdata = sc->tdata; in armada_tsen_readout_valid()
247 tsen_stat = bus_read_4(sc->stat_res, 0); in armada_tsen_readout_valid()
249 tsen_stat >>= tdata->is_valid_shift; in armada_tsen_readout_valid()
263 tdata = sc->tdata; in armada_tsen_get_temp()
265 if ((tdata->is_valid != NULL) && !tdata->is_valid(sc)) in armada_tsen_get_temp()
268 reg = bus_read_4(sc->stat_res, 0); in armada_tsen_get_temp()
269 reg = (reg >> tdata->temp_shift) & tdata->temp_mask; in armada_tsen_get_temp()
272 b = tdata->coef_b; in armada_tsen_get_temp()
273 m = tdata->coef_m; in armada_tsen_get_temp()
274 div = tdata->coef_div; in armada_tsen_get_temp()
276 if (tdata->inverted) in armada_tsen_get_temp()
277 tmp = ((m * reg) - b) / div; in armada_tsen_get_temp()
279 tmp = (b - (m * reg)) / div; in armada_tsen_get_temp()
291 tsen_ctrl = bus_read_4(sc->ctrl_res, 0); in armada380_tsen_init()
294 bus_write_4(sc->ctrl_res, 0, tsen_ctrl); in armada380_tsen_init()
306 (void)armada_tsen_get_temp(sc, &sc->chip_temperature); in armada_temp_update()
308 callout_reset(&sc->temp_upd, hz, armada_temp_update, sc); in armada_temp_update()