Lines Matching defs:bdpsy
147 struct bd70528_psy *bdpsy)
181 bdpsy->psy);
193 ret = regmap_update_bits(bdpsy->regmap,
201 static int bd70528_get_charger_status(struct bd70528_psy *bdpsy, int *val)
206 ret = regmap_read(bdpsy->regmap, BD70528_REG_CHG_CURR_STAT, &v);
208 dev_err(bdpsy->dev, "Charger state read failure %d\n",
241 static int bd70528_get_charge_type(struct bd70528_psy *bdpsy, int *val)
246 ret = regmap_read(bdpsy->regmap, BD70528_REG_CHG_CURR_STAT, &v);
248 dev_err(bdpsy->dev, "Charger state read failure %d\n",
281 static int bd70528_get_battery_health(struct bd70528_psy *bdpsy, int *val)
286 ret = regmap_read(bdpsy->regmap, BD70528_REG_CHG_BAT_STAT, &v);
288 dev_err(bdpsy->dev, "Battery state read failure %d\n",
305 static int bd70528_get_online(struct bd70528_psy *bdpsy, int *val)
310 ret = regmap_read(bdpsy->regmap, BD70528_REG_CHG_IN_STAT, &v);
312 dev_err(bdpsy->dev, "DC1 IN state read failure %d\n",
322 static int bd70528_get_present(struct bd70528_psy *bdpsy, int *val)
327 ret = regmap_read(bdpsy->regmap, BD70528_REG_CHG_BAT_STAT, &v);
329 dev_err(bdpsy->dev, "Battery state read failure %d\n",
401 static int get_charge_current(struct bd70528_psy *bdpsy, int *ma)
406 ret = regmap_read(bdpsy->regmap, BD70528_REG_CHG_CHG_CURR_WARM,
409 dev_err(bdpsy->dev,
420 dev_err(bdpsy->dev,
428 static int get_current_limit(struct bd70528_psy *bdpsy, int *ma)
433 ret = regmap_read(bdpsy->regmap, BD70528_REG_CHG_DCIN_ILIM,
437 dev_err(bdpsy->dev,
470 struct bd70528_psy *bdpsy = power_supply_get_drvdata(psy);
475 return bd70528_get_charger_status(bdpsy, &val->intval);
477 return bd70528_get_charge_type(bdpsy, &val->intval);
479 return bd70528_get_battery_health(bdpsy, &val->intval);
481 return bd70528_get_present(bdpsy, &val->intval);
483 ret = get_current_limit(bdpsy, &val->intval);
487 ret = get_charge_current(bdpsy, &val->intval);
491 return bd70528_get_online(bdpsy, &val->intval);
518 static int set_charge_current(struct bd70528_psy *bdpsy, int ma)
525 dev_warn(bdpsy->dev,
532 dev_err(bdpsy->dev,
552 dev_err(bdpsy->dev,
562 dev_warn(bdpsy->dev,
567 tmpret = regmap_update_bits(bdpsy->regmap,
571 dev_err(bdpsy->dev,
578 tmpret = regmap_update_bits(bdpsy->regmap,
591 static int set_current_limit(struct bd70528_psy *bdpsy, int ma)
598 dev_warn(bdpsy->dev,
605 dev_err(bdpsy->dev,
617 dev_err(bdpsy->dev, "Unsupported current limit %umA\n", ma);
627 dev_warn(bdpsy->dev, "Unsupported current limit %umA\n", ma);
631 tmpret = regmap_update_bits(bdpsy->regmap,
645 struct bd70528_psy *bdpsy = power_supply_get_drvdata(psy);
649 return set_current_limit(bdpsy, val->intval / 1000);
651 return set_charge_current(bdpsy, val->intval / 1000);
670 struct bd70528_psy *bdpsy;
673 bdpsy = devm_kzalloc(&pdev->dev, sizeof(*bdpsy), GFP_KERNEL);
674 if (!bdpsy)
677 bdpsy->regmap = dev_get_regmap(pdev->dev.parent, NULL);
678 if (!bdpsy->regmap) {
682 bdpsy->dev = &pdev->dev;
684 platform_set_drvdata(pdev, bdpsy);
685 cfg.drv_data = bdpsy;
688 bdpsy->psy = devm_power_supply_register(&pdev->dev,
690 if (IS_ERR(bdpsy->psy)) {
692 return PTR_ERR(bdpsy->psy);
695 return bd70528_get_irqs(pdev, bdpsy);