aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 13:58:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 13:58:20 -0500
commita11da7df6543b5f71a150b47c0d08ecf0799a0f3 (patch)
tree77eaac99426f64a0a8dc3b5d62c86138a8c72d43 /drivers/power
parentb8edf848e9119bab9d999b9ca80d8520641810f2 (diff)
parent9c7466b217af784280d9fc841bbd559ef3bf33e9 (diff)
Merge tag 'pm-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
Pull ARM SoC power management and clock changes from Olof Johansson: "This branch contains a largeish set of updates of power management and clock setup. The bulk of it is for OMAP/AM33xx platforms, but also a few around hotplug/suspend/resume on Exynos. It includes a split-up of some of the OMAP clock data into separate files which adds to the diffstat, but gross delta is fairly reasonable." * tag 'pm-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (60 commits) ARM: OMAP: Move plat-omap/dma-omap.h to include/linux/omap-dma.h ASoC: OMAP: mcbsp fixes for enabling ARM multiplatform support watchdog: OMAP: fixup for ARM multiplatform support ARM: EXYNOS: Add flush_cache_all in suspend finisher ARM: EXYNOS: Remove scu_enable from cpuidle ARM: EXYNOS: Fix soft reboot hang after suspend/resume ARM: EXYNOS: Add support for rtc wakeup ARM: EXYNOS: fix the hotplug for Cortex-A15 ARM: OMAP2+: omap_device: Correct resource handling for DT boot ARM: OMAP2+: hwmod: Add possibility to count hwmod resources based on type ARM: OMAP2+: hwmod: Add support for per hwmod/module context lost count ARM: OMAP2+: PRM: initialize some PRM functions early ARM: OMAP2+: voltage: fixup oscillator handling when CONFIG_PM=n ARM: OMAP4: USB: power down MUSB PHY during boot ARM: OMAP2+: clock: Cleanup !CONFIG_COMMON_CLK parts ARM: OMAP2xxx: clock: drop obsolete clock data ARM: OMAP2: clock: Cleanup !CONFIG_COMMON_CLK parts ARM: OMAP3+: DPLL: drop !CONFIG_COMMON_CLK sections ARM: AM33xx: clock: drop obsolete clock data ARM: OMAP3xxx: clk: drop obsolete clock data ...
Diffstat (limited to 'drivers/power')
-rw-r--r--drivers/power/avs/smartreflex.c54
1 files changed, 17 insertions, 37 deletions
diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c
index d0fed2c5cf2c..a17d08411723 100644
--- a/drivers/power/avs/smartreflex.c
+++ b/drivers/power/avs/smartreflex.c
@@ -130,24 +130,21 @@ static irqreturn_t sr_interrupt(int irq, void *data)
130 130
131static void sr_set_clk_length(struct omap_sr *sr) 131static void sr_set_clk_length(struct omap_sr *sr)
132{ 132{
133 struct clk *sys_ck; 133 struct clk *fck;
134 u32 sys_clk_speed; 134 u32 fclk_speed;
135 135
136 if (cpu_is_omap34xx()) 136 fck = clk_get(&sr->pdev->dev, "fck");
137 sys_ck = clk_get(NULL, "sys_ck");
138 else
139 sys_ck = clk_get(NULL, "sys_clkin_ck");
140 137
141 if (IS_ERR(sys_ck)) { 138 if (IS_ERR(fck)) {
142 dev_err(&sr->pdev->dev, "%s: unable to get sys clk\n", 139 dev_err(&sr->pdev->dev, "%s: unable to get fck for device %s\n",
143 __func__); 140 __func__, dev_name(&sr->pdev->dev));
144 return; 141 return;
145 } 142 }
146 143
147 sys_clk_speed = clk_get_rate(sys_ck); 144 fclk_speed = clk_get_rate(fck);
148 clk_put(sys_ck); 145 clk_put(fck);
149 146
150 switch (sys_clk_speed) { 147 switch (fclk_speed) {
151 case 12000000: 148 case 12000000:
152 sr->clk_length = SRCLKLENGTH_12MHZ_SYSCLK; 149 sr->clk_length = SRCLKLENGTH_12MHZ_SYSCLK;
153 break; 150 break;
@@ -164,34 +161,12 @@ static void sr_set_clk_length(struct omap_sr *sr)
164 sr->clk_length = SRCLKLENGTH_38MHZ_SYSCLK; 161 sr->clk_length = SRCLKLENGTH_38MHZ_SYSCLK;
165 break; 162 break;
166 default: 163 default:
167 dev_err(&sr->pdev->dev, "%s: Invalid sysclk value: %d\n", 164 dev_err(&sr->pdev->dev, "%s: Invalid fclk rate: %d\n",
168 __func__, sys_clk_speed); 165 __func__, fclk_speed);
169 break; 166 break;
170 } 167 }
171} 168}
172 169
173static void sr_set_regfields(struct omap_sr *sr)
174{
175 /*
176 * For time being these values are defined in smartreflex.h
177 * and populated during init. May be they can be moved to board
178 * file or pmic specific data structure. In that case these structure
179 * fields will have to be populated using the pdata or pmic structure.
180 */
181 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
182 sr->err_weight = OMAP3430_SR_ERRWEIGHT;
183 sr->err_maxlimit = OMAP3430_SR_ERRMAXLIMIT;
184 sr->accum_data = OMAP3430_SR_ACCUMDATA;
185 if (!(strcmp(sr->name, "smartreflex_mpu_iva"))) {
186 sr->senn_avgweight = OMAP3430_SR1_SENNAVGWEIGHT;
187 sr->senp_avgweight = OMAP3430_SR1_SENPAVGWEIGHT;
188 } else {
189 sr->senn_avgweight = OMAP3430_SR2_SENNAVGWEIGHT;
190 sr->senp_avgweight = OMAP3430_SR2_SENPAVGWEIGHT;
191 }
192 }
193}
194
195static void sr_start_vddautocomp(struct omap_sr *sr) 170static void sr_start_vddautocomp(struct omap_sr *sr)
196{ 171{
197 if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) { 172 if (!sr_class || !(sr_class->enable) || !(sr_class->configure)) {
@@ -924,8 +899,14 @@ static int __init omap_sr_probe(struct platform_device *pdev)
924 sr_info->nvalue_count = pdata->nvalue_count; 899 sr_info->nvalue_count = pdata->nvalue_count;
925 sr_info->senn_mod = pdata->senn_mod; 900 sr_info->senn_mod = pdata->senn_mod;
926 sr_info->senp_mod = pdata->senp_mod; 901 sr_info->senp_mod = pdata->senp_mod;
902 sr_info->err_weight = pdata->err_weight;
903 sr_info->err_maxlimit = pdata->err_maxlimit;
904 sr_info->accum_data = pdata->accum_data;
905 sr_info->senn_avgweight = pdata->senn_avgweight;
906 sr_info->senp_avgweight = pdata->senp_avgweight;
927 sr_info->autocomp_active = false; 907 sr_info->autocomp_active = false;
928 sr_info->ip_type = pdata->ip_type; 908 sr_info->ip_type = pdata->ip_type;
909
929 sr_info->base = ioremap(mem->start, resource_size(mem)); 910 sr_info->base = ioremap(mem->start, resource_size(mem));
930 if (!sr_info->base) { 911 if (!sr_info->base) {
931 dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); 912 dev_err(&pdev->dev, "%s: ioremap fail\n", __func__);
@@ -937,7 +918,6 @@ static int __init omap_sr_probe(struct platform_device *pdev)
937 sr_info->irq = irq->start; 918 sr_info->irq = irq->start;
938 919
939 sr_set_clk_length(sr_info); 920 sr_set_clk_length(sr_info);
940 sr_set_regfields(sr_info);
941 921
942 list_add(&sr_info->node, &sr_list); 922 list_add(&sr_info->node, &sr_list);
943 923