Add linux-next specific files for 20110516
[linux-2.6/next.git] / arch / arm / mach-omap2 / smartreflex-class3.c
blobf438cf4d847b7f093c70d14619d07d630529b932
1 /*
2 * Smart reflex Class 3 specific implementations
4 * Author: Thara Gopinath <thara@ti.com>
6 * Copyright (C) 2010 Texas Instruments, Inc.
7 * Thara Gopinath <thara@ti.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
14 #include "smartreflex.h"
16 static int sr_class3_enable(struct voltagedomain *voltdm)
18 unsigned long volt = omap_voltage_get_nom_volt(voltdm);
20 if (!volt) {
21 pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n",
22 __func__, voltdm->name);
23 return -ENODATA;
26 omap_vp_enable(voltdm);
27 return sr_enable(voltdm, volt);
30 static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
32 omap_vp_disable(voltdm);
33 sr_disable(voltdm);
34 if (is_volt_reset)
35 omap_voltage_reset(voltdm);
37 return 0;
40 static int sr_class3_configure(struct voltagedomain *voltdm)
42 return sr_configure_errgen(voltdm);
45 /* SR class3 structure */
46 static struct omap_sr_class_data class3_data = {
47 .enable = sr_class3_enable,
48 .disable = sr_class3_disable,
49 .configure = sr_class3_configure,
50 .class_type = SR_CLASS3,
53 /* Smartreflex Class3 init API to be called from board file */
54 static int __init sr_class3_init(void)
56 pr_info("SmartReflex Class3 initialized\n");
57 return sr_register_class(&class3_data);
59 late_initcall(sr_class3_init);