Lines Matching +full:auto +full:- +full:pm

1 // SPDX-License-Identifier: GPL-2.0
6 #include "ufs-debugfs.h"
8 #include "ufshcd-priv.h"
18 /* @file corresponds to a debugfs attribute in directory hba->debugfs_root. */
21 return d_inode(file->f_path.dentry->d_parent)->i_private; in hba_from_file()
36 struct ufs_hba *hba = hba_from_file(s->file); in ufs_debugfs_stats_show()
37 struct ufs_event_hist *e = hba->ufs_stats.event; in ufs_debugfs_stats_show()
47 PRT("Auto-hibernate errors: %llu\n", AUTO_HIBERN8_ERR); in ufs_debugfs_stats_show()
50 PRT("PM Resume errors: %llu\n", RESUME_ERR); in ufs_debugfs_stats_show()
51 PRT("PM Suspend errors : %llu\n", SUSPEND_ERR); in ufs_debugfs_stats_show()
64 *val = hba->ee_usr_mask; in ee_usr_mask_get()
69 __acquires(&hba->host_sem) in ufs_debugfs_get_user_access()
71 down(&hba->host_sem); in ufs_debugfs_get_user_access()
73 up(&hba->host_sem); in ufs_debugfs_get_user_access()
74 return -EBUSY; in ufs_debugfs_get_user_access()
81 __releases(&hba->host_sem) in ufs_debugfs_put_user_access()
84 up(&hba->host_sem); in ufs_debugfs_put_user_access()
93 return -EINVAL; in ee_usr_mask_set()
110 if (!hba->debugfs_ee_rate_limit_ms || !status) in ufs_debugfs_exception_event()
113 mutex_lock(&hba->ee_ctrl_mutex); in ufs_debugfs_exception_event()
114 ee_ctrl_mask = hba->ee_drv_mask | (hba->ee_usr_mask & ~status); in ufs_debugfs_exception_event()
115 chgd = ee_ctrl_mask != hba->ee_ctrl_mask; in ufs_debugfs_exception_event()
119 dev_err(hba->dev, "%s: failed to write ee control %d\n", in ufs_debugfs_exception_event()
122 mutex_unlock(&hba->ee_ctrl_mutex); in ufs_debugfs_exception_event()
125 unsigned long delay = msecs_to_jiffies(hba->debugfs_ee_rate_limit_ms); in ufs_debugfs_exception_event()
127 queue_delayed_work(system_freezable_wq, &hba->debugfs_ee_work, delay); in ufs_debugfs_exception_event()
135 if (!hba->ee_usr_mask || pm_runtime_suspended(hba->dev) || in ufs_debugfs_restart_ee()
144 struct ufs_debugfs_attr *attr = s->private; in ufs_saved_err_show()
145 struct ufs_hba *hba = hba_from_file(s->file); in ufs_saved_err_show()
148 if (strcmp(attr->name, "saved_err") == 0) { in ufs_saved_err_show()
149 p = &hba->saved_err; in ufs_saved_err_show()
150 } else if (strcmp(attr->name, "saved_uic_err") == 0) { in ufs_saved_err_show()
151 p = &hba->saved_uic_err; in ufs_saved_err_show()
153 return -ENOENT; in ufs_saved_err_show()
163 struct ufs_debugfs_attr *attr = file->f_inode->i_private; in ufs_saved_err_write()
169 return -EINVAL; in ufs_saved_err_write()
171 return -EFAULT; in ufs_saved_err_write()
176 spin_lock_irq(hba->host->host_lock); in ufs_saved_err_write()
177 if (strcmp(attr->name, "saved_err") == 0) { in ufs_saved_err_write()
178 hba->saved_err = val; in ufs_saved_err_write()
179 } else if (strcmp(attr->name, "saved_uic_err") == 0) { in ufs_saved_err_write()
180 hba->saved_uic_err = val; in ufs_saved_err_write()
182 ret = -ENOENT; in ufs_saved_err_write()
186 spin_unlock_irq(hba->host->host_lock); in ufs_saved_err_write()
193 return single_open(file, ufs_saved_err_show, inode->i_private); in ufs_saved_err_open()
218 hba->debugfs_ee_rate_limit_ms = 20; in ufs_debugfs_hba_init()
219 INIT_DELAYED_WORK(&hba->debugfs_ee_work, ufs_debugfs_restart_ee); in ufs_debugfs_hba_init()
221 root = debugfs_create_dir(dev_name(hba->dev), ufs_debugfs_root); in ufs_debugfs_hba_init()
224 hba->debugfs_root = root; in ufs_debugfs_hba_init()
225 d_inode(root)->i_private = hba; in ufs_debugfs_hba_init()
226 for (attr = ufs_attrs; attr->name; attr++) in ufs_debugfs_hba_init()
227 debugfs_create_file(attr->name, attr->mode, root, (void *)attr, in ufs_debugfs_hba_init()
228 attr->fops); in ufs_debugfs_hba_init()
229 debugfs_create_file("exception_event_mask", 0600, hba->debugfs_root, in ufs_debugfs_hba_init()
231 debugfs_create_u32("exception_event_rate_limit_ms", 0600, hba->debugfs_root, in ufs_debugfs_hba_init()
232 &hba->debugfs_ee_rate_limit_ms); in ufs_debugfs_hba_init()
237 debugfs_remove_recursive(hba->debugfs_root); in ufs_debugfs_hba_exit()
238 cancel_delayed_work_sync(&hba->debugfs_ee_work); in ufs_debugfs_hba_exit()