Merge tag 'locking-urgent-2020-12-27' of git://git.kernel.org/pub/scm/linux/kernel...
[linux/fpc-iii.git] / arch / arm / mach-omap2 / smartreflex-class3.c
blob7c18420c9ff6bd9fc50f813f6852a4cf322311b4
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * Smart reflex Class 3 specific implementations
5 * Author: Thara Gopinath <thara@ti.com>
7 * Copyright (C) 2010 Texas Instruments, Inc.
8 * Thara Gopinath <thara@ti.com>
9 */
11 #include <linux/power/smartreflex.h>
12 #include "soc.h"
13 #include "voltage.h"
15 static int sr_class3_enable(struct omap_sr *sr)
17 unsigned long volt = voltdm_get_voltage(sr->voltdm);
19 if (!volt) {
20 pr_warn("%s: Curr voltage unknown. Cannot enable %s\n",
21 __func__, sr->name);
22 return -ENODATA;
25 omap_vp_enable(sr->voltdm);
26 return sr_enable(sr, volt);
29 static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
31 sr_disable_errgen(sr);
32 omap_vp_disable(sr->voltdm);
33 sr_disable(sr);
34 if (is_volt_reset)
35 voltdm_reset(sr->voltdm);
37 return 0;
40 static int sr_class3_configure(struct omap_sr *sr)
42 return sr_configure_errgen(sr);
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 omap_late_initcall(sr_class3_init);