drivers/gpu/drm/msm/dp/dp_audio.c

Source file repositories/reference/linux-study-clean/drivers/gpu/drm/msm/dp/dp_audio.c

File Facts

System
Linux kernel
Corpus path
drivers/gpu/drm/msm/dp/dp_audio.c
Extension
.c
Size
9118 bytes
Lines
380
Domain
Driver Families
Bucket
drivers/gpu
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

struct msm_dp_audio_private {
	struct platform_device *pdev;
	struct drm_device *drm_dev;
	void __iomem *link_base;

	u32 channels;

	struct msm_dp_audio msm_dp_audio;
};

static inline u32 msm_dp_read_link(struct msm_dp_audio_private *audio, u32 offset)
{
	return readl_relaxed(audio->link_base + offset);
}

static inline void msm_dp_write_link(struct msm_dp_audio_private *audio,
			       u32 offset, u32 data)
{
	/*
	 * To make sure link reg writes happens before any other operation,
	 * this function uses writel() instread of writel_relaxed()
	 */
	writel(data, audio->link_base + offset);
}

static void msm_dp_audio_stream_sdp(struct msm_dp_audio_private *audio)
{
	struct dp_sdp_header sdp_hdr = {
		.HB0 = 0x00,
		.HB1 = 0x02,
		.HB2 = 0x00,
		.HB3 = audio->channels - 1,
	};
	u32 header[2];

	msm_dp_utils_pack_sdp_header(&sdp_hdr, header);

	msm_dp_write_link(audio, MMSS_DP_AUDIO_STREAM_0, header[0]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_STREAM_1, header[1]);
}

static void msm_dp_audio_timestamp_sdp(struct msm_dp_audio_private *audio)
{
	struct dp_sdp_header sdp_hdr = {
		.HB0 = 0x00,
		.HB1 = 0x01,
		.HB2 = 0x17,
		.HB3 = 0x0 | (0x11 << 2),
	};
	u32 header[2];

	msm_dp_utils_pack_sdp_header(&sdp_hdr, header);

	msm_dp_write_link(audio, MMSS_DP_AUDIO_TIMESTAMP_0, header[0]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_TIMESTAMP_1, header[1]);
}

static void msm_dp_audio_infoframe_sdp(struct msm_dp_audio_private *audio)
{
	struct dp_sdp_header sdp_hdr = {
		.HB0 = 0x00,
		.HB1 = 0x84,
		.HB2 = 0x1b,
		.HB3 = 0x0 | (0x11 << 2),
	};
	u32 header[2];

	msm_dp_utils_pack_sdp_header(&sdp_hdr, header);

	msm_dp_write_link(audio, MMSS_DP_AUDIO_INFOFRAME_0, header[0]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_INFOFRAME_1, header[1]);
}

static void msm_dp_audio_copy_management_sdp(struct msm_dp_audio_private *audio)
{
	struct dp_sdp_header sdp_hdr = {
		.HB0 = 0x00,
		.HB1 = 0x05,
		.HB2 = 0x0f,
		.HB3 = 0x00,
	};
	u32 header[2];

	msm_dp_utils_pack_sdp_header(&sdp_hdr, header);

	msm_dp_write_link(audio, MMSS_DP_AUDIO_COPYMANAGEMENT_0, header[0]);
	msm_dp_write_link(audio, MMSS_DP_AUDIO_COPYMANAGEMENT_1, header[1]);
}

static void msm_dp_audio_isrc_sdp(struct msm_dp_audio_private *audio)

Annotation

Implementation Notes