Lines Matching full:hba
42 struct ufs_hba *hba = dev_get_drvdata(dev); in ufs_sysfs_pm_lvl_store() local
43 struct ufs_dev_info *dev_info = &hba->dev_info; in ufs_sysfs_pm_lvl_store()
53 (!(hba->caps & UFSHCD_CAP_DEEPSLEEP) || in ufs_sysfs_pm_lvl_store()
57 spin_lock_irqsave(hba->host->host_lock, flags); in ufs_sysfs_pm_lvl_store()
59 hba->rpm_lvl = value; in ufs_sysfs_pm_lvl_store()
61 hba->spm_lvl = value; in ufs_sysfs_pm_lvl_store()
62 spin_unlock_irqrestore(hba->host->host_lock, flags); in ufs_sysfs_pm_lvl_store()
69 struct ufs_hba *hba = dev_get_drvdata(dev); in rpm_lvl_show() local
71 return sysfs_emit(buf, "%d\n", hba->rpm_lvl); in rpm_lvl_show()
83 struct ufs_hba *hba = dev_get_drvdata(dev); in rpm_target_dev_state_show() local
86 ufs_pm_lvl_states[hba->rpm_lvl].dev_state)); in rpm_target_dev_state_show()
92 struct ufs_hba *hba = dev_get_drvdata(dev); in rpm_target_link_state_show() local
95 ufs_pm_lvl_states[hba->rpm_lvl].link_state)); in rpm_target_link_state_show()
101 struct ufs_hba *hba = dev_get_drvdata(dev); in spm_lvl_show() local
103 return sysfs_emit(buf, "%d\n", hba->spm_lvl); in spm_lvl_show()
115 struct ufs_hba *hba = dev_get_drvdata(dev); in spm_target_dev_state_show() local
118 ufs_pm_lvl_states[hba->spm_lvl].dev_state)); in spm_target_dev_state_show()
124 struct ufs_hba *hba = dev_get_drvdata(dev); in spm_target_link_state_show() local
127 ufs_pm_lvl_states[hba->spm_lvl].link_state)); in spm_target_link_state_show()
159 struct ufs_hba *hba = dev_get_drvdata(dev); in auto_hibern8_show() local
161 if (!ufshcd_is_auto_hibern8_supported(hba)) in auto_hibern8_show()
164 down(&hba->host_sem); in auto_hibern8_show()
165 if (!ufshcd_is_user_access_allowed(hba)) { in auto_hibern8_show()
170 pm_runtime_get_sync(hba->dev); in auto_hibern8_show()
171 ufshcd_hold(hba, false); in auto_hibern8_show()
172 ahit = ufshcd_readl(hba, REG_AUTO_HIBERNATE_IDLE_TIMER); in auto_hibern8_show()
173 ufshcd_release(hba); in auto_hibern8_show()
174 pm_runtime_put_sync(hba->dev); in auto_hibern8_show()
179 up(&hba->host_sem); in auto_hibern8_show()
187 struct ufs_hba *hba = dev_get_drvdata(dev); in auto_hibern8_store() local
191 if (!ufshcd_is_auto_hibern8_supported(hba)) in auto_hibern8_store()
200 down(&hba->host_sem); in auto_hibern8_store()
201 if (!ufshcd_is_user_access_allowed(hba)) { in auto_hibern8_store()
206 ufshcd_auto_hibern8_update(hba, ufshcd_us_to_ahit(timer)); in auto_hibern8_store()
209 up(&hba->host_sem); in auto_hibern8_store()
216 struct ufs_hba *hba = dev_get_drvdata(dev); in wb_on_show() local
218 return sysfs_emit(buf, "%d\n", hba->dev_info.wb_enabled); in wb_on_show()
224 struct ufs_hba *hba = dev_get_drvdata(dev); in wb_on_store() local
228 if (!ufshcd_is_wb_allowed(hba) || (ufshcd_is_clkscaling_supported(hba) in wb_on_store()
229 && ufshcd_enable_wb_if_scaling_up(hba))) { in wb_on_store()
244 down(&hba->host_sem); in wb_on_store()
245 if (!ufshcd_is_user_access_allowed(hba)) { in wb_on_store()
250 ufshcd_rpm_get_sync(hba); in wb_on_store()
251 res = ufshcd_wb_toggle(hba, wb_enable); in wb_on_store()
252 ufshcd_rpm_put_sync(hba); in wb_on_store()
254 up(&hba->host_sem); in wb_on_store()
262 struct ufs_hba *hba = dev_get_drvdata(dev); in enable_wb_buf_flush_show() local
264 return sysfs_emit(buf, "%d\n", hba->dev_info.wb_buf_flush_enabled); in enable_wb_buf_flush_show()
271 struct ufs_hba *hba = dev_get_drvdata(dev); in enable_wb_buf_flush_store() local
275 if (!ufshcd_is_wb_buf_flush_allowed(hba)) { in enable_wb_buf_flush_store()
286 down(&hba->host_sem); in enable_wb_buf_flush_store()
287 if (!ufshcd_is_user_access_allowed(hba)) { in enable_wb_buf_flush_store()
292 ufshcd_rpm_get_sync(hba); in enable_wb_buf_flush_store()
293 res = ufshcd_wb_toggle_buf_flush(hba, enable_wb_buf_flush); in enable_wb_buf_flush_store()
294 ufshcd_rpm_put_sync(hba); in enable_wb_buf_flush_store()
297 up(&hba->host_sem); in enable_wb_buf_flush_store()
331 struct ufs_hba *hba = dev_get_drvdata(dev); in clock_scaling_show() local
333 return sysfs_emit(buf, "%d\n", ufshcd_is_clkscaling_supported(hba)); in clock_scaling_show()
339 struct ufs_hba *hba = dev_get_drvdata(dev); in write_booster_show() local
341 return sysfs_emit(buf, "%d\n", ufshcd_is_wb_allowed(hba)); in write_booster_show()
365 struct ufs_hba *hba = dev_get_drvdata(dev); in monitor_enable_show() local
367 return sysfs_emit(buf, "%d\n", hba->monitor.enabled); in monitor_enable_show()
374 struct ufs_hba *hba = dev_get_drvdata(dev); in monitor_enable_store() local
381 spin_lock_irqsave(hba->host->host_lock, flags); in monitor_enable_store()
382 if (value == hba->monitor.enabled) in monitor_enable_store()
386 memset(&hba->monitor, 0, sizeof(hba->monitor)); in monitor_enable_store()
388 hba->monitor.enabled = true; in monitor_enable_store()
389 hba->monitor.enabled_ts = ktime_get(); in monitor_enable_store()
393 spin_unlock_irqrestore(hba->host->host_lock, flags); in monitor_enable_store()
400 struct ufs_hba *hba = dev_get_drvdata(dev); in monitor_chunk_size_show() local
402 return sysfs_emit(buf, "%lu\n", hba->monitor.chunk_size); in monitor_chunk_size_show()
409 struct ufs_hba *hba = dev_get_drvdata(dev); in monitor_chunk_size_store() local
415 spin_lock_irqsave(hba->host->host_lock, flags); in monitor_chunk_size_store()
417 if (!hba->monitor.enabled) in monitor_chunk_size_store()
418 hba->monitor.chunk_size = value; in monitor_chunk_size_store()
419 spin_unlock_irqrestore(hba->host->host_lock, flags); in monitor_chunk_size_store()
426 struct ufs_hba *hba = dev_get_drvdata(dev); in read_total_sectors_show() local
428 return sysfs_emit(buf, "%lu\n", hba->monitor.nr_sec_rw[READ]); in read_total_sectors_show()
434 struct ufs_hba *hba = dev_get_drvdata(dev); in read_total_busy_show() local
437 ktime_to_us(hba->monitor.total_busy[READ])); in read_total_busy_show()
443 struct ufs_hba *hba = dev_get_drvdata(dev); in read_nr_requests_show() local
445 return sysfs_emit(buf, "%lu\n", hba->monitor.nr_req[READ]); in read_nr_requests_show()
452 struct ufs_hba *hba = dev_get_drvdata(dev); in read_req_latency_avg_show() local
453 struct ufs_hba_monitor *m = &hba->monitor; in read_req_latency_avg_show()
463 struct ufs_hba *hba = dev_get_drvdata(dev); in read_req_latency_max_show() local
466 ktime_to_us(hba->monitor.lat_max[READ])); in read_req_latency_max_show()
473 struct ufs_hba *hba = dev_get_drvdata(dev); in read_req_latency_min_show() local
476 ktime_to_us(hba->monitor.lat_min[READ])); in read_req_latency_min_show()
483 struct ufs_hba *hba = dev_get_drvdata(dev); in read_req_latency_sum_show() local
486 ktime_to_us(hba->monitor.lat_sum[READ])); in read_req_latency_sum_show()
493 struct ufs_hba *hba = dev_get_drvdata(dev); in write_total_sectors_show() local
495 return sysfs_emit(buf, "%lu\n", hba->monitor.nr_sec_rw[WRITE]); in write_total_sectors_show()
501 struct ufs_hba *hba = dev_get_drvdata(dev); in write_total_busy_show() local
504 ktime_to_us(hba->monitor.total_busy[WRITE])); in write_total_busy_show()
510 struct ufs_hba *hba = dev_get_drvdata(dev); in write_nr_requests_show() local
512 return sysfs_emit(buf, "%lu\n", hba->monitor.nr_req[WRITE]); in write_nr_requests_show()
519 struct ufs_hba *hba = dev_get_drvdata(dev); in write_req_latency_avg_show() local
520 struct ufs_hba_monitor *m = &hba->monitor; in write_req_latency_avg_show()
530 struct ufs_hba *hba = dev_get_drvdata(dev); in write_req_latency_max_show() local
533 ktime_to_us(hba->monitor.lat_max[WRITE])); in write_req_latency_max_show()
540 struct ufs_hba *hba = dev_get_drvdata(dev); in write_req_latency_min_show() local
543 ktime_to_us(hba->monitor.lat_min[WRITE])); in write_req_latency_min_show()
550 struct ufs_hba *hba = dev_get_drvdata(dev); in write_req_latency_sum_show() local
553 ktime_to_us(hba->monitor.lat_sum[WRITE])); in write_req_latency_sum_show()
598 static ssize_t ufs_sysfs_read_desc_param(struct ufs_hba *hba, in ufs_sysfs_read_desc_param() argument
611 down(&hba->host_sem); in ufs_sysfs_read_desc_param()
612 if (!ufshcd_is_user_access_allowed(hba)) { in ufs_sysfs_read_desc_param()
617 ufshcd_rpm_get_sync(hba); in ufs_sysfs_read_desc_param()
618 ret = ufshcd_read_desc_param(hba, desc_id, desc_index, in ufs_sysfs_read_desc_param()
620 ufshcd_rpm_put_sync(hba); in ufs_sysfs_read_desc_param()
645 up(&hba->host_sem); in ufs_sysfs_read_desc_param()
653 struct ufs_hba *hba = dev_get_drvdata(dev); \
654 return ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_##_duname, \
878 struct ufs_hba *hba = dev_get_drvdata(dev); \
879 return ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_POWER, 0, \
995 struct ufs_hba *hba = dev_get_drvdata(dev); \
1000 down(&hba->host_sem); \
1001 if (!ufshcd_is_user_access_allowed(hba)) { \
1002 up(&hba->host_sem); \
1007 up(&hba->host_sem); \
1010 ufshcd_rpm_get_sync(hba); \
1011 ret = ufshcd_query_descriptor_retry(hba, \
1021 ret = ufshcd_read_string_desc(hba, index, &desc_buf, \
1027 ufshcd_rpm_put_sync(hba); \
1029 up(&hba->host_sem); \
1067 struct ufs_hba *hba = dev_get_drvdata(dev); \
1069 down(&hba->host_sem); \
1070 if (!ufshcd_is_user_access_allowed(hba)) { \
1071 up(&hba->host_sem); \
1075 index = ufshcd_wb_get_query_index(hba); \
1076 ufshcd_rpm_get_sync(hba); \
1077 ret = ufshcd_query_flag(hba, UPIU_QUERY_OPCODE_READ_FLAG, \
1079 ufshcd_rpm_put_sync(hba); \
1086 up(&hba->host_sem); \
1135 struct ufs_hba *hba = dev_get_drvdata(dev); \
1140 down(&hba->host_sem); \
1141 if (!ufshcd_is_user_access_allowed(hba)) { \
1142 up(&hba->host_sem); \
1146 index = ufshcd_wb_get_query_index(hba); \
1147 ufshcd_rpm_get_sync(hba); \
1148 ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, \
1150 ufshcd_rpm_put_sync(hba); \
1157 up(&hba->host_sem); \
1235 struct ufs_hba *hba = shost_priv(sdev->host); \
1237 if (!ufs_is_valid_unit_desc_lun(&hba->dev_info, lun, \
1240 return ufs_sysfs_read_desc_param(hba, QUERY_DESC_IDN_##_duname, \
1299 struct ufs_hba *hba = shost_priv(sdev->host); in dyn_cap_needed_attribute_show() local
1303 down(&hba->host_sem); in dyn_cap_needed_attribute_show()
1304 if (!ufshcd_is_user_access_allowed(hba)) { in dyn_cap_needed_attribute_show()
1309 ufshcd_rpm_get_sync(hba); in dyn_cap_needed_attribute_show()
1310 ret = ufshcd_query_attr(hba, UPIU_QUERY_OPCODE_READ_ATTR, in dyn_cap_needed_attribute_show()
1312 ufshcd_rpm_put_sync(hba); in dyn_cap_needed_attribute_show()
1321 up(&hba->host_sem); in dyn_cap_needed_attribute_show()