OMAP PM: MPU/DMA Latency constraints
Subsystems (3)
PATCH 1/1 OMAP PM: MPU/DMA Latency constraints
This patch has implementation for OMAP MPU/DMA Latency constraints using PM QOS.
--- arch/arm/plat-omap/Kconfig | 3 + arch/arm/plat-omap/Makefile | 1 + arch/arm/plat-omap/i2c.c | 3 +- arch/arm/plat-omap/include/plat/omap-pm.h | 9 +- arch/arm/plat-omap/omap-pm-noop.c | 20 +-- arch/arm/plat-omap/omap-pm.c | 309 +++++++++++++++++++++++++++++ 6 files changed, 328 insertions(+), 17 deletions(-) create mode 100755 arch/arm/plat-omap/omap-pm.c
arch/arm/plat-omap/Kconfig +3 -0
@@ -194,6 +194,9 @@ config OMAP_PM_NONE config OMAP_PM_NOOP bool "No-op/debug PM layer" +config OMAP_PM + depends on PM + bool "OMAP PM layer implementation" endchoice endmenu
arch/arm/plat-omap/Makefile +1 -0
@@ -32,3 +32,4 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y) obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o +obj-$(CONFIG_OMAP_PM) += omap-pm.o
arch/arm/plat-omap/i2c.c +2 -1
@@ -145,7 +145,8 @@ static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id)*/ static void omap_pm_set_max_mpu_wakeup_lat_compat (struct device *dev,long t) { -omap_pm_set_max_mpu_wakeup_lat (dev, t); +struct pm_qos_request_list *qos_handle =NULL ; +omap_pm_set_max_mpu_wakeup_lat (&qos_handle, t); }static inline int omap2_i2c_add_bus (struct platform_device *pdev,int bus_id)
arch/arm/plat-omap/include/plat/omap-pm.h +5 -4
@@ -19,6 +19,7 @@#include <linux/clk.h> #include "powerdomain.h" +#include <linux/pm_qos_params.h> /** * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU
@@ -86,7 +87,7 @@ void omap_pm_if_exit(void);/** * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency -* @dev: struct device * requesting the constraint +* @qos_request: handle for the constraint. The pointer should be initialized to NULL * @t: maximum MPU wakeup latency in microseconds * * Request that the maximum interrupt latency for the MPU to be no
@@ -118,7 +119,7 @@ void omap_pm_if_exit(void);* Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t); +int omap_pm_set_max_mpu_wakeup_lat (struct pm_qos_request_list **qos_request,long t);/**
@@ -185,7 +186,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,/** * omap_pm_set_max_sdma_lat - set the maximum system DMA transfer start latency -* @dev: struct device * +* @qos_request: handle for the constraint. The pointer should be initialized to NULL * @t: maximum DMA transfer start latency in microseconds * * Request that the maximum system DMA transfer start latency for this
@@ -210,7 +211,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,* Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_sdma_lat (struct device *dev,long t); +int omap_pm_set_max_sdma_lat (struct pm_qos_request_list **qos_request,long t);/**
arch/arm/plat-omap/omap-pm-noop.c +8 -12
@@ -34,19 +34,17 @@ struct omap_opp *l3_opps;* Device-driver-originated constraints (via board-*.c files) */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t) +int omap_pm_set_max_mpu_wakeup_lat (struct pm_qos_request_list **pmqos_req,long t) { -if (!dev || t <-1 ) { +if (!pmqos_req || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ; };if (t ==-1 ) -pr_debug ("OMAP PM: remove max MPU wakeup latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max MPU wakeup latency constraint\n" );else -pr_debug ("OMAP PM: add max MPU wakeup latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); +pr_debug ("OMAP PM: add max MPU wakeup latency constraint: t = %ld usec\n" , t);/* * For current Linux, this needs to map the MPU to a
@@ -120,19 +118,17 @@ int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,return 0 ; } -int omap_pm_set_max_sdma_lat (struct device *dev,long t) +int omap_pm_set_max_sdma_lat (struct pm_qos_request_list **qos_request,long t) { -if (!dev || t <-1 ) { +if (!qos_request || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ; };if (t ==-1 ) -pr_debug ("OMAP PM: remove max DMA latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max DMA latency constraint:\n" );else -pr_debug ("OMAP PM: add max DMA latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); +pr_debug ("OMAP PM: add max DMA latency constraint: t = %ld usec\n" , t);/* * For current Linux PM QOS params, this code should scan the
arch/arm/plat-omap/omap-pm.c new file +309 -0
309 lines not on this page · raw message
Signature · 1 line
1.5.4.7
Kevin,
Any comments on this patch?
Thanks
Vishwa
Quoted 492 lines
-----Original Message-----
From: Sripathy, Vishwanath
Sent: Friday, July 23, 2010 2:07 PM
To: [email protected]
Cc: Sripathy, Vishwanath
Subject: [PATCH] OMAP PM: MPU/DMA Latency constraintsThis patch has implementation for OMAP MPU/DMA Latency constraints using PM QOS.
Signed-off-by Vishwanath Sripathy <[email protected]>--- arch/arm/plat-omap/Kconfig | 3 + arch/arm/plat-omap/Makefile | 1 + arch/arm/plat-omap/i2c.c | 3 +- arch/arm/plat-omap/include/plat/omap-pm.h | 9 +- arch/arm/plat-omap/omap-pm-noop.c | 20 +-- arch/arm/plat-omap/omap-pm.c | 309 +++++++++++++++++++++++++++++ 6 files changed, 328 insertions(+), 17 deletions(-) create mode 100755 arch/arm/plat-omap/omap-pm.carch/arm/plat-omap/Kconfig +3
-0@@ -194,6 +194,9 @@ config OMAP_PM_NONE config OMAP_PM_NOOP bool "No-op/debug PM layer" +config OMAP_PM + depends on PM + bool "OMAP PM layer implementation" endchoice endmenuarch/arm/plat-omap/Makefile +1
-0@@ -32,3 +32,4 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y) obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o +obj-$(CONFIG_OMAP_PM) += omap-pm.oarch/arm/plat-omap/i2c.c +2
-1@@ -145,7 +145,8 @@ static inline int omap1_i2c_add_bus(struct platform_device*pdev, int bus_id) */ static void omap_pm_set_max_mpu_wakeup_lat_compat (struct device *dev,long t) { -omap_pm_set_max_mpu_wakeup_lat (dev, t); +struct pm_qos_request_list *qos_handle =NULL ; +omap_pm_set_max_mpu_wakeup_lat (&qos_handle, t); }static inline int
omap2_i2c_add_bus(struct platform_device *pdev, int bus_id)arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/omap-pm.h +0
-0
omap/include/plat/omap-pm.h
index 728fbb9..47ba9e6 100644arch/arm/plat-omap/include/plat/omap-pm.h +3
-2@@ -19,6 +19,7 @@#include <linux/clk.h> #include "powerdomain.h" +#include <linux/pm_qos_params.h> /** * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU @@ -86,7 +87,7 @@ void omap_pm_if_exit(void);/** * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency -* @dev: struct device * requesting the constraint +* @qos_request: handle for the constraint. The pointer should be initialized to NULL * @t: maximum MPU wakeup latency in microseconds * * Request that the maximum interrupt latency for the MPU to be no @@ -118,7 +119,7 @@ void omap_pm_if_exit(void);* Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t); +int omap_pm_set_max_mpu_wakeup_lat (struct pm_qos_request_list **qos_request,long t);/**
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0@@ -185,7 +186,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,/** * omap_pm_set_max_sdma_lat - set the maximum system DMA transfer start latency
- * @dev: struct device *
+ * @qos_request: handle for the constraint. The pointer should be initialized to NULL
* @t: maximum DMA transfer start latency in microseconds
*
* Request that the maximum system DMA transfer start latency for thisarch/arm/plat-omap/include/plat/omap-pm.h +1
-1@@ -210,7 +211,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device*req_dev, struct device *dev, * Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_sdma_lat (struct device *dev,long t); +int omap_pm_set_max_sdma_lat (struct pm_qos_request_list **qos_request,long t);/**
arch/arm/plat-omap/omap-pm- renamed from arch/arm/plat-omap/omap-pm-noop.c +0
-0
noop.c
index e129ce8..af2fe43 100644arch/arm/plat-omap/omap-pm-noop.c +4
-6@@ -34,19 +34,17 @@ struct omap_opp *l3_opps;* Device-driver-originated constraints (via board-*.c files) */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t) +int omap_pm_set_max_mpu_wakeup_lat (struct pm_qos_request_list **pmqos_req,long t) { -if (!dev || t <-1 ) { +if (!pmqos_req || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ; };if (t ==-1 ) -pr_debug ("OMAP PM: remove max MPU wakeup latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max MPU wakeup latency constraint\n" );else -pr_debug ("OMAP PM: add max MPU wakeup latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); +pr_debug ("OMAP PM: add max MPU wakeup latency constraint: t = %ld usec\n", t);/*
* For current Linux, this needs to map the MPU to aarch/arm/plat-omap/omap-pm-noop.c +4
-6@@ -120,19 +118,17 @@ int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev, return 0; } -int omap_pm_set_max_sdma_lat (struct device *dev,long t) +int omap_pm_set_max_sdma_lat (struct pm_qos_request_list **qos_request,long t) { -if (!dev || t <-1 ) { +if (!qos_request || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ; };if (t ==-1 ) -pr_debug ("OMAP PM: remove max DMA latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max DMA latency constraint:\n" );else -pr_debug ("OMAP PM: add max DMA latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); +pr_debug ("OMAP PM: add max DMA latency constraint: t = %ld usec\n", t);/*
* For current Linux PM QOS params, this code should scan thearch/arm/plat-omap/omap-pm.c new file +34
-0@@ -0,0 +1,309 @@ +/* +* omap-pm.c - OMAP power management interface +* +* Copyright (C) 2008-2010 Texas Instruments, Inc. +* Copyright (C) 2008-2009 Nokia Corporation +* Vishwanath BS +* +* This code is based on plat-omap/omap-pm-noop.c. +* +* Interface developed by (in alphabetical order): +* Karthik Dasu, Tony Lindgren, Rajendra Nayak, Sakari Poussa, Veeramanikandan +* Raju, Anand Sawant, Igor Stoppa, Paul Walmsley, Richard Woodruff +*/ + +#undef DEBUG + +#include <linux/init.h> +#include <linux/cpufreq.h> +#include <linux/device.h> + +/* Interface documentation is in mach/omap-pm.h */ +#include <plat/omap-pm.h> + +#include <plat/powerdomain.h> + +struct omap_opp *dsp_opps; +struct omap_opp *mpu_opps; +struct omap_opp *l3_opps; + +/* +* Device-driver-originated constraints (via board-*.c files) +*/ + +int omap_pm_set_max_mpu_wakeup_lat(struct pm_qos_request_list**qos_request, long t)
arch/arm/plat-omap/omap-pm.c new file +3
-0+{ +if (!qos_request || t <-1 ) { + pr_warning("Warning: invalid params to
omap_pm_set_max_mpu_wakeup_lat\n:");arch/arm/plat-omap/omap-pm.c new file +8
-0+return -EINVAL ; + }; + +if (t ==-1 ) { +pm_qos_remove_request (*qos_request); + *qos_request =NULL ; + }else if (*qos_request ==NULL ) + *qos_request = pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,t);
arch/arm/plat-omap/omap-pm.c new file +69
-0+else +pm_qos_update_request (*qos_request, t); + +return 0 ; +} + + +int omap_pm_set_min_bus_tput (struct device *dev,u8 agent_id,unsigned long r) +{ +if (!dev || (agent_id !=OCP_INITIATOR_AGENT && + agent_id !=OCP_TARGET_AGENT )) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + }; + +if (r ==0 ) +pr_debug ("OMAP PM: remove min bus tput constraint: " +"dev %s for agent_id %d\n" ,dev_name (dev), agent_id); +else +pr_debug ("OMAP PM: add min bus tput constraint: " +"dev %s for agent_id %d: rate %ld KiB\n" , +dev_name (dev), agent_id, r); + +/* +* This code should model the interconnect and compute the +* required clock frequency, convert that to a VDD2 OPP ID, then +* set the VDD2 OPP appropriately. +* +* TI CDP code can call constraint_set here on the VDD2 OPP. +*/ + +return 0 ; +} + +int omap_pm_set_max_dev_wakeup_lat (struct device *req_dev,struct device *dev, +long t) +{ +if (!req_dev || !dev || t <-1 ) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + }; + +if (t ==-1 ) +pr_debug ("OMAP PM: remove max device latency constraint: " +"dev %s\n" ,dev_name (dev)); +else +pr_debug ("OMAP PM: add max device latency constraint: " +"dev %s, t = %ld usec\n" ,dev_name (dev), t); + +/* +* For current Linux, this needs to map the device to a +* powerdomain, then go through the list of current max lat +* constraints on that powerdomain and find the smallest. If +* the latency constraint has changed, the code should +* recompute the state to enter for the next powerdomain +* state. Conceivably, this code should also determine +* whether to actually disable the device clocks or not, +* depending on how long it takes to re-enable the clocks. +* +* TI CDP code can call constraint_set here. +*/ + +return 0 ; +} + +int omap_pm_set_max_sdma_lat (struct pm_qos_request_list **qos_request,long t) +{ +if (!qos_request || t <-1 ) { + pr_warning("Warning: invalid params toomap_pm_set_max_sdma_lat\n:");
arch/arm/plat-omap/omap-pm.c new file +8
-0+return -EINVAL ; + }; + +if (t ==-1 ) { +pm_qos_remove_request (*qos_request); + *qos_request =NULL ; + }else if (*qos_request ==NULL ) + *qos_request = pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,t);
arch/arm/plat-omap/omap-pm.c new file +187
-1+else +pm_qos_update_request (*qos_request, t); + +return 0 ; +} + +int omap_pm_set_min_clk_rate (struct device *dev,struct clk *c,long r) +{ +if (!dev || !c || r <0 ) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + } + +if (r ==0 ) +pr_debug ("OMAP PM: remove min clk rate constraint: " +"dev %s\n" ,dev_name (dev)); +else +pr_debug ("OMAP PM: add min clk rate constraint: " +"dev %s, rate = %ld Hz\n" ,dev_name (dev), r); + +/* +* Code in a real implementation should keep track of these +* constraints on the clock, and determine the highest minimum +* clock rate. It should iterate over each OPP and determine +* whether the OPP will result in a clock rate that would +* satisfy this constraint (and any other PM constraint in effect +* at that time). Once it finds the lowest-voltage OPP that +* meets those conditions, it should switch to it, or return +* an error if the code is not capable of doing so. +*/ + +return 0 ; +} + +/* +* DSP Bridge-specific constraints +*/ + +const struct omap_opp *omap_pm_dsp_get_opp_table (void ) +{ +pr_debug ("OMAP PM: DSP request for OPP table\n" ); + +/* +* Return DSP frequency table here: The final item in the +* array should have .rate = .opp_id = 0. +*/ + +return NULL ; +} + +void omap_pm_dsp_set_min_opp (u8 opp_id) +{ +if (opp_id ==0 ) { +WARN_ON (1 ); +return ; + } + +pr_debug ("OMAP PM: DSP requests minimum VDD1 OPP to be %d\n" , opp_id); + +/* +* +* For l-o dev tree, our VDD1 clk is keyed on OPP ID, so we +* can just test to see which is higher, the CPU's desired OPP +* ID or the DSP's desired OPP ID, and use whichever is +* highest. +* +* In CDP12.14+, the VDD1 OPP custom clock that controls the DSP +* rate is keyed on MPU speed, not the OPP ID. So we need to +* map the OPP ID to the MPU speed for use with clk_set_rate() +* if it is higher than the current OPP clock rate. +* +*/ +} + + +u8 omap_pm_dsp_get_opp (void ) +{ +pr_debug ("OMAP PM: DSP requests current DSP OPP ID\n" ); + +/* +* For l-o dev tree, call clk_get_rate() on VDD1 OPP clock +* +* CDP12.14+: +* Call clk_get_rate() on the OPP custom clock, map that to an +* OPP ID using the tables defined in board-*.c/chip-*.c files. +*/ + +return 0 ; +} + +/* +* CPUFreq-originated constraint +* +* In the future, this should be handled by custom OPP clocktype +* functions. +*/ + +struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table (void ) +{ +pr_debug ("OMAP PM: CPUFreq request for frequency table\n" ); + +/* +* Return CPUFreq frequency table here: loop over +* all VDD1 clkrates, pull out the mpu_ck frequencies, build +* table +*/ + +return NULL ; +} + +void omap_pm_cpu_set_freq (unsigned long f) +{ +if (f ==0 ) { +WARN_ON (1 ); +return ; + } + +pr_debug ("OMAP PM: CPUFreq requests CPU frequency to be set to %lu\n" , + f); + +/* +* For l-o dev tree, determine whether MPU freq or DSP OPP id +* freq is higher. Find the OPP ID corresponding to the +* higher frequency. Call clk_round_rate() and clk_set_rate() +* on the OPP custom clock. +* +* CDP should just be able to set the VDD1 OPP clock rate here. +*/ +} + +unsigned long omap_pm_cpu_get_freq (void ) +{ +pr_debug ("OMAP PM: CPUFreq requests current CPU frequency\n" ); + +/* +* Call clk_get_rate() on the mpu_ck. +*/ + +return 0 ; +} + +/* +* Device context loss tracking +*/ + +int omap_pm_get_dev_context_loss_count (struct device *dev) +{ +if (!dev) { +WARN_ON (1 ); +return -EINVAL ; + }; + +pr_debug ("OMAP PM: returning context loss count for dev %s\n" , +dev_name (dev)); + +/* +* Map the device to the powerdomain. Return the powerdomain +* off counter. +*/ + +return 0 ; +} + + +/* Should be called before clk framework init */ +int __init omap_pm_if_early_init (struct omap_opp *mpu_opp_table, +struct omap_opp *dsp_opp_table, +struct omap_opp *l3_opp_table) +{ + mpu_opps = mpu_opp_table; + dsp_opps = dsp_opp_table; + l3_opps = l3_opp_table; +return 0 ; +} + +/* Must be called after clock framework is initialized */ +int __init omap_pm_if_init (void ) +{ +return 0 ; +} + +void omap_pm_if_exit (void ) +{ +/* Deallocate CPUFreq frequency table here */ +} + + --1.5.4.7
Quoted 1 line · Vishwanath Sripathy
This patch has implementation for OMAP MPU/DMA Latency constraints using PM QOS.
Changelog is missing description of the problem being solved and the motivation for the solution.
In particular, a system-wide API is being changed here with no description of the problem or the reason for this particular solution.
On first glance, the idea here seems wrong. In getting rid of the device pointer, how do you plan to handle per-device constraints?
Kevin
Quoted 463 lines
Signed-off-by Vishwanath Sripathy <[email protected]>--- arch/arm/plat-omap/Kconfig | 3 + arch/arm/plat-omap/Makefile | 1 + arch/arm/plat-omap/i2c.c | 3 +- arch/arm/plat-omap/include/plat/omap-pm.h | 9 +- arch/arm/plat-omap/omap-pm-noop.c | 20 +-- arch/arm/plat-omap/omap-pm.c | 309 +++++++++++++++++++++++++++++ 6 files changed, 328 insertions(+), 17 deletions(-) create mode 100755 arch/arm/plat-omap/omap-pm.carch/arm/plat-omap/Kconfig +3
-0@@ -194,6 +194,9 @@ config OMAP_PM_NONE config OMAP_PM_NOOP bool "No-op/debug PM layer" +config OMAP_PM + depends on PM + bool "OMAP PM layer implementation" endchoice endmenuarch/arm/plat-omap/Makefile +1
-0@@ -32,3 +32,4 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y) obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o +obj-$(CONFIG_OMAP_PM) += omap-pm.oarch/arm/plat-omap/i2c.c +2
-1@@ -145,7 +145,8 @@ static inline int omap1_i2c_add_bus(struct platform_device *pdev, int bus_id)*/ static void omap_pm_set_max_mpu_wakeup_lat_compat (struct device *dev,long t) { -omap_pm_set_max_mpu_wakeup_lat (dev, t); +struct pm_qos_request_list *qos_handle =NULL ; +omap_pm_set_max_mpu_wakeup_lat (&qos_handle, t); }static inline int omap2_i2c_add_bus (struct platform_device *pdev,int bus_id)arch/arm/plat-omap/include/plat/omap-pm.h +5
-4@@ -19,6 +19,7 @@#include <linux/clk.h> #include "powerdomain.h" +#include <linux/pm_qos_params.h> /** * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU @@ -86,7 +87,7 @@ void omap_pm_if_exit(void);/** * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency -* @dev: struct device * requesting the constraint +* @qos_request: handle for the constraint. The pointer should be initialized to NULL * @t: maximum MPU wakeup latency in microseconds * * Request that the maximum interrupt latency for the MPU to be no @@ -118,7 +119,7 @@ void omap_pm_if_exit(void);* Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t); +int omap_pm_set_max_mpu_wakeup_lat (struct pm_qos_request_list **qos_request,long t);/** @@ -185,7 +186,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,/** * omap_pm_set_max_sdma_lat - set the maximum system DMA transfer start latency -* @dev: struct device * +* @qos_request: handle for the constraint. The pointer should be initialized to NULL * @t: maximum DMA transfer start latency in microseconds * * Request that the maximum system DMA transfer start latency for this @@ -210,7 +211,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,* Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_sdma_lat (struct device *dev,long t); +int omap_pm_set_max_sdma_lat (struct pm_qos_request_list **qos_request,long t);/** arch/arm/plat-omap/omap-pm-noop.c +8
-12@@ -34,19 +34,17 @@ struct omap_opp *l3_opps;* Device-driver-originated constraints (via board-*.c files) */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t) +int omap_pm_set_max_mpu_wakeup_lat (struct pm_qos_request_list **pmqos_req,long t) { -if (!dev || t <-1 ) { +if (!pmqos_req || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ; };if (t ==-1 ) -pr_debug ("OMAP PM: remove max MPU wakeup latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max MPU wakeup latency constraint\n" );else -pr_debug ("OMAP PM: add max MPU wakeup latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); +pr_debug ("OMAP PM: add max MPU wakeup latency constraint: t = %ld usec\n" , t);/* * For current Linux, this needs to map the MPU to a @@ -120,19 +118,17 @@ int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,return 0 ; } -int omap_pm_set_max_sdma_lat (struct device *dev,long t) +int omap_pm_set_max_sdma_lat (struct pm_qos_request_list **qos_request,long t) { -if (!dev || t <-1 ) { +if (!qos_request || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ; };if (t ==-1 ) -pr_debug ("OMAP PM: remove max DMA latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max DMA latency constraint:\n" );else -pr_debug ("OMAP PM: add max DMA latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); +pr_debug ("OMAP PM: add max DMA latency constraint: t = %ld usec\n" , t);/* * For current Linux PM QOS params, this code should scan the arch/arm/plat-omap/omap-pm.c new file +309
-0@@ -0,0 +1,309 @@ +/* +* omap-pm.c - OMAP power management interface +* +* Copyright (C) 2008-2010 Texas Instruments, Inc. +* Copyright (C) 2008-2009 Nokia Corporation +* Vishwanath BS +* +* This code is based on plat-omap/omap-pm-noop.c. +* +* Interface developed by (in alphabetical order): +* Karthik Dasu, Tony Lindgren, Rajendra Nayak, Sakari Poussa, Veeramanikandan +* Raju, Anand Sawant, Igor Stoppa, Paul Walmsley, Richard Woodruff +*/ + +#undef DEBUG + +#include <linux/init.h> +#include <linux/cpufreq.h> +#include <linux/device.h> + +/* Interface documentation is in mach/omap-pm.h */ +#include <plat/omap-pm.h> + +#include <plat/powerdomain.h> + +struct omap_opp *dsp_opps; +struct omap_opp *mpu_opps; +struct omap_opp *l3_opps; + +/* +* Device-driver-originated constraints (via board-*.c files) +*/ + +int omap_pm_set_max_mpu_wakeup_lat (struct pm_qos_request_list **qos_request,long t) +{ +if (!qos_request || t <-1 ) { +pr_warning ("Warning: invalid params to omap_pm_set_max_mpu_wakeup_lat \n:" ); +return -EINVAL ; + }; + +if (t ==-1 ) { +pm_qos_remove_request (*qos_request); + *qos_request =NULL ; + }else if (*qos_request ==NULL ) + *qos_request =pm_qos_add_request (PM_QOS_CPU_DMA_LATENCY , t); +else +pm_qos_update_request (*qos_request, t); + +return 0 ; +} + + +int omap_pm_set_min_bus_tput (struct device *dev,u8 agent_id,unsigned long r) +{ +if (!dev || (agent_id !=OCP_INITIATOR_AGENT && + agent_id !=OCP_TARGET_AGENT )) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + }; + +if (r ==0 ) +pr_debug ("OMAP PM: remove min bus tput constraint: " +"dev %s for agent_id %d\n" ,dev_name (dev), agent_id); +else +pr_debug ("OMAP PM: add min bus tput constraint: " +"dev %s for agent_id %d: rate %ld KiB\n" , +dev_name (dev), agent_id, r); + +/* +* This code should model the interconnect and compute the +* required clock frequency, convert that to a VDD2 OPP ID, then +* set the VDD2 OPP appropriately. +* +* TI CDP code can call constraint_set here on the VDD2 OPP. +*/ + +return 0 ; +} + +int omap_pm_set_max_dev_wakeup_lat (struct device *req_dev,struct device *dev, +long t) +{ +if (!req_dev || !dev || t <-1 ) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + }; + +if (t ==-1 ) +pr_debug ("OMAP PM: remove max device latency constraint: " +"dev %s\n" ,dev_name (dev)); +else +pr_debug ("OMAP PM: add max device latency constraint: " +"dev %s, t = %ld usec\n" ,dev_name (dev), t); + +/* +* For current Linux, this needs to map the device to a +* powerdomain, then go through the list of current max lat +* constraints on that powerdomain and find the smallest. If +* the latency constraint has changed, the code should +* recompute the state to enter for the next powerdomain +* state. Conceivably, this code should also determine +* whether to actually disable the device clocks or not, +* depending on how long it takes to re-enable the clocks. +* +* TI CDP code can call constraint_set here. +*/ + +return 0 ; +} + +int omap_pm_set_max_sdma_lat (struct pm_qos_request_list **qos_request,long t) +{ +if (!qos_request || t <-1 ) { +pr_warning ("Warning: invalid params to omap_pm_set_max_sdma_lat\n:" ); +return -EINVAL ; + }; + +if (t ==-1 ) { +pm_qos_remove_request (*qos_request); + *qos_request =NULL ; + }else if (*qos_request ==NULL ) + *qos_request =pm_qos_add_request (PM_QOS_CPU_DMA_LATENCY , t); +else +pm_qos_update_request (*qos_request, t); + +return 0 ; +} + +int omap_pm_set_min_clk_rate (struct device *dev,struct clk *c,long r) +{ +if (!dev || !c || r <0 ) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + } + +if (r ==0 ) +pr_debug ("OMAP PM: remove min clk rate constraint: " +"dev %s\n" ,dev_name (dev)); +else +pr_debug ("OMAP PM: add min clk rate constraint: " +"dev %s, rate = %ld Hz\n" ,dev_name (dev), r); + +/* +* Code in a real implementation should keep track of these +* constraints on the clock, and determine the highest minimum +* clock rate. It should iterate over each OPP and determine +* whether the OPP will result in a clock rate that would +* satisfy this constraint (and any other PM constraint in effect +* at that time). Once it finds the lowest-voltage OPP that +* meets those conditions, it should switch to it, or return +* an error if the code is not capable of doing so. +*/ + +return 0 ; +} + +/* +* DSP Bridge-specific constraints +*/ + +const struct omap_opp *omap_pm_dsp_get_opp_table (void ) +{ +pr_debug ("OMAP PM: DSP request for OPP table\n" ); + +/* +* Return DSP frequency table here: The final item in the +* array should have .rate = .opp_id = 0. +*/ + +return NULL ; +} + +void omap_pm_dsp_set_min_opp (u8 opp_id) +{ +if (opp_id ==0 ) { +WARN_ON (1 ); +return ; + } + +pr_debug ("OMAP PM: DSP requests minimum VDD1 OPP to be %d\n" , opp_id); + +/* +* +* For l-o dev tree, our VDD1 clk is keyed on OPP ID, so we +* can just test to see which is higher, the CPU's desired OPP +* ID or the DSP's desired OPP ID, and use whichever is +* highest. +* +* In CDP12.14+, the VDD1 OPP custom clock that controls the DSP +* rate is keyed on MPU speed, not the OPP ID. So we need to +* map the OPP ID to the MPU speed for use with clk_set_rate() +* if it is higher than the current OPP clock rate. +* +*/ +} + + +u8 omap_pm_dsp_get_opp (void ) +{ +pr_debug ("OMAP PM: DSP requests current DSP OPP ID\n" ); + +/* +* For l-o dev tree, call clk_get_rate() on VDD1 OPP clock +* +* CDP12.14+: +* Call clk_get_rate() on the OPP custom clock, map that to an +* OPP ID using the tables defined in board-*.c/chip-*.c files. +*/ + +return 0 ; +} + +/* +* CPUFreq-originated constraint +* +* In the future, this should be handled by custom OPP clocktype +* functions. +*/ + +struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table (void ) +{ +pr_debug ("OMAP PM: CPUFreq request for frequency table\n" ); + +/* +* Return CPUFreq frequency table here: loop over +* all VDD1 clkrates, pull out the mpu_ck frequencies, build +* table +*/ + +return NULL ; +} + +void omap_pm_cpu_set_freq (unsigned long f) +{ +if (f ==0 ) { +WARN_ON (1 ); +return ; + } + +pr_debug ("OMAP PM: CPUFreq requests CPU frequency to be set to %lu\n" , + f); + +/* +* For l-o dev tree, determine whether MPU freq or DSP OPP id +* freq is higher. Find the OPP ID corresponding to the +* higher frequency. Call clk_round_rate() and clk_set_rate() +* on the OPP custom clock. +* +* CDP should just be able to set the VDD1 OPP clock rate here. +*/ +} + +unsigned long omap_pm_cpu_get_freq (void ) +{ +pr_debug ("OMAP PM: CPUFreq requests current CPU frequency\n" ); + +/* +* Call clk_get_rate() on the mpu_ck. +*/ + +return 0 ; +} + +/* +* Device context loss tracking +*/ + +int omap_pm_get_dev_context_loss_count (struct device *dev) +{ +if (!dev) { +WARN_ON (1 ); +return -EINVAL ; + }; + +pr_debug ("OMAP PM: returning context loss count for dev %s\n" , +dev_name (dev)); + +/* +* Map the device to the powerdomain. Return the powerdomain +* off counter. +*/ + +return 0 ; +} + + +/* Should be called before clk framework init */ +int __init omap_pm_if_early_init (struct omap_opp *mpu_opp_table, +struct omap_opp *dsp_opp_table, +struct omap_opp *l3_opp_table) +{ + mpu_opps = mpu_opp_table; + dsp_opps = dsp_opp_table; + l3_opps = l3_opp_table; +return 0 ; +} + +/* Must be called after clock framework is initialized */ +int __init omap_pm_if_init (void ) +{ +return 0 ; +} + +void omap_pm_if_exit (void ) +{ +/* Deallocate CPUFreq frequency table here */ +} + +
Kevin,
Quoted 12 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Monday, August 09, 2010 11:59 PM
To: Sripathy, Vishwanath
Cc: [email protected]
Subject: Re: [PATCH] OMAP PM: MPU/DMA Latency constraintsQuoted 1 line · Vishwanath Sripathy
This patch has implementation for OMAP MPU/DMA Latency constraints using PM
QOS.
Quoted 8 lines
Changelog is missing description of the problem being solved and the motivation for the solution.
In particular, a system-wide API is being changed here with no description of the problem or the reason for this particular solution.
On first glance, the idea here seems wrong. In getting rid of the device pointer, how do you plan to handle per-device constraints?
Sorry for not being a very descriptive.
The motivation here is to remove the dependency on SRF for implementing mpu/dma latency constraints. Instead they have been implemented using pm_qos infrastructure.
Latest pm_qos apis take pm_qos handle to distinguish different pm_qos requests (or use counting mechanism). Hence drivers need to pass pm_qos handle instead of device pointer. Drivers just to define a handle and this handle gets initialized when they make the first request. So from driver's point of view, it's an opaque handle. That's why you see the change in signature of the api.
Regards
Vishwa
Quoted 492 lines
Kevin
Quoted 8 lines
Signed-off-by Vishwanath Sripathy <[email protected]>--- arch/arm/plat-omap/Kconfig | 3 + arch/arm/plat-omap/Makefile | 1 + arch/arm/plat-omap/i2c.c | 3 +- arch/arm/plat-omap/include/plat/omap-pm.h | 9 +- arch/arm/plat-omap/omap-pm-noop.c | 20 +-- arch/arm/plat-omap/omap-pm.c | 309+++++++++++++++++++++++++++++
arch/arm/plat-omap/i2c.c static inline int omap1_i2c_add_bus(struct platform_device
Quoted 31 lines
6 files changed, 328 insertions(+), 17 deletions(-) create mode 100755 arch/arm/plat-omap/omap-pm.carch/arm/plat-omap/Kconfig +3
-0@@ -194,6 +194,9 @@ config OMAP_PM_NONE config OMAP_PM_NOOP bool "No-op/debug PM layer" +config OMAP_PM + depends on PM + bool "OMAP PM layer implementation" endchoice endmenuarch/arm/plat-omap/Makefile +1
-0@@ -32,3 +32,4 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y) obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.o obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o +obj-$(CONFIG_OMAP_PM) += omap-pm.oarch/arm/plat-omap/i2c.c +0
-0@@ -145,7 +145,8 @@ static inline int omap1_i2c_add_bus(struct platform_device*pdev, int
bus_id)arch/arm/plat-omap/i2c.c static inline int omap1_i2c_add_bus(struct platform_device · line 146
Quoted 2 lines
arch/arm/plat-omap/i2c.c +0
-0*/ static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev, longt)
arch/arm/plat-
Quoted 8 lines
arch/arm/plat-omap/i2c.c +2
-1{ -omap_pm_set_max_mpu_wakeup_lat (dev, t); +struct pm_qos_request_list *qos_handle =NULL ; +omap_pm_set_max_mpu_wakeup_lat (&qos_handle, t); }static inline int omap2_i2c_add_bus (struct platform_device *pdev,int bus_id)arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/omap-pm.h +0
-0
omap/include/plat/omap-pm.hQuoted 12 lines
index 728fbb9..47ba9e6 100644
arch/arm/plat-omap/include/plat/omap-pm.h +1
-0@@ -19,6 +19,7 @@#include <linux/clk.h> #include "powerdomain.h" +#include <linux/pm_qos_params.h> /** * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU arch/arm/plat-omap/include/plat/omap-pm.h void omap_pm_if_exit(void); · line 90
Quoted 5 lines
arch/arm/plat-omap/include/plat/omap-pm.h +1
-1@@ -86,7 +87,7 @@ void omap_pm_if_exit(void);/** * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency -* @dev: struct device * requesting the constraint +* @qos_request: handle for the constraint. The pointer should be initialized to NULL
arch/arm/plat-omap/include/plat/omap-pm.h void omap_pm_if_exit(void); · line 122
Quoted 9 lines
arch/arm/plat-omap/include/plat/omap-pm.h +1
-1* @t: maximum MPU wakeup latency in microseconds * * Request that the maximum interrupt latency for the MPU to be no @@ -118,7 +119,7 @@ void omap_pm_if_exit(void);* Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t); +int omap_pm_set_max_mpu_wakeup_lat(struct pm_qos_request_list**qos_request, long t);
arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device
Quoted 4 lines
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0/** @@ -185,7 +186,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device
*req_dev, struct device *dev,arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device · line 187
Quoted 3 lines
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0/** * omap_pm_set_max_sdma_lat - set the maximum system DMA transfer start latency
arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device · line 188
Quoted 2 lines
arch/arm/plat-omap/include/plat/omap-pm.h +1
-1-* @dev: struct device * +* @qos_request: handle for the constraint. The pointer should be initialized to NULL
arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device
Quoted 4 lines
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0* @t: maximum DMA transfer start latency in microseconds * * Request that the maximum system DMA transfer start latency for this @@ -210,7 +211,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device
*req_dev, struct device *dev,arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
Quoted 5 lines
arch/arm/plat-omap/include/plat/omap-pm.h +1
-1* Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_sdma_lat (struct device *dev,long t); +int omap_pm_set_max_sdma_lat(struct pm_qos_request_list **qos_request, longt);
arch/arm/plat-omap/omap-pm-
Quoted 4 lines
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0/** arch/arm/plat-omap/omap-pm- renamed from arch/arm/plat-omap/omap-pm-noop.c +0
-0
noop.carch/arm/plat-omap/omap-pm-noop.c struct omap_opp *l3_opps; · line 37
Quoted 9 lines
index e129ce8..af2fe43 100644
arch/arm/plat-omap/omap-pm-noop.c +1
-1@@ -34,19 +34,17 @@ struct omap_opp *l3_opps;* Device-driver-originated constraints (via board-*.c files) */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t) +int omap_pm_set_max_mpu_wakeup_lat(struct pm_qos_request_list**pmqos_req, long t)
Quoted 5 lines
arch/arm/plat-omap/omap-pm-noop.c +1
-1{ -if (!dev || t <-1 ) { +if (!pmqos_req || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ;arch/arm/plat-omap/omap-pm-noop.c struct omap_opp *l3_opps;
Quoted 10 lines
arch/arm/plat-omap/omap-pm-noop.c +2
-4};if (t ==-1 ) -pr_debug ("OMAP PM: remove max MPU wakeup latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max MPU wakeup latency constraint\n" );else -pr_debug ("OMAP PM: add max MPU wakeup latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); + pr_debug("OMAP PM: add max MPU wakeup latency constraint: t = %ldusec\n", t);
arch/arm/plat-omap/omap-pm-noop.c int omap_pm_set_max_dev_wakeup_lat(struct device
Quoted 4 lines
arch/arm/plat-omap/omap-pm-noop.c +0
-0/* * For current Linux, this needs to map the MPU to a @@ -120,19 +118,17 @@ int omap_pm_set_max_dev_wakeup_lat(struct device
*req_dev, struct device *dev,arch/arm/plat-omap/omap-pm-noop.c int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
Quoted 5 lines
arch/arm/plat-omap/omap-pm-noop.c +1
-1return 0 ; } -int omap_pm_set_max_sdma_lat (struct device *dev,long t) +int omap_pm_set_max_sdma_lat(struct pm_qos_request_list **qos_request, longt)
Quoted 5 lines
arch/arm/plat-omap/omap-pm-noop.c +1
-1{ -if (!dev || t <-1 ) { +if (!qos_request || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ;arch/arm/plat-omap/omap-pm-noop.c int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
Quoted 10 lines
arch/arm/plat-omap/omap-pm-noop.c +2
-4};if (t ==-1 ) -pr_debug ("OMAP PM: remove max DMA latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max DMA latency constraint:\n" );else -pr_debug ("OMAP PM: add max DMA latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); + pr_debug("OMAP PM: add max DMA latency constraint: t = %ldusec\n", t);
Quoted 10 lines
arch/arm/plat-omap/omap-pm-noop.c +0
-0/* * For current Linux PM QOS params, this code should scan the arch/arm/plat-omap/omap-pm.c new file +1
-0@@ -0,0 +1,309 @@ +/* arch/arm/plat-omap/omap-pm.c line 11
Quoted 10 lines
arch/arm/plat-omap/omap-pm.c new file +10
-0+* omap-pm.c - OMAP power management interface +* +* Copyright (C) 2008-2010 Texas Instruments, Inc. +* Copyright (C) 2008-2009 Nokia Corporation +* Vishwanath BS +* +* This code is based on plat-omap/omap-pm-noop.c. +* +* Interface developed by (in alphabetical order): +* Karthik Dasu, Tony Lindgren, Rajendra Nayak, Sakari Poussa, Veeramanikandan
Quoted 13 lines
arch/arm/plat-omap/omap-pm.c new file +13
-0+* Raju, Anand Sawant, Igor Stoppa, Paul Walmsley, Richard Woodruff +*/ + +#undef DEBUG + +#include <linux/init.h> +#include <linux/cpufreq.h> +#include <linux/device.h> + +/* Interface documentation is in mach/omap-pm.h */ +#include <plat/omap-pm.h> + +#include <plat/powerdomain.h> arch/arm/plat-omap/omap-pm.c
Quoted 10 lines
arch/arm/plat-omap/omap-pm.c new file +10
-0+ +struct omap_opp *dsp_opps; +struct omap_opp *mpu_opps; +struct omap_opp *l3_opps; + +/* +* Device-driver-originated constraints (via board-*.c files) +*/ + +int omap_pm_set_max_mpu_wakeup_lat(struct pm_qos_request_list**qos_request, long t)
arch/arm/plat-omap/omap-pm.c
Quoted 3 lines
arch/arm/plat-omap/omap-pm.c new file +3
-0+{ +if (!qos_request || t <-1 ) { + pr_warning("Warning: invalid params to
omap_pm_set_max_mpu_wakeup_lat\n:");arch/arm/plat-omap/omap-pm.c
Quoted 8 lines
arch/arm/plat-omap/omap-pm.c new file +8
-0+return -EINVAL ; + }; + +if (t ==-1 ) { +pm_qos_remove_request (*qos_request); + *qos_request =NULL ; + }else if (*qos_request ==NULL ) + *qos_request = pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,t);
arch/arm/plat-omap/omap-pm.c
Quoted 8 lines
arch/arm/plat-omap/omap-pm.c new file +8
-0+else +pm_qos_update_request (*qos_request, t); + +return 0 ; +} + + +int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned longr)
Quoted 17 lines
arch/arm/plat-omap/omap-pm.c new file +17
-0+{ +if (!dev || (agent_id !=OCP_INITIATOR_AGENT && + agent_id !=OCP_TARGET_AGENT )) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + }; + +if (r ==0 ) +pr_debug ("OMAP PM: remove min bus tput constraint: " +"dev %s for agent_id %d\n" ,dev_name (dev), agent_id); +else +pr_debug ("OMAP PM: add min bus tput constraint: " +"dev %s for agent_id %d: rate %ld KiB\n" , +dev_name (dev), agent_id, r); + +/* +* This code should model the interconnect and compute the arch/arm/plat-omap/omap-pm.c
Quoted 10 lines
arch/arm/plat-omap/omap-pm.c new file +10
-0+* required clock frequency, convert that to a VDD2 OPP ID, then +* set the VDD2 OPP appropriately. +* +* TI CDP code can call constraint_set here on the VDD2 OPP. +*/ + +return 0 ; +} + +int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device*dev,
Quoted 21 lines
arch/arm/plat-omap/omap-pm.c new file +21
-0+ long t) +{ +if (!req_dev || !dev || t <-1 ) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + }; + +if (t ==-1 ) +pr_debug ("OMAP PM: remove max device latency constraint: " +"dev %s\n" ,dev_name (dev)); +else +pr_debug ("OMAP PM: add max device latency constraint: " +"dev %s, t = %ld usec\n" ,dev_name (dev), t); + +/* +* For current Linux, this needs to map the device to a +* powerdomain, then go through the list of current max lat +* constraints on that powerdomain and find the smallest. If +* the latency constraint has changed, the code should +* recompute the state to enter for the next powerdomain +* state. Conceivably, this code should also determine arch/arm/plat-omap/omap-pm.c
Quoted 10 lines
arch/arm/plat-omap/omap-pm.c new file +10
-0+* whether to actually disable the device clocks or not, +* depending on how long it takes to re-enable the clocks. +* +* TI CDP code can call constraint_set here. +*/ + +return 0 ; +} + +int omap_pm_set_max_sdma_lat(struct pm_qos_request_list **qos_request, longt)
arch/arm/plat-omap/omap-pm.c
Quoted 3 lines
arch/arm/plat-omap/omap-pm.c new file +3
-0+{ +if (!qos_request || t <-1 ) { + pr_warning("Warning: invalid params toomap_pm_set_max_sdma_lat\n:");
arch/arm/plat-omap/omap-pm.c
Quoted 8 lines
arch/arm/plat-omap/omap-pm.c new file +8
-0+return -EINVAL ; + }; + +if (t ==-1 ) { +pm_qos_remove_request (*qos_request); + *qos_request =NULL ; + }else if (*qos_request ==NULL ) + *qos_request = pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,t);
Quoted 187 lines
arch/arm/plat-omap/omap-pm.c new file +187
-0+else +pm_qos_update_request (*qos_request, t); + +return 0 ; +} + +int omap_pm_set_min_clk_rate (struct device *dev,struct clk *c,long r) +{ +if (!dev || !c || r <0 ) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + } + +if (r ==0 ) +pr_debug ("OMAP PM: remove min clk rate constraint: " +"dev %s\n" ,dev_name (dev)); +else +pr_debug ("OMAP PM: add min clk rate constraint: " +"dev %s, rate = %ld Hz\n" ,dev_name (dev), r); + +/* +* Code in a real implementation should keep track of these +* constraints on the clock, and determine the highest minimum +* clock rate. It should iterate over each OPP and determine +* whether the OPP will result in a clock rate that would +* satisfy this constraint (and any other PM constraint in effect +* at that time). Once it finds the lowest-voltage OPP that +* meets those conditions, it should switch to it, or return +* an error if the code is not capable of doing so. +*/ + +return 0 ; +} + +/* +* DSP Bridge-specific constraints +*/ + +const struct omap_opp *omap_pm_dsp_get_opp_table (void ) +{ +pr_debug ("OMAP PM: DSP request for OPP table\n" ); + +/* +* Return DSP frequency table here: The final item in the +* array should have .rate = .opp_id = 0. +*/ + +return NULL ; +} + +void omap_pm_dsp_set_min_opp (u8 opp_id) +{ +if (opp_id ==0 ) { +WARN_ON (1 ); +return ; + } + +pr_debug ("OMAP PM: DSP requests minimum VDD1 OPP to be %d\n" , opp_id); + +/* +* +* For l-o dev tree, our VDD1 clk is keyed on OPP ID, so we +* can just test to see which is higher, the CPU's desired OPP +* ID or the DSP's desired OPP ID, and use whichever is +* highest. +* +* In CDP12.14+, the VDD1 OPP custom clock that controls the DSP +* rate is keyed on MPU speed, not the OPP ID. So we need to +* map the OPP ID to the MPU speed for use with clk_set_rate() +* if it is higher than the current OPP clock rate. +* +*/ +} + + +u8 omap_pm_dsp_get_opp (void ) +{ +pr_debug ("OMAP PM: DSP requests current DSP OPP ID\n" ); + +/* +* For l-o dev tree, call clk_get_rate() on VDD1 OPP clock +* +* CDP12.14+: +* Call clk_get_rate() on the OPP custom clock, map that to an +* OPP ID using the tables defined in board-*.c/chip-*.c files. +*/ + +return 0 ; +} + +/* +* CPUFreq-originated constraint +* +* In the future, this should be handled by custom OPP clocktype +* functions. +*/ + +struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table (void ) +{ +pr_debug ("OMAP PM: CPUFreq request for frequency table\n" ); + +/* +* Return CPUFreq frequency table here: loop over +* all VDD1 clkrates, pull out the mpu_ck frequencies, build +* table +*/ + +return NULL ; +} + +void omap_pm_cpu_set_freq (unsigned long f) +{ +if (f ==0 ) { +WARN_ON (1 ); +return ; + } + +pr_debug ("OMAP PM: CPUFreq requests CPU frequency to be set to %lu\n" , + f); + +/* +* For l-o dev tree, determine whether MPU freq or DSP OPP id +* freq is higher. Find the OPP ID corresponding to the +* higher frequency. Call clk_round_rate() and clk_set_rate() +* on the OPP custom clock. +* +* CDP should just be able to set the VDD1 OPP clock rate here. +*/ +} + +unsigned long omap_pm_cpu_get_freq (void ) +{ +pr_debug ("OMAP PM: CPUFreq requests current CPU frequency\n" ); + +/* +* Call clk_get_rate() on the mpu_ck. +*/ + +return 0 ; +} + +/* +* Device context loss tracking +*/ + +int omap_pm_get_dev_context_loss_count (struct device *dev) +{ +if (!dev) { +WARN_ON (1 ); +return -EINVAL ; + }; + +pr_debug ("OMAP PM: returning context loss count for dev %s\n" , +dev_name (dev)); + +/* +* Map the device to the powerdomain. Return the powerdomain +* off counter. +*/ + +return 0 ; +} + + +/* Should be called before clk framework init */ +int __init omap_pm_if_early_init (struct omap_opp *mpu_opp_table, +struct omap_opp *dsp_opp_table, +struct omap_opp *l3_opp_table) +{ + mpu_opps = mpu_opp_table; + dsp_opps = dsp_opp_table; + l3_opps = l3_opp_table; +return 0 ; +} + +/* Must be called after clock framework is initialized */ +int __init omap_pm_if_init (void ) +{ +return 0 ; +} + +void omap_pm_if_exit (void ) +{ +/* Deallocate CPUFreq frequency table here */ +} + +
Kevin, Paul,
Do you have any comments on this patch?
Regards
Vishwa
Quoted 547 lines
-----Original Message-----
From: [email protected] [mailto:linux-omap- [email protected]] On Behalf Of Sripathy, Vishwanath
Sent: Tuesday, August 10, 2010 10:43 AM
To: Kevin Hilman
Cc: [email protected]
Subject: RE: [PATCH] OMAP PM: MPU/DMA Latency constraintsKevin,
Quoted 12 lines
-----Original Message-----
From: Kevin Hilman [mailto:[email protected]]
Sent: Monday, August 09, 2010 11:59 PM
To: Sripathy, Vishwanath
Cc: [email protected]
Subject: Re: [PATCH] OMAP PM: MPU/DMA Latency constraintsQuoted 1 line · Vishwanath Sripathy
This patch has implementation for OMAP MPU/DMA Latency constraints using PM
QOS.
Quoted 8 lines
Changelog is missing description of the problem being solved and the motivation for the solution.
In particular, a system-wide API is being changed here with no description of the problem or the reason for this particular solution.
On first glance, the idea here seems wrong. In getting rid of the device pointer, how do you plan to handle per-device constraints?
Sorry for not being a very descriptive.
The motivation here is to remove the dependency on SRF for implementing mpu/dma latency constraints. Instead they have been implemented usingpm_qosinfrastructure.
Latestpm_qosapis takepm_qoshandle to distinguish differentpm_qosrequests (or use counting mechanism). Hence drivers need to passpm_qoshandle instead of device pointer. Drivers just to define a handle and this handle gets initialized when they make the first request. So from driver's point of view, it's an opaque handle. That's why you see the change in signature of the api.Regards
VishwaQuoted 36 lines
Kevin
Quoted 8 lines
Signed-off-by Vishwanath Sripathy <[email protected]>--- arch/arm/plat-omap/Kconfig | 3 + arch/arm/plat-omap/Makefile | 1 + arch/arm/plat-omap/i2c.c | 3 +- arch/arm/plat-omap/include/plat/omap-pm.h | 9 +- arch/arm/plat-omap/omap-pm-noop.c | 20 +-- arch/arm/plat-omap/omap-pm.c | 309+++++++++++++++++++++++++++++
Quoted 24 lines
6 files changed, 328 insertions(+), 17 deletions(-) create mode 100755 arch/arm/plat-omap/omap-pm.carch/arm/plat-omap/Kconfig +3
-0@@ -194,6 +194,9 @@ config OMAP_PM_NONE config OMAP_PM_NOOP bool "No-op/debug PM layer" +config OMAP_PM + depends on PM + bool "OMAP PM layer implementation" endchoice endmenuarch/arm/plat-omap/Makefile +0
-0@@ -32,3 +32,4 @@ obj-y += $(i2c-omap-m) $(i2c-omap-y) obj-$(CONFIG_OMAP_MBOX_FWK) += mailbox.oQuoted 7 lines
arch/arm/plat-omap/i2c.c static inline int omap1_i2c_add_bus(struct
Quoted 7 lines
arch/arm/plat-omap/Makefile +1
-0obj-$(CONFIG_OMAP_PM_NOOP) += omap-pm-noop.o +obj-$(CONFIG_OMAP_PM) += omap-pm.oarch/arm/plat-omap/i2c.c +0
-0@@ -145,7 +145,8 @@ static inline int omap1_i2c_add_bus(struct
platform_deviceQuoted 3 lines
*pdev, int
bus_id)Quoted 2 lines
arch/arm/plat-omap/i2c.c +0
-0*/ static void omap_pm_set_max_mpu_wakeup_lat_compat(struct device *dev,long
Quoted 19 lines
t)
arch/arm/plat-
Quoted 8 lines
arch/arm/plat-omap/i2c.c +2
-1{ -omap_pm_set_max_mpu_wakeup_lat (dev, t); +struct pm_qos_request_list *qos_handle =NULL ; +omap_pm_set_max_mpu_wakeup_lat (&qos_handle, t); }static inline int omap2_i2c_add_bus (struct platform_device *pdev,int bus_id)arch/arm/plat- renamed from arch/arm/plat-omap/include/plat/omap-pm.h +0
-0
omap/include/plat/omap-pm.hQuoted 9 lines
index 728fbb9..47ba9e6 100644
arch/arm/plat-omap/include/plat/omap-pm.h +1
-0@@ -19,6 +19,7 @@#include <linux/clk.h> #include "powerdomain.h" +#include <linux/pm_qos_params.h> Quoted 6 lines
arch/arm/plat-omap/include/plat/omap-pm.h void omap_pm_if_exit(void); · line 89
Quoted 6 lines
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0/** * struct omap_opp - clock frequency-to-OPP ID table for DSP, MPU @@ -86,7 +87,7 @@ void omap_pm_if_exit(void);/** * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency
Quoted 30 lines
arch/arm/plat-omap/include/plat/omap-pm.h void omap_pm_if_exit(void); · line 90
Quoted 2 lines
arch/arm/plat-omap/include/plat/omap-pm.h +1
-1-* @dev: struct device * requesting the constraint +* @qos_request: handle for the constraint. The pointer should be initialized to NULL
arch/arm/plat-omap/include/plat/omap-pm.h void omap_pm_if_exit(void); · line 122
Quoted 9 lines
arch/arm/plat-omap/include/plat/omap-pm.h +1
-1* @t: maximum MPU wakeup latency in microseconds * * Request that the maximum interrupt latency for the MPU to be no @@ -118,7 +119,7 @@ void omap_pm_if_exit(void);* Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t); +int omap_pm_set_max_mpu_wakeup_lat(struct pm_qos_request_list**qos_request, long t);
arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device
Quoted 4 lines
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0/** @@ -185,7 +186,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device
*req_dev, struct device *dev,arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device · line 187
Quoted 3 lines
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0/** * omap_pm_set_max_sdma_lat - set the maximum system DMA transfer start latency
arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device · line 188
Quoted 2 lines
arch/arm/plat-omap/include/plat/omap-pm.h +1
-1-* @dev: struct device * +* @qos_request: handle for the constraint. The pointer should be initialized to NULL
arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device
Quoted 4 lines
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0* @t: maximum DMA transfer start latency in microseconds * * Request that the maximum system DMA transfer start latency for this @@ -210,7 +211,7 @@ int omap_pm_set_max_dev_wakeup_lat(struct device
*req_dev, struct device *dev,Quoted 5 lines
arch/arm/plat-omap/include/plat/omap-pm.h int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
Quoted 5 lines
arch/arm/plat-omap/include/plat/omap-pm.h +1
-1* Returns -EINVAL for an invalid argument, -ERANGE if the constraint * is not satisfiable, or 0 upon success. */ -int omap_pm_set_max_sdma_lat (struct device *dev,long t); +int omap_pm_set_max_sdma_lat(struct pm_qos_request_list **qos_request,long
Quoted 5 lines
t);
arch/arm/plat-omap/omap-
Quoted 4 lines
arch/arm/plat-omap/include/plat/omap-pm.h +0
-0/** arch/arm/plat-omap/omap- renamed from arch/arm/plat-omap/omap-pm-noop.c +0
-0pm-
Quoted 32 lines
noop.carch/arm/plat-omap/omap-pm-noop.c struct omap_opp *l3_opps; · line 37
Quoted 9 lines
index e129ce8..af2fe43 100644
arch/arm/plat-omap/omap-pm-noop.c +1
-1@@ -34,19 +34,17 @@ struct omap_opp *l3_opps;* Device-driver-originated constraints (via board-*.c files) */ -int omap_pm_set_max_mpu_wakeup_lat (struct device *dev,long t) +int omap_pm_set_max_mpu_wakeup_lat(struct pm_qos_request_list**pmqos_req, long t)
Quoted 5 lines
arch/arm/plat-omap/omap-pm-noop.c +1
-1{ -if (!dev || t <-1 ) { +if (!pmqos_req || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ;arch/arm/plat-omap/omap-pm-noop.c struct omap_opp *l3_opps;
Quoted 10 lines
arch/arm/plat-omap/omap-pm-noop.c +2
-4};if (t ==-1 ) -pr_debug ("OMAP PM: remove max MPU wakeup latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max MPU wakeup latency constraint\n" );else -pr_debug ("OMAP PM: add max MPU wakeup latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); + pr_debug("OMAP PM: add max MPU wakeup latency constraint: t = %ldusec\n", t);
arch/arm/plat-omap/omap-pm-noop.c int omap_pm_set_max_dev_wakeup_lat(struct device
Quoted 4 lines
arch/arm/plat-omap/omap-pm-noop.c +0
-0/* * For current Linux, this needs to map the MPU to a @@ -120,19 +118,17 @@ int omap_pm_set_max_dev_wakeup_lat(struct device
*req_dev, struct device *dev,Quoted 5 lines
arch/arm/plat-omap/omap-pm-noop.c int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
Quoted 5 lines
arch/arm/plat-omap/omap-pm-noop.c +1
-1return 0 ; } -int omap_pm_set_max_sdma_lat (struct device *dev,long t) +int omap_pm_set_max_sdma_lat(struct pm_qos_request_list **qos_request,long
Quoted 135 lines
t)
Quoted 5 lines
arch/arm/plat-omap/omap-pm-noop.c +1
-1{ -if (!dev || t <-1 ) { +if (!qos_request || t <-1 ) {WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__);return -EINVAL ;arch/arm/plat-omap/omap-pm-noop.c int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device *dev,
Quoted 10 lines
arch/arm/plat-omap/omap-pm-noop.c +2
-4};if (t ==-1 ) -pr_debug ("OMAP PM: remove max DMA latency constraint: " -"dev %s\n" ,dev_name (dev)); +pr_debug ("OMAP PM: remove max DMA latency constraint:\n" );else -pr_debug ("OMAP PM: add max DMA latency constraint: " -"dev %s, t = %ld usec\n" ,dev_name (dev), t); + pr_debug("OMAP PM: add max DMA latency constraint: t = %ldusec\n", t);
Quoted 10 lines
arch/arm/plat-omap/omap-pm-noop.c +0
-0/* * For current Linux PM QOS params, this code should scan the arch/arm/plat-omap/omap-pm.c new file +1
-0@@ -0,0 +1,309 @@ +/* arch/arm/plat-omap/omap-pm.c line 11
Quoted 10 lines
arch/arm/plat-omap/omap-pm.c new file +10
-0+* omap-pm.c - OMAP power management interface +* +* Copyright (C) 2008-2010 Texas Instruments, Inc. +* Copyright (C) 2008-2009 Nokia Corporation +* Vishwanath BS +* +* This code is based on plat-omap/omap-pm-noop.c. +* +* Interface developed by (in alphabetical order): +* Karthik Dasu, Tony Lindgren, Rajendra Nayak, Sakari Poussa, Veeramanikandan
Quoted 13 lines
arch/arm/plat-omap/omap-pm.c new file +13
-0+* Raju, Anand Sawant, Igor Stoppa, Paul Walmsley, Richard Woodruff +*/ + +#undef DEBUG + +#include <linux/init.h> +#include <linux/cpufreq.h> +#include <linux/device.h> + +/* Interface documentation is in mach/omap-pm.h */ +#include <plat/omap-pm.h> + +#include <plat/powerdomain.h> arch/arm/plat-omap/omap-pm.c
Quoted 10 lines
arch/arm/plat-omap/omap-pm.c new file +10
-0+ +struct omap_opp *dsp_opps; +struct omap_opp *mpu_opps; +struct omap_opp *l3_opps; + +/* +* Device-driver-originated constraints (via board-*.c files) +*/ + +int omap_pm_set_max_mpu_wakeup_lat(struct pm_qos_request_list**qos_request, long t)
arch/arm/plat-omap/omap-pm.c
Quoted 3 lines
arch/arm/plat-omap/omap-pm.c new file +3
-0+{ +if (!qos_request || t <-1 ) { + pr_warning("Warning: invalid params to
omap_pm_set_max_mpu_wakeup_lat\n:");arch/arm/plat-omap/omap-pm.c
Quoted 8 lines
arch/arm/plat-omap/omap-pm.c new file +8
-0+return -EINVAL ; + }; + +if (t ==-1 ) { +pm_qos_remove_request (*qos_request); + *qos_request =NULL ; + }else if (*qos_request ==NULL ) + *qos_request = pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,t);
arch/arm/plat-omap/omap-pm.c
Quoted 8 lines
arch/arm/plat-omap/omap-pm.c new file +8
-0+else +pm_qos_update_request (*qos_request, t); + +return 0 ; +} + + +int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned longr)
Quoted 17 lines
arch/arm/plat-omap/omap-pm.c new file +17
-0+{ +if (!dev || (agent_id !=OCP_INITIATOR_AGENT && + agent_id !=OCP_TARGET_AGENT )) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + }; + +if (r ==0 ) +pr_debug ("OMAP PM: remove min bus tput constraint: " +"dev %s for agent_id %d\n" ,dev_name (dev), agent_id); +else +pr_debug ("OMAP PM: add min bus tput constraint: " +"dev %s for agent_id %d: rate %ld KiB\n" , +dev_name (dev), agent_id, r); + +/* +* This code should model the interconnect and compute the arch/arm/plat-omap/omap-pm.c
Quoted 10 lines
arch/arm/plat-omap/omap-pm.c new file +10
-0+* required clock frequency, convert that to a VDD2 OPP ID, then +* set the VDD2 OPP appropriately. +* +* TI CDP code can call constraint_set here on the VDD2 OPP. +*/ + +return 0 ; +} + +int omap_pm_set_max_dev_wakeup_lat(struct device *req_dev, struct device*dev,
Quoted 23 lines
arch/arm/plat-omap/omap-pm.c new file +23
-0+ long t) +{ +if (!req_dev || !dev || t <-1 ) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + }; + +if (t ==-1 ) +pr_debug ("OMAP PM: remove max device latency constraint: " +"dev %s\n" ,dev_name (dev)); +else +pr_debug ("OMAP PM: add max device latency constraint: " +"dev %s, t = %ld usec\n" ,dev_name (dev), t); + +/* +* For current Linux, this needs to map the device to a +* powerdomain, then go through the list of current max lat +* constraints on that powerdomain and find the smallest. If +* the latency constraint has changed, the code should +* recompute the state to enter for the next powerdomain +* state. Conceivably, this code should also determine +* whether to actually disable the device clocks or not, +* depending on how long it takes to re-enable the clocks. Quoted 8 lines
arch/arm/plat-omap/omap-pm.c
Quoted 8 lines
arch/arm/plat-omap/omap-pm.c new file +8
-0+* +* TI CDP code can call constraint_set here. +*/ + +return 0 ; +} + +int omap_pm_set_max_sdma_lat(struct pm_qos_request_list **qos_request,long
Quoted 64 lines
t)
arch/arm/plat-omap/omap-pm.c
Quoted 3 lines
arch/arm/plat-omap/omap-pm.c new file +3
-0+{ +if (!qos_request || t <-1 ) { + pr_warning("Warning: invalid params toomap_pm_set_max_sdma_lat\n:");
arch/arm/plat-omap/omap-pm.c
Quoted 8 lines
arch/arm/plat-omap/omap-pm.c new file +8
-0+return -EINVAL ; + }; + +if (t ==-1 ) { +pm_qos_remove_request (*qos_request); + *qos_request =NULL ; + }else if (*qos_request ==NULL ) + *qos_request = pm_qos_add_request(PM_QOS_CPU_DMA_LATENCY,t);
Quoted 50 lines
arch/arm/plat-omap/omap-pm.c new file +50
-0+else +pm_qos_update_request (*qos_request, t); + +return 0 ; +} + +int omap_pm_set_min_clk_rate (struct device *dev,struct clk *c,long r) +{ +if (!dev || !c || r <0 ) { +WARN (1 ,"OMAP PM: %s: invalid parameter(s)" , __func__); +return -EINVAL ; + } + +if (r ==0 ) +pr_debug ("OMAP PM: remove min clk rate constraint: " +"dev %s\n" ,dev_name (dev)); +else +pr_debug ("OMAP PM: add min clk rate constraint: " +"dev %s, rate = %ld Hz\n" ,dev_name (dev), r); + +/* +* Code in a real implementation should keep track of these +* constraints on the clock, and determine the highest minimum +* clock rate. It should iterate over each OPP and determine +* whether the OPP will result in a clock rate that would +* satisfy this constraint (and any other PM constraint in effect +* at that time). Once it finds the lowest-voltage OPP that +* meets those conditions, it should switch to it, or return +* an error if the code is not capable of doing so. +*/ + +return 0 ; +} + +/* +* DSP Bridge-specific constraints +*/ + +const struct omap_opp *omap_pm_dsp_get_opp_table (void ) +{ +pr_debug ("OMAP PM: DSP request for OPP table\n" ); + +/* +* Return DSP frequency table here: The final item in the +* array should have .rate = .opp_id = 0. +*/ + +return NULL ; +} +Quoted 8 lines
arch/arm/plat-omap/omap-pm.c
Quoted 8 lines
arch/arm/plat-omap/omap-pm.c new file +8
-0+void omap_pm_dsp_set_min_opp (u8 opp_id) +{ +if (opp_id ==0 ) { +WARN_ON (1 ); +return ; + } + + pr_debug("OMAP PM: DSP requests minimum VDD1 OPP to be %d\n",
opp_id);Quoted 121 lines
Quoted 121 lines
arch/arm/plat-omap/omap-pm.c new file +121
-0+ +/* +* +* For l-o dev tree, our VDD1 clk is keyed on OPP ID, so we +* can just test to see which is higher, the CPU's desired OPP +* ID or the DSP's desired OPP ID, and use whichever is +* highest. +* +* In CDP12.14+, the VDD1 OPP custom clock that controls the DSP +* rate is keyed on MPU speed, not the OPP ID. So we need to +* map the OPP ID to the MPU speed for use with clk_set_rate() +* if it is higher than the current OPP clock rate. +* +*/ +} + + +u8 omap_pm_dsp_get_opp (void ) +{ +pr_debug ("OMAP PM: DSP requests current DSP OPP ID\n" ); + +/* +* For l-o dev tree, call clk_get_rate() on VDD1 OPP clock +* +* CDP12.14+: +* Call clk_get_rate() on the OPP custom clock, map that to an +* OPP ID using the tables defined in board-*.c/chip-*.c files. +*/ + +return 0 ; +} + +/* +* CPUFreq-originated constraint +* +* In the future, this should be handled by custom OPP clocktype +* functions. +*/ + +struct cpufreq_frequency_table **omap_pm_cpu_get_freq_table (void ) +{ +pr_debug ("OMAP PM: CPUFreq request for frequency table\n" ); + +/* +* Return CPUFreq frequency table here: loop over +* all VDD1 clkrates, pull out the mpu_ck frequencies, build +* table +*/ + +return NULL ; +} + +void omap_pm_cpu_set_freq (unsigned long f) +{ +if (f ==0 ) { +WARN_ON (1 ); +return ; + } + +pr_debug ("OMAP PM: CPUFreq requests CPU frequency to be set to %lu\n" , + f); + +/* +* For l-o dev tree, determine whether MPU freq or DSP OPP id +* freq is higher. Find the OPP ID corresponding to the +* higher frequency. Call clk_round_rate() and clk_set_rate() +* on the OPP custom clock. +* +* CDP should just be able to set the VDD1 OPP clock rate here. +*/ +} + +unsigned long omap_pm_cpu_get_freq (void ) +{ +pr_debug ("OMAP PM: CPUFreq requests current CPU frequency\n" ); + +/* +* Call clk_get_rate() on the mpu_ck. +*/ + +return 0 ; +} + +/* +* Device context loss tracking +*/ + +int omap_pm_get_dev_context_loss_count (struct device *dev) +{ +if (!dev) { +WARN_ON (1 ); +return -EINVAL ; + }; + +pr_debug ("OMAP PM: returning context loss count for dev %s\n" , +dev_name (dev)); + +/* +* Map the device to the powerdomain. Return the powerdomain +* off counter. +*/ + +return 0 ; +} + + +/* Should be called before clk framework init */ +int __init omap_pm_if_early_init (struct omap_opp *mpu_opp_table, +struct omap_opp *dsp_opp_table, +struct omap_opp *l3_opp_table) +{ + mpu_opps = mpu_opp_table; + dsp_opps = dsp_opp_table; + l3_opps = l3_opp_table; +return 0 ; +} + +/* Must be called after clock framework is initialized */ +int __init omap_pm_if_init (void ) +{ +return 0 ;Quoted 8 lines
arch/arm/plat-omap/omap-pm.c line 309
Quoted 8 lines
arch/arm/plat-omap/omap-pm.c new file +8
-0+} + +void omap_pm_if_exit (void ) +{ +/* Deallocate CPUFreq frequency table here */ +} + +--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html