Linux Audio

Check our new training course

In-person Linux kernel drivers training

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