Lines Matching refs:smb

307 static int smb347_update_ps_status(struct smb347_charger *smb)  in smb347_update_ps_status()  argument
314 ret = regmap_read(smb->regmap, IRQSTAT_E, &val); in smb347_update_ps_status()
322 if (smb->use_mains) in smb347_update_ps_status()
324 if (smb->use_usb) in smb347_update_ps_status()
327 ret = smb->mains_online != dc || smb->usb_online != usb; in smb347_update_ps_status()
328 smb->mains_online = dc; in smb347_update_ps_status()
329 smb->usb_online = usb; in smb347_update_ps_status()
343 static bool smb347_is_ps_online(struct smb347_charger *smb) in smb347_is_ps_online() argument
345 return smb->usb_online || smb->mains_online; in smb347_is_ps_online()
355 static int smb347_charging_status(struct smb347_charger *smb) in smb347_charging_status() argument
360 if (!smb347_is_ps_online(smb)) in smb347_charging_status()
363 ret = regmap_read(smb->regmap, STAT_C, &val); in smb347_charging_status()
370 static int smb347_charging_set(struct smb347_charger *smb, bool enable) in smb347_charging_set() argument
372 if (smb->enable_control != SMB3XX_CHG_ENABLE_SW) { in smb347_charging_set()
373 dev_dbg(smb->dev, "charging enable/disable in SW disabled\n"); in smb347_charging_set()
377 if (enable && smb->usb_vbus_enabled) { in smb347_charging_set()
378 dev_dbg(smb->dev, "charging not enabled because USB is in host mode\n"); in smb347_charging_set()
382 return regmap_update_bits(smb->regmap, CMD_A, CMD_A_CHG_ENABLED, in smb347_charging_set()
386 static inline int smb347_charging_enable(struct smb347_charger *smb) in smb347_charging_enable() argument
388 return smb347_charging_set(smb, true); in smb347_charging_enable()
391 static inline int smb347_charging_disable(struct smb347_charger *smb) in smb347_charging_disable() argument
393 return smb347_charging_set(smb, false); in smb347_charging_disable()
396 static int smb347_start_stop_charging(struct smb347_charger *smb) in smb347_start_stop_charging() argument
405 if (smb347_is_ps_online(smb)) { in smb347_start_stop_charging()
406 ret = smb347_charging_enable(smb); in smb347_start_stop_charging()
408 dev_err(smb->dev, "failed to enable charging\n"); in smb347_start_stop_charging()
410 ret = smb347_charging_disable(smb); in smb347_start_stop_charging()
412 dev_err(smb->dev, "failed to disable charging\n"); in smb347_start_stop_charging()
418 static int smb347_set_charge_current(struct smb347_charger *smb) in smb347_set_charge_current() argument
420 unsigned int id = smb->id; in smb347_set_charge_current()
423 if (smb->max_charge_current) { in smb347_set_charge_current()
425 smb->max_charge_current); in smb347_set_charge_current()
429 ret = regmap_update_bits(smb->regmap, CFG_CHARGE_CURRENT, in smb347_set_charge_current()
436 if (smb->pre_charge_current) { in smb347_set_charge_current()
438 smb->pre_charge_current); in smb347_set_charge_current()
442 ret = regmap_update_bits(smb->regmap, CFG_CHARGE_CURRENT, in smb347_set_charge_current()
449 if (smb->termination_current) { in smb347_set_charge_current()
451 smb->termination_current); in smb347_set_charge_current()
455 ret = regmap_update_bits(smb->regmap, CFG_CHARGE_CURRENT, in smb347_set_charge_current()
464 static int smb347_set_current_limits(struct smb347_charger *smb) in smb347_set_current_limits() argument
466 unsigned int id = smb->id; in smb347_set_current_limits()
469 if (smb->mains_current_limit) { in smb347_set_current_limits()
471 smb->mains_current_limit); in smb347_set_current_limits()
475 ret = regmap_update_bits(smb->regmap, CFG_CURRENT_LIMIT, in smb347_set_current_limits()
482 if (smb->usb_hc_current_limit) { in smb347_set_current_limits()
484 smb->usb_hc_current_limit); in smb347_set_current_limits()
488 ret = regmap_update_bits(smb->regmap, CFG_CURRENT_LIMIT, in smb347_set_current_limits()
497 static int smb347_set_voltage_limits(struct smb347_charger *smb) in smb347_set_voltage_limits() argument
501 if (smb->pre_to_fast_voltage) { in smb347_set_voltage_limits()
502 ret = smb->pre_to_fast_voltage; in smb347_set_voltage_limits()
508 ret = regmap_update_bits(smb->regmap, CFG_FLOAT_VOLTAGE, in smb347_set_voltage_limits()
515 if (smb->max_charge_voltage) { in smb347_set_voltage_limits()
516 ret = smb->max_charge_voltage; in smb347_set_voltage_limits()
522 ret = regmap_update_bits(smb->regmap, CFG_FLOAT_VOLTAGE, in smb347_set_voltage_limits()
531 static int smb347_set_temp_limits(struct smb347_charger *smb) in smb347_set_temp_limits() argument
533 unsigned int id = smb->id; in smb347_set_temp_limits()
538 if (smb->chip_temp_threshold) { in smb347_set_temp_limits()
539 val = smb->chip_temp_threshold; in smb347_set_temp_limits()
545 ret = regmap_update_bits(smb->regmap, CFG_OTG, in smb347_set_temp_limits()
552 if (smb->soft_cold_temp_limit != SMB3XX_TEMP_USE_DEFAULT) { in smb347_set_temp_limits()
553 val = smb->soft_cold_temp_limit; in smb347_set_temp_limits()
560 ret = regmap_update_bits(smb->regmap, CFG_TEMP_LIMIT, in smb347_set_temp_limits()
569 if (smb->soft_hot_temp_limit != SMB3XX_TEMP_USE_DEFAULT) { in smb347_set_temp_limits()
570 val = smb->soft_hot_temp_limit; in smb347_set_temp_limits()
575 ret = regmap_update_bits(smb->regmap, CFG_TEMP_LIMIT, in smb347_set_temp_limits()
584 if (smb->hard_cold_temp_limit != SMB3XX_TEMP_USE_DEFAULT) { in smb347_set_temp_limits()
585 val = smb->hard_cold_temp_limit; in smb347_set_temp_limits()
592 ret = regmap_update_bits(smb->regmap, CFG_TEMP_LIMIT, in smb347_set_temp_limits()
601 if (smb->hard_hot_temp_limit != SMB3XX_TEMP_USE_DEFAULT) { in smb347_set_temp_limits()
602 val = smb->hard_hot_temp_limit; in smb347_set_temp_limits()
607 ret = regmap_update_bits(smb->regmap, CFG_TEMP_LIMIT, in smb347_set_temp_limits()
627 ret = regmap_update_bits(smb->regmap, CFG_THERM, in smb347_set_temp_limits()
633 if (smb->suspend_on_hard_temp_limit) { in smb347_set_temp_limits()
634 ret = regmap_update_bits(smb->regmap, CFG_SYSOK, in smb347_set_temp_limits()
640 if (smb->soft_temp_limit_compensation != in smb347_set_temp_limits()
642 val = smb->soft_temp_limit_compensation & 0x3; in smb347_set_temp_limits()
644 ret = regmap_update_bits(smb->regmap, CFG_THERM, in smb347_set_temp_limits()
650 ret = regmap_update_bits(smb->regmap, CFG_THERM, in smb347_set_temp_limits()
657 if (smb->charge_current_compensation) { in smb347_set_temp_limits()
659 smb->charge_current_compensation); in smb347_set_temp_limits()
663 ret = regmap_update_bits(smb->regmap, CFG_OTG, in smb347_set_temp_limits()
682 static int smb347_set_writable(struct smb347_charger *smb, bool writable, in smb347_set_writable() argument
685 struct i2c_client *client = to_i2c_client(smb->dev); in smb347_set_writable()
688 if (writable && irq_toggle && !smb->irq_unsupported) in smb347_set_writable()
691 ret = regmap_update_bits(smb->regmap, CMD_A, CMD_A_ALLOW_WRITE, in smb347_set_writable()
694 if ((!writable || ret) && irq_toggle && !smb->irq_unsupported) in smb347_set_writable()
700 static int smb347_hw_init(struct smb347_charger *smb) in smb347_hw_init() argument
705 ret = smb347_set_writable(smb, true, false); in smb347_hw_init()
713 ret = smb347_set_charge_current(smb); in smb347_hw_init()
717 ret = smb347_set_current_limits(smb); in smb347_hw_init()
721 ret = smb347_set_voltage_limits(smb); in smb347_hw_init()
725 ret = smb347_set_temp_limits(smb); in smb347_hw_init()
730 if (!smb->use_usb) { in smb347_hw_init()
731 ret = regmap_update_bits(smb->regmap, CMD_A, in smb347_hw_init()
742 ret = regmap_update_bits(smb->regmap, CFG_OTHER, CFG_OTHER_RID_MASK, in smb347_hw_init()
743 smb->use_usb_otg ? CFG_OTHER_RID_ENABLED_AUTO_OTG : 0); in smb347_hw_init()
748 switch (smb->enable_control) { in smb347_hw_init()
751 ret = regmap_set_bits(smb->regmap, CFG_PIN, CFG_PIN_EN_CTRL); in smb347_hw_init()
761 switch (smb->enable_control) { in smb347_hw_init()
773 ret = regmap_update_bits(smb->regmap, CFG_PIN, CFG_PIN_EN_CTRL_MASK, in smb347_hw_init()
779 ret = regmap_update_bits(smb->regmap, CFG_PIN, CFG_PIN_EN_APSD_IRQ, 0); in smb347_hw_init()
783 ret = smb347_update_ps_status(smb); in smb347_hw_init()
787 ret = smb347_start_stop_charging(smb); in smb347_hw_init()
790 smb347_set_writable(smb, false, false); in smb347_hw_init()
796 struct smb347_charger *smb = data; in smb347_interrupt() local
804 ret = regmap_read(smb->regmap, STAT_C, &stat_c); in smb347_interrupt()
806 dev_warn(smb->dev, "reading STAT_C failed\n"); in smb347_interrupt()
810 ret = regmap_read(smb->regmap, IRQSTAT_C, &irqstat_c); in smb347_interrupt()
812 dev_warn(smb->dev, "reading IRQSTAT_C failed\n"); in smb347_interrupt()
816 ret = regmap_read(smb->regmap, IRQSTAT_D, &irqstat_d); in smb347_interrupt()
818 dev_warn(smb->dev, "reading IRQSTAT_D failed\n"); in smb347_interrupt()
822 ret = regmap_read(smb->regmap, IRQSTAT_E, &irqstat_e); in smb347_interrupt()
824 dev_warn(smb->dev, "reading IRQSTAT_E failed\n"); in smb347_interrupt()
833 dev_err(smb->dev, "charging stopped due to charger error\n"); in smb347_interrupt()
834 if (smb->use_mains) in smb347_interrupt()
835 power_supply_changed(smb->mains); in smb347_interrupt()
836 if (smb->use_usb) in smb347_interrupt()
837 power_supply_changed(smb->usb); in smb347_interrupt()
848 if (smb->use_mains) in smb347_interrupt()
849 power_supply_changed(smb->mains); in smb347_interrupt()
850 if (smb->use_usb) in smb347_interrupt()
851 power_supply_changed(smb->usb); in smb347_interrupt()
853 dev_dbg(smb->dev, "going to HW maintenance mode\n"); in smb347_interrupt()
862 dev_dbg(smb->dev, "total Charge Timeout INT received\n"); in smb347_interrupt()
865 dev_warn(smb->dev, "charging stopped due to timeout\n"); in smb347_interrupt()
866 if (smb->use_mains) in smb347_interrupt()
867 power_supply_changed(smb->mains); in smb347_interrupt()
868 if (smb->use_usb) in smb347_interrupt()
869 power_supply_changed(smb->usb); in smb347_interrupt()
878 if (smb347_update_ps_status(smb) > 0) { in smb347_interrupt()
879 smb347_start_stop_charging(smb); in smb347_interrupt()
880 if (smb->use_mains) in smb347_interrupt()
881 power_supply_changed(smb->mains); in smb347_interrupt()
882 if (smb->use_usb) in smb347_interrupt()
883 power_supply_changed(smb->usb); in smb347_interrupt()
891 static int smb347_irq_set(struct smb347_charger *smb, bool enable) in smb347_irq_set() argument
895 if (smb->irq_unsupported) in smb347_irq_set()
898 ret = smb347_set_writable(smb, true, true); in smb347_irq_set()
909 ret = regmap_update_bits(smb->regmap, CFG_FAULT_IRQ, 0xff, in smb347_irq_set()
914 ret = regmap_update_bits(smb->regmap, CFG_STATUS_IRQ, 0xff, in smb347_irq_set()
920 ret = regmap_update_bits(smb->regmap, CFG_PIN, CFG_PIN_EN_CHARGER_ERROR, in smb347_irq_set()
923 smb347_set_writable(smb, false, true); in smb347_irq_set()
927 static inline int smb347_irq_enable(struct smb347_charger *smb) in smb347_irq_enable() argument
929 return smb347_irq_set(smb, true); in smb347_irq_enable()
932 static inline int smb347_irq_disable(struct smb347_charger *smb) in smb347_irq_disable() argument
934 return smb347_irq_set(smb, false); in smb347_irq_disable()
937 static int smb347_irq_init(struct smb347_charger *smb, in smb347_irq_init() argument
942 smb->irq_unsupported = true; in smb347_irq_init()
951 ret = smb347_set_writable(smb, true, false); in smb347_irq_init()
959 ret = regmap_update_bits(smb->regmap, CFG_STAT, in smb347_irq_init()
963 smb347_set_writable(smb, false, false); in smb347_irq_init()
966 dev_warn(smb->dev, "failed to initialize IRQ: %d\n", ret); in smb347_irq_init()
967 dev_warn(smb->dev, "disabling IRQ support\n"); in smb347_irq_init()
971 ret = devm_request_threaded_irq(smb->dev, client->irq, NULL, in smb347_irq_init()
973 client->name, smb); in smb347_irq_init()
977 smb->irq_unsupported = false; in smb347_irq_init()
979 ret = smb347_irq_enable(smb); in smb347_irq_init()
990 static int get_const_charge_current(struct smb347_charger *smb) in get_const_charge_current() argument
992 unsigned int id = smb->id; in get_const_charge_current()
996 if (!smb347_is_ps_online(smb)) in get_const_charge_current()
999 ret = regmap_read(smb->regmap, STAT_B, &v); in get_const_charge_current()
1023 static int get_const_charge_voltage(struct smb347_charger *smb) in get_const_charge_voltage() argument
1028 if (!smb347_is_ps_online(smb)) in get_const_charge_voltage()
1031 ret = regmap_read(smb->regmap, STAT_A, &v); in get_const_charge_voltage()
1044 static int smb347_get_charging_status(struct smb347_charger *smb, in smb347_get_charging_status() argument
1051 if (!smb->usb_online) in smb347_get_charging_status()
1054 if (!smb->mains_online) in smb347_get_charging_status()
1058 ret = regmap_read(smb->regmap, STAT_C, &val); in smb347_get_charging_status()
1099 struct smb347_charger *smb = power_supply_get_drvdata(psy); in smb347_get_property_locked() local
1104 ret = smb347_get_charging_status(smb, psy); in smb347_get_property_locked()
1112 if (!smb->usb_online) in smb347_get_property_locked()
1115 if (!smb->mains_online) in smb347_get_property_locked()
1123 switch (smb347_charging_status(smb)) { in smb347_get_property_locked()
1138 val->intval = smb->usb_online; in smb347_get_property_locked()
1140 val->intval = smb->mains_online; in smb347_get_property_locked()
1144 ret = get_const_charge_voltage(smb); in smb347_get_property_locked()
1151 ret = get_const_charge_current(smb); in smb347_get_property_locked()
1168 struct smb347_charger *smb = power_supply_get_drvdata(psy); in smb347_get_property() local
1169 struct i2c_client *client = to_i2c_client(smb->dev); in smb347_get_property()
1172 if (!smb->irq_unsupported) in smb347_get_property()
1177 if (!smb->irq_unsupported) in smb347_get_property()
1234 static void smb347_dt_parse_dev_info(struct smb347_charger *smb) in smb347_dt_parse_dev_info() argument
1236 struct device *dev = smb->dev; in smb347_dt_parse_dev_info()
1238 smb->soft_temp_limit_compensation = in smb347_dt_parse_dev_info()
1244 smb->soft_cold_temp_limit = SMB3XX_TEMP_USE_DEFAULT; in smb347_dt_parse_dev_info()
1245 smb->hard_cold_temp_limit = SMB3XX_TEMP_USE_DEFAULT; in smb347_dt_parse_dev_info()
1246 smb->soft_hot_temp_limit = SMB3XX_TEMP_USE_DEFAULT; in smb347_dt_parse_dev_info()
1247 smb->hard_hot_temp_limit = SMB3XX_TEMP_USE_DEFAULT; in smb347_dt_parse_dev_info()
1251 &smb->pre_to_fast_voltage); in smb347_dt_parse_dev_info()
1253 &smb->mains_current_limit); in smb347_dt_parse_dev_info()
1255 &smb->usb_hc_current_limit); in smb347_dt_parse_dev_info()
1259 &smb->chip_temp_threshold); in smb347_dt_parse_dev_info()
1261 &smb->soft_temp_limit_compensation); in smb347_dt_parse_dev_info()
1263 &smb->charge_current_compensation); in smb347_dt_parse_dev_info()
1266 smb->use_mains = device_property_read_bool(dev, "summit,enable-mains-charging"); in smb347_dt_parse_dev_info()
1267 smb->use_usb = device_property_read_bool(dev, "summit,enable-usb-charging"); in smb347_dt_parse_dev_info()
1268 smb->use_usb_otg = device_property_read_bool(dev, "summit,enable-otg-charging"); in smb347_dt_parse_dev_info()
1272 &smb->enable_control); in smb347_dt_parse_dev_info()
1279 &smb->inok_polarity); in smb347_dt_parse_dev_info()
1282 static int smb347_get_battery_info(struct smb347_charger *smb) in smb347_get_battery_info() argument
1288 if (smb->mains) in smb347_get_battery_info()
1289 supply = smb->mains; in smb347_get_battery_info()
1291 supply = smb->usb; in smb347_get_battery_info()
1300 smb->max_charge_current = info->constant_charge_current_max_ua; in smb347_get_battery_info()
1303 smb->max_charge_voltage = info->constant_charge_voltage_max_uv; in smb347_get_battery_info()
1306 smb->pre_charge_current = info->precharge_current_ua; in smb347_get_battery_info()
1309 smb->termination_current = info->charge_term_current_ua; in smb347_get_battery_info()
1312 smb->soft_cold_temp_limit = info->temp_alert_min; in smb347_get_battery_info()
1315 smb->soft_hot_temp_limit = info->temp_alert_max; in smb347_get_battery_info()
1318 smb->hard_cold_temp_limit = info->temp_min; in smb347_get_battery_info()
1321 smb->hard_hot_temp_limit = info->temp_max; in smb347_get_battery_info()
1324 if (smb->hard_cold_temp_limit != SMB3XX_TEMP_USE_DEFAULT || in smb347_get_battery_info()
1325 smb->hard_hot_temp_limit != SMB3XX_TEMP_USE_DEFAULT) in smb347_get_battery_info()
1326 smb->suspend_on_hard_temp_limit = true; in smb347_get_battery_info()
1333 struct smb347_charger *smb = rdev_get_drvdata(rdev); in smb347_usb_vbus_get_current_limit() local
1337 ret = regmap_read(smb->regmap, CFG_OTG, &val); in smb347_usb_vbus_get_current_limit()
1351 static int smb347_usb_vbus_set_new_current_limit(struct smb347_charger *smb, in smb347_usb_vbus_set_new_current_limit() argument
1362 ret = regmap_update_bits(smb->regmap, CFG_OTG, mask, val); in smb347_usb_vbus_set_new_current_limit()
1364 dev_err(smb->dev, "failed to change USB current limit\n"); in smb347_usb_vbus_set_new_current_limit()
1372 struct smb347_charger *smb = rdev_get_drvdata(rdev); in smb347_usb_vbus_set_current_limit() local
1375 ret = smb347_set_writable(smb, true, true); in smb347_usb_vbus_set_current_limit()
1379 ret = smb347_usb_vbus_set_new_current_limit(smb, max_uA); in smb347_usb_vbus_set_current_limit()
1380 smb347_set_writable(smb, false, true); in smb347_usb_vbus_set_current_limit()
1387 struct smb347_charger *smb = rdev_get_drvdata(rdev); in smb347_usb_vbus_regulator_enable() local
1390 ret = smb347_set_writable(smb, true, true); in smb347_usb_vbus_regulator_enable()
1394 smb347_charging_disable(smb); in smb347_usb_vbus_regulator_enable()
1399 if (smb->inok_polarity == SMB3XX_SYSOK_INOK_ACTIVE_LOW) in smb347_usb_vbus_regulator_enable()
1406 ret = regmap_update_bits(smb->regmap, CFG_SYSOK, in smb347_usb_vbus_regulator_enable()
1409 dev_err(smb->dev, "failed to disable INOK\n"); in smb347_usb_vbus_regulator_enable()
1416 dev_err(smb->dev, "failed to get USB VBUS current limit\n"); in smb347_usb_vbus_regulator_enable()
1422 ret = smb347_usb_vbus_set_new_current_limit(smb, 250000); in smb347_usb_vbus_regulator_enable()
1424 dev_err(smb->dev, "failed to preset USB VBUS current limit\n"); in smb347_usb_vbus_regulator_enable()
1428 ret = regmap_set_bits(smb->regmap, CMD_A, CMD_A_OTG_ENABLED); in smb347_usb_vbus_regulator_enable()
1430 dev_err(smb->dev, "failed to enable USB VBUS\n"); in smb347_usb_vbus_regulator_enable()
1434 smb->usb_vbus_enabled = true; in smb347_usb_vbus_regulator_enable()
1436 ret = smb347_usb_vbus_set_new_current_limit(smb, max_uA); in smb347_usb_vbus_regulator_enable()
1438 dev_err(smb->dev, "failed to restore USB VBUS current limit\n"); in smb347_usb_vbus_regulator_enable()
1442 smb347_set_writable(smb, false, true); in smb347_usb_vbus_regulator_enable()
1449 struct smb347_charger *smb = rdev_get_drvdata(rdev); in smb347_usb_vbus_regulator_disable() local
1452 ret = smb347_set_writable(smb, true, true); in smb347_usb_vbus_regulator_disable()
1456 ret = regmap_clear_bits(smb->regmap, CMD_A, CMD_A_OTG_ENABLED); in smb347_usb_vbus_regulator_disable()
1458 dev_err(smb->dev, "failed to disable USB VBUS\n"); in smb347_usb_vbus_regulator_disable()
1462 smb->usb_vbus_enabled = false; in smb347_usb_vbus_regulator_disable()
1467 if (smb->inok_polarity == SMB3XX_SYSOK_INOK_ACTIVE_HIGH) in smb347_usb_vbus_regulator_disable()
1470 ret = regmap_update_bits(smb->regmap, CFG_SYSOK, in smb347_usb_vbus_regulator_disable()
1473 dev_err(smb->dev, "failed to enable INOK\n"); in smb347_usb_vbus_regulator_disable()
1478 smb347_start_stop_charging(smb); in smb347_usb_vbus_regulator_disable()
1480 smb347_set_writable(smb, false, true); in smb347_usb_vbus_regulator_disable()
1537 struct smb347_charger *smb; in smb347_probe() local
1540 smb = devm_kzalloc(dev, sizeof(*smb), GFP_KERNEL); in smb347_probe()
1541 if (!smb) in smb347_probe()
1543 smb->dev = &client->dev; in smb347_probe()
1544 smb->id = id->driver_data; in smb347_probe()
1545 i2c_set_clientdata(client, smb); in smb347_probe()
1547 smb347_dt_parse_dev_info(smb); in smb347_probe()
1548 if (!smb->use_mains && !smb->use_usb) in smb347_probe()
1551 smb->regmap = devm_regmap_init_i2c(client, &smb347_regmap); in smb347_probe()
1552 if (IS_ERR(smb->regmap)) in smb347_probe()
1553 return PTR_ERR(smb->regmap); in smb347_probe()
1555 mains_usb_cfg.drv_data = smb; in smb347_probe()
1557 if (smb->use_mains) { in smb347_probe()
1558 smb->mains = devm_power_supply_register(dev, &smb347_mains_desc, in smb347_probe()
1560 if (IS_ERR(smb->mains)) in smb347_probe()
1561 return PTR_ERR(smb->mains); in smb347_probe()
1564 if (smb->use_usb) { in smb347_probe()
1565 smb->usb = devm_power_supply_register(dev, &smb347_usb_desc, in smb347_probe()
1567 if (IS_ERR(smb->usb)) in smb347_probe()
1568 return PTR_ERR(smb->usb); in smb347_probe()
1571 ret = smb347_get_battery_info(smb); in smb347_probe()
1575 ret = smb347_hw_init(smb); in smb347_probe()
1579 ret = smb347_irq_init(smb, client); in smb347_probe()
1584 usb_rdev_cfg.driver_data = smb; in smb347_probe()
1585 usb_rdev_cfg.regmap = smb->regmap; in smb347_probe()
1587 smb->usb_rdev = devm_regulator_register(dev, in smb347_probe()
1590 if (IS_ERR(smb->usb_rdev)) { in smb347_probe()
1591 smb347_irq_disable(smb); in smb347_probe()
1592 return PTR_ERR(smb->usb_rdev); in smb347_probe()
1600 struct smb347_charger *smb = i2c_get_clientdata(client); in smb347_remove() local
1602 smb347_usb_vbus_regulator_disable(smb->usb_rdev); in smb347_remove()
1603 smb347_irq_disable(smb); in smb347_remove()