From patchwork Wed Mar 2 10:55:21 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nishanth Menon X-Patchwork-Id: 602711 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 p22AusEN008734 for ; Wed, 2 Mar 2011 10:56:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757150Ab1CBK4y (ORCPT ); Wed, 2 Mar 2011 05:56:54 -0500 Received: from na3sys009aog116.obsmtp.com ([74.125.149.240]:42261 "EHLO na3sys009aog116.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757145Ab1CBK4x (ORCPT ); Wed, 2 Mar 2011 05:56:53 -0500 Received: from source ([209.85.161.173]) (using TLSv1) by na3sys009aob116.postini.com ([74.125.148.12]) with SMTP ID DSNKTW4idDT27w1n+qyF0VL2HiSLn57TRZP/@postini.com; Wed, 02 Mar 2011 02:56:53 PST Received: by gxk28 with SMTP id 28so2790836gxk.32 for ; Wed, 02 Mar 2011 02:56:51 -0800 (PST) Received: by 10.90.142.8 with SMTP id p8mr10921743agd.37.1299063411853; Wed, 02 Mar 2011 02:56:51 -0800 (PST) Received: from localhost (dragon.ti.com [192.94.94.33]) by mx.google.com with ESMTPS id x31sm1614124ana.29.2011.03.02.02.56.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 02 Mar 2011 02:56:50 -0800 (PST) From: Nishanth Menon To: linux-omap Cc: Kevin H , Tony L , linux-arm , Nishanth Menon Subject: [PATCH v2 08/18] omap3+: sr: introduce class init, deinit and priv data Date: Wed, 2 Mar 2011 16:25:21 +0530 Message-Id: <1299063331-27968-9-git-send-email-nm@ti.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1299063331-27968-1-git-send-email-nm@ti.com> References: <1299063331-27968-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]); Wed, 02 Mar 2011 10:56:55 +0000 (UTC) diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 08e1ee4..35658a2 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -220,6 +220,13 @@ static void sr_start_vddautocomp(struct omap_sr *sr) return; } + if (sr_class->class_init && + sr_class->class_init(sr->voltdm, sr_class->class_priv_data)) { + dev_err(&sr->pdev->dev, + "%s: SRClass initialization failed\n", __func__); + return; + } + if (!sr_class->enable(sr->voltdm)) sr->autocomp_active = true; } @@ -235,6 +242,13 @@ static void sr_stop_vddautocomp(struct omap_sr *sr) if (sr->autocomp_active) { sr_class->disable(sr->voltdm, 1); + if (sr_class->class_deinit && + sr_class->class_deinit(sr->voltdm, + sr_class->class_priv_data)) { + dev_err(&sr->pdev->dev, + "%s: SR[%d]Class deinitialization failed\n", + __func__, sr->srid); + } sr->autocomp_active = false; } } diff --git a/arch/arm/plat-omap/include/plat/smartreflex.h b/arch/arm/plat-omap/include/plat/smartreflex.h index 6568c88..8b6ecd9 100644 --- a/arch/arm/plat-omap/include/plat/smartreflex.h +++ b/arch/arm/plat-omap/include/plat/smartreflex.h @@ -167,6 +167,8 @@ struct omap_sr_pmic_data { * * @enable: API to enable a particular class smaartreflex. * @disable: API to disable a particular class smartreflex. + * @class_init: API to do class specific initialization (optional) + * @class_deinit: API to do class specific initialization (optional) * @configure: API to configure a particular class smartreflex. * @notify: API to notify the class driver about an event in SR. * Not needed for class3. @@ -174,14 +176,19 @@ struct omap_sr_pmic_data { * @class_type: specify which smartreflex class. * Can be used by the SR driver to take any class * based decisions. + * @class_priv_data: Class specific private data (optional) */ struct omap_sr_class_data { int (*enable)(struct voltagedomain *voltdm); 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, + void *class_priv_data); int (*configure)(struct voltagedomain *voltdm); int (*notify)(struct voltagedomain *voltdm, u32 status); u8 notify_flags; u8 class_type; + void *class_priv_data; }; /**