Lines Matching +full:semi +full:- +full:static

1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * act8865-regulator.c - Voltage regulation for active-semi ACT88xx PMUs
5 * http://www.active-semi.com/products/power-management-units/act88xx/
22 #include <dt-bindings/regulator/active-semi,8865-regulator.h>
124 #define ACT8865_ENA 0x80 /* ON - [7] */
125 #define ACT8865_DIS 0x40 /* DIS - [6] */
127 #define ACT8865_VSEL_MASK 0x3F /* VSET - [5:0] */
130 #define ACT8600_LDO10_ENA 0x40 /* ON - [6] */
131 #define ACT8600_SUDCDC_VSEL_MASK 0xFF /* SUDCDC VSET - [7:0] */
150 static const struct regmap_range act8600_reg_ranges[] = {
171 static const struct regmap_range act8600_reg_ro_ranges[] = {
176 static const struct regmap_range act8600_reg_volatile_ranges[] = {
192 static const struct regmap_access_table act8600_write_ranges_table = {
199 static const struct regmap_access_table act8600_read_ranges_table = {
204 static const struct regmap_access_table act8600_volatile_ranges_table = {
209 static const struct regmap_config act8600_regmap_config = {
218 static const struct regmap_config act8865_regmap_config = {
223 static const struct linear_range act8865_voltage_ranges[] = {
229 static const struct linear_range act8600_sudcdc_voltage_ranges[] = {
237 static int act8865_set_suspend_state(struct regulator_dev *rdev, bool enable) in act8865_set_suspend_state()
239 struct regmap *regmap = rdev->regmap; in act8865_set_suspend_state()
240 int id = rdev->desc->id, reg, val; in act8865_set_suspend_state()
272 return -EINVAL; in act8865_set_suspend_state()
285 static int act8865_set_suspend_enable(struct regulator_dev *rdev) in act8865_set_suspend_enable()
290 static int act8865_set_suspend_disable(struct regulator_dev *rdev) in act8865_set_suspend_disable()
295 static unsigned int act8865_of_map_mode(unsigned int mode) in act8865_of_map_mode()
309 static int act8865_set_mode(struct regulator_dev *rdev, unsigned int mode) in act8865_set_mode()
311 struct regmap *regmap = rdev->regmap; in act8865_set_mode()
338 return -EINVAL; in act8865_set_mode()
352 return -EINVAL; in act8865_set_mode()
358 static unsigned int act8865_get_mode(struct regulator_dev *rdev) in act8865_get_mode()
360 struct regmap *regmap = rdev->regmap; in act8865_get_mode()
387 return -EINVAL; in act8865_get_mode()
402 static const struct regulator_ops act8865_ops = {
416 static const struct regulator_ops act8865_ldo_ops = {
431 static const struct regulator_ops act8865_fixed_ldo_ops = {
465 static const struct regulator_desc act8600_regulators[] = {
517 static const struct regulator_desc act8846_regulators[] = {
532 static const struct regulator_desc act8865_regulators[] = {
542 static const struct regulator_desc act8865_alt_regulators[] = {
553 static const struct of_device_id act8865_dt_ids[] = {
554 { .compatible = "active-semi,act8600", .data = (void *)ACT8600 },
555 { .compatible = "active-semi,act8846", .data = (void *)ACT8846 },
556 { .compatible = "active-semi,act8865", .data = (void *)ACT8865 },
562 static struct act8865_regulator_data *act8865_get_regulator_data( in act8865_get_regulator_data()
567 for (i = 0; i < pdata->num_regulators; i++) { in act8865_get_regulator_data()
568 if (pdata->regulators[i].id == id) in act8865_get_regulator_data()
569 return &pdata->regulators[i]; in act8865_get_regulator_data()
575 static struct i2c_client *act8865_i2c_client;
576 static void act8865_power_off(void) in act8865_power_off()
581 regmap_write(act8865->regmap, act8865->off_reg, act8865->off_mask); in act8865_power_off()
585 static int act8600_charger_get_status(struct regmap *map) in act8600_charger_get_status()
608 static int act8600_charger_get_property(struct power_supply *psy, in act8600_charger_get_property()
620 val->intval = ret; in act8600_charger_get_property()
623 return -EINVAL; in act8600_charger_get_property()
629 static enum power_supply_property act8600_charger_properties[] = {
633 static const struct power_supply_desc act8600_charger_desc = {
634 .name = "act8600-charger",
641 static int act8600_charger_probe(struct device *dev, struct regmap *regmap) in act8600_charger_probe()
646 .of_node = dev->of_node, in act8600_charger_probe()
654 static int act8865_pmic_probe(struct i2c_client *client) in act8865_pmic_probe()
659 struct device *dev = &client->dev; in act8865_pmic_probe()
667 if (dev->of_node) { in act8865_pmic_probe()
672 return -ENODEV; in act8865_pmic_probe()
674 type = (unsigned long) id->data; in act8865_pmic_probe()
676 voltage_select = of_property_read_bool(dev->of_node, "active-semi,vsel-high"); in act8865_pmic_probe()
678 type = i2c_id->driver_data; in act8865_pmic_probe()
687 off_reg = -1; in act8865_pmic_probe()
688 off_mask = -1; in act8865_pmic_probe()
711 return -EINVAL; in act8865_pmic_probe()
716 return -ENOMEM; in act8865_pmic_probe()
718 act8865->regmap = devm_regmap_init_i2c(client, regmap_config); in act8865_pmic_probe()
719 if (IS_ERR(act8865->regmap)) { in act8865_pmic_probe()
720 ret = PTR_ERR(act8865->regmap); in act8865_pmic_probe()
725 if (of_device_is_system_power_controller(dev->of_node)) { in act8865_pmic_probe()
728 act8865->off_reg = off_reg; in act8865_pmic_probe()
729 act8865->off_mask = off_mask; in act8865_pmic_probe()
744 config.regmap = act8865->regmap; in act8865_pmic_probe()
749 rdata = act8865_get_regulator_data(desc->id, pdata); in act8865_pmic_probe()
751 config.init_data = rdata->init_data; in act8865_pmic_probe()
752 config.of_node = rdata->of_node; in act8865_pmic_probe()
758 dev_err(dev, "failed to register %s\n", desc->name); in act8865_pmic_probe()
764 ret = act8600_charger_probe(dev, act8865->regmap); in act8865_pmic_probe()
766 if (ret != -EPROBE_DEFER) in act8865_pmic_probe()
775 return type != ACT8865 ? 0 : regmap_write(act8865->regmap, in act8865_pmic_probe()
779 static const struct i2c_device_id act8865_ids[] = {
787 static struct i2c_driver act8865_pmic_driver = {
798 MODULE_DESCRIPTION("active-semi act88xx voltage regulator driver");