drivers/ufs/core/ufs-sysfs.c

Source file repositories/reference/linux-study-clean/drivers/ufs/core/ufs-sysfs.c

File Facts

System
Linux kernel
Corpus path
drivers/ufs/core/ufs-sysfs.c
Extension
.c
Size
63114 bytes
Lines
2164
Domain
Driver Families
Bucket
drivers/ufs
Inferred role
Driver Families: exported/initcall integration point
Status
integration implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

// SPDX-License-Identifier: GPL-2.0
// Copyright (C) 2018 Western Digital Corporation

#include <linux/err.h>
#include <linux/string.h>
#include <linux/bitfield.h>
#include <linux/unaligned.h>
#include <linux/string_choices.h>

#include <ufs/ufs.h>
#include <ufs/unipro.h>
#include "ufs-sysfs.h"
#include "ufshcd-priv.h"

static const char *ufs_pa_pwr_mode_to_string(enum ufs_pa_pwr_mode mode)
{
	switch (mode) {
	case FAST_MODE:		return "FAST_MODE";
	case SLOW_MODE:		return "SLOW_MODE";
	case FASTAUTO_MODE:	return "FASTAUTO_MODE";
	case SLOWAUTO_MODE:	return "SLOWAUTO_MODE";
	default:		return "UNKNOWN";
	}
}

static const char *ufs_hs_gear_rate_to_string(enum ufs_hs_gear_rate rate)
{
	switch (rate) {
	case PA_HS_MODE_A:	return "HS_RATE_A";
	case PA_HS_MODE_B:	return "HS_RATE_B";
	default:		return "UNKNOWN";
	}
}

static const char *ufs_pwm_gear_to_string(enum ufs_pwm_gear_tag gear)
{
	switch (gear) {
	case UFS_PWM_G1:	return "PWM_GEAR1";
	case UFS_PWM_G2:	return "PWM_GEAR2";
	case UFS_PWM_G3:	return "PWM_GEAR3";
	case UFS_PWM_G4:	return "PWM_GEAR4";
	case UFS_PWM_G5:	return "PWM_GEAR5";
	case UFS_PWM_G6:	return "PWM_GEAR6";
	case UFS_PWM_G7:	return "PWM_GEAR7";
	default:		return "UNKNOWN";
	}
}

static const char *ufs_hs_gear_to_string(enum ufs_hs_gear_tag gear)
{
	switch (gear) {
	case UFS_HS_G1:	return "HS_GEAR1";
	case UFS_HS_G2:	return "HS_GEAR2";
	case UFS_HS_G3:	return "HS_GEAR3";
	case UFS_HS_G4:	return "HS_GEAR4";
	case UFS_HS_G5:	return "HS_GEAR5";
	default:	return "UNKNOWN";
	}
}

static const char *ufs_wb_resize_hint_to_string(enum wb_resize_hint hint)
{
	switch (hint) {
	case WB_RESIZE_HINT_KEEP:
		return "keep";
	case WB_RESIZE_HINT_DECREASE:
		return "decrease";
	case WB_RESIZE_HINT_INCREASE:
		return "increase";
	default:
		return "unknown";
	}
}

static const char *ufs_wb_resize_status_to_string(enum wb_resize_status status)
{
	switch (status) {
	case WB_RESIZE_STATUS_IDLE:
		return "idle";
	case WB_RESIZE_STATUS_IN_PROGRESS:
		return "in_progress";
	case WB_RESIZE_STATUS_COMPLETE_SUCCESS:
		return "complete_success";
	case WB_RESIZE_STATUS_GENERAL_FAILURE:
		return "general_failure";
	default:
		return "unknown";
	}
}

Annotation

Implementation Notes