[PATCH V3 07/16] PM / OPP: Add support to parse "operating-points-v2" bindings

Stephen Boyd sboyd at codeaurora.org
Thu Jul 30 22:51:06 PDT 2015


On 07/29, Viresh Kumar wrote:
> This adds support in OPP library to parse and create list of OPPs from
> operating-points-v2 bindings. It takes care of most of the properties of
> new bindings (except shared-opp, which will be handled separately).
> 
> For backward compatibility, we keep supporting earlier bindings. We try
> to search for the new bindings first, in case they aren't present we
> look for the old deprecated ones.
> 
> There are few things marked as TODO:
> - Support for multiple OPP tables
> - Support for multiple regulators
> 
> They should be fixed separately.
> 
> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie at samsung.com>
> Signed-off-by: Viresh Kumar <viresh.kumar at linaro.org>

Reviewed-by: Stephen Boyd <sboyd at codeaurora.org>

One question below:

> @@ -679,6 +691,125 @@ static int _opp_add_dynamic(struct device *dev, unsigned long freq,
>  	return ret;
>  }
>  
> +/* TODO: Support multiple regulators */
> +static int opp_get_microvolt(struct dev_pm_opp *opp, struct device *dev)
> +{
> +	u32 microvolt[3] = {0};
> +	int count, ret;
> +
> +	count = of_property_count_u32_elems(opp->np, "opp-microvolt");
> +	if (!count)
> +		return 0;
> +
> +	/* There can be one or three elements here */
> +	if (count != 1 && count != 3) {
> +		dev_err(dev, "%s: Invalid number of elements in opp-microvolt property (%d)\n",
> +			__func__, count);
> +		return -EINVAL;
> +	}
> +
> +	ret = of_property_read_u32_array(opp->np, "opp-microvolt", microvolt,
> +					 count);
> +	if (ret) {
> +		dev_err(dev, "%s: error parsing opp-microvolt: %d\n", __func__,
> +			ret);
> +		return -EINVAL;
> +	}
> +
> +	opp->u_volt = microvolt[0];
> +	opp->u_volt_min = microvolt[1];
> +	opp->u_volt_max = microvolt[2];

Should the default be 0 and ULONG_MAX for volt_min/volt_max when
there's on element?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project



More information about the linux-arm-kernel mailing list