Lines Matching refs:pfuze_chip

72 struct pfuze_chip {  struct
120 struct pfuze_chip *pfuze100 = rdev_get_drvdata(rdev); in pfuze100_set_ramp_delay()
509 static int pfuze_parse_regulators_dt(struct pfuze_chip *chip) in pfuze_parse_regulators_dt()
577 struct pfuze_chip *syspm_pfuze_chip = data->cb_data; in pfuze_power_off_prepare()
617 static int pfuze_power_off_prepare_init(struct pfuze_chip *pfuze_chip) in pfuze_power_off_prepare_init() argument
621 if (pfuze_chip->chip_id != PFUZE100) { in pfuze_power_off_prepare_init()
622 dev_warn(pfuze_chip->dev, "Requested pm_power_off_prepare handler for not supported chip\n"); in pfuze_power_off_prepare_init()
626 err = devm_register_sys_off_handler(pfuze_chip->dev, in pfuze_power_off_prepare_init()
630 pfuze_chip); in pfuze_power_off_prepare_init()
632 dev_err(pfuze_chip->dev, "failed to register sys-off handler: %d\n", in pfuze_power_off_prepare_init()
640 static int pfuze_identify(struct pfuze_chip *pfuze_chip) in pfuze_identify() argument
645 ret = regmap_read(pfuze_chip->regmap, PFUZE100_DEVICEID, &value); in pfuze_identify()
649 if (((value & 0x0f) == 0x8) && (pfuze_chip->chip_id == PFUZE100)) { in pfuze_identify()
654 dev_info(pfuze_chip->dev, "Assuming misprogrammed ID=0x8"); in pfuze_identify()
655 } else if ((value & 0x0f) != pfuze_chip->chip_id && in pfuze_identify()
656 (value & 0xf0) >> 4 != pfuze_chip->chip_id && in pfuze_identify()
657 (value != pfuze_chip->chip_id)) { in pfuze_identify()
659 dev_warn(pfuze_chip->dev, "Illegal ID: %x\n", value); in pfuze_identify()
663 ret = regmap_read(pfuze_chip->regmap, PFUZE100_REVID, &value); in pfuze_identify()
666 dev_info(pfuze_chip->dev, in pfuze_identify()
670 ret = regmap_read(pfuze_chip->regmap, PFUZE100_FABID, &value); in pfuze_identify()
673 dev_info(pfuze_chip->dev, "FAB: %x, FIN: %x\n", in pfuze_identify()
689 struct pfuze_chip *pfuze_chip; in pfuze100_regulator_probe() local
696 pfuze_chip = devm_kzalloc(&client->dev, sizeof(*pfuze_chip), in pfuze100_regulator_probe()
698 if (!pfuze_chip) in pfuze100_regulator_probe()
707 pfuze_chip->chip_id = (int)(long)match->data; in pfuze100_regulator_probe()
709 pfuze_chip->chip_id = id->driver_data; in pfuze100_regulator_probe()
715 i2c_set_clientdata(client, pfuze_chip); in pfuze100_regulator_probe()
716 pfuze_chip->dev = &client->dev; in pfuze100_regulator_probe()
718 pfuze_chip->regmap = devm_regmap_init_i2c(client, &pfuze_regmap_config); in pfuze100_regulator_probe()
719 if (IS_ERR(pfuze_chip->regmap)) { in pfuze100_regulator_probe()
720 ret = PTR_ERR(pfuze_chip->regmap); in pfuze100_regulator_probe()
726 ret = pfuze_identify(pfuze_chip); in pfuze100_regulator_probe()
733 switch (pfuze_chip->chip_id) { in pfuze100_regulator_probe()
735 pfuze_chip->pfuze_regulators = pfuze3001_regulators; in pfuze100_regulator_probe()
742 pfuze_chip->pfuze_regulators = pfuze3000_regulators; in pfuze100_regulator_probe()
749 pfuze_chip->pfuze_regulators = pfuze200_regulators; in pfuze100_regulator_probe()
756 pfuze_chip->pfuze_regulators = pfuze100_regulators; in pfuze100_regulator_probe()
763 (pfuze_chip->chip_id == PFUZE100) ? "100" : in pfuze100_regulator_probe()
764 (((pfuze_chip->chip_id == PFUZE200) ? "200" : in pfuze100_regulator_probe()
765 ((pfuze_chip->chip_id == PFUZE3000) ? "3000" : "3001")))); in pfuze100_regulator_probe()
767 memcpy(pfuze_chip->regulator_descs, pfuze_chip->pfuze_regulators, in pfuze100_regulator_probe()
770 ret = pfuze_parse_regulators_dt(pfuze_chip); in pfuze100_regulator_probe()
779 desc = &pfuze_chip->regulator_descs[i].desc; in pfuze100_regulator_probe()
785 ret = regmap_read(pfuze_chip->regmap, in pfuze100_regulator_probe()
793 if (pfuze_chip->chip_id == PFUZE3000 || in pfuze100_regulator_probe()
794 pfuze_chip->chip_id == PFUZE3001) { in pfuze100_regulator_probe()
811 if (pfuze_chip->flags & PFUZE_FLAG_DISABLE_SW) { in pfuze100_regulator_probe()
812 if (pfuze_chip->chip_id == PFUZE100 || in pfuze100_regulator_probe()
813 pfuze_chip->chip_id == PFUZE200) { in pfuze100_regulator_probe()
814 if (pfuze_chip->regulator_descs[i].sw_reg) { in pfuze100_regulator_probe()
825 config.driver_data = pfuze_chip; in pfuze100_regulator_probe()
828 pfuze_chip->regulators[i] = in pfuze100_regulator_probe()
830 if (IS_ERR(pfuze_chip->regulators[i])) { in pfuze100_regulator_probe()
832 pfuze_chip->pfuze_regulators[i].desc.name); in pfuze100_regulator_probe()
833 return PTR_ERR(pfuze_chip->regulators[i]); in pfuze100_regulator_probe()
839 return pfuze_power_off_prepare_init(pfuze_chip); in pfuze100_regulator_probe()