aboutsummaryrefslogtreecommitdiff
path: root/arch/arm/plat-omap
diff options
context:
space:
mode:
authorVishwanath BS <vishwanath.bs@ti.com>2010-12-27 15:04:06 +0530
committerNicolas Pitre <nicolas.pitre@linaro.org>2011-02-21 23:10:36 -0500
commit5a3e542038950078f2d2c9552234a2016d38ca04 (patch)
tree34f74599e1ed304fe03f2428215760bf4059949e /arch/arm/plat-omap
parent4f6da9f6a9e50555f5e912202513f60141398eb1 (diff)
downloadlinux-linaro-5a3e542038950078f2d2c9552234a2016d38ca04.tar.gz
OMAP: Introduce accessory APIs for DVFS
This patch introduces accessory APIs for DVFS. Data structures added: 1. omap_dev_user_list: This structure maintains list of frequency requests per device basis. When a device needs to be scaled to a particular frequency, This list is searched to find the maximum request for a given device. If noone has placed any request, device frequency is obtained from device opp table. 2. omap_vdd_dev_list: This strcucture stores device list per vdd basis. Whenever a device is registered with a vdd, it is added to this list. 3. omap_vdd_user_list: User list of devices associated with each voltage domain instance. The user list is implemented using plist structure with priority node populated with the voltage values. 4. omap_vdd_dvfs_info: This structure is used to abstract DVFS related information per VDD basis. It holds pointer to corresponding vdd's voltagedomain instance and pointer to user list. Following APIs have been added to operate on above data structures: 1. omap_dvfs_add_vdd_user - API to add a user into omap_vdd_user_list 2. omap_vdd_user_list - API to remove a user from omap_vdd_user_list 3. omap_dvfs_register_device - API to register a device with vdd 4. omap_dvfs_add_freq_request - API to add a frequency request into omap_dev_user_list 5. omap_dvfs_remove_freq_request - API to remove a frequency request from omap_dev_user_list 6. omap_dvfs_find_voltage - API to find the opp corresponding to given voltage DVFS layer is initialized and basic data structures are allocated and initialized as part of this. This patch is based on Thara's previous DVFS implementation, but with major rework. Signed-off-by: Vishwanath BS <vishwanath.bs@ti.com> Cc: Thara Gopinath <thara@ti.com>
Diffstat (limited to 'arch/arm/plat-omap')
-rw-r--r--arch/arm/plat-omap/include/plat/dvfs.h27
-rw-r--r--arch/arm/plat-omap/omap_device.c9
2 files changed, 36 insertions, 0 deletions
diff --git a/arch/arm/plat-omap/include/plat/dvfs.h b/arch/arm/plat-omap/include/plat/dvfs.h
new file mode 100644
index 00000000000..1302990c27d
--- /dev/null
+++ b/arch/arm/plat-omap/include/plat/dvfs.h
@@ -0,0 +1,27 @@
+/*
+ * OMAP3/OMAP4 DVFS Management Routines
+ *
+ * Author: Vishwanath BS <vishwanath.bs@ti.com>
+ *
+ * Copyright (C) 2011 Texas Instruments, Inc.
+ * Vishwanath BS <vishwanath.bs@ti.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef __ARCH_ARM_MACH_OMAP2_DVFS_H
+#define __ARCH_ARM_MACH_OMAP2_DVFS_H
+#include <plat/voltage.h>
+
+#ifdef CONFIG_PM
+int omap_dvfs_register_device(struct voltagedomain *voltdm, struct device *dev);
+#else
+static inline int omap_dvfs_register_device(struct voltagedomain *voltdm,
+ struct device *dev)
+{
+ return -EINVAL;
+}
+#endif
+#endif
diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c
index 57adb270767..a84e8494d76 100644
--- a/arch/arm/plat-omap/omap_device.c
+++ b/arch/arm/plat-omap/omap_device.c
@@ -86,6 +86,7 @@
#include <plat/omap_device.h>
#include <plat/omap_hwmod.h>
+#include <plat/dvfs.h>
/* These parameters are passed to _omap_device_{de,}activate() */
#define USE_WAKEUP_LAT 0
@@ -481,6 +482,14 @@ struct omap_device *omap_device_build_ss(const char *pdev_name, int pdev_id,
for (i = 0; i < oh_cnt; i++) {
hwmods[i]->od = od;
_add_optional_clock_alias(od, hwmods[i]);
+ if (!is_early_device && hwmods[i]->vdd_name) {
+ struct omap_hwmod *oh = hwmods[i];
+ struct voltagedomain *voltdm;
+
+ voltdm = omap_voltage_domain_lookup(oh->vdd_name);
+ if (!omap_dvfs_register_device(voltdm, &od->pdev.dev))
+ oh->voltdm = voltdm;
+ }
}
if (ret)