lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <53F19848.7020303@nvidia.com>
Date:	Mon, 18 Aug 2014 14:08:08 +0800
From:	Vince Hsu <vinceh@...dia.com>
To:	Tuomas Tynkkynen <ttynkkynen@...dia.com>,
	"linux-tegra@...r.kernel.org" <linux-tegra@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>
CC:	Stephen Warren <swarren@...dotorg.org>,
	Thierry Reding <thierry.reding@...il.com>,
	Peter De Schrijver <pdeschrijver@...dia.com>,
	Prashant Gaikwad <pgaikwad@...dia.com>,
	Mike Turquette <mturquette@...aro.org>,
	"Rafael J. Wysocki" <rjw@...ysocki.net>,
	Viresh Kumar <viresh.kumar@...aro.org>,
	Paul Walmsley <pwalmsley@...dia.com>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"broonie@...nel.org" <broonie@...nel.org>
Subject: Re: [PATCH v2 05/16] clk: tegra: Add closed loop support for the
 DFLL

Hi,

On 07/21/2014 11:38 PM, Tuomas Tynkkynen wrote:
> With closed loop support, the clock rate of the DFLL can be adjusted.
>
> The oscillator itself in the DFLL is a free-running oscillator whose
> rate is directly determined the supply voltage. However, the DFLL
> module contains logic to compare the DFLL output rate to a fixed
> reference clock (51 MHz) and make a decision to either lower or raise
> the DFLL supply voltage. The DFLL module can then autonomously change
> the supply voltage by communicating with an off-chip PMIC via either I2C
> or PWM signals. This driver currently supports only I2C.
>
> Signed-off-by: Tuomas Tynkkynen <ttynkkynen@...dia.com>
> ---
> v2 changes:
>      - query the various properties required for I2C mode from the
>        regulator framework
>
>   drivers/clk/tegra/clk-dfll.c | 656 ++++++++++++++++++++++++++++++++++++++++++-
>   1 file changed, 653 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/clk/tegra/clk-dfll.c b/drivers/clk/tegra/clk-dfll.c
> index d83e859..0d4b2dd 100644
> --- a/drivers/clk/tegra/clk-dfll.c
> +++ b/drivers/clk/tegra/clk-dfll.c
> @@ -205,12 +205,16 @@
...
> +
> +/**
> + * dfll_calculate_rate_request - calculate DFLL parameters for a given rate
> + * @td: DFLL instance
> + * @req: DFLL-rate-request structure
> + * @rate: the desired DFLL rate
> + *
> + * Populate the DFLL-rate-request record @req fields with the scale_bits
> + * and mult_bits fields, based on the target input rate. Returns 0 upon
> + * success, or -EINVAL if the requested rate in req->rate is too high
> + * or low for the DFLL to generate.
> + */
> +static int dfll_calculate_rate_request(struct tegra_dfll *td,
> +				       struct dfll_rate_req *req,
> +				       unsigned long rate)
> +{
> +	u32 val;
> +
> +	/*
> +	 * If requested rate is below the minimum DVCO rate, active the scaler.
> +	 * In the future the DVCO minimum voltage should be selected based on
> +	 * chip temperature and the actual minimum rate should be calibrated
> +	 * at runtime.
> +	 */
> +	req->scale_bits = DFLL_FREQ_REQ_SCALE_MAX - 1;
> +	if (rate < td->dvco_rate_min) {
> +		int scale;
> +
> +		scale = DIV_ROUND_CLOSEST(rate / 1000 * DFLL_FREQ_REQ_SCALE_MAX,
> +					  td->dvco_rate_min / 1000);
> +		if (!scale) {
> +			dev_err(td->dev, "%s: Rate %lu is too low\n",
> +				__func__, rate);
> +			return -EINVAL;
> +		}
> +		req->scale_bits = scale - 1;
> +		rate = td->dvco_rate_min;
> +	}
> +
> +	/* Convert requested rate into frequency request and scale settings */
> +	val = DVCO_RATE_TO_MULT(rate, td->ref_rate);
> +	if (val > FREQ_MAX) {
> +		dev_err(td->dev, "%s: Rate %lu is above dfll range\n",
> +			__func__, rate);
> +		return -EINVAL;
> +	}
> +	req->mult_bits = val;
> +	req->dvco_target_rate = MULT_TO_DVCO_RATE(req->mult_bits, td->ref_rate);
> +	req->rate = dfll_scale_dvco_rate(req->dvco_target_rate,
> +					 req->scale_bits);
Should be dfll_scale_dvco_rate(req->scale_bits, req->dvco_target_rate);

Thanks,
Vince

> +	req->lut_index = find_lut_index_for_rate(td, req->dvco_target_rate);
> +	if (req->lut_index < 0)
> +		return req->lut_index;
> +
> +	return 0;
> +}
> +

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ