Lines Matching refs:tps

197 	struct tps65010	*tps = s->private;  in dbg_show()  local
203 switch (tps->model) { in dbg_show()
213 mutex_lock(&tps->lock); in dbg_show()
219 seq_printf(s, "%scharging\n\n", tps->charging ? "" : "(not) "); in dbg_show()
225 value = i2c_smbus_read_byte_data(tps->client, TPS_CHGCONFIG); in dbg_show()
226 dbg_chgconf(tps->por, buf, sizeof buf, value); in dbg_show()
229 value = i2c_smbus_read_byte_data(tps->client, TPS_CHGSTATUS); in dbg_show()
232 value = i2c_smbus_read_byte_data(tps->client, TPS_MASK1); in dbg_show()
237 value = i2c_smbus_read_byte_data(tps->client, TPS_REGSTATUS); in dbg_show()
240 value = i2c_smbus_read_byte_data(tps->client, TPS_MASK2); in dbg_show()
245 schedule_delayed_work(&tps->work, POWER_POLL_DELAY); in dbg_show()
249 value = i2c_smbus_read_byte_data(tps->client, TPS_VDCDC1); in dbg_show()
253 value = i2c_smbus_read_byte_data(tps->client, TPS_VDCDC2); in dbg_show()
257 value = i2c_smbus_read_byte_data(tps->client, TPS_VREGS1); in dbg_show()
262 value = i2c_smbus_read_byte_data(tps->client, TPS_LED1_ON); in dbg_show()
263 v2 = i2c_smbus_read_byte_data(tps->client, TPS_LED1_PER); in dbg_show()
271 value = i2c_smbus_read_byte_data(tps->client, TPS_LED2_ON); in dbg_show()
272 v2 = i2c_smbus_read_byte_data(tps->client, TPS_LED2_PER); in dbg_show()
280 value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO); in dbg_show()
281 v2 = i2c_smbus_read_byte_data(tps->client, TPS_MASK3); in dbg_show()
295 mutex_unlock(&tps->lock); in dbg_show()
320 static void tps65010_interrupt(struct tps65010 *tps) in tps65010_interrupt() argument
330 if (tps->nmask2) { in tps65010_interrupt()
331 tmp = i2c_smbus_read_byte_data(tps->client, TPS_REGSTATUS); in tps65010_interrupt()
332 mask = tmp ^ tps->regstatus; in tps65010_interrupt()
333 tps->regstatus = tmp; in tps65010_interrupt()
334 mask &= tps->nmask2; in tps65010_interrupt()
338 tps->regstatus = tmp; in tps65010_interrupt()
357 if (tps->nmask1) { in tps65010_interrupt()
358 tmp = i2c_smbus_read_byte_data(tps->client, TPS_CHGSTATUS); in tps65010_interrupt()
359 mask = tmp ^ tps->chgstatus; in tps65010_interrupt()
360 tps->chgstatus = tmp; in tps65010_interrupt()
361 mask &= tps->nmask1; in tps65010_interrupt()
369 show_chgconfig(tps->por, "conf", tps->chgconf); in tps65010_interrupt()
375 if (!(tps->chgstatus & ~(TPS_CHG_USB|TPS_CHG_AC)) in tps65010_interrupt()
376 && (tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC)) in tps65010_interrupt()
377 && (tps->chgconf & TPS_CHARGE_ENABLE) in tps65010_interrupt()
379 if (tps->chgstatus & TPS_CHG_USB) { in tps65010_interrupt()
382 set_bit(FLAG_VBUS_CHANGED, &tps->flags); in tps65010_interrupt()
384 } else if (tps->chgstatus & TPS_CHG_AC) in tps65010_interrupt()
387 if (charging != tps->charging) { in tps65010_interrupt()
388 tps->charging = charging; in tps65010_interrupt()
391 ((tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC)) in tps65010_interrupt()
399 if ((tps->model != TPS65013 || !tps->charging) in tps65010_interrupt()
400 && (tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC))) in tps65010_interrupt()
403 schedule_delayed_work(&tps->work, POWER_POLL_DELAY); in tps65010_interrupt()
411 struct tps65010 *tps; in tps65010_work() local
413 tps = container_of(to_delayed_work(work), struct tps65010, work); in tps65010_work()
414 mutex_lock(&tps->lock); in tps65010_work()
416 tps65010_interrupt(tps); in tps65010_work()
418 if (test_and_clear_bit(FLAG_VBUS_CHANGED, &tps->flags)) { in tps65010_work()
422 chgconfig = i2c_smbus_read_byte_data(tps->client, in tps65010_work()
425 if (tps->vbus == 500) in tps65010_work()
427 else if (tps->vbus >= 100) in tps65010_work()
430 status = i2c_smbus_write_byte_data(tps->client, in tps65010_work()
434 tmp = i2c_smbus_read_byte_data(tps->client, TPS_CHGCONFIG); in tps65010_work()
435 tps->chgconf = tmp; in tps65010_work()
436 show_chgconfig(tps->por, "update vbus", tmp); in tps65010_work()
439 if (test_and_clear_bit(FLAG_IRQ_ENABLE, &tps->flags)) in tps65010_work()
440 enable_irq(tps->client->irq); in tps65010_work()
442 mutex_unlock(&tps->lock); in tps65010_work()
447 struct tps65010 *tps = _tps; in tps65010_irq() local
450 set_bit(FLAG_IRQ_ENABLE, &tps->flags); in tps65010_irq()
451 schedule_delayed_work(&tps->work, 0); in tps65010_irq()
477 struct tps65010 *tps; in tps65010_output() local
479 tps = container_of(chip, struct tps65010, chip); in tps65010_output()
480 if (!(tps->outmask & (1 << offset))) in tps65010_output()
494 struct tps65010 *tps; in tps65010_gpio_get() local
496 tps = container_of(chip, struct tps65010, chip); in tps65010_gpio_get()
499 value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO); in tps65010_gpio_get()
519 struct tps65010 *tps = i2c_get_clientdata(client); in tps65010_remove() local
529 free_irq(client->irq, tps); in tps65010_remove()
530 cancel_delayed_work_sync(&tps->work); in tps65010_remove()
531 debugfs_remove(tps->file); in tps65010_remove()
532 kfree(tps); in tps65010_remove()
540 struct tps65010 *tps; in tps65010_probe() local
552 tps = kzalloc(sizeof *tps, GFP_KERNEL); in tps65010_probe()
553 if (!tps) in tps65010_probe()
556 mutex_init(&tps->lock); in tps65010_probe()
557 INIT_DELAYED_WORK(&tps->work, tps65010_work); in tps65010_probe()
558 tps->client = client; in tps65010_probe()
559 tps->model = id->driver_data; in tps65010_probe()
567 DRIVER_NAME, tps); in tps65010_probe()
578 set_bit(FLAG_IRQ_ENABLE, &tps->flags); in tps65010_probe()
583 switch (tps->model) { in tps65010_probe()
586 tps->por = 1; in tps65010_probe()
590 tps->chgconf = i2c_smbus_read_byte_data(client, TPS_CHGCONFIG); in tps65010_probe()
591 show_chgconfig(tps->por, "conf/init", tps->chgconf); in tps65010_probe()
606 i2c_set_clientdata(client, tps); in tps65010_probe()
607 the_tps = tps; in tps65010_probe()
614 tps->vbus = 100; in tps65010_probe()
621 tps->nmask1 = ~0; in tps65010_probe()
622 (void) i2c_smbus_write_byte_data(client, TPS_MASK1, ~tps->nmask1); in tps65010_probe()
624 tps->nmask2 = TPS_REG_ONOFF; in tps65010_probe()
625 if (tps->model == TPS65013) in tps65010_probe()
626 tps->nmask2 |= TPS_REG_NO_CHG; in tps65010_probe()
627 (void) i2c_smbus_write_byte_data(client, TPS_MASK2, ~tps->nmask2); in tps65010_probe()
632 tps65010_work(&tps->work.work); in tps65010_probe()
634 tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL, in tps65010_probe()
635 tps, DEBUG_FOPS); in tps65010_probe()
639 tps->outmask = board->outmask; in tps65010_probe()
641 tps->chip.label = client->name; in tps65010_probe()
642 tps->chip.dev = &client->dev; in tps65010_probe()
643 tps->chip.owner = THIS_MODULE; in tps65010_probe()
645 tps->chip.set = tps65010_gpio_set; in tps65010_probe()
646 tps->chip.direction_output = tps65010_output; in tps65010_probe()
649 tps->chip.get = tps65010_gpio_get; in tps65010_probe()
651 tps->chip.base = board->base; in tps65010_probe()
652 tps->chip.ngpio = 7; in tps65010_probe()
653 tps->chip.can_sleep = 1; in tps65010_probe()
655 status = gpiochip_add(&tps->chip); in tps65010_probe()
672 kfree(tps); in tps65010_probe()