From patchwork Sat Feb 19 12:01:56 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 574831 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1JC2BhJ013921 for ; Sat, 19 Feb 2011 12:04:24 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754446Ab1BSMEY (ORCPT ); Sat, 19 Feb 2011 07:04:24 -0500 Received: from na3sys009aog107.obsmtp.com ([74.125.149.197]:45038 "EHLO na3sys009aog107.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754406Ab1BSMEX (ORCPT ); Sat, 19 Feb 2011 07:04:23 -0500 Received: from source ([209.85.160.177]) (using TLSv1) by na3sys009aob107.postini.com ([74.125.148.12]) with SMTP ID DSNKTV+xx54mZFTa45OVi5GcS6g+ClCt74Kd@postini.com; Sat, 19 Feb 2011 04:04:23 PST Received: by gyg4 with SMTP id 4so1897175gyg.36 for ; Sat, 19 Feb 2011 04:04:22 -0800 (PST) Received: by 10.90.25.11 with SMTP id 11mr2495987agy.119.1298117062125; Sat, 19 Feb 2011 04:04:22 -0800 (PST) Received: from localhost (dragon.ti.com [192.94.94.33]) by mx.google.com with ESMTPS id z12sm1565211anp.19.2011.02.19.04.04.18 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 19 Feb 2011 04:04:21 -0800 (PST) From: Nishanth Menon To: linux-omap Cc: Tony Lindgren , Kevin Hilman , Nishanth Menon Subject: [PATCH 17/19] omap3+: sr: make enable path use volt_data pointer Date: Sat, 19 Feb 2011 17:31:56 +0530 Message-Id: <1298116918-30744-18-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1298116918-30744-1-git-send-email-nm@ti.com> References: <1298116918-30744-1-git-send-email-nm@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Sat, 19 Feb 2011 12:04:25 +0000 (UTC) diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c index 2195668..7ac88da 100644 --- a/arch/arm/mach-omap2/smartreflex-class3.c +++ b/arch/arm/mach-omap2/smartreflex-class3.c @@ -13,19 +13,12 @@ #include -static int sr_class3_enable(struct voltagedomain *voltdm) +static int sr_class3_enable(struct voltagedomain *voltdm, + struct omap_volt_data *volt_data) { - unsigned long volt = omap_get_operation_voltage( - omap_voltage_get_nom_volt(voltdm)); - - if (!volt) { - pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n", - __func__, voltdm->name); - return -ENODATA; - } omap_vp_enable(voltdm); - return sr_enable(voltdm, volt); + return sr_enable(voltdm, volt_data); } static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset) diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 0301186..3a5f2f6 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -302,7 +302,8 @@ static void sr_start_vddautocomp(struct omap_sr *sr) return; } - if (!sr_class->enable(sr->voltdm)) + if (!sr_class->enable(sr->voltdm, + omap_voltage_get_nom_volt(sr->voltdm))) sr->autocomp_active = true; } @@ -618,7 +619,7 @@ int sr_configure_minmax(struct voltagedomain *voltdm) /** * sr_enable() - Enables the smartreflex module. * @voltdm: VDD pointer to which the SR module to be configured belongs to. - * @volt: The voltage at which the Voltage domain associated with + * @volt_data: The voltage at which the Voltage domain associated with * the smartreflex module is operating at. * This is required only to program the correct Ntarget value. * @@ -626,10 +627,9 @@ int sr_configure_minmax(struct voltagedomain *voltdm) * enable a smartreflex module. Returns 0 on success. Returns error * value if the voltage passed is wrong or if ntarget value is wrong. */ -int sr_enable(struct voltagedomain *voltdm, unsigned long volt) +int sr_enable(struct voltagedomain *voltdm, struct omap_volt_data *volt_data) { u32 nvalue_reciprocal; - struct omap_volt_data *volt_data; struct omap_sr *sr = _sr_lookup(voltdm); int ret; @@ -639,19 +639,16 @@ int sr_enable(struct voltagedomain *voltdm, unsigned long volt) return -EINVAL; } - volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); - - if (IS_ERR(volt_data)) { - dev_warn(&sr->pdev->dev, "%s: Unable to get voltage table" - "for nominal voltage %ld\n", __func__, volt); - return -ENODATA; + if (IS_ERR_OR_NULL(volt_data)) { + dev_warn(&sr->pdev->dev, "%s: bad voltage data\n", __func__); + return -EINVAL; } nvalue_reciprocal = sr_retrieve_nvalue(sr, volt_data->sr_efuse_offs); if (!nvalue_reciprocal) { dev_warn(&sr->pdev->dev, "%s: NVALUE = 0 at voltage %ld\n", - __func__, volt); + __func__, omap_get_operation_voltage(volt_data)); return -ENODATA; } @@ -808,13 +805,15 @@ int sr_register_class(struct omap_sr_class_data *class_data) * omap_sr_enable() - API to enable SR clocks and to call into the * registered smartreflex class enable API. * @voltdm: VDD pointer to which the SR module to be configured belongs to. + * @volt_data: Voltage data to go to * * This API is to be called from the kernel in order to enable * a particular smartreflex module. This API will do the initial * configurations to turn on the smartreflex module and in turn call * into the registered smartreflex class enable API. */ -void omap_sr_enable(struct voltagedomain *voltdm) +void omap_sr_enable(struct voltagedomain *voltdm, + struct omap_volt_data *volt_data) { struct omap_sr *sr = _sr_lookup(voltdm); @@ -833,7 +832,7 @@ void omap_sr_enable(struct voltagedomain *voltdm) return; } - sr_class->enable(voltdm); + sr_class->enable(voltdm, volt_data); } /** diff --git a/arch/arm/plat-omap/include/plat/smartreflex.h b/arch/arm/plat-omap/include/plat/smartreflex.h index d420f44..07f35b2 100644 --- a/arch/arm/plat-omap/include/plat/smartreflex.h +++ b/arch/arm/plat-omap/include/plat/smartreflex.h @@ -185,7 +185,8 @@ struct omap_sr_pmic_data { * @class_priv_data: Class specific private data (optional) */ struct omap_sr_class_data { - int (*enable)(struct voltagedomain *voltdm); + int (*enable)(struct voltagedomain *voltdm, + struct omap_volt_data *volt_data); int (*disable)(struct voltagedomain *voltdm, int is_volt_reset); int (*class_init)(struct voltagedomain *voltdm, void *class_priv_data); int (*class_deinit)(struct voltagedomain *voltdm, @@ -232,7 +233,8 @@ struct omap_sr_data { }; /* Smartreflex module enable/disable interface */ -void omap_sr_enable(struct voltagedomain *voltdm); +void omap_sr_enable(struct voltagedomain *voltdm, + struct omap_volt_data *volt_data); void omap_sr_disable(struct voltagedomain *voltdm); void omap_sr_disable_reset_volt(struct voltagedomain *voltdm); @@ -240,7 +242,7 @@ void omap_sr_disable_reset_volt(struct voltagedomain *voltdm); void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data); /* Smartreflex driver hooks to be called from Smartreflex class driver */ -int sr_enable(struct voltagedomain *voltdm, unsigned long volt); +int sr_enable(struct voltagedomain *voltdm, struct omap_volt_data *volt_data); void sr_disable(struct voltagedomain *voltdm); int sr_notifier_control(struct voltagedomain *voltdm, bool enable); int sr_configure_errgen(struct voltagedomain *voltdm);