Lines Matching refs:dev

45 #include <dev/iicbus/iicbus.h>
46 #include <dev/iicbus/iiconf.h>
48 #include <dev/ofw/openfirm.h>
49 #include <dev/ofw/ofw_bus.h>
50 #include <dev/ofw/ofw_bus_subr.h>
78 am335x_pmic_read(device_t dev, uint8_t addr, uint8_t *data, uint8_t size)
80 struct am335x_pmic_softc *sc = device_get_softc(dev);
85 return (iicbus_transfer(dev, msg, 2));
89 am335x_pmic_write(device_t dev, uint8_t address, uint8_t *data, uint8_t size)
92 struct am335x_pmic_softc *sc = device_get_softc(dev);
103 return (iicbus_transfer(dev, msg, 1));
140 am335x_pmic_probe(device_t dev)
144 if (!ofw_bus_is_compatible(dev, "ti,tps65217"))
147 sc = device_get_softc(dev);
148 sc->sc_dev = dev;
150 sc->sc_addr = iicbus_get_addr(dev);
152 device_set_desc(dev, "TI TPS65217 Power Management IC");
158 am335x_pmic_dump_chgconfig(device_t dev)
177 am335x_pmic_read(dev, TPS65217_CHGCONFIG0_REG, (uint8_t *)&reg0, 1);
178 device_printf(dev, " BAT TEMP/NTC ERROR: %s\n", f_t[reg0.battemp]);
179 device_printf(dev, " Pre-charge timer time-out: %s\n", f_t[reg0.pchgtout]);
180 device_printf(dev, " Charge timer time-out: %s\n", f_t[reg0.chgtout]);
181 device_printf(dev, " Charger active: %s\n", f_t[reg0.active]);
182 device_printf(dev, " Termination current detected: %s\n", f_t[reg0.termi]);
183 device_printf(dev, " Thermal suspend: %s\n", f_t[reg0.tsusp]);
184 device_printf(dev, " DPPM active: %s\n", f_t[reg0.dppm]);
185 device_printf(dev, " Thermal regulation: %s\n", i_a[reg0.treg]);
187 am335x_pmic_read(dev, TPS65217_CHGCONFIG1_REG, (uint8_t *)&reg1, 1);
188 device_printf(dev, " Charger: %s\n", d_e[reg1.chg_en]);
189 device_printf(dev, " Suspend charge: %s\n", i_a[reg1.susp]);
190 device_printf(dev, " Charge termination: %s\n", e_d[reg1.term]);
191 device_printf(dev, " Charger reset: %s\n", i_a[reg1.reset]);
192 device_printf(dev, " NTC TYPE: %s\n", ntc_type_c[reg1.ntc_type]);
193 device_printf(dev, " Safety timer: %s\n", d_e[reg1.tmr_en]);
194 device_printf(dev, " Charge safety timer: %s\n", timer_c[reg1.timer]);
196 am335x_pmic_read(dev, TPS65217_CHGCONFIG2_REG, (uint8_t *)&reg2, 1);
197 device_printf(dev, " Charge voltage: %s\n", tps65217_voreg_c[reg2.voreg]);
198 device_printf(dev, " Pre-charge to fast charge transition voltage: %s\n",
200 device_printf(dev, " Dynamic timer function: %s\n", d_e[reg2.dyntmr]);
202 am335x_pmic_read(dev, TPS65217_CHGCONFIG3_REG, (uint8_t *)&reg3, 1);
203 device_printf(dev, " Temperature range for charging: %s\n", trange_c[reg3.trange]);
204 device_printf(dev, " Termination current factor: %s\n", termif_c[reg3.termif]);
205 device_printf(dev, " Pre-charge time: %s\n", pchrgt_c[reg3.pchrgt]);
206 device_printf(dev, " Power path DPPM threshold: %s\n", dppmth_c[reg3.dppmth]);
207 device_printf(dev, " Charge current: %s\n", ichrg_c[reg3.ichrg]);
211 am335x_pmic_setvo(device_t dev, uint8_t vo)
215 am335x_pmic_read(dev, TPS65217_CHGCONFIG2_REG, (uint8_t *)&reg2, 1);
217 am335x_pmic_write(dev, TPS65217_CHGCONFIG2_REG, (uint8_t *)&reg2, 1);
224 device_t dev = (device_t)xdev;
232 sc = device_get_softc(dev);
234 am335x_pmic_read(dev, TPS65217_CHIPID_REG, (uint8_t *)&chipid_reg, 1);
252 am335x_pmic_read(dev, TPS65217_STATUS_REG, (uint8_t *)&status_reg, 1);
253 device_printf(dev, "%s powered by %s\n", name,
262 device_printf(dev, "WARNING: hw.am335x_pmic.vo=\"%s\""
265 am335x_pmic_setvo(dev, vo);
270 am335x_pmic_dump_chgconfig(dev);
273 EVENTHANDLER_REGISTER(shutdown_final, am335x_pmic_shutdown, dev,
280 am335x_pmic_write(dev, TPS65217_INT_REG, &reg, 1);
281 am335x_pmic_read(dev, TPS65217_INT_REG, &reg, 1);
284 rv = bus_setup_intr(dev, sc->sc_irq_res,
288 device_printf(dev,
294 am335x_pmic_attach(device_t dev)
299 sc = device_get_softc(dev);
302 sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
305 device_printf(dev, "cannot allocate interrupt\n");
310 sc->enum_hook.ich_arg = dev;
321 device_t dev;
326 dev = (device_t)xdev;
327 am335x_pmic_read(dev, TPS65217_STATUS_REG, (uint8_t *)&reg, 1);
330 am335x_pmic_write(dev, TPS65217_STATUS_REG, (uint8_t *)&reg, 1);