From: jean.pihet@newoldbits.com
To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
Kevin Hilman <khilman@ti.com>, "Rafael J. Wysocki" <rjw@sisk.pl>,
LKML <linux-kernel@vger.kernel.org>
Cc: Jean Pihet <j-pihet@ti.com>, Paul Walmsley <paul@pwsan.com>,
Thara Gopinath <thara@ti.com>, Nishanth Menon <nm@ti.com>
Subject: [PATCH 3/9] ARM: OMAP3+: SmartReflex: class drivers should use struct omap_sr *
Date: Mon, 19 Mar 2012 17:12:52 +0100 [thread overview]
Message-ID: <1332173578-27422-4-git-send-email-j-pihet@ti.com> (raw)
In-Reply-To: <1332173578-27422-1-git-send-email-j-pihet@ti.com>
From: Jean Pihet <j-pihet@ti.com>
Convert SmartReflex "class" functions to take a struct omap_sr *, rather than
a struct voltagedomain *. SmartReflex code should be driver code and not
tightly coupled to OMAP subarchitecture-specific structures.
Based on Paul's original code for the SmartReflex driver conversion.
Signed-off-by: Jean Pihet <j-pihet@ti.com>
Cc: Paul Walmsley <paul@pwsan.com>
Cc: Thara Gopinath <thara@ti.com>
Cc: Nishanth Menon <nm@ti.com>
Cc: Kevin Hilman <khilman@ti.com>
---
arch/arm/mach-omap2/smartreflex-class3.c | 24 +++++++++---------
arch/arm/mach-omap2/smartreflex.c | 37 +++++------------------------
arch/arm/mach-omap2/smartreflex.h | 9 ++++---
include/linux/power/smartreflex.h | 23 ++++++++++++++++++
4 files changed, 47 insertions(+), 46 deletions(-)
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index e12c51e..54ba048 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -14,34 +14,34 @@
#include "smartreflex.h"
#include "voltage.h"
-static int sr_class3_enable(struct voltagedomain *voltdm)
+static int sr_class3_enable(struct omap_sr *sr)
{
- unsigned long volt = voltdm_get_voltage(voltdm);
+ unsigned long volt = voltdm_get_voltage(sr->voltdm);
if (!volt) {
pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n",
- __func__, voltdm->name);
+ __func__, sr->voltdm->name);
return -ENODATA;
}
- omap_vp_enable(voltdm);
- return sr_enable(voltdm, volt);
+ omap_vp_enable(sr->voltdm);
+ return sr_enable(sr->voltdm, volt);
}
-static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
+static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
{
- sr_disable_errgen(voltdm);
- omap_vp_disable(voltdm);
- sr_disable(voltdm);
+ sr_disable_errgen(sr->voltdm);
+ omap_vp_disable(sr->voltdm);
+ sr_disable(sr->voltdm);
if (is_volt_reset)
- voltdm_reset(voltdm);
+ voltdm_reset(sr->voltdm);
return 0;
}
-static int sr_class3_configure(struct voltagedomain *voltdm)
+static int sr_class3_configure(struct omap_sr *sr)
{
- return sr_configure_errgen(voltdm);
+ return sr_configure_errgen(sr->voltdm);
}
/* SR class3 structure */
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 33e2825..dbb6a0c 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -35,29 +35,6 @@
#define NVALUE_NAME_LEN 40
#define SR_DISABLE_TIMEOUT 200
-struct omap_sr {
- struct list_head node;
- struct platform_device *pdev;
- struct omap_sr_nvalue_table *nvalue_table;
- struct voltagedomain *voltdm;
- struct dentry *dbg_dir;
- unsigned int irq;
- int srid;
- int ip_type;
- int nvalue_count;
- bool autocomp_active;
- u32 clk_length;
- u32 err_weight;
- u32 err_minlimit;
- u32 err_maxlimit;
- u32 accum_data;
- u32 senn_avgweight;
- u32 senp_avgweight;
- u32 senp_mod;
- u32 senn_mod;
- void __iomem *base;
-};
-
/* sr_list contains all the instances of smartreflex module */
static LIST_HEAD(sr_list);
@@ -148,7 +125,7 @@ static irqreturn_t sr_interrupt(int irq, void *data)
}
if (sr_class->notify)
- sr_class->notify(sr_info->voltdm, status);
+ sr_class->notify(sr_info, status);
return IRQ_HANDLED;
}
@@ -226,7 +203,7 @@ static void sr_start_vddautocomp(struct omap_sr *sr)
return;
}
- if (!sr_class->enable(sr->voltdm))
+ if (!sr_class->enable(sr))
sr->autocomp_active = true;
}
@@ -240,7 +217,7 @@ static void sr_stop_vddautocomp(struct omap_sr *sr)
}
if (sr->autocomp_active) {
- sr_class->disable(sr->voltdm, 1);
+ sr_class->disable(sr, 1);
sr->autocomp_active = false;
}
}
@@ -655,7 +632,7 @@ int sr_enable(struct voltagedomain *voltdm, unsigned long volt)
return 0;
/* Configure SR */
- ret = sr_class->configure(voltdm);
+ ret = sr_class->configure(sr);
if (ret)
return ret;
@@ -773,7 +750,7 @@ void omap_sr_enable(struct voltagedomain *voltdm)
return;
}
- sr_class->enable(voltdm);
+ sr_class->enable(sr);
}
/**
@@ -806,7 +783,7 @@ void omap_sr_disable(struct voltagedomain *voltdm)
return;
}
- sr_class->disable(voltdm, 0);
+ sr_class->disable(sr, 0);
}
/**
@@ -839,7 +816,7 @@ void omap_sr_disable_reset_volt(struct voltagedomain *voltdm)
return;
}
- sr_class->disable(voltdm, 1);
+ sr_class->disable(sr, 1);
}
/**
diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h
index 8835422..6f9b677 100644
--- a/arch/arm/mach-omap2/smartreflex.h
+++ b/arch/arm/mach-omap2/smartreflex.h
@@ -21,6 +21,7 @@
#define __ASM_ARM_OMAP_SMARTREFLEX_H
#include <linux/platform_device.h>
+#include <linux/power/smartreflex.h>
#include <plat/voltage.h>
@@ -178,10 +179,10 @@ struct omap_sr_pmic_data {
* based decisions.
*/
struct omap_sr_class_data {
- int (*enable)(struct voltagedomain *voltdm);
- int (*disable)(struct voltagedomain *voltdm, int is_volt_reset);
- int (*configure)(struct voltagedomain *voltdm);
- int (*notify)(struct voltagedomain *voltdm, u32 status);
+ int (*enable)(struct omap_sr *sr);
+ int (*disable)(struct omap_sr *sr, int is_volt_reset);
+ int (*configure)(struct omap_sr *sr);
+ int (*notify)(struct omap_sr *sr, u32 status);
u8 notify_flags;
u8 class_type;
};
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h
index 4a15640..cf292ac 100644
--- a/include/linux/power/smartreflex.h
+++ b/include/linux/power/smartreflex.h
@@ -21,6 +21,29 @@
#include <plat/voltage.h>
+struct omap_sr {
+ struct list_head node;
+ struct platform_device *pdev;
+ struct omap_sr_nvalue_table *nvalue_table;
+ struct voltagedomain *voltdm;
+ struct dentry *dbg_dir;
+ unsigned int irq;
+ int srid;
+ int ip_type;
+ int nvalue_count;
+ bool autocomp_active;
+ u32 clk_length;
+ u32 err_weight;
+ u32 err_minlimit;
+ u32 err_maxlimit;
+ u32 accum_data;
+ u32 senn_avgweight;
+ u32 senp_avgweight;
+ u32 senp_mod;
+ u32 senn_mod;
+ void __iomem *base;
+};
+
/**
* struct omap_sr_nvalue_table - Smartreflex n-target value info
*
--
1.7.5.4
next prev parent reply other threads:[~2012-03-19 16:13 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 16:12 [PATCH v2 0/9] PM: Create the AVS class of drivers jean.pihet
2012-03-19 16:12 ` [PATCH 1/9] ARM: OMAP3+: voltage: export functions to plat/voltage.h jean.pihet
2012-04-18 17:27 ` Kevin Hilman
2012-04-18 20:36 ` Jean Pihet
2012-03-19 16:12 ` [PATCH 2/9] ARM: OMAP2+: SmartReflex: move the driver specific macros in include/linux/power jean.pihet
2012-04-04 19:10 ` Trilok Soni
2012-04-04 19:41 ` Cousson, Benoit
2012-04-05 6:53 ` Trilok Soni
2012-04-05 8:59 ` Jean Pihet
2012-04-05 9:35 ` Trilok Soni
2012-04-19 13:54 ` Arnd Bergmann
2012-04-19 16:02 ` Jean Pihet
2012-04-19 17:06 ` Kevin Hilman
2012-03-19 16:12 ` jean.pihet [this message]
2012-03-19 16:12 ` [PATCH 4/9] ARM: OMAP2+: smartreflex: Use the names from hwmod data instead of voltage domains jean.pihet
2012-03-19 16:12 ` [PATCH 5/9] ARM: OMAP3: hwmod: rename the smartreflex entries jean.pihet
2012-04-18 17:33 ` Kevin Hilman
2012-04-18 20:41 ` Jean Pihet
2012-03-19 16:12 ` [PATCH 6/9] ARM: OMAP2+: SmartReflex: introduce a busy loop condition test macro jean.pihet
2012-03-19 16:12 ` [PATCH 7/9] ARM: OMAP2+: SmartReflex: Use per-OPP data structure jean.pihet
2012-04-18 18:21 ` Kevin Hilman
2012-04-18 20:52 ` Jean Pihet
2012-03-19 16:12 ` [PATCH 8/9] ARM: OMAP2+: SmartReflex: add POWER_AVS Kconfig options jean.pihet
2012-03-19 16:12 ` [PATCH 9/9] ARM: OMAP: SmartReflex: Move smartreflex driver to drivers/ jean.pihet
2012-04-18 18:17 ` Kevin Hilman
2012-04-03 11:14 ` [PATCH v2 0/9] PM: Create the AVS class of drivers Jean Pihet
2012-04-18 8:04 ` Jean Pihet
2012-04-19 0:08 ` Greg KH
2012-04-18 18:29 ` Kevin Hilman
2012-04-18 18:30 ` Kevin Hilman
2012-04-18 18:49 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1332173578-27422-4-git-send-email-j-pihet@ti.com \
--to=jean.pihet@newoldbits.com \
--cc=j-pihet@ti.com \
--cc=khilman@ti.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=nm@ti.com \
--cc=paul@pwsan.com \
--cc=rjw@sisk.pl \
--cc=thara@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).