Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753556Ab3FGKLy (ORCPT ); Fri, 7 Jun 2013 06:11:54 -0400 Received: from utopia.booyaka.com ([74.50.51.50]:44872 "EHLO utopia.booyaka.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752699Ab3FGKLw (ORCPT ); Fri, 7 Jun 2013 06:11:52 -0400 Date: Fri, 7 Jun 2013 10:11:51 +0000 (UTC) From: Paul Walmsley To: Mark Brown cc: Liam Girdwood , linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, Andrew Chew , Matthew Longnecker Subject: Re: [PATCH] regulator: core: add regulator_get_linear_step() In-Reply-To: Message-ID: References: <20130607090923.GH31367@sirena.org.uk> <20130607095936.GK31367@sirena.org.uk> User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1588 Lines: 50 On Fri, 7 Jun 2013, Paul Walmsley wrote: > The IP block has an I2C controller embedded in it that autonomously sends > set-voltage commands (across a range of voltages) to the PMIC. To enable > that, the driver must first initialize the IP block with a > voltage-to-selector table. Here's the table loading code - +/** + * _load_lut - load voltage lookup table into DFLL RAM + * @pdev: DFLL instance + * + * Load the voltage-to-PMIC register value lookup table into the DFLL + * IP block LUT memory. td->lut_min and td->lut_max are used to cap + * the minimum and maximum voltage requested. This function shouldn't + * be called directly by code other than dfll_load_lut(), since this + * function doesn't handle the necessary pre- and post-requisites. No + * return value. + */ +static void _load_lut(struct platform_device *pdev) +{ + struct tegra_dfll *td = dev_get_drvdata(&pdev->dev); + int i; + u32 val; + + val = td->out_map[td->lut_min]->reg_value; + for (i = 0; i <= td->lut_min; i++) + dfll_writel(td, val, DFLL_OUTPUT_LUT + i * 4); + + for (; i < td->lut_max; i++) { + val = td->out_map[i]->reg_value; + dfll_writel(td, val, DFLL_OUTPUT_LUT + i * 4); + } + + val = td->out_map[td->lut_max]->reg_value; + for (; i < td->num_voltages; i++) + dfll_writel(td, val, DFLL_OUTPUT_LUT + i * 4); + + dfll_wmb(td); +} - Paul -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/