Lines Matching +full:otg +full:- +full:rev
1 // SPDX-License-Identifier: GPL-2.0+
3 * max77976_charger.c - Driver for the Maxim MAX77976 battery charger
14 #define MAX77976_DRIVER_NAME "max77976-charger"
20 /* --------------------------------------------------------------------------
110 /* --------------------------------------------------------------------------
120 /* --------------------------------------------------------------------------
129 err = regmap_field_read(chg->rfield[CHG_DTLS], ®val); in max77976_get_status()
167 err = regmap_field_read(chg->rfield[CHG_DTLS], ®val); in max77976_get_charge_type()
205 err = regmap_field_read(chg->rfield[BAT_DTLS], ®val); in max77976_get_health()
239 err = regmap_field_read(chg->rfield[CHGIN_OK], ®val); in max77976_get_online()
255 err = regmap_field_read(chg->rfield[fidx], ®val); in max77976_get_integer()
272 return regmap_field_write(chg->rfield[fidx], regval); in max77976_set_integer()
284 err = max77976_get_status(chg, &val->intval); in max77976_get_property()
287 err = max77976_get_charge_type(chg, &val->intval); in max77976_get_property()
290 err = max77976_get_health(chg, &val->intval); in max77976_get_property()
293 err = max77976_get_online(chg, &val->intval); in max77976_get_property()
296 val->intval = MAX77976_CHG_CC_MAX; in max77976_get_property()
303 &val->intval); in max77976_get_property()
310 &val->intval); in max77976_get_property()
313 val->strval = max77976_model; in max77976_get_property()
316 val->strval = max77976_manufacturer; in max77976_get_property()
319 err = -EINVAL; in max77976_get_property()
338 val->intval); in max77976_set_property()
345 val->intval); in max77976_set_property()
348 err = -EINVAL; in max77976_set_property()
388 /* --------------------------------------------------------------------------
394 struct device *dev = &chg->client->dev; in max77976_detect()
395 unsigned int id, ver, rev; in max77976_detect() local
398 err = regmap_read(chg->regmap, MAX77976_REG_CHIP_ID, &id); in max77976_detect()
403 return dev_err_probe(dev, -ENXIO, "unknown model ID 0x%02x\n", id); in max77976_detect()
405 err = regmap_field_read(chg->rfield[VERSION], &ver); in max77976_detect()
407 err = regmap_field_read(chg->rfield[REVISION], &rev); in max77976_detect()
409 return dev_err_probe(dev, -ENXIO, "cannot read version/revision\n"); in max77976_detect()
411 dev_info(dev, "detected model MAX779%02x ver %u rev %u", id, ver, rev); in max77976_detect()
418 struct device *dev = &chg->client->dev; in max77976_configure()
422 err = regmap_field_write(chg->rfield[CHGPROT], 0x3); in max77976_configure()
427 * Mode 5 = Charger ON, OTG OFF, buck ON, boost OFF. in max77976_configure()
430 err = regmap_field_write(chg->rfield[MODE], MAX77976_MODE_CHARGER_BUCK); in max77976_configure()
442 struct device *dev = &client->dev; in max77976_probe()
451 return -ENOMEM; in max77976_probe()
455 chg->client = client; in max77976_probe()
457 chg->regmap = devm_regmap_init_i2c(client, &max77976_regmap_config); in max77976_probe()
458 if (IS_ERR(chg->regmap)) in max77976_probe()
459 return dev_err_probe(dev, PTR_ERR(chg->regmap), in max77976_probe()
463 chg->rfield[i] = devm_regmap_field_alloc(dev, chg->regmap, in max77976_probe()
465 if (IS_ERR(chg->rfield[i])) in max77976_probe()
466 return dev_err_probe(dev, PTR_ERR(chg->rfield[i]), in max77976_probe()