Lines Matching refs:hba
41 struct ufs_hba *hba = dev_get_drvdata(dev); in ufs_sysfs_pm_lvl_store() local
42 struct ufs_dev_info *dev_info = &hba->dev_info; in ufs_sysfs_pm_lvl_store()
52 (!(hba->caps & UFSHCD_CAP_DEEPSLEEP) || in ufs_sysfs_pm_lvl_store()
56 spin_lock_irqsave(hba->host->host_lock, flags); in ufs_sysfs_pm_lvl_store()
58 hba->rpm_lvl = value; in ufs_sysfs_pm_lvl_store()
60 hba->spm_lvl = value; in ufs_sysfs_pm_lvl_store()
61 spin_unlock_irqrestore(hba->host->host_lock, flags); in ufs_sysfs_pm_lvl_store()
68 struct ufs_hba *hba = dev_get_drvdata(dev); in rpm_lvl_show() local
70 return sysfs_emit(buf, "%d\n", hba->rpm_lvl); in rpm_lvl_show()
82 struct ufs_hba *hba = dev_get_drvdata(dev); in rpm_target_dev_state_show() local
85 ufs_pm_lvl_states[hba->rpm_lvl].dev_state)); in rpm_target_dev_state_show()
91 struct ufs_hba *hba = dev_get_drvdata(dev); in rpm_target_link_state_show() local
94 ufs_pm_lvl_states[hba->rpm_lvl].link_state)); in rpm_target_link_state_show()
100 struct ufs_hba *hba = dev_get_drvdata(dev); in spm_lvl_show() local
102 return sysfs_emit(buf, "%d\n", hba->spm_lvl); in spm_lvl_show()
114 struct ufs_hba *hba = dev_get_drvdata(dev); in spm_target_dev_state_show() local
117 ufs_pm_lvl_states[hba->spm_lvl].dev_state)); in spm_target_dev_state_show()
123 struct ufs_hba *hba = dev_get_drvdata(dev); in spm_target_link_state_show() local
126 ufs_pm_lvl_states[hba->spm_lvl].link_state)); in spm_target_link_state_show()
158 struct ufs_hba *hba = dev_get_drvdata(dev); in auto_hibern8_show() local
160 if (!ufshcd_is_auto_hibern8_supported(hba)) in auto_hibern8_show()
163 down(&hba->host_sem); in auto_hibern8_show()
164 if (!ufshcd_is_user_access_allowed(hba)) { in auto_hibern8_show()
169 pm_runtime_get_sync(hba->dev); in auto_hibern8_show()
170 ufshcd_hold(hba, false); in auto_hibern8_show()
171 ahit = ufshcd_readl(hba, REG_AUTO_HIBERNATE_IDLE_TIMER); in auto_hibern8_show()
172 ufshcd_release(hba); in auto_hibern8_show()
173 pm_runtime_put_sync(hba->dev); in auto_hibern8_show()
178 up(&hba->host_sem); in auto_hibern8_show()
186 struct ufs_hba *hba = dev_get_drvdata(dev); in auto_hibern8_store() local
190 if (!ufshcd_is_auto_hibern8_supported(hba)) in auto_hibern8_store()
199 down(&hba->host_sem); in auto_hibern8_store()
200 if (!ufshcd_is_user_access_allowed(hba)) { in auto_hibern8_store()
205 ufshcd_auto_hibern8_update(hba, ufshcd_us_to_ahit(timer)); in auto_hibern8_store()
208 up(&hba->host_sem); in auto_hibern8_store()
215 struct ufs_hba *hba = dev_get_drvdata(dev); in wb_on_show() local
217 return sysfs_emit(buf, "%d\n", hba->dev_info.wb_enabled); in wb_on_show()
223 struct ufs_hba *hba = dev_get_drvdata(dev); in wb_on_store() local
227 if (!ufshcd_is_wb_allowed(hba) || ufshcd_is_clkscaling_supported(hba)) { in wb_on_store()
242 down(&hba->host_sem); in wb_on_store()
243 if (!ufshcd_is_user_access_allowed(hba)) { in wb_on_store()
248 ufshcd_rpm_get_sync(hba); in wb_on_store()
249 res = ufshcd_wb_toggle(hba, wb_enable); in wb_on_store()
250 ufshcd_rpm_put_sync(hba); in wb_on_store()
252 up(&hba->host_sem); in wb_on_store()
284 struct ufs_hba *hba = dev_get_drvdata(dev); in monitor_enable_show() local
286 return sysfs_emit(buf, "%d\n", hba->monitor.enabled); in monitor_enable_show()
293 struct ufs_hba *hba = dev_get_drvdata(dev); in monitor_enable_store() local
300 spin_lock_irqsave(hba->host->host_lock, flags); in monitor_enable_store()
301 if (value == hba->monitor.enabled) in monitor_enable_store()
305 memset(&hba->monitor, 0, sizeof(hba->monitor)); in monitor_enable_store()
307 hba->monitor.enabled = true; in monitor_enable_store()
308 hba->monitor.enabled_ts = ktime_get(); in monitor_enable_store()
312 spin_unlock_irqrestore(hba->host->host_lock, flags); in monitor_enable_store()
319 struct ufs_hba *hba = dev_get_drvdata(dev); in monitor_chunk_size_show() local
321 return sysfs_emit(buf, "%lu\n", hba->monitor.chunk_size); in monitor_chunk_size_show()
328 struct ufs_hba *hba = dev_get_drvdata(dev); in monitor_chunk_size_store() local
334 spin_lock_irqsave(hba->host->host_lock, flags); in monitor_chunk_size_store()
336 if (!hba->monitor.enabled) in monitor_chunk_size_store()
337 hba->monitor.chunk_size = value; in monitor_chunk_size_store()
338 spin_unlock_irqrestore(hba->host->host_lock, flags); in monitor_chunk_size_store()
345 struct ufs_hba *hba = dev_get_drvdata(dev); in read_total_sectors_show() local
347 return sysfs_emit(buf, "%lu\n", hba->monitor.nr_sec_rw[READ]); in read_total_sectors_show()
353 struct ufs_hba *hba = dev_get_drvdata(dev); in read_total_busy_show() local
356 ktime_to_us(hba->monitor.total_busy[READ])); in read_total_busy_show()
362 struct ufs_hba *hba = dev_get_drvdata(dev); in read_nr_requests_show() local
364 return sysfs_emit(buf, "%lu\n", hba->monitor.nr_req[READ]); in read_nr_requests_show()
371 struct ufs_hba *hba = dev_get_drvdata(dev); in read_req_latency_avg_show() local
372 struct ufs_hba_monitor *m = &hba->monitor; in read_req_latency_avg_show()
382 struct ufs_hba *hba = dev_get_drvdata(dev); in read_req_latency_max_show() local
385 ktime_to_us(hba->monitor.lat_max[READ])); in read_req_latency_max_show()
392 struct ufs_hba *hba = dev_get_drvdata(dev); in read_req_latency_min_show() local
395 ktime_to_us(hba->monitor.lat_min[READ])); in read_req_latency_min_show()
402 struct ufs_hba *hba = dev_get_drvdata(dev); in read_req_latency_sum_show() local
405 ktime_to_us(hba->monitor.lat_sum[READ])); in read_req_latency_sum_show()
412 struct ufs_hba *hba = dev_get_drvdata(dev); in write_total_sectors_show() local
414 return sysfs_emit(buf, "%lu\n", hba->monitor.nr_sec_rw[WRITE]); in write_total_sectors_show()
420 struct ufs_hba *hba = dev_get_drvdata(dev); in write_total_busy_show() local
423 ktime_to_us(hba->monitor.total_busy[WRITE])); in write_total_busy_show()
429 struct ufs_hba *hba = dev_get_drvdata(dev); in write_nr_requests_show() local
431 return sysfs_emit(buf, "%lu\n", hba->monitor.nr_req[WRITE]); in write_nr_requests_show()
438 struct ufs_hba *hba = dev_get_drvdata(dev); in write_req_latency_avg_show() local
439 struct ufs_hba_monitor *m = &hba->monitor; in write_req_latency_avg_show()
449 struct ufs_hba *hba = dev_get_drvdata(dev); in write_req_latency_max_show() local
452 ktime_to_us(hba->monitor.lat_max[WRITE])); in write_req_latency_max_show()
459 struct ufs_hba *hba = dev_get_drvdata(dev); in write_req_latency_min_show() local
462 ktime_to_us(hba->monitor.lat_min[WRITE])); in write_req_latency_min_show()
469 struct ufs_hba *hba = dev_get_drvdata(dev); in write_req_latency_sum_show() local
472 ktime_to_us(hba->monitor.lat_sum[WRITE])); in write_req_latency_sum_show()
517 static ssize_t ufs_sysfs_read_desc_param(struct ufs_hba *hba, in ufs_sysfs_read_desc_param() argument
530 down(&hba->host_sem); in ufs_sysfs_read_desc_param()
531 if (!ufshcd_is_user_access_allowed(hba)) { in ufs_sysfs_read_desc_param()
536 ufshcd_rpm_get_sync(hba); in ufs_sysfs_read_desc_param()
537 ret = ufshcd_read_desc_param(hba, desc_id, desc_index, in ufs_sysfs_read_desc_param()
539 ufshcd_rpm_put_sync(hba); in ufs_sysfs_read_desc_param()
564 up(&hba->host_sem); in ufs_sysfs_read_desc_param()
572 struct ufs_hba *hba = dev_get_drvdata(dev); \
573 return ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_##_duname, \
797 struct ufs_hba *hba = dev_get_drvdata(dev); \
798 return ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_POWER, 0, \
914 struct ufs_hba *hba = dev_get_drvdata(dev); \
919 down(&hba->host_sem); \
920 if (!ufshcd_is_user_access_allowed(hba)) { \
921 up(&hba->host_sem); \
926 up(&hba->host_sem); \
929 ufshcd_rpm_get_sync(hba); \
930 ret = ufshcd_query_descriptor_retry(hba, \
940 ret = ufshcd_read_string_desc(hba, index, &desc_buf, \
946 ufshcd_rpm_put_sync(hba); \
948 up(&hba->host_sem); \
986 struct ufs_hba *hba = dev_get_drvdata(dev); \
988 down(&hba->host_sem); \
989 if (!ufshcd_is_user_access_allowed(hba)) { \
990 up(&hba->host_sem); \
994 index = ufshcd_wb_get_query_index(hba); \
995 ufshcd_rpm_get_sync(hba); \
996 ret = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG, \
998 ufshcd_rpm_put_sync(hba); \
1005 up(&hba->host_sem); \
1054 struct ufs_hba *hba = dev_get_drvdata(dev); \
1059 down(&hba->host_sem); \
1060 if (!ufshcd_is_user_access_allowed(hba)) { \
1061 up(&hba->host_sem); \
1065 index = ufshcd_wb_get_query_index(hba); \
1066 ufshcd_rpm_get_sync(hba); \
1067 ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, \
1069 ufshcd_rpm_put_sync(hba); \
1076 up(&hba->host_sem); \
1153 struct ufs_hba *hba = shost_priv(sdev->host); \
1155 if (!ufs_is_valid_unit_desc_lun(&hba->dev_info, lun, \
1158 return ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_##_duname, \
1217 struct ufs_hba *hba = shost_priv(sdev->host); in dyn_cap_needed_attribute_show() local
1221 down(&hba->host_sem); in dyn_cap_needed_attribute_show()
1222 if (!ufshcd_is_user_access_allowed(hba)) { in dyn_cap_needed_attribute_show()
1227 ufshcd_rpm_get_sync(hba); in dyn_cap_needed_attribute_show()
1228 ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, in dyn_cap_needed_attribute_show()
1230 ufshcd_rpm_put_sync(hba); in dyn_cap_needed_attribute_show()
1239 up(&hba->host_sem); in dyn_cap_needed_attribute_show()