Re: [PATCH v2] regulator: qcom-saw2: Add support for SAW2 regulators

From: Mark Brown
Date: Thu Jan 28 2016 - 18:25:16 EST


On Thu, Jan 28, 2016 at 04:59:02PM +0200, Georgi Djakov wrote:

> +static int saw2_regulator_get_voltage(struct regulator_dev *rdev)
> +{
> + struct saw2_vreg *vreg = rdev_get_drvdata(rdev);
> +
> + return regulator_list_voltage_linear_range(rdev, vreg->selector);
> +}

Implement regulator_get_voltage_sel() instead.

> + do {
> + regmap_read(vreg->regmap, SPM_REG_STS_1, &new_val);
> + new_val &= 0xff;
> + if (new_val == val)
> + break;
> + udelay(1);
> + } while (--timeout_us);

A cpu_relax() in here might be friendly.

> + if (sel > vreg->selector) {
> + /* PMIC internal slew rate is 1250 uV/us */
> + udelay((sel - vreg->selector) * 10);
> + }

The core already does this for you.

> + vreg->rdesc.name = of_get_property(np, "regulator-name", NULL);

Don't open code standard properties and don't add new use of legacy
properties like regulator-name. Just assign a sensible name.

Attachment: signature.asc
Description: PGP signature