Lines Matching refs:power
536 struct wm831x_power *power; in wm831x_power_probe() local
539 power = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_power), in wm831x_power_probe()
541 if (power == NULL) in wm831x_power_probe()
544 power->wm831x = wm831x; in wm831x_power_probe()
545 platform_set_drvdata(pdev, power); in wm831x_power_probe()
548 snprintf(power->wall_name, sizeof(power->wall_name), in wm831x_power_probe()
550 snprintf(power->battery_name, sizeof(power->wall_name), in wm831x_power_probe()
552 snprintf(power->usb_name, sizeof(power->wall_name), in wm831x_power_probe()
555 snprintf(power->wall_name, sizeof(power->wall_name), in wm831x_power_probe()
557 snprintf(power->battery_name, sizeof(power->wall_name), in wm831x_power_probe()
559 snprintf(power->usb_name, sizeof(power->wall_name), in wm831x_power_probe()
568 power->wall_desc.name = power->wall_name; in wm831x_power_probe()
569 power->wall_desc.type = POWER_SUPPLY_TYPE_MAINS; in wm831x_power_probe()
570 power->wall_desc.properties = wm831x_wall_props; in wm831x_power_probe()
571 power->wall_desc.num_properties = ARRAY_SIZE(wm831x_wall_props); in wm831x_power_probe()
572 power->wall_desc.get_property = wm831x_wall_get_prop; in wm831x_power_probe()
573 power->wall = power_supply_register(&pdev->dev, &power->wall_desc, in wm831x_power_probe()
575 if (IS_ERR(power->wall)) { in wm831x_power_probe()
576 ret = PTR_ERR(power->wall); in wm831x_power_probe()
580 power->usb_desc.name = power->usb_name, in wm831x_power_probe()
581 power->usb_desc.type = POWER_SUPPLY_TYPE_USB; in wm831x_power_probe()
582 power->usb_desc.properties = wm831x_usb_props; in wm831x_power_probe()
583 power->usb_desc.num_properties = ARRAY_SIZE(wm831x_usb_props); in wm831x_power_probe()
584 power->usb_desc.get_property = wm831x_usb_get_prop; in wm831x_power_probe()
585 power->usb = power_supply_register(&pdev->dev, &power->usb_desc, NULL); in wm831x_power_probe()
586 if (IS_ERR(power->usb)) { in wm831x_power_probe()
587 ret = PTR_ERR(power->usb); in wm831x_power_probe()
594 power->have_battery = ret & WM831X_CHG_ENA; in wm831x_power_probe()
596 if (power->have_battery) { in wm831x_power_probe()
597 power->battery_desc.name = power->battery_name; in wm831x_power_probe()
598 power->battery_desc.properties = wm831x_bat_props; in wm831x_power_probe()
599 power->battery_desc.num_properties = ARRAY_SIZE(wm831x_bat_props); in wm831x_power_probe()
600 power->battery_desc.get_property = wm831x_bat_get_prop; in wm831x_power_probe()
601 power->battery_desc.use_for_apm = 1; in wm831x_power_probe()
602 power->battery = power_supply_register(&pdev->dev, in wm831x_power_probe()
603 &power->battery_desc, in wm831x_power_probe()
605 if (IS_ERR(power->battery)) { in wm831x_power_probe()
606 ret = PTR_ERR(power->battery); in wm831x_power_probe()
614 power); in wm831x_power_probe()
624 power); in wm831x_power_probe()
638 power); in wm831x_power_probe()
647 power->usb_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "phys", 0); in wm831x_power_probe()
648 ret = PTR_ERR_OR_ZERO(power->usb_phy); in wm831x_power_probe()
652 power->usb_notify.notifier_call = wm831x_usb_limit_change; in wm831x_power_probe()
653 ret = usb_register_notifier(power->usb_phy, &power->usb_notify); in wm831x_power_probe()
663 power->usb_phy = NULL; in wm831x_power_probe()
679 free_irq(irq, power); in wm831x_power_probe()
682 free_irq(irq, power); in wm831x_power_probe()
685 free_irq(irq, power); in wm831x_power_probe()
687 if (power->have_battery) in wm831x_power_probe()
688 power_supply_unregister(power->battery); in wm831x_power_probe()
690 power_supply_unregister(power->usb); in wm831x_power_probe()
692 power_supply_unregister(power->wall); in wm831x_power_probe()