]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
PM / AVS: SmartReflex: use omap_sr * for errgen interfaces
authorAndrii Tseglytskyi <andrii.tseglytskyi@ti.com>
Mon, 27 May 2013 11:09:22 +0000 (14:09 +0300)
committerKevin Hilman <khilman@linaro.org>
Mon, 10 Jun 2013 17:46:17 +0000 (10:46 -0700)
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_disable_errgen() and sr_configure_errgen() are interface
functions between SR driver and SR class. They are typically
used by Class driver to configure error generator module during
SmartReflex enable/disable sequence.
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>
arch/arm/mach-omap2/smartreflex-class3.c
drivers/power/avs/smartreflex.c
include/linux/power/smartreflex.h

index aee3c8940a30ca19f6d7819b2cc654481bbd1fd5..6c26dc15815c94ed2e1b051becc5d53167cbec27 100644 (file)
@@ -31,7 +31,7 @@ static int sr_class3_enable(struct omap_sr *sr)
 
 static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
 {
-       sr_disable_errgen(sr->voltdm);
+       sr_disable_errgen(sr);
        omap_vp_disable(sr->voltdm);
        sr_disable(sr->voltdm);
        if (is_volt_reset)
@@ -42,7 +42,7 @@ static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
 
 static int sr_class3_configure(struct omap_sr *sr)
 {
-       return sr_configure_errgen(sr->voltdm);
+       return sr_configure_errgen(sr);
 }
 
 /* SR class3 structure */
index 002005ee48d23a3f1bc17dfdd1b0f31c0af42740..fccb62743d1910482cdfd9ab7b4fdff82d2ec138 100644 (file)
@@ -342,9 +342,9 @@ static struct omap_sr_nvalue_table *sr_retrieve_nvalue_row(
 /* Public Functions */
 
 /**
- * sr_configure_errgen() - Configures the smrtreflex to perform AVS using the
+ * sr_configure_errgen() - Configures the SmartReflex to perform AVS using the
  *                      error generator module.
- * @voltdm:    VDD pointer to which the SR module to be configured belongs to.
+ * @sr:                        SR module to be configured.
  *
  * This API is to be called from the smartreflex class driver to
  * configure the error generator module inside the smartreflex module.
@@ -353,17 +353,17 @@ static struct omap_sr_nvalue_table *sr_retrieve_nvalue_row(
  * SR CLASS 2 can choose between ERROR module and MINMAXAVG
  * module. Returns 0 on success and error value in case of failure.
  */
-int sr_configure_errgen(struct voltagedomain *voltdm)
+int sr_configure_errgen(struct omap_sr *sr)
 {
        u32 sr_config, sr_errconfig, errconfig_offs;
        u32 vpboundint_en, vpboundint_st;
        u32 senp_en = 0, senn_en = 0;
        u8 senp_shift, senn_shift;
-       struct omap_sr *sr = _sr_lookup(voltdm);
 
-       if (IS_ERR(sr)) {
-               pr_warning("%s: omap_sr struct for voltdm not found\n", __func__);
-               return PTR_ERR(sr);
+       if (!sr) {
+               pr_warn("%s: NULL omap_sr from %pF\n", __func__,
+                       (void *)_RET_IP_);
+               return -EINVAL;
        }
 
        if (!sr->clk_length)
@@ -415,22 +415,22 @@ int sr_configure_errgen(struct voltagedomain *voltdm)
 
 /**
  * sr_disable_errgen() - Disables SmartReflex AVS module's errgen component
- * @voltdm:    VDD pointer to which the SR module to be configured belongs to.
+ * @sr:                        SR module to be configured.
  *
  * This API is to be called from the smartreflex class driver to
  * disable the error generator module inside the smartreflex module.
  *
  * Returns 0 on success and error value in case of failure.
  */
-int sr_disable_errgen(struct voltagedomain *voltdm)
+int sr_disable_errgen(struct omap_sr *sr)
 {
        u32 errconfig_offs;
        u32 vpboundint_en, vpboundint_st;
-       struct omap_sr *sr = _sr_lookup(voltdm);
 
-       if (IS_ERR(sr)) {
-               pr_warning("%s: omap_sr struct for voltdm not found\n", __func__);
-               return PTR_ERR(sr);
+       if (!sr) {
+               pr_warn("%s: NULL omap_sr from %pF\n", __func__,
+                       (void *)_RET_IP_);
+               return -EINVAL;
        }
 
        switch (sr->ip_type) {
index c0f44c2b006da4ae05e4c55e7ed322fb50c581fd..9c3b9ad17095d7fb5347a6711b89da71405bcb27 100644 (file)
@@ -301,8 +301,8 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
 /* Smartreflex driver hooks to be called from Smartreflex class driver */
 int sr_enable(struct voltagedomain *voltdm, unsigned long volt);
 void sr_disable(struct voltagedomain *voltdm);
-int sr_configure_errgen(struct voltagedomain *voltdm);
-int sr_disable_errgen(struct voltagedomain *voltdm);
+int sr_configure_errgen(struct omap_sr *sr);
+int sr_disable_errgen(struct omap_sr *sr);
 int sr_configure_minmax(struct voltagedomain *voltdm);
 
 /* API to register the smartreflex class driver with the smartreflex driver */