sound/soc/codecs/cs42l43-jack.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs42l43-jack.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cs42l43-jack.c- Extension
.c- Size
- 29158 bytes
- Lines
- 990
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- 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.
- 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/build_bug.hlinux/completion.hlinux/delay.hlinux/errno.hlinux/irq.hlinux/jiffies.hlinux/mfd/cs42l43.hlinux/mfd/cs42l43-regs.hlinux/mutex.hlinux/pm_runtime.hlinux/property.hlinux/regmap.hlinux/time.hlinux/workqueue.hsound/control.hsound/jack.hsound/pcm.hsound/pcm_params.hsound/soc-component.hsound/soc-jack.hsound/soc.hcs42l43.h
Detected Declarations
enum cs42l43_raw_jackfunction cs42l43_find_indexfunction cs42l43_set_jackfunction cs42l43_start_hs_biasfunction cs42l43_stop_hs_biasfunction cs42l43_bias_detect_clampfunction cs42l43_jack_presentfunction cs42l43_start_button_detectfunction cs42l43_stop_button_detectfunction cs42l43_button_pressfunction cs42l43_button_releasefunction cs42l43_bias_sense_timeoutfunction cs42l43_start_load_detectfunction cs42l43_stop_load_detectfunction cs42l43_run_load_detectfunction cs42l43_run_type_detectfunction cs42l43_clear_jackfunction cs42l43_tip_sense_workfunction cs42l43_tip_sensefunction cs42l43_jack_getfunction cs42l43_jack_put
Annotated Snippet
if (ret < 0) {
dev_err(priv->dev, "Property cirrus,buttons-ohms malformed: %d\n",
ret);
goto error;
}
if (ret > CS42L43_N_BUTTONS) {
ret = -EINVAL;
dev_err(priv->dev, "Property cirrus,buttons-ohms too many entries\n");
goto error;
}
ret = device_property_read_u32_array(cs42l43->dev, "cirrus,buttons-ohms",
priv->buttons, ret);
if (ret < 0) {
dev_err(priv->dev, "Property cirrus,button-ohms malformed: %d\n",
ret);
goto error;
}
} else {
priv->buttons[0] = 70;
priv->buttons[1] = 185;
priv->buttons[2] = 355;
priv->buttons[3] = 735;
}
ret = cs42l43_find_index(priv, "cirrus,detect-us", 50000, &priv->detect_us,
cs42l43_accdet_us, ARRAY_SIZE(cs42l43_accdet_us));
if (ret < 0)
goto error;
hs2 |= ret << CS42L43_AUTO_HSDET_TIME_SHIFT;
priv->bias_low = device_property_read_bool(cs42l43->dev, "cirrus,bias-low");
ret = cs42l43_find_index(priv, "cirrus,bias-ramp-ms", 170,
&priv->bias_ramp_ms, cs42l43_accdet_ramp_ms,
ARRAY_SIZE(cs42l43_accdet_ramp_ms));
if (ret < 0)
goto error;
hs2 |= ret << CS42L43_HSBIAS_RAMP_SHIFT;
ret = cs42l43_find_index(priv, "cirrus,bias-sense-microamp", 14,
&priv->bias_sense_ua, cs42l43_accdet_bias_sense,
ARRAY_SIZE(cs42l43_accdet_bias_sense));
if (ret < 0)
goto error;
if (priv->bias_sense_ua)
autocontrol |= ret << CS42L43_HSBIAS_SENSE_TRIP_SHIFT;
if (!device_property_read_bool(cs42l43->dev, "cirrus,button-automute"))
autocontrol |= CS42L43_S0_AUTO_ADCMUTE_DISABLE_MASK;
ret = device_property_read_u32(cs42l43->dev, "cirrus,tip-debounce-ms",
&priv->tip_debounce_ms);
if (ret < 0 && ret != -EINVAL) {
dev_err(priv->dev, "Property cirrus,tip-debounce-ms malformed: %d\n", ret);
goto error;
}
/* This tip sense invert is set normally, as TIPSENSE_INV already inverted */
if (device_property_read_bool(cs42l43->dev, "cirrus,tip-invert"))
autocontrol |= 0x1 << CS42L43_JACKDET_INV_SHIFT;
if (device_property_read_bool(cs42l43->dev, "cirrus,tip-disable-pullup"))
autocontrol |= 0x1 << CS42L43_JACKDET_MODE_SHIFT;
else
autocontrol |= 0x3 << CS42L43_JACKDET_MODE_SHIFT;
ret = cs42l43_find_index(priv, "cirrus,tip-fall-db-ms", 500,
&priv->tip_fall_db_ms, cs42l43_accdet_db_ms,
ARRAY_SIZE(cs42l43_accdet_db_ms));
if (ret < 0)
goto error;
tip_deb |= ret << CS42L43_TIPSENSE_FALLING_DB_TIME_SHIFT;
ret = cs42l43_find_index(priv, "cirrus,tip-rise-db-ms", 500,
&priv->tip_rise_db_ms, cs42l43_accdet_db_ms,
ARRAY_SIZE(cs42l43_accdet_db_ms));
if (ret < 0)
goto error;
tip_deb |= ret << CS42L43_TIPSENSE_RISING_DB_TIME_SHIFT;
if (device_property_read_bool(cs42l43->dev, "cirrus,use-ring-sense")) {
unsigned int ring_deb = 0;
Annotation
- Immediate include surface: `linux/build_bug.h`, `linux/completion.h`, `linux/delay.h`, `linux/errno.h`, `linux/irq.h`, `linux/jiffies.h`, `linux/mfd/cs42l43.h`, `linux/mfd/cs42l43-regs.h`.
- Detected declarations: `enum cs42l43_raw_jack`, `function cs42l43_find_index`, `function cs42l43_set_jack`, `function cs42l43_start_hs_bias`, `function cs42l43_stop_hs_bias`, `function cs42l43_bias_detect_clamp`, `function cs42l43_jack_present`, `function cs42l43_start_button_detect`, `function cs42l43_stop_button_detect`, `function cs42l43_button_press`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.