sound/soc/sdca/sdca_jack.c
Source file repositories/reference/linux-study-clean/sound/soc/sdca/sdca_jack.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sdca/sdca_jack.c- Extension
.c- Size
- 7048 bytes
- Lines
- 263
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cleanup.hlinux/device.hlinux/dev_printk.hlinux/soundwire/sdw.hlinux/soundwire/sdw_registers.hlinux/sprintf.hlinux/regmap.hlinux/rwsem.hsound/asound.hsound/control.hsound/jack.hsound/sdca.hsound/sdca_function.hsound/sdca_interrupts.hsound/sdca_jack.hsound/soc-component.hsound/soc-jack.hsound/soc.h
Detected Declarations
function sdca_jack_processfunction sdca_jack_alloc_statefunction type_get_maskfunction sdca_jack_set_jackfunction sdca_jack_report
Annotated Snippet
if (ret) {
dev_err(dev, "failed to re-check selected mode: %d\n", ret);
return ret;
}
break;
default:
break;
}
dev_dbg(dev, "%s: %#x\n", interrupt->name, val);
if (kctl) {
struct soc_enum *soc_enum = (struct soc_enum *)kctl->private_value;
ucontrol = kzalloc_obj(*ucontrol);
if (!ucontrol)
return -ENOMEM;
ucontrol->value.enumerated.item[0] = snd_soc_enum_val_to_item(soc_enum, val);
ret = snd_soc_dapm_put_enum_double(kctl, ucontrol);
if (ret < 0) {
dev_err(dev, "failed to update selected mode: %d\n", ret);
return ret;
}
snd_ctl_notify(card->snd_card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
} else {
ret = regmap_write(interrupt->function_regmap, reg, val);
if (ret) {
dev_err(dev, "failed to write selected mode: %d\n", ret);
return ret;
}
}
return sdca_jack_report(interrupt);
}
EXPORT_SYMBOL_NS_GPL(sdca_jack_process, "SND_SOC_SDCA");
/**
* sdca_jack_alloc_state - allocate state for a jack interrupt
* @interrupt: SDCA interrupt structure.
*
* Return: Zero on success or a negative error code.
*/
int sdca_jack_alloc_state(struct sdca_interrupt *interrupt)
{
struct device *dev = interrupt->dev;
struct jack_state *jack_state;
jack_state = devm_kzalloc(dev, sizeof(*jack_state), GFP_KERNEL);
if (!jack_state)
return -ENOMEM;
interrupt->priv = jack_state;
return 0;
}
EXPORT_SYMBOL_NS_GPL(sdca_jack_alloc_state, "SND_SOC_SDCA");
static int type_get_mask(enum sdca_terminal_type type)
{
switch (type) {
case SDCA_TERM_TYPE_LINEIN_STEREO:
case SDCA_TERM_TYPE_LINEIN_FRONT_LR:
case SDCA_TERM_TYPE_LINEIN_CENTER_LFE:
case SDCA_TERM_TYPE_LINEIN_SURROUND_LR:
case SDCA_TERM_TYPE_LINEIN_REAR_LR:
return SND_JACK_LINEIN;
case SDCA_TERM_TYPE_LINEOUT_STEREO:
case SDCA_TERM_TYPE_LINEOUT_FRONT_LR:
case SDCA_TERM_TYPE_LINEOUT_CENTER_LFE:
case SDCA_TERM_TYPE_LINEOUT_SURROUND_LR:
case SDCA_TERM_TYPE_LINEOUT_REAR_LR:
return SND_JACK_LINEOUT;
case SDCA_TERM_TYPE_MIC_JACK:
return SND_JACK_MICROPHONE;
case SDCA_TERM_TYPE_HEADPHONE_JACK:
return SND_JACK_HEADPHONE;
case SDCA_TERM_TYPE_HEADSET_JACK:
return SND_JACK_HEADSET;
default:
return 0;
}
}
/**
* sdca_jack_set_jack - attach an ASoC jack to SDCA
* @info: SDCA interrupt information.
* @jack: ASoC jack to be attached.
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/device.h`, `linux/dev_printk.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_registers.h`, `linux/sprintf.h`, `linux/regmap.h`, `linux/rwsem.h`.
- Detected declarations: `function sdca_jack_process`, `function sdca_jack_alloc_state`, `function type_get_mask`, `function sdca_jack_set_jack`, `function sdca_jack_report`.
- 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.