+static ssize_t
+rockchip_ion_debug_write(struct file *filp, const char __user *ubuf, size_t cnt,
+ loff_t *ppos)
+{
+ char buf[64];
+
+ if (copy_from_user(buf, ubuf, cnt>63?63:cnt)) {
+ return -EFAULT;
+ }
+ buf[cnt] = '\0';
+ ion_trace_lvl = simple_strtol(buf, NULL, 10);
+ *ppos += cnt;
+ return cnt;
+}
+
+static ssize_t
+rockchip_ion_debug_read(struct file *filp, char __user *ubuf, size_t cnt,
+ loff_t *ppos)
+{
+ int r;
+ char buf[64];
+
+ if (*ppos)
+ return 0;
+
+ snprintf(buf, 63, "%d\n", ion_trace_lvl);
+ r = simple_read_from_buffer(ubuf, cnt, ppos, buf, strlen(buf));
+
+ return r;
+}
+
+static const struct file_operations rockchip_ion_debug_fops = {
+ .read = rockchip_ion_debug_read,
+ .write = rockchip_ion_debug_write,
+};
+