Commit db27f829 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Greg Kroah-Hartman

staging: regulator: hi6421v600-regulator: use shorter names for OF properties

Simplify the names of the OF properties, in order to make
them similar to other drivers and to make easier to understand
what each property means.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Link: https://lore.kernel.org/r/98f66100263940901ba59ec187919e9cf5e64f31.1597647359.git.mchehab+huawei@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9a18329f
...@@ -196,14 +196,14 @@ static int hisi_regulator_set_mode(struct regulator_dev *rdev, ...@@ -196,14 +196,14 @@ static int hisi_regulator_set_mode(struct regulator_dev *rdev,
{ {
struct hi6421v600_regulator *sreg = rdev_get_drvdata(rdev); struct hi6421v600_regulator *sreg = rdev_get_drvdata(rdev);
struct hisi_pmic *pmic = sreg->pmic; struct hisi_pmic *pmic = sreg->pmic;
u32 eco_mode; u32 val;
switch (mode) { switch (mode) {
case REGULATOR_MODE_NORMAL: case REGULATOR_MODE_NORMAL:
eco_mode = HISI_ECO_MODE_DISABLE; val = 0;
break; break;
case REGULATOR_MODE_IDLE: case REGULATOR_MODE_IDLE:
eco_mode = HISI_ECO_MODE_ENABLE; val = sreg->eco_mode_mask << (ffs(sreg->eco_mode_mask) - 1);
break; break;
default: default:
return -EINVAL; return -EINVAL;
...@@ -211,15 +211,12 @@ static int hisi_regulator_set_mode(struct regulator_dev *rdev, ...@@ -211,15 +211,12 @@ static int hisi_regulator_set_mode(struct regulator_dev *rdev,
/* set mode */ /* set mode */
hisi_pmic_rmw(pmic, rdev->desc->enable_reg, hisi_pmic_rmw(pmic, rdev->desc->enable_reg,
sreg->eco_mode_mask, sreg->eco_mode_mask, val);
eco_mode << (ffs(sreg->eco_mode_mask) - 1));
dev_dbg(&rdev->dev, dev_dbg(&rdev->dev,
"%s: enable_reg=0x%x, eco_mode_mask=0x%x, value=0x%x\n", "%s: enable_reg=0x%x, eco_mode_mask=0x%x, value=0x%x\n",
__func__, __func__, rdev->desc->enable_reg, sreg->eco_mode_mask, val);
rdev->desc->enable_reg,
sreg->eco_mode_mask,
eco_mode << (ffs(sreg->eco_mode_mask) - 1));
return 0; return 0;
} }
...@@ -249,10 +246,10 @@ static int hisi_dt_parse(struct platform_device *pdev, ...@@ -249,10 +246,10 @@ static int hisi_dt_parse(struct platform_device *pdev,
int ret; int ret;
/* parse .register_info.enable_reg */ /* parse .register_info.enable_reg */
ret = of_property_read_u32_array(np, "hisilicon,hisi-ctrl", ret = of_property_read_u32_array(np, "hi6421-ctrl",
register_info, 3); register_info, 3);
if (ret) { if (ret) {
dev_err(dev, "no hisilicon,hisi-ctrl property set\n"); dev_err(dev, "no hi6421-ctrl property set\n");
return ret; return ret;
} }
rdesc->enable_reg = register_info[0]; rdesc->enable_reg = register_info[0];
...@@ -260,33 +257,33 @@ static int hisi_dt_parse(struct platform_device *pdev, ...@@ -260,33 +257,33 @@ static int hisi_dt_parse(struct platform_device *pdev,
sreg->eco_mode_mask = register_info[2]; sreg->eco_mode_mask = register_info[2];
/* parse .register_info.vsel_reg */ /* parse .register_info.vsel_reg */
ret = of_property_read_u32_array(np, "hisilicon,hisi-vset", ret = of_property_read_u32_array(np, "hi6421-vsel",
register_info, 2); register_info, 2);
if (ret) { if (ret) {
dev_err(dev, "no hisilicon,hisi-vset property set\n"); dev_err(dev, "no hi6421-vsel property set\n");
return ret; return ret;
} }
rdesc->vsel_reg = register_info[0]; rdesc->vsel_reg = register_info[0];
rdesc->vsel_mask = register_info[1]; rdesc->vsel_mask = register_info[1];
/* parse .off-on-delay */ /* parse .off-on-delay */
ret = of_property_read_u32(np, "hisilicon,hisi-off-on-delay-us", ret = of_property_read_u32(np, "off-on-delay-us",
&rdesc->off_on_delay); &rdesc->off_on_delay);
if (ret) { if (ret) {
dev_err(dev, "no hisilicon,hisi-off-on-delay-us property set\n"); dev_err(dev, "no off-on-delay-us property set\n");
return ret; return ret;
} }
/* parse .enable_time */ /* parse .enable_time */
ret = of_property_read_u32(np, "hisilicon,hisi-enable-time-us", ret = of_property_read_u32(np, "startup-delay-us",
&rdesc->enable_time); &rdesc->enable_time);
if (ret) { if (ret) {
dev_err(dev, "no hisilicon,hisi-enable-time-us property set\n"); dev_err(dev, "no startup-delay-us property set\n");
return ret; return ret;
} }
/* parse .eco_uA */ /* parse .eco_uA */
ret = of_property_read_u32(np, "hisilicon,hisi-eco-microamp", ret = of_property_read_u32(np, "eco-microamp",
&sreg->eco_uA); &sreg->eco_uA);
if (ret) { if (ret) {
sreg->eco_uA = 0; sreg->eco_uA = 0;
...@@ -295,7 +292,7 @@ static int hisi_dt_parse(struct platform_device *pdev, ...@@ -295,7 +292,7 @@ static int hisi_dt_parse(struct platform_device *pdev,
/* parse volt_table */ /* parse volt_table */
rdesc->n_voltages = of_property_count_u32_elems(np, "hisilicon,hisi-vset-table"); rdesc->n_voltages = of_property_count_u32_elems(np, "voltage-table");
v_table = devm_kzalloc(dev, sizeof(unsigned int) * rdesc->n_voltages, v_table = devm_kzalloc(dev, sizeof(unsigned int) * rdesc->n_voltages,
GFP_KERNEL); GFP_KERNEL);
...@@ -303,10 +300,10 @@ static int hisi_dt_parse(struct platform_device *pdev, ...@@ -303,10 +300,10 @@ static int hisi_dt_parse(struct platform_device *pdev,
return -ENOMEM; return -ENOMEM;
rdesc->volt_table = v_table; rdesc->volt_table = v_table;
ret = of_property_read_u32_array(np, "hisilicon,hisi-vset-table", ret = of_property_read_u32_array(np, "voltage-table",
v_table, rdesc->n_voltages); v_table, rdesc->n_voltages);
if (ret) { if (ret) {
dev_err(dev, "no hisilicon,hisi-vset-table property set\n"); dev_err(dev, "no voltage-table property set\n");
return ret; return ret;
} }
...@@ -329,13 +326,6 @@ static struct regulator_ops hisi_ldo_rops = { ...@@ -329,13 +326,6 @@ static struct regulator_ops hisi_ldo_rops = {
* Used only for parsing the DT properties * Used only for parsing the DT properties
*/ */
static const struct of_device_id of_hisi_pmic_match_tbl[] = {
{
.compatible = "hisilicon,hi6421-spmi-pmic-ldo",
},
{ }
};
static int hisi_regulator_probe_ldo(struct platform_device *pdev, static int hisi_regulator_probe_ldo(struct platform_device *pdev,
struct device_node *np, struct device_node *np,
struct hisi_pmic *pmic) struct hisi_pmic *pmic)
...@@ -360,14 +350,14 @@ static int hisi_regulator_probe_ldo(struct platform_device *pdev, ...@@ -360,14 +350,14 @@ static int hisi_regulator_probe_ldo(struct platform_device *pdev,
/* hisi regulator supports two modes */ /* hisi regulator supports two modes */
constraint = &initdata->constraints; constraint = &initdata->constraints;
ret = of_property_read_u32_array(np, "hisilicon,valid-modes-mask", ret = of_property_read_u32_array(np, "valid-modes-mask",
&constraint->valid_modes_mask, 1); &constraint->valid_modes_mask, 1);
if (ret) { if (ret) {
dev_err(dev, "no valid modes mask\n"); dev_err(dev, "no valid modes mask\n");
ret = -ENODEV; ret = -ENODEV;
return ret; return ret;
} }
ret = of_property_read_u32_array(np, "hisilicon,valid-idle-mask", ret = of_property_read_u32_array(np, "valid-idle-mask",
&temp_modes, 1); &temp_modes, 1);
if (ret) { if (ret) {
dev_err(dev, "no valid idle mask\n"); dev_err(dev, "no valid idle mask\n");
...@@ -388,7 +378,7 @@ static int hisi_regulator_probe_ldo(struct platform_device *pdev, ...@@ -388,7 +378,7 @@ static int hisi_regulator_probe_ldo(struct platform_device *pdev,
rdesc->type = REGULATOR_VOLTAGE; rdesc->type = REGULATOR_VOLTAGE;
rdesc->min_uV = initdata->constraints.min_uV; rdesc->min_uV = initdata->constraints.min_uV;
supplyname = of_get_property(np, "hisilicon,supply_name", NULL); supplyname = of_get_property(np, "supply_name", NULL);
if (supplyname) if (supplyname)
initdata->supply_regulator = supplyname; initdata->supply_regulator = supplyname;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment