scsi: ufs: Remove "<name>-fixed-regulator" device tree property
authorStanley Chu <stanley.chu@mediatek.com>
Thu, 28 Mar 2019 09:16:27 +0000 (17:16 +0800)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 4 Apr 2019 03:11:35 +0000 (23:11 -0400)
"<name>-fixed-regulator" device tree property can be safely removed because
below things are fixed or resolved,

1. "<name>-max-microamp" becomes optional property: Undefined
   "<name>-max-microamp" will not cause initialization fail if
   "<name>-fixed-regulator" is not defined.

2. Current switching operation (by regulator_set_load) now has rules:
   Regulators will have undefined current limit if "<name>-fixed-regulator"
   is not defined. But this is safe because only regulator which has
   configured current limit from "<name>-max-microamp" property is allowed
   to change its load.

Although "<name>-fixed-regulator" is not used in any dt-bindings in tree,
this patch is still safe for regulators already defined
"<name>-fixed-regulator". To be more clear, if a regulator defined
"<name>-fixed-regulator" before, the behavior difference after this patch
is,

1. "<name>-max-microamp":
   If a regulator defined "<name>-fixed-regulator", it is not necessary
   to define "<name>-max-microamp" property in device tree and it is
   expected to have an undefined current limit, i.e., "max_uA" field
   is zero in struct ufs_vreg. This is exactly the same as patched.

2. "vcc-supply-1p8" or volatge range settings:
   * For vcc, vccq or vccq2, these three regulators shall not define
     "<name>-fixed-regulator" because defining it will lead to
     undefined voltage range and thus voltage switching will be
     unexpected.
   * For other regulators with undefined voltage range, voltage range
     will be still undefined after patched.

Therefore this patch is safe for all existed regulators with
"<name>-fixed-regulator" property already defined.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>
Acked-by: Alim Akhtar <alim.akhtar@samsung.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/ufs/ufshcd-pltfrm.c

index 3444ff83c568e5e65b8c16afe38dba054196a91b..8a74ec30c3d21af5149787069ac4debdfc99cc85 100644 (file)
@@ -152,11 +152,6 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,
 
        vreg->name = kstrdup(name, GFP_KERNEL);
 
-       /* if fixed regulator no need further initialization */
-       snprintf(prop_name, MAX_PROP_SIZE, "%s-fixed-regulator", name);
-       if (of_property_read_bool(np, prop_name))
-               goto out;
-
        snprintf(prop_name, MAX_PROP_SIZE, "%s-max-microamp", name);
        if (of_property_read_u32(np, prop_name, &vreg->max_uA)) {
                dev_info(dev, "%s: unable to find %s\n", __func__, prop_name);