aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/smartreflex.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/smartreflex.c')
-rw-r--r--arch/arm/mach-omap2/smartreflex.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index fb7dc52394a8..2ce2fb7664bc 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -143,7 +143,7 @@ static irqreturn_t sr_interrupt(int irq, void *data)
143 sr_write_reg(sr_info, IRQSTATUS, status); 143 sr_write_reg(sr_info, IRQSTATUS, status);
144 } 144 }
145 145
146 if (sr_class->class_type == SR_CLASS2 && sr_class->notify) 146 if (sr_class->notify)
147 sr_class->notify(sr_info->voltdm, status); 147 sr_class->notify(sr_info->voltdm, status);
148 148
149 return IRQ_HANDLED; 149 return IRQ_HANDLED;
@@ -258,9 +258,7 @@ static int sr_late_init(struct omap_sr *sr_info)
258 struct resource *mem; 258 struct resource *mem;
259 int ret = 0; 259 int ret = 0;
260 260
261 if (sr_class->class_type == SR_CLASS2 && 261 if (sr_class->notify && sr_class->notify_flags && sr_info->irq) {
262 sr_class->notify_flags && sr_info->irq) {
263
264 name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name); 262 name = kasprintf(GFP_KERNEL, "sr_%s", sr_info->voltdm->name);
265 if (name == NULL) { 263 if (name == NULL) {
266 ret = -ENOMEM; 264 ret = -ENOMEM;
@@ -270,6 +268,7 @@ static int sr_late_init(struct omap_sr *sr_info)
270 0, name, (void *)sr_info); 268 0, name, (void *)sr_info);
271 if (ret) 269 if (ret)
272 goto error; 270 goto error;
271 disable_irq(sr_info->irq);
273 } 272 }
274 273
275 if (pdata && pdata->enable_on_init) 274 if (pdata && pdata->enable_on_init)
@@ -278,16 +277,16 @@ static int sr_late_init(struct omap_sr *sr_info)
278 return ret; 277 return ret;
279 278
280error: 279error:
281 iounmap(sr_info->base); 280 iounmap(sr_info->base);
282 mem = platform_get_resource(sr_info->pdev, IORESOURCE_MEM, 0); 281 mem = platform_get_resource(sr_info->pdev, IORESOURCE_MEM, 0);
283 release_mem_region(mem->start, resource_size(mem)); 282 release_mem_region(mem->start, resource_size(mem));
284 list_del(&sr_info->node); 283 list_del(&sr_info->node);
285 dev_err(&sr_info->pdev->dev, "%s: ERROR in registering" 284 dev_err(&sr_info->pdev->dev, "%s: ERROR in registering"
286 "interrupt handler. Smartreflex will" 285 "interrupt handler. Smartreflex will"
287 "not function as desired\n", __func__); 286 "not function as desired\n", __func__);
288 kfree(name); 287 kfree(name);
289 kfree(sr_info); 288 kfree(sr_info);
290 return ret; 289 return ret;
291} 290}
292 291
293static void sr_v1_disable(struct omap_sr *sr) 292static void sr_v1_disable(struct omap_sr *sr)
@@ -808,10 +807,13 @@ static int omap_sr_autocomp_store(void *data, u64 val)
808 return -EINVAL; 807 return -EINVAL;
809 } 808 }
810 809
811 if (!val) 810 /* control enable/disable only if there is a delta in value */
812 sr_stop_vddautocomp(sr_info); 811 if (sr_info->autocomp_active != val) {
813 else 812 if (!val)
814 sr_start_vddautocomp(sr_info); 813 sr_stop_vddautocomp(sr_info);
814 else
815 sr_start_vddautocomp(sr_info);
816 }
815 817
816 return 0; 818 return 0;
817} 819}