diff options
author | Andrii Tseglytskyi <andrii.tseglytskyi@ti.com> | 2013-05-27 07:09:24 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@linaro.org> | 2013-06-10 13:46:18 -0400 |
commit | 299066bb376ef7720cc3d8de95d5b967c5446863 (patch) | |
tree | 2c8fccdbe53d050a71ede615271a566d75e7fc67 | |
parent | 6c80573415fe47450579d5d8bfab53b304d803ed (diff) |
PM / AVS: SmartReflex: use omap_sr * for enable/disable interface
SmartReflex driver interface is natively divided to two parts:
- external SmartReflex interface
- interface between SmartReflex driver and SmartReflex Class
Functions which belong to AVS class interface can use
struct omap_sr* instead of struct voltatedomain*, to provide a
direct connection between SR driver and SR class. This allows
us to optimize and not do additional lookups where none is
required.
sr_enable() and sr_disable() are interface functions between
SR driver and SR class. They are typically used by Class driver
to enable/disable SmartReflex hardware module.
Now they take struct omap_sr* as input parameter.
Signed-off-by: Andrii Tseglytskyi <andrii.tseglytskyi@ti.com>
Acked-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Kevin Hilman <khilman@linaro.org>
-rw-r--r-- | arch/arm/mach-omap2/smartreflex-class3.c | 4 | ||||
-rw-r--r-- | drivers/power/avs/smartreflex.c | 23 | ||||
-rw-r--r-- | include/linux/power/smartreflex.h | 4 |
3 files changed, 15 insertions, 16 deletions
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c index 6c26dc15815c..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); | 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 | ||
diff --git a/drivers/power/avs/smartreflex.c b/drivers/power/avs/smartreflex.c index 08a8a299f1fd..14cce7addbb9 100644 --- a/drivers/power/avs/smartreflex.c +++ b/drivers/power/avs/smartreflex.c | |||
@@ -552,7 +552,7 @@ int sr_configure_minmax(struct omap_sr *sr) | |||
552 | 552 | ||
553 | /** | 553 | /** |
554 | * sr_enable() - Enables the smartreflex module. | 554 | * sr_enable() - Enables the smartreflex module. |
555 | * @voltdm: VDD pointer to which the SR module to be configured belongs to. | 555 | * @sr: pointer to which the SR module to be configured belongs to. |
556 | * @volt: The voltage at which the Voltage domain associated with | 556 | * @volt: The voltage at which the Voltage domain associated with |
557 | * the smartreflex module is operating at. | 557 | * the smartreflex module is operating at. |
558 | * This is required only to program the correct Ntarget value. | 558 | * This is required only to program the correct Ntarget value. |
@@ -561,16 +561,16 @@ int sr_configure_minmax(struct omap_sr *sr) | |||
561 | * enable a smartreflex module. Returns 0 on success. Returns error | 561 | * enable a smartreflex module. Returns 0 on success. Returns error |
562 | * value if the voltage passed is wrong or if ntarget value is wrong. | 562 | * value if the voltage passed is wrong or if ntarget value is wrong. |
563 | */ | 563 | */ |
564 | int sr_enable(struct voltagedomain *voltdm, unsigned long volt) | 564 | int sr_enable(struct omap_sr *sr, unsigned long volt) |
565 | { | 565 | { |
566 | struct omap_volt_data *volt_data; | 566 | struct omap_volt_data *volt_data; |
567 | struct omap_sr *sr = _sr_lookup(voltdm); | ||
568 | struct omap_sr_nvalue_table *nvalue_row; | 567 | struct omap_sr_nvalue_table *nvalue_row; |
569 | int ret; | 568 | int ret; |
570 | 569 | ||
571 | if (IS_ERR(sr)) { | 570 | if (!sr) { |
572 | pr_warning("%s: omap_sr struct for voltdm not found\n", __func__); | 571 | pr_warn("%s: NULL omap_sr from %pF\n", __func__, |
573 | return PTR_ERR(sr); | 572 | (void *)_RET_IP_); |
573 | return -EINVAL; | ||
574 | } | 574 | } |
575 | 575 | ||
576 | volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); | 576 | volt_data = omap_voltage_get_voltdata(sr->voltdm, volt); |
@@ -612,17 +612,16 @@ int sr_enable(struct voltagedomain *voltdm, unsigned long volt) | |||
612 | 612 | ||
613 | /** | 613 | /** |
614 | * sr_disable() - Disables the smartreflex module. | 614 | * sr_disable() - Disables the smartreflex module. |
615 | * @voltdm: VDD pointer to which the SR module to be configured belongs to. | 615 | * @sr: pointer to which the SR module to be configured belongs to. |
616 | * | 616 | * |
617 | * This API is to be called from the smartreflex class driver to | 617 | * This API is to be called from the smartreflex class driver to |
618 | * disable a smartreflex module. | 618 | * disable a smartreflex module. |
619 | */ | 619 | */ |
620 | void sr_disable(struct voltagedomain *voltdm) | 620 | void sr_disable(struct omap_sr *sr) |
621 | { | 621 | { |
622 | struct omap_sr *sr = _sr_lookup(voltdm); | 622 | if (!sr) { |
623 | 623 | pr_warn("%s: NULL omap_sr from %pF\n", __func__, | |
624 | if (IS_ERR(sr)) { | 624 | (void *)_RET_IP_); |
625 | pr_warning("%s: omap_sr struct for voltdm not found\n", __func__); | ||
626 | return; | 625 | return; |
627 | } | 626 | } |
628 | 627 | ||
diff --git a/include/linux/power/smartreflex.h b/include/linux/power/smartreflex.h index 648be776b661..d8b187c3925d 100644 --- a/include/linux/power/smartreflex.h +++ b/include/linux/power/smartreflex.h | |||
@@ -299,8 +299,8 @@ 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 omap_sr *sr); | 304 | int sr_configure_errgen(struct omap_sr *sr); |
305 | int sr_disable_errgen(struct omap_sr *sr); | 305 | int sr_disable_errgen(struct omap_sr *sr); |
306 | int sr_configure_minmax(struct omap_sr *sr); | 306 | int sr_configure_minmax(struct omap_sr *sr); |