RE: [PATCH v1 2/2] scsi: ufs: Support reading UFS's Vcc voltage from device tree

Avri Altman
2020-09-15T06:51:46Z

> > Maybe instead call ufshcd_populate_vreg with the new name,
> > To not break the function flow, and just add another else if ?
> Could you please clarify your comments? Are you suggesting to create a
> new function?
> Thank you.
No, just call ufshcd_populate_vreg with the new name, e.g. something like:

diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index 3db0af6..9798d4c 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -141,6 +141,8 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,
vreg->min_uV = UFS_VREG_VCC_MIN_UV;
vreg->max_uV = UFS_VREG_VCC_MAX_UV;
}
+ } else if (!strcmp(name, "vcc-voltage-level")) {
+ /* add your changes here */
} else if (!strcmp(name, "vccq")) {
vreg->min_uV = UFS_VREG_VCCQ_MIN_UV;
vreg->max_uV = UFS_VREG_VCCQ_MAX_UV;
@@ -177,8 +179,12 @@ static int ufshcd_parse_regulator_info(struct ufs_hba *hba)
goto out;

err = ufshcd_populate_vreg(dev, "vcc", &info->vcc);
- if (err)
- goto out;
+ if (err) {
+ err = ufshcd_populate_vreg(dev, "vcc-voltage-level",
+ &info->vcc);
+ if (err)
+ goto out;
+ }

err = ufshcd_populate_vreg(dev, "vccq", &info->vccq);
if (err)