sound/soc/ux500/ux500_msp_dai.c

Source file repositories/reference/linux-study-clean/sound/soc/ux500/ux500_msp_dai.c

File Facts

System
Linux kernel
Corpus path
sound/soc/ux500/ux500_msp_dai.c
Extension
.c
Size
21691 bytes
Lines
825
Domain
Driver Families
Bucket
sound/soc
Inferred role
Driver Families: implementation source
Status
source 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

switch (rate) {
		case 8000:
			prot_desc->frame_period =
				FRAME_PER_SINGLE_SLOT_8_KHZ;
			break;

		case 16000:
			prot_desc->frame_period =
				FRAME_PER_SINGLE_SLOT_16_KHZ;
			break;

		case 44100:
			prot_desc->frame_period =
				FRAME_PER_SINGLE_SLOT_44_1_KHZ;
			break;

		case 48000:
			prot_desc->frame_period =
				FRAME_PER_SINGLE_SLOT_48_KHZ;
			break;

		default:
			dev_err(dai->dev,
				"%s: Error: Unsupported sample-rate (freq = %d)!\n",
				__func__, rate);
			return -EINVAL;
		}
		break;

	case 2:
		prot_desc->frame_period = FRAME_PER_2_SLOTS;
		break;

	case 8:
		prot_desc->frame_period = FRAME_PER_8_SLOTS;
		break;

	case 16:
		prot_desc->frame_period = FRAME_PER_16_SLOTS;
		break;
	default:
		dev_err(dai->dev,
			"%s: Error: Unsupported slot-count (slots = %d)!\n",
			__func__, drvdata->slots);
		return -EINVAL;
	}

	prot_desc->clocks_per_frame =
			prot_desc->frame_period+1;

	dev_dbg(dai->dev, "%s: Clocks per frame: %u\n",
		__func__,
		prot_desc->clocks_per_frame);

	return 0;
}

static int setup_pcm_framing(struct snd_soc_dai *dai, unsigned int rate,
			struct msp_protdesc *prot_desc)
{
	struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(dai->dev);

	u32 frame_length = MSP_FRAME_LEN_1;

	prot_desc->frame_width = 0;

	switch (drvdata->slots) {
	case 1:
		frame_length = MSP_FRAME_LEN_1;
		break;

	case 2:
		frame_length = MSP_FRAME_LEN_2;
		break;

	case 8:
		frame_length = MSP_FRAME_LEN_8;
		break;

	case 16:
		frame_length = MSP_FRAME_LEN_16;
		break;
	default:
		dev_err(dai->dev,
			"%s: Error: Unsupported slot-count (slots = %d)!\n",
			__func__, drvdata->slots);
		return -EINVAL;
	}

	prot_desc->tx_frame_len_1 = frame_length;

Annotation

Implementation Notes