Lines Matching defs:lmsc
2172 lm_generic_banksel(struct lm_softc *lmsc, uint8_t bank)
2174 (*lmsc->lm_writereg)(lmsc, WB_BANKSEL, bank);
2180 * prerequisites: lmsc contains valid lm_{read,write}reg() routines
2184 lm_match(struct lm_softc *lmsc)
2190 /*(*lmsc->lm_writereg)(lmsc, LMD_CONFIG, 0x80); */
2192 cr = (*lmsc->lm_readreg)(lmsc, LMD_CONFIG);
2201 if ((rv = lm_chips[i].chip_match(lmsc)) != 0)
2228 lm_attach(struct lm_softc *lmsc)
2234 if (lm_chips[i].chip_match(lmsc) != 0) {
2235 if (lm_chips[i].chip_attach(lmsc) == 0)
2243 (*lmsc->lm_writereg)(lmsc, LMD_CONFIG, 0x01);
2245 lmsc->sc_sme = sysmon_envsys_create();
2247 for (i = 0; i < lmsc->numsensors; i++) {
2248 lmsc->sensors[i].state = ENVSYS_SINVALID;
2249 if ((rv = sysmon_envsys_sensor_attach(lmsc->sc_sme,
2250 &lmsc->sensors[i])) != 0) {
2251 sysmon_envsys_destroy(lmsc->sc_sme);
2252 lmsc->sc_sme = NULL;
2253 aprint_error_dev(lmsc->sc_dev,
2262 callout_init(&lmsc->sc_callout, 0);
2263 callout_setfunc(&lmsc->sc_callout, lm_refresh, lmsc);
2264 callout_schedule(&lmsc->sc_callout, LM_REFRESH_TIMO);
2269 lmsc->sc_sme->sme_name = device_xname(lmsc->sc_dev);
2270 lmsc->sc_sme->sme_flags = SME_DISABLE_REFRESH;
2272 if (sysmon_envsys_register(lmsc->sc_sme)) {
2273 aprint_error_dev(lmsc->sc_dev,
2275 sysmon_envsys_destroy(lmsc->sc_sme);
2276 lmsc->sc_sme = NULL;
2278 if (!pmf_device_register(lmsc->sc_dev, NULL, NULL))
2279 aprint_error_dev(lmsc->sc_dev,
2288 lm_detach(struct lm_softc *lmsc)
2290 callout_halt(&lmsc->sc_callout, NULL);
2291 callout_destroy(&lmsc->sc_callout);
2293 if (lmsc->sc_sme != NULL)
2294 sysmon_envsys_unregister(lmsc->sc_sme);
2295 pmf_device_deregister(lmsc->sc_dev);
2301 struct lm_softc *lmsc = arg;
2303 lmsc->refresh_sensor_data(lmsc);
2304 callout_schedule(&lmsc->sc_callout, LM_REFRESH_TIMO);