Merge branch 'vmwgfx-fixes-3.13' of git://people.freedesktop.org/~thomash/linux into...
[deliverable/linux.git] / arch / arm / mach-omap2 / smartreflex-class3.c
CommitLineData
fa765823
TG
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
b86aeafc 14#include <linux/power/smartreflex.h>
dad2d9e6 15#include "soc.h"
b86aeafc 16#include "voltage.h"
fa765823 17
80821c9c 18static int sr_class3_enable(struct omap_sr *sr)
fa765823 19{
80821c9c 20 unsigned long volt = voltdm_get_voltage(sr->voltdm);
fa765823
TG
21
22 if (!volt) {
8b765d72
JP
23 pr_warning("%s: Curr voltage unknown. Cannot enable %s\n",
24 __func__, sr->name);
fa765823
TG
25 return -ENODATA;
26 }
27
80821c9c 28 omap_vp_enable(sr->voltdm);
299066bb 29 return sr_enable(sr, volt);
fa765823
TG
30}
31
80821c9c 32static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
fa765823 33{
3dfc35ff 34 sr_disable_errgen(sr);
80821c9c 35 omap_vp_disable(sr->voltdm);
299066bb 36 sr_disable(sr);
fa765823 37 if (is_volt_reset)
80821c9c 38 voltdm_reset(sr->voltdm);
fa765823
TG
39
40 return 0;
41}
42
80821c9c 43static int sr_class3_configure(struct omap_sr *sr)
fa765823 44{
3dfc35ff 45 return sr_configure_errgen(sr);
fa765823
TG
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}
b76c8b19 62omap_late_initcall(sr_class3_init);
This page took 0.175144 seconds and 5 git commands to generate.