Lines Matching refs:tps

184 	struct tps65010	*tps = s->private;  in dbg_show()  local
190 switch (tps->model) { in dbg_show()
200 mutex_lock(&tps->lock); in dbg_show()
206 seq_printf(s, "%scharging\n\n", tps->charging ? "" : "(not) "); in dbg_show()
212 value = i2c_smbus_read_byte_data(tps->client, TPS_CHGCONFIG); in dbg_show()
213 dbg_chgconf(tps->por, buf, sizeof buf, value); in dbg_show()
216 value = i2c_smbus_read_byte_data(tps->client, TPS_CHGSTATUS); in dbg_show()
219 value = i2c_smbus_read_byte_data(tps->client, TPS_MASK1); in dbg_show()
224 value = i2c_smbus_read_byte_data(tps->client, TPS_REGSTATUS); in dbg_show()
227 value = i2c_smbus_read_byte_data(tps->client, TPS_MASK2); in dbg_show()
232 queue_delayed_work(system_power_efficient_wq, &tps->work, in dbg_show()
236 value = i2c_smbus_read_byte_data(tps->client, TPS_VDCDC1); in dbg_show()
240 value = i2c_smbus_read_byte_data(tps->client, TPS_VDCDC2); in dbg_show()
244 value = i2c_smbus_read_byte_data(tps->client, TPS_VREGS1); in dbg_show()
249 value = i2c_smbus_read_byte_data(tps->client, TPS_LED1_ON); in dbg_show()
250 v2 = i2c_smbus_read_byte_data(tps->client, TPS_LED1_PER); in dbg_show()
258 value = i2c_smbus_read_byte_data(tps->client, TPS_LED2_ON); in dbg_show()
259 v2 = i2c_smbus_read_byte_data(tps->client, TPS_LED2_PER); in dbg_show()
267 value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO); in dbg_show()
268 v2 = i2c_smbus_read_byte_data(tps->client, TPS_MASK3); in dbg_show()
282 mutex_unlock(&tps->lock); in dbg_show()
307 static void tps65010_interrupt(struct tps65010 *tps) in tps65010_interrupt() argument
317 if (tps->nmask2) { in tps65010_interrupt()
318 tmp = i2c_smbus_read_byte_data(tps->client, TPS_REGSTATUS); in tps65010_interrupt()
319 mask = tmp ^ tps->regstatus; in tps65010_interrupt()
320 tps->regstatus = tmp; in tps65010_interrupt()
321 mask &= tps->nmask2; in tps65010_interrupt()
325 tps->regstatus = tmp; in tps65010_interrupt()
344 if (tps->nmask1) { in tps65010_interrupt()
345 tmp = i2c_smbus_read_byte_data(tps->client, TPS_CHGSTATUS); in tps65010_interrupt()
346 mask = tmp ^ tps->chgstatus; in tps65010_interrupt()
347 tps->chgstatus = tmp; in tps65010_interrupt()
348 mask &= tps->nmask1; in tps65010_interrupt()
356 show_chgconfig(tps->por, "conf", tps->chgconf); in tps65010_interrupt()
362 if (!(tps->chgstatus & ~(TPS_CHG_USB|TPS_CHG_AC)) in tps65010_interrupt()
363 && (tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC)) in tps65010_interrupt()
364 && (tps->chgconf & TPS_CHARGE_ENABLE) in tps65010_interrupt()
366 if (tps->chgstatus & TPS_CHG_USB) { in tps65010_interrupt()
369 set_bit(FLAG_VBUS_CHANGED, &tps->flags); in tps65010_interrupt()
371 } else if (tps->chgstatus & TPS_CHG_AC) in tps65010_interrupt()
374 if (charging != tps->charging) { in tps65010_interrupt()
375 tps->charging = charging; in tps65010_interrupt()
378 ((tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC)) in tps65010_interrupt()
386 if ((tps->model != TPS65013 || !tps->charging) in tps65010_interrupt()
387 && (tps->chgstatus & (TPS_CHG_USB|TPS_CHG_AC))) in tps65010_interrupt()
390 queue_delayed_work(system_power_efficient_wq, &tps->work, in tps65010_interrupt()
399 struct tps65010 *tps; in tps65010_work() local
401 tps = container_of(to_delayed_work(work), struct tps65010, work); in tps65010_work()
402 mutex_lock(&tps->lock); in tps65010_work()
404 tps65010_interrupt(tps); in tps65010_work()
406 if (test_and_clear_bit(FLAG_VBUS_CHANGED, &tps->flags)) { in tps65010_work()
409 chgconfig = i2c_smbus_read_byte_data(tps->client, in tps65010_work()
412 if (tps->vbus == 500) in tps65010_work()
414 else if (tps->vbus >= 100) in tps65010_work()
417 i2c_smbus_write_byte_data(tps->client, in tps65010_work()
421 tmp = i2c_smbus_read_byte_data(tps->client, TPS_CHGCONFIG); in tps65010_work()
422 tps->chgconf = tmp; in tps65010_work()
423 show_chgconfig(tps->por, "update vbus", tmp); in tps65010_work()
426 if (test_and_clear_bit(FLAG_IRQ_ENABLE, &tps->flags)) in tps65010_work()
427 enable_irq(tps->client->irq); in tps65010_work()
429 mutex_unlock(&tps->lock); in tps65010_work()
434 struct tps65010 *tps = _tps; in tps65010_irq() local
437 set_bit(FLAG_IRQ_ENABLE, &tps->flags); in tps65010_irq()
438 queue_delayed_work(system_power_efficient_wq, &tps->work, 0); in tps65010_irq()
464 struct tps65010 *tps; in tps65010_output() local
466 tps = gpiochip_get_data(chip); in tps65010_output()
467 if (!(tps->outmask & (1 << offset))) in tps65010_output()
481 struct tps65010 *tps; in tps65010_gpio_get() local
483 tps = gpiochip_get_data(chip); in tps65010_gpio_get()
486 value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO); in tps65010_gpio_get()
506 struct tps65010 *tps = i2c_get_clientdata(client); in tps65010_remove() local
516 free_irq(client->irq, tps); in tps65010_remove()
517 cancel_delayed_work_sync(&tps->work); in tps65010_remove()
518 debugfs_remove(tps->file); in tps65010_remove()
525 struct tps65010 *tps; in tps65010_probe() local
537 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); in tps65010_probe()
538 if (!tps) in tps65010_probe()
541 mutex_init(&tps->lock); in tps65010_probe()
542 INIT_DELAYED_WORK(&tps->work, tps65010_work); in tps65010_probe()
543 tps->client = client; in tps65010_probe()
544 tps->model = id->driver_data; in tps65010_probe()
551 IRQF_TRIGGER_FALLING, DRIVER_NAME, tps); in tps65010_probe()
562 set_bit(FLAG_IRQ_ENABLE, &tps->flags); in tps65010_probe()
567 switch (tps->model) { in tps65010_probe()
570 tps->por = 1; in tps65010_probe()
574 tps->chgconf = i2c_smbus_read_byte_data(client, TPS_CHGCONFIG); in tps65010_probe()
575 show_chgconfig(tps->por, "conf/init", tps->chgconf); in tps65010_probe()
590 i2c_set_clientdata(client, tps); in tps65010_probe()
591 the_tps = tps; in tps65010_probe()
598 tps->vbus = 100; in tps65010_probe()
605 tps->nmask1 = ~0; in tps65010_probe()
606 (void) i2c_smbus_write_byte_data(client, TPS_MASK1, ~tps->nmask1); in tps65010_probe()
608 tps->nmask2 = TPS_REG_ONOFF; in tps65010_probe()
609 if (tps->model == TPS65013) in tps65010_probe()
610 tps->nmask2 |= TPS_REG_NO_CHG; in tps65010_probe()
611 (void) i2c_smbus_write_byte_data(client, TPS_MASK2, ~tps->nmask2); in tps65010_probe()
616 tps65010_work(&tps->work.work); in tps65010_probe()
618 tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL, in tps65010_probe()
619 tps, DEBUG_FOPS); in tps65010_probe()
623 tps->outmask = board->outmask; in tps65010_probe()
625 tps->chip.label = client->name; in tps65010_probe()
626 tps->chip.parent = &client->dev; in tps65010_probe()
627 tps->chip.owner = THIS_MODULE; in tps65010_probe()
629 tps->chip.set = tps65010_gpio_set; in tps65010_probe()
630 tps->chip.direction_output = tps65010_output; in tps65010_probe()
633 tps->chip.get = tps65010_gpio_get; in tps65010_probe()
635 tps->chip.base = board->base; in tps65010_probe()
636 tps->chip.ngpio = 7; in tps65010_probe()
637 tps->chip.can_sleep = 1; in tps65010_probe()
639 status = gpiochip_add_data(&tps->chip, tps); in tps65010_probe()