aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/mach-omap2/smartreflex-class3.c1
-rw-r--r--arch/arm/mach-omap2/smartreflex.c44
-rw-r--r--arch/arm/mach-omap2/smartreflex.h1
3 files changed, 46 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/smartreflex-class3.c b/arch/arm/mach-omap2/smartreflex-class3.c
index 53d9d0a5b39d..955566eefac4 100644
--- a/arch/arm/mach-omap2/smartreflex-class3.c
+++ b/arch/arm/mach-omap2/smartreflex-class3.c
@@ -29,6 +29,7 @@ static int sr_class3_enable(struct voltagedomain *voltdm)
29 29
30static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset) 30static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
31{ 31{
32 sr_disable_errgen(voltdm);
32 omap_vp_disable(voltdm); 33 omap_vp_disable(voltdm);
33 sr_disable(voltdm); 34 sr_disable(voltdm);
34 if (is_volt_reset) 35 if (is_volt_reset)
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index eaf0d6e2f2e0..4b39c6489f6b 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -454,6 +454,50 @@ int sr_configure_errgen(struct voltagedomain *voltdm)
454} 454}
455 455
456/** 456/**
457 * sr_disable_errgen() - Disables SmartReflex AVS module's errgen component
458 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
459 *
460 * This API is to be called from the smartreflex class driver to
461 * disable the error generator module inside the smartreflex module.
462 *
463 * Returns 0 on success and error value in case of failure.
464 */
465int sr_disable_errgen(struct voltagedomain *voltdm)
466{
467 u32 errconfig_offs, vpboundint_en;
468 u32 vpboundint_st;
469 struct omap_sr *sr = _sr_lookup(voltdm);
470
471 if (IS_ERR(sr)) {
472 pr_warning("%s: omap_sr struct for sr_%s not found\n",
473 __func__, voltdm->name);
474 return -EINVAL;
475 }
476
477 if (sr->ip_type == SR_TYPE_V1) {
478 errconfig_offs = ERRCONFIG_V1;
479 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V1;
480 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V1;
481 } else if (sr->ip_type == SR_TYPE_V2) {
482 errconfig_offs = ERRCONFIG_V2;
483 vpboundint_en = ERRCONFIG_VPBOUNDINTEN_V2;
484 vpboundint_st = ERRCONFIG_VPBOUNDINTST_V2;
485 } else {
486 dev_err(&sr->pdev->dev, "%s: Trying to Configure smartreflex"
487 "module without specifying the ip\n", __func__);
488 return -EINVAL;
489 }
490
491 /* Disable the interrupts of ERROR module */
492 sr_modify_reg(sr, errconfig_offs, vpboundint_en | vpboundint_st, 0);
493
494 /* Disable the Sensor and errorgen */
495 sr_modify_reg(sr, SRCONFIG, SRCONFIG_SENENABLE | SRCONFIG_ERRGEN_EN, 0);
496
497 return 0;
498}
499
500/**
457 * sr_configure_minmax() - Configures the smrtreflex to perform AVS using the 501 * sr_configure_minmax() - Configures the smrtreflex to perform AVS using the
458 * minmaxavg module. 502 * minmaxavg module.
459 * @voltdm: VDD pointer to which the SR module to be configured belongs to. 503 * @voltdm: VDD pointer to which the SR module to be configured belongs to.
diff --git a/arch/arm/mach-omap2/smartreflex.h b/arch/arm/mach-omap2/smartreflex.h
index fd61498f71e0..5809141171f8 100644
--- a/arch/arm/mach-omap2/smartreflex.h
+++ b/arch/arm/mach-omap2/smartreflex.h
@@ -240,6 +240,7 @@ void omap_sr_register_pmic(struct omap_sr_pmic_data *pmic_data);
240int sr_enable(struct voltagedomain *voltdm, unsigned long volt); 240int sr_enable(struct voltagedomain *voltdm, unsigned long volt);
241void sr_disable(struct voltagedomain *voltdm); 241void sr_disable(struct voltagedomain *voltdm);
242int sr_configure_errgen(struct voltagedomain *voltdm); 242int sr_configure_errgen(struct voltagedomain *voltdm);
243int sr_disable_errgen(struct voltagedomain *voltdm);
243int sr_configure_minmax(struct voltagedomain *voltdm); 244int sr_configure_minmax(struct voltagedomain *voltdm);
244 245
245/* API to register the smartreflex class driver with the smartreflex driver */ 246/* API to register the smartreflex class driver with the smartreflex driver */