sound/soc/sdw_utils/soc_sdw_rt_sdca_jack_common.c
Source file repositories/reference/linux-study-clean/sound/soc/sdw_utils/soc_sdw_rt_sdca_jack_common.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/sdw_utils/soc_sdw_rt_sdca_jack_common.c- Extension
.c- Size
- 6442 bytes
- Lines
- 224
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/errno.hlinux/input.hlinux/soundwire/sdw.hlinux/soundwire/sdw_type.hsound/control.hsound/soc.hsound/soc-acpi.hsound/soc-dapm.hsound/jack.hsound/soc_sdw_utils.h
Detected Declarations
function snd_soc_register_cardfunction asoc_sdw_rt_sdca_jack_rtd_initfunction asoc_sdw_rt_sdca_jack_exitfunction asoc_sdw_rt_sdca_jack_init
Annotated Snippet
if (strstr(component->name_prefix, need_sdca_suffix[i])) {
/* Add -sdca suffix for existing UCMs */
card->components = devm_kasprintf(card->dev, GFP_KERNEL,
"%s-sdca", card->components);
if (!card->components)
return -ENOMEM;
break;
}
}
if (strstr(component->name_prefix, "rt711")) {
ret = snd_soc_dapm_add_routes(dapm, rt711_sdca_map,
ARRAY_SIZE(rt711_sdca_map));
} else if (strstr(component->name_prefix, "rt712")) {
ret = snd_soc_dapm_add_routes(dapm, rt712_sdca_map,
ARRAY_SIZE(rt712_sdca_map));
} else if (strstr(component->name_prefix, "rt713")) {
ret = snd_soc_dapm_add_routes(dapm, rt713_sdca_map,
ARRAY_SIZE(rt713_sdca_map));
} else if (strstr(component->name_prefix, "rt721")) {
ret = snd_soc_dapm_add_routes(dapm, rt721_sdca_map,
ARRAY_SIZE(rt721_sdca_map));
} else if (strstr(component->name_prefix, "rt722")) {
ret = snd_soc_dapm_add_routes(dapm, rt722_sdca_map,
ARRAY_SIZE(rt722_sdca_map));
} else {
dev_err(card->dev, "%s is not supported\n", component->name_prefix);
return -EINVAL;
}
if (ret) {
dev_err(card->dev, "rt sdca jack map addition failed: %d\n", ret);
return ret;
}
ret = snd_soc_card_jack_new_pins(rtd->card, "Headset Jack",
SND_JACK_HEADSET | SND_JACK_BTN_0 |
SND_JACK_BTN_1 | SND_JACK_BTN_2 |
SND_JACK_BTN_3,
&ctx->sdw_headset,
rt_sdca_jack_pins,
ARRAY_SIZE(rt_sdca_jack_pins));
if (ret) {
dev_err(rtd->card->dev, "Headset Jack creation failed: %d\n",
ret);
return ret;
}
jack = &ctx->sdw_headset;
snd_jack_set_key(jack->jack, SND_JACK_BTN_0, KEY_PLAYPAUSE);
snd_jack_set_key(jack->jack, SND_JACK_BTN_1, KEY_VOICECOMMAND);
snd_jack_set_key(jack->jack, SND_JACK_BTN_2, KEY_VOLUMEUP);
snd_jack_set_key(jack->jack, SND_JACK_BTN_3, KEY_VOLUMEDOWN);
ret = snd_soc_component_set_jack(component, jack, NULL);
if (ret)
dev_err(rtd->card->dev, "Headset Jack call-back failed: %d\n",
ret);
return ret;
}
EXPORT_SYMBOL_NS(asoc_sdw_rt_sdca_jack_rtd_init, "SND_SOC_SDW_UTILS");
int asoc_sdw_rt_sdca_jack_exit(struct snd_soc_card *card, struct snd_soc_dai_link *dai_link)
{
struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
if (!ctx->headset_codec_dev)
return 0;
if (!SOC_SDW_JACK_JDSRC(ctx->mc_quirk))
return 0;
device_remove_software_node(ctx->headset_codec_dev);
put_device(ctx->headset_codec_dev);
ctx->headset_codec_dev = NULL;
return 0;
}
EXPORT_SYMBOL_NS(asoc_sdw_rt_sdca_jack_exit, "SND_SOC_SDW_UTILS");
int asoc_sdw_rt_sdca_jack_init(struct snd_soc_card *card,
struct snd_soc_dai_link *dai_links,
struct asoc_sdw_codec_info *info,
bool playback)
{
struct asoc_sdw_mc_private *ctx = snd_soc_card_get_drvdata(card);
struct device *sdw_dev;
Annotation
- Immediate include surface: `linux/device.h`, `linux/errno.h`, `linux/input.h`, `linux/soundwire/sdw.h`, `linux/soundwire/sdw_type.h`, `sound/control.h`, `sound/soc.h`, `sound/soc-acpi.h`.
- Detected declarations: `function snd_soc_register_card`, `function asoc_sdw_rt_sdca_jack_rtd_init`, `function asoc_sdw_rt_sdca_jack_exit`, `function asoc_sdw_rt_sdca_jack_init`.
- 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.