Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0-only
0002 /*
0003  * Smart reflex Class 3 specific implementations
0004  *
0005  * Author: Thara Gopinath       <thara@ti.com>
0006  *
0007  * Copyright (C) 2010 Texas Instruments, Inc.
0008  * Thara Gopinath <thara@ti.com>
0009  */
0010 
0011 #include <linux/power/smartreflex.h>
0012 #include "soc.h"
0013 #include "voltage.h"
0014 
0015 static int sr_class3_enable(struct omap_sr *sr)
0016 {
0017     unsigned long volt = voltdm_get_voltage(sr->voltdm);
0018 
0019     if (!volt) {
0020         pr_warn("%s: Curr voltage unknown. Cannot enable %s\n",
0021             __func__, sr->name);
0022         return -ENODATA;
0023     }
0024 
0025     omap_vp_enable(sr->voltdm);
0026     return sr_enable(sr, volt);
0027 }
0028 
0029 static int sr_class3_disable(struct omap_sr *sr, int is_volt_reset)
0030 {
0031     sr_disable_errgen(sr);
0032     omap_vp_disable(sr->voltdm);
0033     sr_disable(sr);
0034     if (is_volt_reset)
0035         voltdm_reset(sr->voltdm);
0036 
0037     return 0;
0038 }
0039 
0040 static int sr_class3_configure(struct omap_sr *sr)
0041 {
0042     return sr_configure_errgen(sr);
0043 }
0044 
0045 /* SR class3 structure */
0046 static struct omap_sr_class_data class3_data = {
0047     .enable = sr_class3_enable,
0048     .disable = sr_class3_disable,
0049     .configure = sr_class3_configure,
0050     .class_type = SR_CLASS3,
0051 };
0052 
0053 /* Smartreflex Class3 init API to be called from board file */
0054 static int __init sr_class3_init(void)
0055 {
0056     pr_info("SmartReflex Class3 initialized\n");
0057     return sr_register_class(&class3_data);
0058 }
0059 omap_late_initcall(sr_class3_init);