diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-28 07:01:22 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-06-28 07:01:22 -0400 |
commit | 52388492ea7046888156ed2756fbba390b18c01e (patch) | |
tree | 3d5935b0f4c1dbd723223f37caf8f227be8861c6 | |
parent | ceaed1e3942132a0705ef5b4e1d696313d638550 (diff) | |
parent | 592a55d83599d6b3c90acc7a3795fb3ff1851be7 (diff) |
Merge branch 'pm-omap'
* pm-omap:
PM / AVS: SmartReflex: use devm_* API to initialize SmartReflex
PM / AVS: SmartReflex: use omap_sr * for enable/disable interface
PM / AVS: SmartReflex: use omap_sr * for minmax interfaces
PM / AVS: SmartReflex: use omap_sr * for errgen interfaces
PM / AVS: SmartReflex: fix driver name
PM / AVS: SmartReflex: disable runtime PM on driver remove
PM / AVS: SmartReflex: disable errgen before vpbound disable
-rw-r--r-- | arch/arm/mach-omap2/smartreflex-class3.c | 8 | ||||
-rw-r--r-- | drivers/power/avs/smartreflex.c | 154 | ||||
-rw-r--r-- | include/linux/power/smartreflex.h | 10 |
3 files changed, 72 insertions, 100 deletions
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c index aee3c8940a30..7a42e1960c3b 100644 --- a/arch/arm/mach-omap2/smartreflex-class3.c +++ b/arch/arm/mach-omap2/smartreflex-class3.c | |||
@@ -26,14 +26,14 @@ static int sr_class3_enable(struct omap_sr *sr) | |||
26 | } | 26 | } |
27 | 27 | ||
28 | omap_vp_enable(sr->voltdm); | 28 | omap_vp_enable(sr->voltdm); |
29 | return sr_enable(sr->voltdm, volt); | 29 | return sr_enable(sr, volt); |
30 | } | 30 | } |
31 | 31 | ||
32 | static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset) | 32 | static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset) |
33 | { | 33 | { |
34 | sr_disable_errgen(sr->voltdm); | 34 | sr_disable_errgen(sr); |
35 | omap_vp_disable(sr->voltdm); | 35 | omap_vp_disable(sr->voltdm); |
36 | sr_disable(sr->voltdm); | 36 | sr_disable(sr); |
37 | if (is_volt_reset) | 37 | if (is_volt_reset) |
38 | voltdm_reset(sr->voltdm); | 38 | voltdm_reset(sr->voltdm); |
39 | 39 | ||
@@ -42,7 +42,7 @@ static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset) | |||
42 | 42 | ||
43 | static int sr_class3_configure(struct omap_sr *sr) | 43 | static int sr_class3_configure(struct omap_sr *sr) |
44 | { | 44 | { |
45 | return sr_configure_errgen(sr->voltdm); | 45 | return sr_configure_errgen(sr); |
46 | } | 46 | } |
47 | 47 | ||
48 | /* SR class3 structure */ | 48 | /* SR class3 structure */ |
diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c index 6b2238bb6a81..db9973bb53f1 100644 --- a/drivers/power/avs/smartreflex.c +++ b/drivers/power/avs/smartreflex.c | |||
@@ -27,7 +27,8 @@ | |||
27 | #include <linux/pm_runtime.h> | 27 | #include <linux/pm_runtime.h> |
28 | #include <linux/power/smartreflex.h> | 28 | #include <linux/power/smartreflex.h> |
29 | 29 | ||
30 | #define SMARTREFLEX_NAME_LEN 16 | 30 | #define DRIVER_NAME "smartreflex" |
31 | #define SMARTREFLEX_NAME_LEN 32 | ||
31 | #define NVALUE_NAME_LEN 40 | 32 | #define NVALUE_NAME_LEN 40 |
32 | #define SR_DISABLE_TIMEOUT 200 | 33 | #define SR_DISABLE_TIMEOUT 200 |
33 | 34 | ||
@@ -207,12 +208,11 @@ static void sr_stop_vddautocomp(struct omap_sr *sr) | |||
207 | static int sr_late_init(struct omap_sr *sr_info) | 208 | static int sr_late_init(struct omap_sr *sr_info) |
208 | { | 209 | { |
209 | struct omap_sr_data *pdata = sr_info->pdev->dev.platform_data; | 210 | struct omap_sr_data *pdata = sr_info->pdev->dev.platform_data; |
210 | struct resource *mem; | ||
211 | int ret = 0; | 211 | int ret = 0; |
212 | 212 | ||
213 | if (sr_class->notify && sr_class->notify_flags && sr_info->irq) { | 213 | if (sr_class->notify && sr_class->notify_flags && sr_info->irq) { |
214 | ret = request_irq(sr_info->irq, sr_interrupt, | 214 | ret = devm_request_irq(&sr_info->pdev->dev, sr_info->irq, |
215 | 0, sr_info->name, sr_info); | 215 | sr_interrupt, 0, sr_info->name, sr_info); |
216 | if (ret) | 216 | if (ret) |
217 | goto error; | 217 | goto error; |
218 | disable_irq(sr_info->irq); | 218 | disable_irq(sr_info->irq); |
@@ -224,14 +224,10 @@ static int sr_late_init(struct omap_sr *sr_info) | |||
224 | return ret; | 224 | return ret; |
225 | 225 | ||
226 | error: | 226 | error: |
227 | iounmap(sr_info->base); | ||
228 | mem = platform_get_resource(sr_info->pdev, IORESOURCE_MEM, 0); | ||
229 | release_mem_region(mem->start, resource_size(mem)); | ||
230 | list_del(&sr_info->node); | 227 | list_del(&sr_info->node); |
231 | dev_err(&sr_info->pdev->dev, "%s: ERROR in registering" | 228 | dev_err(&sr_info->pdev->dev, "%s: ERROR in registering" |
232 | "interrupt handler. Smartreflex will" | 229 | "interrupt handler. Smartreflex will" |
233 | "not function as desired\n", __func__); | 230 | "not function as desired\n", __func__); |
234 | kfree(sr_info); | ||
235 | 231 | ||
236 | return ret; | 232 | return ret; |
237 | } | 233 | } |
@@ -341,9 +337,9 @@ static struct omap_sr_nvalue_table *sr_retrieve_nvalue_row( | |||
341 | /* Public Functions */ | 337 | /* Public Functions */ |
342 | 338 | ||
343 | /** | 339 | /** |
344 | * sr_configure_errgen() - Configures the smrtreflex to perform AVS using the | 340 | * sr_configure_errgen() - Configures the SmartReflex to perform AVS using the |
345 | * error generator module. | 341 | * error generator module. |
346 | * @voltdm: VDD pointer to which the SR module to be configured belongs to. | 342 | * @sr: SR module to be configured. |
347 | * | 343 | * |
348 | * This API is to be called from the smartreflex class driver to | 344 | * This API is to be called from the smartreflex class driver to |
349 | * configure the error generator module inside the smartreflex module. | 345 | * configure the error generator module inside the smartreflex module. |
@@ -352,17 +348,17 @@ static struct omap_sr_nvalue_table *sr_retrieve_nvalue_row( | |||
352 | * SR CLASS 2 can choose between ERROR module and MINMAXAVG | 348 | * SR CLASS 2 can choose between ERROR module and MINMAXAVG |
353 | * module. Returns 0 on success and error value in case of failure. | 349 | * module. Returns 0 on success and error value in case of failure. |
354 | */ | 350 | */ |
355 | int sr_configure_errgen(struct voltagedomain *voltdm) | 351 | int sr_configure_errgen(struct omap_sr *sr) |
356 | { | 352 | { |
357 | u32 sr_config, sr_errconfig, errconfig_offs; | 353 | u32 sr_config, sr_errconfig, errconfig_offs; |
358 | u32 vpboundint_en, vpboundint_st; | 354 | u32 vpboundint_en, vpboundint_st; |
359 | u32 senp_en = 0, senn_en = 0; | 355 | u32 senp_en = 0, senn_en = 0; |
360 | u8 senp_shift, senn_shift; | 356 | u8 senp_shift, senn_shift; |
361 | struct omap_sr *sr = _sr_lookup(voltdm); | ||
362 | 357 | ||
363 | if (IS_ERR(sr)) { | 358 | if (!sr) { |
364 | pr_warning("%s: omap_sr struct for voltdm not found\n", __func__); | 359 | pr_warn("%s: NULL omap_sr from %pF\n", __func__, |
365 | return PTR_ERR(sr); | 360 | (void *)_RET_IP_); |
361 | return -EINVAL; | ||
366 | } | 362 | } |
367 | 363 | ||
368 | if (!sr->clk_length) | 364 | if (!sr->clk_length) |
@@ -414,22 +410,22 @@ int sr_configure_errgen(struct voltagedomain *voltdm) | |||
414 | 410 | ||
415 | /** | 411 | /** |
416 | * sr_disable_errgen() - Disables SmartReflex AVS module's errgen component | 412 | * sr_disable_errgen() - Disables SmartReflex AVS module's errgen component |
417 | * @voltdm: VDD pointer to which the SR module to be configured belongs to. | 413 | * @sr: SR module to be configured. |
418 | * | 414 | * |
419 | * This API is to be called from the smartreflex class driver to | 415 | * This API is to be called from the smartreflex class driver to |
420 | * disable the error generator module inside the smartreflex module. | 416 | * disable the error generator module inside the smartreflex module. |
421 | * | 417 | * |
422 | * Returns 0 on success and error value in case of failure. | 418 | * Returns 0 on success and error value in case of failure. |
423 | */ | 419 | */ |
424 | int sr_disable_errgen(struct voltagedomain *voltdm) | 420 | int sr_disable_errgen(struct omap_sr *sr) |
425 | { | 421 | { |
426 | u32 errconfig_offs; | 422 | u32 errconfig_offs; |
427 | u32 vpboundint_en, vpboundint_st; | 423 | u32 vpboundint_en, vpboundint_st; |
428 | struct omap_sr *sr = _sr_lookup(voltdm); | ||
429 | 424 | ||
430 | if (IS_ERR(sr)) { | 425 | if (!sr) { |
431 | pr_warning("%s: omap_sr struct for voltdm not found\n", __func__); | 426 | pr_warn("%s: NULL omap_sr from %pF\n", __func__, |
432 | return PTR_ERR(sr); | 427 | (void *)_RET_IP_); |
428 | return -EINVAL; | ||
433 | } | 429 | } |
434 | 430 | ||
435 | switch (sr->ip_type) { | 431 | switch (sr->ip_type) { |
@@ -449,19 +445,24 @@ int sr_disable_errgen(struct voltagedomain *voltdm) | |||
449 | return -EINVAL; | 445 | return -EINVAL; |
450 | } | 446 | } |
451 | 447 | ||
452 | /* Disable the interrupts of ERROR module */ | ||
453 | sr_modify_reg(sr, errconfig_offs, vpboundint_en | vpboundint_st, 0); | ||
454 | |||
455 | /* Disable the Sensor and errorgen */ | 448 | /* Disable the Sensor and errorgen */ |
456 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN, 0); | 449 | sr_modify_reg(sr, SRCONFIG, SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN, 0); |
457 | 450 | ||
451 | /* | ||
452 | * Disable the interrupts of ERROR module | ||
453 | * NOTE: modify is a read, modify,write - an implicit OCP barrier | ||
454 | * which is required is present here - sequencing is critical | ||
455 | * at this point (after errgen is disabled, vpboundint disable) | ||
456 | */ | ||
457 | sr_modify_reg(sr, errconfig_offs, vpboundint_en | vpboundint_st, 0); | ||
458 | |||
458 | return 0; | 459 | return 0; |
459 | } | 460 | } |
460 | 461 | ||
461 | /** | 462 | /** |
462 | * sr_configure_minmax() - Configures the smrtreflex to perform AVS using the | 463 | * sr_configure_minmax() - Configures the SmartReflex to perform AVS using the |
463 | * minmaxavg module. | 464 | * minmaxavg module. |
464 | * @voltdm: VDD pointer to which the SR module to be configured belongs to. | 465 | * @sr: SR module to be configured. |
465 | * | 466 | * |
466 | * This API is to be called from the smartreflex class driver to | 467 | * This API is to be called from the smartreflex class driver to |
467 | * configure the minmaxavg module inside the smartreflex module. | 468 | * configure the minmaxavg module inside the smartreflex module. |
@@ -470,16 +471,16 @@ int sr_disable_errgen(struct voltagedomain *voltdm) | |||
470 | * SR CLASS 2 can choose between ERROR module and MINMAXAVG | 471 | * SR CLASS 2 can choose between ERROR module and MINMAXAVG |
471 | * module. Returns 0 on success and error value in case of failure. | 472 | * module. Returns 0 on success and error value in case of failure. |
472 | */ | 473 | */ |
473 | int sr_configure_minmax(struct voltagedomain *voltdm) | 474 | int sr_configure_minmax(struct omap_sr *sr) |
474 | { | 475 | { |
475 | u32 sr_config, sr_avgwt; | 476 | u32 sr_config, sr_avgwt; |
476 | u32 senp_en = 0, senn_en = 0; | 477 | u32 senp_en = 0, senn_en = 0; |
477 | u8 senp_shift, senn_shift; | 478 | u8 senp_shift, senn_shift; |
478 | struct omap_sr *sr = _sr_lookup(voltdm); | ||
479 | 479 | ||
480 | if (IS_ERR(sr)) { | 480 | if (!sr) { |
481 | pr_warning("%s: omap_sr struct for voltdm not found\n", __func__); | 481 | pr_warn("%s: NULL omap_sr from %pF\n", __func__, |
482 | return PTR_ERR(sr); | 482 | (void *)_RET_IP_); |
483 | return -EINVAL; | ||
483 | } | 484 | } |
484 | 485 | ||
485 | if (!sr->clk_length) | 486 | if (!sr->clk_length) |
@@ -546,7 +547,7 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
546 | 547 | ||
547 | /** | 548 | /** |
548 | * sr_enable() - Enables the smartreflex module. | 549 | * sr_enable() - Enables the smartreflex module. |
549 | * @voltdm: VDD pointer to which the SR module to be configured belongs to. | 550 | * @sr: pointer to which the SR module to be configured belongs to. |
550 | * @volt: The voltage at which the Voltage domain associated with | 551 | * @volt: The voltage at which the Voltage domain associated with |
551 | * the smartreflex module is operating at. | 552 | * the smartreflex module is operating at. |
552 | * This is required only to program the correct Ntarget value. | 553 | * This is required only to program the correct Ntarget value. |
@@ -555,16 +556,16 @@ int sr_configure_minmax(struct voltagedomain *voltdm) | |||
555 | * enable a smartreflex module. Returns 0 on success. Returns error | 556 | * enable a smartreflex module. Returns 0 on success. Returns error |
556 | * value if the voltage passed is wrong or if ntarget value is wrong. | 557 | * value if the voltage passed is wrong or if ntarget value is wrong. |
557 | */ | 558 | */ |
558 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt) | 559 | int sr_enable(struct omap_sr *sr, unsigned long volt) |
559 | { | 560 | { |
560 | struct omap_volt_data *volt_data; | 561 | struct omap_volt_data *volt_data; |
561 | struct omap_sr *sr = _sr_lookup(voltdm); | ||
562 | struct omap_sr_nvalue_table *nvalue_row; | 562 | struct omap_sr_nvalue_table *nvalue_row; |
563 | int ret; | 563 | int ret; |
564 | 564 | ||
565 | if (IS_ERR(sr)) { | 565 | if (!sr) { |
566 | pr_warning("%s: omap_sr struct for voltdm not found\n", __func__); | 566 | pr_warn("%s: NULL omap_sr from %pF\n", __func__, |
567 | return PTR_ERR(sr); | 567 | (void *)_RET_IP_); |
568 | return -EINVAL; | ||
568 | } | 569 | } |
569 | 570 | ||
570 | volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); | 571 | volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); |
@@ -606,17 +607,16 @@ int sr_enable(struct voltagedomain *voltdm, unsigned long volt) | |||
606 | 607 | ||
607 | /** | 608 | /** |
608 | * sr_disable() - Disables the smartreflex module. | 609 | * sr_disable() - Disables the smartreflex module. |
609 | * @voltdm: VDD pointer to which the SR module to be configured belongs to. | 610 | * @sr: pointer to which the SR module to be configured belongs to. |
610 | * | 611 | * |
611 | * This API is to be called from the smartreflex class driver to | 612 | * This API is to be called from the smartreflex class driver to |
612 | * disable a smartreflex module. | 613 | * disable a smartreflex module. |
613 | */ | 614 | */ |
614 | void sr_disable(struct voltagedomain *voltdm) | 615 | void sr_disable(struct omap_sr *sr) |
615 | { | 616 | { |
616 | struct omap_sr *sr = _sr_lookup(voltdm); | 617 | if (!sr) { |
617 | 618 | pr_warn("%s: NULL omap_sr from %pF\n", __func__, | |
618 | if (IS_ERR(sr)) { | 619 | (void *)_RET_IP_); |
619 | pr_warning("%s: omap_sr struct for voltdm not found\n", __func__); | ||
620 | return; | 620 | return; |
621 | } | 621 | } |
622 | 622 | ||
@@ -847,34 +847,33 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
847 | struct dentry *nvalue_dir; | 847 | struct dentry *nvalue_dir; |
848 | int i, ret = 0; | 848 | int i, ret = 0; |
849 | 849 | ||
850 | sr_info = kzalloc(sizeof(struct omap_sr), GFP_KERNEL); | 850 | sr_info = devm_kzalloc(&pdev->dev, sizeof(struct omap_sr), GFP_KERNEL); |
851 | if (!sr_info) { | 851 | if (!sr_info) { |
852 | dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", | 852 | dev_err(&pdev->dev, "%s: unable to allocate sr_info\n", |
853 | __func__); | 853 | __func__); |
854 | return -ENOMEM; | 854 | return -ENOMEM; |
855 | } | 855 | } |
856 | 856 | ||
857 | sr_info->name = devm_kzalloc(&pdev->dev, | ||
858 | SMARTREFLEX_NAME_LEN, GFP_KERNEL); | ||
859 | if (!sr_info->name) { | ||
860 | dev_err(&pdev->dev, "%s: unable to allocate SR instance name\n", | ||
861 | __func__); | ||
862 | return -ENOMEM; | ||
863 | } | ||
864 | |||
857 | platform_set_drvdata(pdev, sr_info); | 865 | platform_set_drvdata(pdev, sr_info); |
858 | 866 | ||
859 | if (!pdata) { | 867 | if (!pdata) { |
860 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); | 868 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); |
861 | ret = -EINVAL; | 869 | return -EINVAL; |
862 | goto err_free_devinfo; | ||
863 | } | 870 | } |
864 | 871 | ||
865 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 872 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
866 | if (!mem) { | 873 | sr_info->base = devm_ioremap_resource(&pdev->dev, mem); |
867 | dev_err(&pdev->dev, "%s: no mem resource\n", __func__); | 874 | if (IS_ERR(sr_info->base)) { |
868 | ret = -ENODEV; | 875 | dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); |
869 | goto err_free_devinfo; | 876 | return PTR_ERR(sr_info->base); |
870 | } | ||
871 | |||
872 | mem = request_mem_region(mem->start, resource_size(mem), | ||
873 | dev_name(&pdev->dev)); | ||
874 | if (!mem) { | ||
875 | dev_err(&pdev->dev, "%s: no mem region\n", __func__); | ||
876 | ret = -EBUSY; | ||
877 | goto err_free_devinfo; | ||
878 | } | 877 | } |
879 | 878 | ||
880 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); | 879 | irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0); |
@@ -882,13 +881,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
882 | pm_runtime_enable(&pdev->dev); | 881 | pm_runtime_enable(&pdev->dev); |
883 | pm_runtime_irq_safe(&pdev->dev); | 882 | pm_runtime_irq_safe(&pdev->dev); |
884 | 883 | ||
885 | sr_info->name = kasprintf(GFP_KERNEL, "%s", pdata->name); | 884 | snprintf(sr_info->name, SMARTREFLEX_NAME_LEN, "%s", pdata->name); |
886 | if (!sr_info->name) { | ||
887 | dev_err(&pdev->dev, "%s: Unable to alloc SR instance name\n", | ||
888 | __func__); | ||
889 | ret = -ENOMEM; | ||
890 | goto err_release_region; | ||
891 | } | ||
892 | 885 | ||
893 | sr_info->pdev = pdev; | 886 | sr_info->pdev = pdev; |
894 | sr_info->srid = pdev->id; | 887 | sr_info->srid = pdev->id; |
@@ -905,13 +898,6 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
905 | sr_info->autocomp_active = false; | 898 | sr_info->autocomp_active = false; |
906 | sr_info->ip_type = pdata->ip_type; | 899 | sr_info->ip_type = pdata->ip_type; |
907 | 900 | ||
908 | sr_info->base = ioremap(mem->start, resource_size(mem)); | ||
909 | if (!sr_info->base) { | ||
910 | dev_err(&pdev->dev, "%s: ioremap fail\n", __func__); | ||
911 | ret = -ENOMEM; | ||
912 | goto err_free_name; | ||
913 | } | ||
914 | |||
915 | if (irq) | 901 | if (irq) |
916 | sr_info->irq = irq->start; | 902 | sr_info->irq = irq->start; |
917 | 903 | ||
@@ -927,7 +913,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
927 | ret = sr_late_init(sr_info); | 913 | ret = sr_late_init(sr_info); |
928 | if (ret) { | 914 | if (ret) { |
929 | pr_warning("%s: Error in SR late init\n", __func__); | 915 | pr_warning("%s: Error in SR late init\n", __func__); |
930 | goto err_iounmap; | 916 | goto err_list_del; |
931 | } | 917 | } |
932 | } | 918 | } |
933 | 919 | ||
@@ -938,7 +924,7 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
938 | ret = PTR_ERR(sr_dbg_dir); | 924 | ret = PTR_ERR(sr_dbg_dir); |
939 | pr_err("%s:sr debugfs dir creation failed(%d)\n", | 925 | pr_err("%s:sr debugfs dir creation failed(%d)\n", |
940 | __func__, ret); | 926 | __func__, ret); |
941 | goto err_iounmap; | 927 | goto err_list_del; |
942 | } | 928 | } |
943 | } | 929 | } |
944 | 930 | ||
@@ -991,16 +977,8 @@ static int __init omap_sr_probe(struct platform_device *pdev) | |||
991 | 977 | ||
992 | err_debugfs: | 978 | err_debugfs: |
993 | debugfs_remove_recursive(sr_info->dbg_dir); | 979 | debugfs_remove_recursive(sr_info->dbg_dir); |
994 | err_iounmap: | 980 | err_list_del: |
995 | list_del(&sr_info->node); | 981 | list_del(&sr_info->node); |
996 | iounmap(sr_info->base); | ||
997 | err_free_name: | ||
998 | kfree(sr_info->name); | ||
999 | err_release_region: | ||
1000 | release_mem_region(mem->start, resource_size(mem)); | ||
1001 | err_free_devinfo: | ||
1002 | kfree(sr_info); | ||
1003 | |||
1004 | return ret; | 982 | return ret; |
1005 | } | 983 | } |
1006 | 984 | ||
@@ -1008,7 +986,6 @@ static int omap_sr_remove(struct platform_device *pdev) | |||
1008 | { | 986 | { |
1009 | struct omap_sr_data *pdata = pdev->dev.platform_data; | 987 | struct omap_sr_data *pdata = pdev->dev.platform_data; |
1010 | struct omap_sr *sr_info; | 988 | struct omap_sr *sr_info; |
1011 | struct resource *mem; | ||
1012 | 989 | ||
1013 | if (!pdata) { | 990 | if (!pdata) { |
1014 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); | 991 | dev_err(&pdev->dev, "%s: platform data missing\n", __func__); |
@@ -1027,13 +1004,8 @@ static int omap_sr_remove(struct platform_device *pdev) | |||
1027 | if (sr_info->dbg_dir) | 1004 | if (sr_info->dbg_dir) |
1028 | debugfs_remove_recursive(sr_info->dbg_dir); | 1005 | debugfs_remove_recursive(sr_info->dbg_dir); |
1029 | 1006 | ||
1007 | pm_runtime_disable(&pdev->dev); | ||
1030 | list_del(&sr_info->node); | 1008 | list_del(&sr_info->node); |
1031 | iounmap(sr_info->base); | ||
1032 | kfree(sr_info->name); | ||
1033 | kfree(sr_info); | ||
1034 | mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
1035 | release_mem_region(mem->start, resource_size(mem)); | ||
1036 | |||
1037 | return 0; | 1009 | return 0; |
1038 | } | 1010 | } |
1039 | 1011 | ||
@@ -1064,7 +1036,7 @@ static struct platform_driver smartreflex_driver = { | |||
1064 | .remove = omap_sr_remove, | 1036 | .remove = omap_sr_remove, |
1065 | .shutdown = omap_sr_shutdown, | 1037 | .shutdown = omap_sr_shutdown, |
1066 | .driver = { | 1038 | .driver = { |
1067 | .name = "smartreflex", | 1039 | .name = DRIVER_NAME, |
1068 | }, | 1040 | }, |
1069 | }; | 1041 | }; |
1070 | 1042 | ||
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h index c0f44c2b006d..d8b187c3925d 100644 --- a/include/linux/power/smartreflex.h +++ b/include/linux/power/smartreflex.h | |||
@@ -299,11 +299,11 @@ void omap_sr_disable_reset_volt(struct voltagedomain *voltdm); | |||
299 | void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data); | 299 | void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data); |
300 | 300 | ||
301 | /* Smartreflex driver hooks to be called from Smartreflex class driver */ | 301 | /* Smartreflex driver hooks to be called from Smartreflex class driver */ |
302 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt); | 302 | int sr_enable(struct omap_sr *sr, unsigned long volt); |
303 | void sr_disable(struct voltagedomain *voltdm); | 303 | void sr_disable(struct omap_sr *sr); |
304 | int sr_configure_errgen(struct voltagedomain *voltdm); | 304 | int sr_configure_errgen(struct omap_sr *sr); |
305 | int sr_disable_errgen(struct voltagedomain *voltdm); | 305 | int sr_disable_errgen(struct omap_sr *sr); |
306 | int sr_configure_minmax(struct voltagedomain *voltdm); | 306 | int sr_configure_minmax(struct omap_sr *sr); |
307 | 307 | ||
308 | /* API to register the smartreflex class driver with the smartreflex driver */ | 308 | /* API to register the smartreflex class driver with the smartreflex driver */ |
309 | int sr_register_class(struct omap_sr_class_data *class_data); | 309 | int sr_register_class(struct omap_sr_class_data *class_data); |