sound/soc/codecs/arizona-jack.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/arizona-jack.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/arizona-jack.c- Extension
.c- Size
- 42627 bytes
- Lines
- 1632
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/slab.hlinux/interrupt.hlinux/err.hlinux/gpio/consumer.hlinux/input.hlinux/pm_runtime.hlinux/property.hlinux/regulator/consumer.hsound/jack.hsound/soc.hlinux/mfd/arizona/core.hlinux/mfd/arizona/pdata.hlinux/mfd/arizona/registers.hdt-bindings/mfd/arizona.harizona.h
Detected Declarations
function arizona_extcon_hp_clampfunction arizona_extcon_set_modefunction arizona_extcon_pulse_micbiasfunction arizona_start_micfunction arizona_stop_micfunction arizona_hpdet_readfunction arizona_hpdet_do_idfunction arizona_hpdet_irqfunction arizona_identify_headphonefunction arizona_start_hpdet_acc_idfunction arizona_micd_timeout_workfunction arizona_micd_adc_readfunction arizona_micd_readfunction arizona_micdet_readingfunction arizona_button_readingfunction arizona_micd_detectfunction arizona_micdetfunction arizona_hpdet_workfunction arizona_hpdet_waitfunction arizona_jackdetfunction arizona_micd_set_levelfunction arizona_extcon_get_micd_configsfunction arizona_extcon_device_get_pdatafunction arizona_jack_codec_dev_probefunction arizona_jack_codec_dev_removefunction arizona_jack_enable_jack_detectfunction arizona_jack_disable_jack_detectfunction arizona_jack_set_jackexport arizona_jack_codec_dev_probeexport arizona_jack_codec_dev_removeexport arizona_jack_set_jack
Annotated Snippet
if (clamp) {
val = ARIZONA_HP1L_SHRTO;
cap_sel = ARIZONA_TST_CAP_CLAMP;
} else {
val = ARIZONA_HP1L_FLWR | ARIZONA_HP1L_SHRTI;
cap_sel = ARIZONA_TST_CAP_DEFAULT;
}
ret = regmap_update_bits(arizona->regmap,
ARIZONA_HP_TEST_CTRL_1,
ARIZONA_HP1_TST_CAP_SEL_MASK,
cap_sel);
if (ret)
dev_warn(arizona->dev, "Failed to set TST_CAP_SEL: %d\n", ret);
break;
default:
mask = ARIZONA_RMV_SHRT_HP1L;
if (clamp)
val = ARIZONA_RMV_SHRT_HP1L;
break;
}
snd_soc_dapm_mutex_lock(arizona->dapm);
arizona->hpdet_clamp = clamp;
/* Keep the HP output stages disabled while doing the clamp */
if (clamp) {
ret = regmap_update_bits(arizona->regmap,
ARIZONA_OUTPUT_ENABLES_1,
ARIZONA_OUT1L_ENA |
ARIZONA_OUT1R_ENA, 0);
if (ret)
dev_warn(arizona->dev, "Failed to disable headphone outputs: %d\n", ret);
}
if (mask) {
ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1L,
mask, val);
if (ret)
dev_warn(arizona->dev, "Failed to do clamp: %d\n", ret);
ret = regmap_update_bits(arizona->regmap, ARIZONA_HP_CTRL_1R,
mask, val);
if (ret)
dev_warn(arizona->dev, "Failed to do clamp: %d\n", ret);
}
/* Restore the desired state while not doing the clamp */
if (!clamp) {
ret = regmap_update_bits(arizona->regmap,
ARIZONA_OUTPUT_ENABLES_1,
ARIZONA_OUT1L_ENA |
ARIZONA_OUT1R_ENA, arizona->hp_ena);
if (ret)
dev_warn(arizona->dev, "Failed to restore headphone outputs: %d\n", ret);
}
snd_soc_dapm_mutex_unlock(arizona->dapm);
}
static void arizona_extcon_set_mode(struct arizona_priv *info, int mode)
{
struct arizona *arizona = info->arizona;
mode %= info->micd_num_modes;
gpiod_set_value_cansleep(info->micd_pol_gpio,
info->micd_modes[mode].gpio);
regmap_update_bits(arizona->regmap, ARIZONA_MIC_DETECT_1,
ARIZONA_MICD_BIAS_SRC_MASK,
info->micd_modes[mode].bias <<
ARIZONA_MICD_BIAS_SRC_SHIFT);
regmap_update_bits(arizona->regmap, ARIZONA_ACCESSORY_DETECT_MODE_1,
ARIZONA_ACCDET_SRC, info->micd_modes[mode].src);
info->micd_mode = mode;
dev_dbg(arizona->dev, "Set jack polarity to %d\n", mode);
}
static const char *arizona_extcon_get_micbias(struct arizona_priv *info)
{
switch (info->micd_modes[0].bias) {
case 1:
return "MICBIAS1";
case 2:
return "MICBIAS2";
case 3:
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/input.h`, `linux/pm_runtime.h`.
- Detected declarations: `function arizona_extcon_hp_clamp`, `function arizona_extcon_set_mode`, `function arizona_extcon_pulse_micbias`, `function arizona_start_mic`, `function arizona_stop_mic`, `function arizona_hpdet_read`, `function arizona_hpdet_do_id`, `function arizona_hpdet_irq`, `function arizona_identify_headphone`, `function arizona_start_hpdet_acc_id`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.