aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSakethram Bommisetti <sakethram.bommisetti@stericsson.com>2011-09-12 15:32:40 +0530
committerSakethram BOMMISETTI <sakethram.bommisetti@stericsson.com>2011-09-12 12:40:45 +0200
commit81756e807124d8d1f77a5e75bf60c294f597b342 (patch)
treebd3d5f2a54a6c5ac856fa529100946f505e63ef6
parent2b301121ea6845983cb6510534a760a8e0d359f5 (diff)
ux500: usb: Move request ARM OPP qos to usb driveralk_kernel_3.0_wk37.1
ST-Ericsson ID: - ST-Ericsson Linux next: Not tested ST-Ericsson FOSS-OUT ID: Trivial Signed-off-by: Sakethram Bommisetti <sakethram.bommisetti@stericsson.com> Signed-off-by: Jonas Aaberg <jonas.aberg@stericsson.com> Change-Id: I70bc1f067032973d20261edb7cdc73631ad30d1c Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/30691 Reviewed-by: Rabin VINCENT <rabin.vincent@stericsson.com> Reviewed-by: Praveena NADAHALLY <praveen.nadahally@stericsson.com>
-rw-r--r--arch/arm/mach-ux500/pm/cpufreq-db8500.c45
-rw-r--r--arch/arm/mach-ux500/pm/cpufreq.h2
-rw-r--r--drivers/usb/otg/ab8500-usb.c56
3 files changed, 52 insertions, 51 deletions
diff --git a/arch/arm/mach-ux500/pm/cpufreq-db8500.c b/arch/arm/mach-ux500/pm/cpufreq-db8500.c
index c5193ab2ab4..294af62ff37 100644
--- a/arch/arm/mach-ux500/pm/cpufreq-db8500.c
+++ b/arch/arm/mach-ux500/pm/cpufreq-db8500.c
@@ -57,10 +57,6 @@ static enum arm_opp idx2opp[] = {
#define WLAN_LIMIT (3000/3) /* If we have more than 1000 irqs per second */
static struct delayed_work work_wlan_workaround;
-#define USB_PROBE_DELAY 1000 /* 1 seconds */
-#define USB_LIMIT (200) /* If we have more than 200 irqs per second */
-static struct delayed_work work_usb_workaround;
-
static void wlan_load(struct work_struct *work)
{
int cpu;
@@ -85,43 +81,6 @@ static void wlan_load(struct work_struct *work)
msecs_to_jiffies(WLAN_PROBE_DELAY));
}
-static void usb_load(struct work_struct *work)
-{
- int cpu;
- unsigned int num_irqs = 0;
- static unsigned int old_num_irqs = UINT_MAX;
-
- for_each_online_cpu(cpu)
- num_irqs += kstat_irqs_cpu(IRQ_DB8500_USBOTG, cpu);
-
- if ((num_irqs > old_num_irqs) &&
- (num_irqs - old_num_irqs) > USB_LIMIT)
- prcmu_qos_update_requirement(PRCMU_QOS_ARM_OPP,
- "usb", 125);
- else
- prcmu_qos_update_requirement(PRCMU_QOS_ARM_OPP,
- "usb", 25);
-
- old_num_irqs = num_irqs;
-
- schedule_delayed_work_on(0,
- &work_usb_workaround,
- msecs_to_jiffies(USB_PROBE_DELAY));
-}
-
-void cpufreq_usb_connect_notify(bool connect)
-{
- if (connect) {
- schedule_delayed_work_on(0,
- &work_usb_workaround,
- msecs_to_jiffies(USB_PROBE_DELAY));
- } else {
- cancel_delayed_work_sync(&work_usb_workaround);
- prcmu_qos_update_requirement(PRCMU_QOS_ARM_OPP,
- "usb", 25);
- }
-}
-
int u8500_cpufreq_limits(int cpu, int r, unsigned int *min, unsigned int *max)
{
int op;
@@ -196,10 +155,6 @@ static int __init u8500_cpufreq_register(void)
INIT_DELAYED_WORK_DEFERRABLE(&work_wlan_workaround,
wlan_load);
- INIT_DELAYED_WORK_DEFERRABLE(&work_usb_workaround,
- usb_load);
-
- prcmu_qos_add_requirement(PRCMU_QOS_ARM_OPP, "usb", 25);
prcmu_qos_add_requirement(PRCMU_QOS_ARM_OPP, "wlan", 25);
schedule_delayed_work_on(0,
diff --git a/arch/arm/mach-ux500/pm/cpufreq.h b/arch/arm/mach-ux500/pm/cpufreq.h
index b111c05ea98..eaf5eab3ab3 100644
--- a/arch/arm/mach-ux500/pm/cpufreq.h
+++ b/arch/arm/mach-ux500/pm/cpufreq.h
@@ -11,8 +11,6 @@
extern int ux500_cpufreq_register(struct cpufreq_frequency_table *freq_table,
enum arm_opp *idx2opp);
-void cpufreq_usb_connect_notify(bool connect);
-
/* This function lives in drivers/cpufreq/cpufreq.c */
int cpufreq_update_freq(int cpu, unsigned int min, unsigned int max);
diff --git a/drivers/usb/otg/ab8500-usb.c b/drivers/usb/otg/ab8500-usb.c
index 98aa780dc76..ff990e38b26 100644
--- a/drivers/usb/otg/ab8500-usb.c
+++ b/drivers/usb/otg/ab8500-usb.c
@@ -36,6 +36,7 @@
#include <linux/regulator/consumer.h>
#include <mach/prcmu.h>
#include <mach/usb.h>
+#include <linux/kernel_stat.h>
#include <linux/wakelock.h>
static struct wake_lock ab8500_musb_wakelock;
@@ -71,8 +72,8 @@ static struct wake_lock ab8500_musb_wakelock;
#define AB8500_USB_PHY_TUNE3 0x07
-
-
+#define USB_PROBE_DELAY 1000 /* 1 seconds */
+#define USB_LIMIT (200) /* If we have more than 200 irqs per second */
/* Usb line status register */
enum ab8500_usb_link_status {
@@ -120,6 +121,7 @@ struct ab8500_usb {
struct regulator *v_musb;
struct regulator *v_ulpi;
struct ab8500_usbgpio_platform_data *usb_gpio;
+ struct delayed_work work_usb_workaround;
};
static inline struct ab8500_usb *xceiv_to_ab(struct otg_transceiver *x)
@@ -151,6 +153,33 @@ static void ab8500_usb_wd_workaround(struct ab8500_usb *ab)
0);
}
+static void ab8500_usb_load(struct work_struct *work)
+{
+ int cpu;
+ unsigned int num_irqs = 0;
+ static unsigned int old_num_irqs = UINT_MAX;
+ struct delayed_work *work_usb_workaround = to_delayed_work(work);
+ struct ab8500_usb *ab = container_of(work_usb_workaround,
+ struct ab8500_usb, work_usb_workaround);
+
+ for_each_online_cpu(cpu)
+ num_irqs += kstat_irqs_cpu(IRQ_DB8500_USBOTG, cpu);
+
+ if ((num_irqs > old_num_irqs) &&
+ (num_irqs - old_num_irqs) > USB_LIMIT)
+ prcmu_qos_update_requirement(PRCMU_QOS_ARM_OPP,
+ "usb", 125);
+ else
+ prcmu_qos_update_requirement(PRCMU_QOS_ARM_OPP,
+ "usb", 25);
+
+ old_num_irqs = num_irqs;
+
+ schedule_delayed_work_on(0,
+ &ab->work_usb_workaround,
+ msecs_to_jiffies(USB_PROBE_DELAY));
+}
+
static void ab8500_usb_regulator_ctrl(struct ab8500_usb *ab, bool sel_host,
bool enable)
{
@@ -177,9 +206,16 @@ static void ab8500_usb_phy_enable(struct ab8500_usb *ab, bool sel_host)
clk_enable(ab->sysclk);
ab8500_usb_regulator_ctrl(ab, sel_host, true);
+
prcmu_qos_update_requirement(PRCMU_QOS_APE_OPP,
(char *)dev_name(ab->dev), 100);
+ if (!sel_host) {
+ schedule_delayed_work_on(0,
+ &ab->work_usb_workaround,
+ msecs_to_jiffies(USB_PROBE_DELAY));
+ }
+
abx500_mask_and_set_register_interruptible(ab->dev,
AB8500_USB,
AB8500_USB_PHY_CTRL_REG,
@@ -226,6 +262,14 @@ static void ab8500_usb_phy_disable(struct ab8500_usb *ab, bool sel_host)
prcmu_qos_update_requirement(PRCMU_QOS_APE_OPP,
(char *)dev_name(ab->dev), 50);
+
+ if (!sel_host) {
+
+ cancel_delayed_work_sync(&ab->work_usb_workaround);
+ prcmu_qos_update_requirement(PRCMU_QOS_ARM_OPP,
+ "usb", 25);
+ }
+
wake_unlock(&ab8500_musb_wakelock);
}
@@ -303,8 +347,8 @@ static int ab8500_usb_link_status_update(struct ab8500_usb *ab)
static void ab8500_usb_delayed_work(struct work_struct *work)
{
- struct ab8500_usb *ab = container_of(work, struct ab8500_usb,
- dwork.work);
+ struct delayed_work *dwork = to_delayed_work(work);
+ struct ab8500_usb *ab = container_of(dwork, struct ab8500_usb, dwork);
ab8500_usb_link_status_update(ab);
}
@@ -704,6 +748,8 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
/* all: Disable phy when called from set_host and set_peripheral */
INIT_WORK(&ab->phy_dis_work, ab8500_usb_phy_disable_work);
+ INIT_DELAYED_WORK_DEFERRABLE(&ab->work_usb_workaround,
+ ab8500_usb_load);
err = ab8500_usb_regulator_get(ab);
if (err)
goto fail0;
@@ -782,6 +828,8 @@ static int __devinit ab8500_usb_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "revision 0x%2x driver initialized\n", ab->rev);
+ prcmu_qos_add_requirement(PRCMU_QOS_ARM_OPP, "usb", 25);
+
wake_lock_init(&ab8500_musb_wakelock, WAKE_LOCK_SUSPEND, "ab8500-usb");
err = ab8500_usb_boot_detect(ab);