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()
410 chgconfig = i2c_smbus_read_byte_data(tps->client, in tps65010_work()
413 if (tps->vbus == 500) in tps65010_work()
415 else if (tps->vbus >= 100) in tps65010_work()
418 status = i2c_smbus_write_byte_data(tps->client, in tps65010_work()
422 tmp = i2c_smbus_read_byte_data(tps->client, TPS_CHGCONFIG); in tps65010_work()
423 tps->chgconf = tmp; in tps65010_work()
424 show_chgconfig(tps->por, "update vbus", tmp); in tps65010_work()
427 if (test_and_clear_bit(FLAG_IRQ_ENABLE, &tps->flags)) in tps65010_work()
428 enable_irq(tps->client->irq); in tps65010_work()
430 mutex_unlock(&tps->lock); in tps65010_work()
435 struct tps65010 *tps = _tps; in tps65010_irq() local
438 set_bit(FLAG_IRQ_ENABLE, &tps->flags); in tps65010_irq()
439 queue_delayed_work(system_power_efficient_wq, &tps->work, 0); in tps65010_irq()
465 struct tps65010 *tps; in tps65010_output() local
467 tps = gpiochip_get_data(chip); in tps65010_output()
468 if (!(tps->outmask & (1 << offset))) in tps65010_output()
482 struct tps65010 *tps; in tps65010_gpio_get() local
484 tps = gpiochip_get_data(chip); in tps65010_gpio_get()
487 value = i2c_smbus_read_byte_data(tps->client, TPS_DEFGPIO); in tps65010_gpio_get()
507 struct tps65010 *tps = i2c_get_clientdata(client); in tps65010_remove() local
517 free_irq(client->irq, tps); in tps65010_remove()
518 cancel_delayed_work_sync(&tps->work); in tps65010_remove()
519 debugfs_remove(tps->file); in tps65010_remove()
527 struct tps65010 *tps; in tps65010_probe() local
539 tps = devm_kzalloc(&client->dev, sizeof(*tps), GFP_KERNEL); in tps65010_probe()
540 if (!tps) in tps65010_probe()
543 mutex_init(&tps->lock); in tps65010_probe()
544 INIT_DELAYED_WORK(&tps->work, tps65010_work); in tps65010_probe()
545 tps->client = client; in tps65010_probe()
546 tps->model = id->driver_data; in tps65010_probe()
553 IRQF_TRIGGER_FALLING, DRIVER_NAME, tps); in tps65010_probe()
564 set_bit(FLAG_IRQ_ENABLE, &tps->flags); in tps65010_probe()
569 switch (tps->model) { in tps65010_probe()
572 tps->por = 1; in tps65010_probe()
576 tps->chgconf = i2c_smbus_read_byte_data(client, TPS_CHGCONFIG); in tps65010_probe()
577 show_chgconfig(tps->por, "conf/init", tps->chgconf); in tps65010_probe()
592 i2c_set_clientdata(client, tps); in tps65010_probe()
593 the_tps = tps; in tps65010_probe()
600 tps->vbus = 100; in tps65010_probe()
607 tps->nmask1 = ~0; in tps65010_probe()
608 (void) i2c_smbus_write_byte_data(client, TPS_MASK1, ~tps->nmask1); in tps65010_probe()
610 tps->nmask2 = TPS_REG_ONOFF; in tps65010_probe()
611 if (tps->model == TPS65013) in tps65010_probe()
612 tps->nmask2 |= TPS_REG_NO_CHG; in tps65010_probe()
613 (void) i2c_smbus_write_byte_data(client, TPS_MASK2, ~tps->nmask2); in tps65010_probe()
618 tps65010_work(&tps->work.work); in tps65010_probe()
620 tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL, in tps65010_probe()
621 tps, DEBUG_FOPS); in tps65010_probe()
625 tps->outmask = board->outmask; in tps65010_probe()
627 tps->chip.label = client->name; in tps65010_probe()
628 tps->chip.parent = &client->dev; in tps65010_probe()
629 tps->chip.owner = THIS_MODULE; in tps65010_probe()
631 tps->chip.set = tps65010_gpio_set; in tps65010_probe()
632 tps->chip.direction_output = tps65010_output; in tps65010_probe()
635 tps->chip.get = tps65010_gpio_get; in tps65010_probe()
637 tps->chip.base = board->base; in tps65010_probe()
638 tps->chip.ngpio = 7; in tps65010_probe()
639 tps->chip.can_sleep = 1; in tps65010_probe()
641 status = gpiochip_add_data(&tps->chip, tps); in tps65010_probe()