diff options
Diffstat (limited to 'extras/recipes-kernel/linux/linux-omap/dvfs/0009-OMAP-Introduce-device-specific-set-rate-and-get-rate.patch')
-rw-r--r-- | extras/recipes-kernel/linux/linux-omap/dvfs/0009-OMAP-Introduce-device-specific-set-rate-and-get-rate.patch | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/extras/recipes-kernel/linux/linux-omap/dvfs/0009-OMAP-Introduce-device-specific-set-rate-and-get-rate.patch b/extras/recipes-kernel/linux/linux-omap/dvfs/0009-OMAP-Introduce-device-specific-set-rate-and-get-rate.patch new file mode 100644 index 00000000..f5914aa3 --- /dev/null +++ b/extras/recipes-kernel/linux/linux-omap/dvfs/0009-OMAP-Introduce-device-specific-set-rate-and-get-rate.patch | |||
@@ -0,0 +1,120 @@ | |||
1 | From 6ec7cf889c9a8ddf97fbbcbda4888b0f17930e04 Mon Sep 17 00:00:00 2001 | ||
2 | From: Thara Gopinath <thara@ti.com> | ||
3 | Date: Fri, 29 Oct 2010 20:43:29 +0530 | ||
4 | Subject: [PATCH 09/20] OMAP: Introduce device specific set rate and get rate in omap_device structure | ||
5 | |||
6 | This patch extends the omap_device structure to contain | ||
7 | pointers to scale the operating rate of the | ||
8 | device and to retrieve the operating rate of the device. | ||
9 | This patch also adds the three new APIs in the omap device layer | ||
10 | namely omap_device_set_rate that can be called to set a new operating | ||
11 | rate for a device, omap_device_get_rate that can be called to retrieve | ||
12 | the operating frequency for a device and omap_device_populate_rate_fns | ||
13 | to populte the device specific set_rate and get_rate API's. | ||
14 | The omap_device_set_rate and omap_device_get_rate does some routine error | ||
15 | checks and finally calls into the device specific set_rate | ||
16 | and get_rate APIs populated through omap_device_populate_rate_fns. | ||
17 | |||
18 | Signed-off-by: Thara Gopinath <thara@ti.com> | ||
19 | --- | ||
20 | arch/arm/plat-omap/include/plat/omap_device.h | 9 +++++ | ||
21 | arch/arm/plat-omap/omap_device.c | 49 +++++++++++++++++++++++++ | ||
22 | 2 files changed, 58 insertions(+), 0 deletions(-) | ||
23 | |||
24 | diff --git a/arch/arm/plat-omap/include/plat/omap_device.h b/arch/arm/plat-omap/include/plat/omap_device.h | ||
25 | index e4c349f..1178b86 100644 | ||
26 | --- a/arch/arm/plat-omap/include/plat/omap_device.h | ||
27 | +++ b/arch/arm/plat-omap/include/plat/omap_device.h | ||
28 | @@ -50,6 +50,8 @@ extern struct device omap_device_parent; | ||
29 | * @hwmods: (one .. many per omap_device) | ||
30 | * @hwmods_cnt: ARRAY_SIZE() of @hwmods | ||
31 | * @pm_lats: ptr to an omap_device_pm_latency table | ||
32 | + * @set_rate: fn ptr to change the operating rate. | ||
33 | + * @get_rate: fn ptr to retrieve the current operating rate. | ||
34 | * @pm_lats_cnt: ARRAY_SIZE() of what is passed to @pm_lats | ||
35 | * @pm_lat_level: array index of the last odpl entry executed - -1 if never | ||
36 | * @dev_wakeup_lat: dev wakeup latency in nanoseconds | ||
37 | @@ -67,6 +69,8 @@ struct omap_device { | ||
38 | struct platform_device pdev; | ||
39 | struct omap_hwmod **hwmods; | ||
40 | struct omap_device_pm_latency *pm_lats; | ||
41 | + int (*set_rate)(struct device *dev, unsigned long rate); | ||
42 | + unsigned long (*get_rate) (struct device *dev); | ||
43 | u32 dev_wakeup_lat; | ||
44 | u32 _dev_wakeup_lat_limit; | ||
45 | u8 pm_lats_cnt; | ||
46 | @@ -108,6 +112,11 @@ int omap_device_align_pm_lat(struct platform_device *pdev, | ||
47 | u32 new_wakeup_lat_limit); | ||
48 | struct powerdomain *omap_device_get_pwrdm(struct omap_device *od); | ||
49 | u32 omap_device_get_context_loss_count(struct platform_device *pdev); | ||
50 | +int omap_device_set_rate(struct device *dev, unsigned long freq); | ||
51 | +unsigned long omap_device_get_rate(struct device *dev); | ||
52 | +void omap_device_populate_rate_fns(struct device *dev, | ||
53 | + int (*set_rate)(struct device *dev, unsigned long rate), | ||
54 | + unsigned long (*get_rate) (struct device *dev)); | ||
55 | |||
56 | /* Other */ | ||
57 | |||
58 | diff --git a/arch/arm/plat-omap/omap_device.c b/arch/arm/plat-omap/omap_device.c | ||
59 | index 2c95e61..0d67af6 100644 | ||
60 | --- a/arch/arm/plat-omap/omap_device.c | ||
61 | +++ b/arch/arm/plat-omap/omap_device.c | ||
62 | @@ -813,6 +813,55 @@ int omap_device_enable_clocks(struct omap_device *od) | ||
63 | return 0; | ||
64 | } | ||
65 | |||
66 | +int omap_device_set_rate(struct device *dev, unsigned long freq) | ||
67 | +{ | ||
68 | + struct platform_device *pdev; | ||
69 | + struct omap_device *od; | ||
70 | + | ||
71 | + pdev = container_of(dev, struct platform_device, dev); | ||
72 | + od = _find_by_pdev(pdev); | ||
73 | + | ||
74 | + if (!od->set_rate) { | ||
75 | + dev_err(dev, "%s: No set_rate API for scaling device\n", | ||
76 | + __func__); | ||
77 | + return -ENODATA; | ||
78 | + } | ||
79 | + | ||
80 | + return od->set_rate(dev, freq); | ||
81 | +} | ||
82 | + | ||
83 | +unsigned long omap_device_get_rate(struct device *dev) | ||
84 | +{ | ||
85 | + struct platform_device *pdev; | ||
86 | + struct omap_device *od; | ||
87 | + | ||
88 | + pdev = container_of(dev, struct platform_device, dev); | ||
89 | + od = _find_by_pdev(pdev); | ||
90 | + | ||
91 | + | ||
92 | + if (!od->get_rate) { | ||
93 | + dev_err(dev, "%s: No get rate API for the device\n", | ||
94 | + __func__); | ||
95 | + return 0; | ||
96 | + } | ||
97 | + | ||
98 | + return od->get_rate(dev); | ||
99 | +} | ||
100 | + | ||
101 | +void omap_device_populate_rate_fns(struct device *dev, | ||
102 | + int (*set_rate)(struct device *dev, unsigned long rate), | ||
103 | + unsigned long (*get_rate) (struct device *dev)) | ||
104 | +{ | ||
105 | + struct platform_device *pdev; | ||
106 | + struct omap_device *od; | ||
107 | + | ||
108 | + pdev = container_of(dev, struct platform_device, dev); | ||
109 | + od = _find_by_pdev(pdev); | ||
110 | + | ||
111 | + od->set_rate = set_rate; | ||
112 | + od->get_rate = get_rate; | ||
113 | +} | ||
114 | + | ||
115 | struct device omap_device_parent = { | ||
116 | .init_name = "omap", | ||
117 | .parent = &platform_bus, | ||
118 | -- | ||
119 | 1.6.6.1 | ||
120 | |||