Il 28/04/21 08:54, Roger Lu ha scritto:
The purpose of SVS is to help find the suitable voltages
for DVFS. Therefore, if SVS bank voltages are concerned
to be wrong, we can adjust SVS bank voltages by this patch.
Signed-off-by: Roger Lu <roger.lu@xxxxxxxxxxxx>
---
drivers/soc/mediatek/mtk-svs.c | 328 +++++++++++++++++++++++++++++++++
1 file changed, 328 insertions(+)
diff --git a/drivers/soc/mediatek/mtk-svs.c b/drivers/soc/mediatek/mtk-svs.c
index 2d2153c92373..8794a2d87baa 100644
--- a/drivers/soc/mediatek/mtk-svs.c
+++ b/drivers/soc/mediatek/mtk-svs.c
@@ -6,6 +6,7 @@
#include <linux/bits.h>
#include <linux/clk.h>
#include <linux/completion.h>
+#include <linux/debugfs.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/interrupt.h>
@@ -24,6 +25,7 @@
#include <linux/pm_runtime.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
+#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/thermal.h>
@@ -62,6 +64,39 @@
#define SVSB_INTSTS_COMPLETE 0x1
#define SVSB_INTSTS_CLEAN 0x00ffffff
+#define debug_fops_ro(name) \
+ static int svs_##name##_debug_open(struct inode *inode, \
+ struct file *filp) \
+ { \
+ return single_open(filp, svs_##name##_debug_show, \
+ inode->i_private); \
+ } \
+ static const struct file_operations svs_##name##_debug_fops = { \
+ .owner = THIS_MODULE, \
+ .open = svs_##name##_debug_open, \
+ .read = seq_read, \
+ .llseek = seq_lseek, \
+ .release = single_release, \
+ }
+
+#define debug_fops_rw(name) \
+ static int svs_##name##_debug_open(struct inode *inode, \
+ struct file *filp) \
+ { \
+ return single_open(filp, svs_##name##_debug_show, \
+ inode->i_private); \
+ } \
+ static const struct file_operations svs_##name##_debug_fops = { \
+ .owner = THIS_MODULE, \
+ .open = svs_##name##_debug_open, \
+ .read = seq_read, \
+ .write = svs_##name##_debug_write, \
+ .llseek = seq_lseek, \
+ .release = single_release, \
+ }
+
+#define svs_dentry(name) {__stringify(name), &svs_##name##_debug_fops}
+
static DEFINE_SPINLOCK(mtk_svs_lock);
/*
@@ -83,6 +118,7 @@ enum svsb_phase {
SVSB_PHASE_INIT01,
SVSB_PHASE_INIT02,
SVSB_PHASE_MON,
+ SVSB_PHASE_NUM,
I would move the addition of these last members in the previous (3/7) patch,
where you introduce the driver in the first place.
Also, I think that using _MAX instead would be better, as it is pretty
much a common practice. So, this would become SVSB_PHASE_MAX.
};
enum svs_reg_index {
@@ -140,6 +176,7 @@ enum svs_reg_index {
SPARE2,
SPARE3,
THSLPEVEB,
+ SVS_REG_NUM,
... and this would become SVS_REG_MAX
};
static const u32 svs_regs_v2[] = {
Apart from that,
Acked-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>