Loading...
1/*
2 * Smart reflex Class 3 specific implementations
3 *
4 * Author: Thara Gopinath <thara@ti.com>
5 *
6 * Copyright (C) 2010 Texas Instruments, Inc.
7 * Thara Gopinath <thara@ti.com>
8 *
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.
12 */
13
14#include "smartreflex.h"
15
16static int sr_class3_enable(struct voltagedomain *voltdm)
17{
18 unsigned long volt = voltdm_get_voltage(voltdm);
19
20 if (!volt) {
21 pr_warning("%s: Curr voltage unknown. Cannot enable sr_%s\n",
22 __func__, voltdm->name);
23 return -ENODATA;
24 }
25
26 omap_vp_enable(voltdm);
27 return sr_enable(voltdm, volt);
28}
29
30static int sr_class3_disable(struct voltagedomain *voltdm, int is_volt_reset)
31{
32 sr_disable_errgen(voltdm);
33 omap_vp_disable(voltdm);
34 sr_disable(voltdm);
35 if (is_volt_reset)
36 voltdm_reset(voltdm);
37
38 return 0;
39}
40
41static int sr_class3_configure(struct voltagedomain *voltdm)
42{
43 return sr_configure_errgen(voltdm);
44}
45
46/* SR class3 structure */
47static struct omap_sr_class_data class3_data = {
48 .enable = sr_class3_enable,
49 .disable = sr_class3_disable,
50 .configure = sr_class3_configure,
51 .class_type = SR_CLASS3,
52};
53
54/* Smartreflex Class3 init API to be called from board file */
55static int __init sr_class3_init(void)
56{
57 pr_info("SmartReflex Class3 initialized\n");
58 return sr_register_class(&class3_data);
59}
60late_initcall(sr_class3_init);
1/*
2 * Smart reflex Class 3 specific implementations
3 *
4 * Author: Thara Gopinath <thara@ti.com>
5 *
6 * Copyright (C) 2010 Texas Instruments, Inc.
7 * Thara Gopinath <thara@ti.com>
8 *
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.
12 */
13
14#include <linux/power/smartreflex.h>
15#include "soc.h"
16#include "voltage.h"
17
18static int sr_class3_enable(struct omap_sr *sr)
19{
20 unsigned long volt = voltdm_get_voltage(sr->voltdm);
21
22 if (!volt) {
23 pr_warning("%s: Curr voltage unknown. Cannot enable %s\n",
24 __func__, sr->name);
25 return -ENODATA;
26 }
27
28 omap_vp_enable(sr->voltdm);
29 return sr_enable(sr, volt);
30}
31
32static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
33{
34 sr_disable_errgen(sr);
35 omap_vp_disable(sr->voltdm);
36 sr_disable(sr);
37 if (is_volt_reset)
38 voltdm_reset(sr->voltdm);
39
40 return 0;
41}
42
43static int sr_class3_configure(struct omap_sr *sr)
44{
45 return sr_configure_errgen(sr);
46}
47
48/* SR class3 structure */
49static struct omap_sr_class_data class3_data = {
50 .enable = sr_class3_enable,
51 .disable = sr_class3_disable,
52 .configure = sr_class3_configure,
53 .class_type = SR_CLASS3,
54};
55
56/* Smartreflex Class3 init API to be called from board file */
57static int __init sr_class3_init(void)
58{
59 pr_info("SmartReflex Class3 initialized\n");
60 return sr_register_class(&class3_data);
61}
62omap_late_initcall(sr_class3_init);