Lines Matching +full:hi6421v600 +full:- +full:spmi

1 // SPDX-License-Identifier: GPL-2.0
7 // Copyright (c) 2020-2021 Huawei Technologies Co., Ltd.
17 #include <linux/spmi.h>
63 * HI6421V600_LDO() - specify a LDO power line
87 .vsel_mask = ARRAY_SIZE(vtable) - 1, \
105 mutex_lock(&priv->enable_mutex); in hi6421_spmi_regulator_enable()
107 ret = regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, in hi6421_spmi_regulator_enable()
108 rdev->desc->enable_mask, in hi6421_spmi_regulator_enable()
109 rdev->desc->enable_mask); in hi6421_spmi_regulator_enable()
112 usleep_range(rdev->desc->off_on_delay, rdev->desc->off_on_delay + 60); in hi6421_spmi_regulator_enable()
114 mutex_unlock(&priv->enable_mutex); in hi6421_spmi_regulator_enable()
124 sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc); in hi6421_spmi_regulator_get_mode()
125 regmap_read(rdev->regmap, rdev->desc->enable_reg, &reg_val); in hi6421_spmi_regulator_get_mode()
127 if (reg_val & sreg->eco_mode_mask) in hi6421_spmi_regulator_get_mode()
139 sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc); in hi6421_spmi_regulator_set_mode()
145 if (!sreg->eco_mode_mask) in hi6421_spmi_regulator_set_mode()
146 return -EINVAL; in hi6421_spmi_regulator_set_mode()
148 val = sreg->eco_mode_mask; in hi6421_spmi_regulator_set_mode()
151 return -EINVAL; in hi6421_spmi_regulator_set_mode()
154 return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, in hi6421_spmi_regulator_set_mode()
155 sreg->eco_mode_mask, val); in hi6421_spmi_regulator_set_mode()
165 sreg = container_of(rdev->desc, struct hi6421_spmi_reg_info, desc); in hi6421_spmi_regulator_get_optimum_mode()
167 if (!sreg->eco_uA || ((unsigned int)load_uA > sreg->eco_uA)) in hi6421_spmi_regulator_get_optimum_mode()
186 /* HI6421v600 regulators with known registers */
235 struct device *pmic_dev = pdev->dev.parent; in hi6421_spmi_regulator_probe()
239 struct device *dev = &pdev->dev; in hi6421_spmi_regulator_probe()
245 * This driver is meant to be called by hi6421-spmi-core, in hi6421_spmi_regulator_probe()
251 return -ENODEV; in hi6421_spmi_regulator_probe()
255 return -ENOMEM; in hi6421_spmi_regulator_probe()
257 mutex_init(&priv->enable_mutex); in hi6421_spmi_regulator_probe()
262 config.dev = pdev->dev.parent; in hi6421_spmi_regulator_probe()
266 rdev = devm_regulator_register(dev, &info->desc, &config); in hi6421_spmi_regulator_probe()
269 info->desc.name); in hi6421_spmi_regulator_probe()
278 { .name = "hi6421v600-regulator" },
286 .name = "hi6421v600-regulator",
293 MODULE_DESCRIPTION("Hi6421v600 SPMI regulator driver");