sound/soc/qcom/qdsp6/q6dsp-common.c
Source file repositories/reference/linux-study-clean/sound/soc/qcom/qdsp6/q6dsp-common.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/qcom/qdsp6/q6dsp-common.c- Extension
.c- Size
- 2161 bytes
- Lines
- 104
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
Dependency Surface
q6dsp-common.hlinux/kernel.hlinux/module.hlinux/string.hlinux/errno.h
Detected Declarations
function q6dsp_map_channelsfunction q6dsp_get_channel_allocationexport q6dsp_map_channelsexport q6dsp_get_channel_allocation
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2011-2017, The Linux Foundation. All rights reserved.
// Copyright (c) 2018, Linaro Limited
#include "q6dsp-common.h"
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/errno.h>
int q6dsp_map_channels(u8 ch_map[PCM_MAX_NUM_CHANNEL], int ch)
{
memset(ch_map, 0, PCM_MAX_NUM_CHANNEL);
switch (ch) {
case 1:
ch_map[0] = PCM_CHANNEL_FC;
break;
case 2:
ch_map[0] = PCM_CHANNEL_FL;
ch_map[1] = PCM_CHANNEL_FR;
break;
case 3:
ch_map[0] = PCM_CHANNEL_FL;
ch_map[1] = PCM_CHANNEL_FR;
ch_map[2] = PCM_CHANNEL_FC;
break;
case 4:
ch_map[0] = PCM_CHANNEL_FL;
ch_map[1] = PCM_CHANNEL_FR;
ch_map[2] = PCM_CHANNEL_LS;
ch_map[3] = PCM_CHANNEL_RS;
break;
case 5:
ch_map[0] = PCM_CHANNEL_FL;
ch_map[1] = PCM_CHANNEL_FR;
ch_map[2] = PCM_CHANNEL_FC;
ch_map[3] = PCM_CHANNEL_LS;
ch_map[4] = PCM_CHANNEL_RS;
break;
case 6:
ch_map[0] = PCM_CHANNEL_FL;
ch_map[1] = PCM_CHANNEL_FR;
ch_map[2] = PCM_CHANNEL_LFE;
ch_map[3] = PCM_CHANNEL_FC;
ch_map[4] = PCM_CHANNEL_LS;
ch_map[5] = PCM_CHANNEL_RS;
break;
case 8:
ch_map[0] = PCM_CHANNEL_FL;
ch_map[1] = PCM_CHANNEL_FR;
ch_map[2] = PCM_CHANNEL_LFE;
ch_map[3] = PCM_CHANNEL_FC;
ch_map[4] = PCM_CHANNEL_LS;
ch_map[5] = PCM_CHANNEL_RS;
ch_map[6] = PCM_CHANNEL_LB;
ch_map[7] = PCM_CHANNEL_RB;
break;
default:
return -EINVAL;
}
return 0;
}
EXPORT_SYMBOL_GPL(q6dsp_map_channels);
int q6dsp_get_channel_allocation(int channels)
{
int channel_allocation;
/* HDMI spec CEA-861-E: Table 28 Audio InfoFrame Data Byte 4 */
switch (channels) {
case 2:
channel_allocation = 0;
break;
case 3:
channel_allocation = 0x02;
break;
case 4:
channel_allocation = 0x06;
break;
case 5:
channel_allocation = 0x0A;
break;
case 6:
channel_allocation = 0x0B;
break;
case 7:
channel_allocation = 0x12;
break;
Annotation
- Immediate include surface: `q6dsp-common.h`, `linux/kernel.h`, `linux/module.h`, `linux/string.h`, `linux/errno.h`.
- Detected declarations: `function q6dsp_map_channels`, `function q6dsp_get_channel_allocation`, `export q6dsp_map_channels`, `export q6dsp_get_channel_allocation`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.