sound/soc/codecs/rt700.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/rt700.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/rt700.c- Extension
.c- Size
- 32676 bytes
- Lines
- 1236
- 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.
- 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/module.hlinux/moduleparam.hlinux/kernel.hlinux/init.hlinux/delay.hlinux/pm_runtime.hlinux/pm.hlinux/soundwire/sdw.hlinux/regmap.hlinux/slab.hsound/core.hsound/pcm.hsound/pcm_params.hsound/sdw.hsound/soc.hsound/soc-dapm.hsound/initval.hsound/tlv.hsound/hda_verbs.hsound/jack.hrt700.h
Detected Declarations
function rt700_index_writefunction rt700_index_readfunction rt700_button_detectfunction rt700_headset_detectfunction rt700_jack_detect_handlerfunction rt700_btn_check_handlerfunction rt700_jack_initfunction rt700_set_jack_detectfunction rt700_get_gainfunction rt700_set_amp_gain_putfunction rt700_set_amp_gain_getfunction rt700_mux_getfunction rt700_mux_putfunction rt700_dac_front_eventfunction rt700_dac_surround_eventfunction rt700_adc_09_eventfunction rt700_adc_08_eventfunction rt700_hpo_mux_eventfunction rt700_spk_pga_eventfunction rt700_probefunction rt700_set_bias_levelfunction rt700_set_sdw_streamfunction rt700_shutdownfunction rt700_pcm_hw_paramsfunction rt700_pcm_hw_freefunction rt700_clock_configfunction rt700_initfunction rt700_io_init
Annotated Snippet
if (rt700->jack_type == 0) {
ret = rt700_headset_detect(rt700);
if (ret < 0)
return;
if (rt700->jack_type == SND_JACK_HEADSET)
btn_type = rt700_button_detect(rt700);
} else if (rt700->jack_type == SND_JACK_HEADSET) {
/* jack is already in, report button event */
btn_type = rt700_button_detect(rt700);
}
} else {
/* jack out */
rt700->jack_type = 0;
}
dev_dbg(&rt700->slave->dev,
"in %s, jack_type=0x%x\n", __func__, rt700->jack_type);
dev_dbg(&rt700->slave->dev,
"in %s, btn_type=0x%x\n", __func__, btn_type);
snd_soc_jack_report(rt700->hs_jack, rt700->jack_type | btn_type,
SND_JACK_HEADSET |
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3);
if (btn_type) {
/* button released */
snd_soc_jack_report(rt700->hs_jack, rt700->jack_type,
SND_JACK_HEADSET |
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3);
mod_delayed_work(system_power_efficient_wq,
&rt700->jack_btn_check_work, msecs_to_jiffies(200));
}
return;
io_error:
pr_err_ratelimited("IO error in %s, ret %d\n", __func__, ret);
}
static void rt700_btn_check_handler(struct work_struct *work)
{
struct rt700_priv *rt700 = container_of(work, struct rt700_priv,
jack_btn_check_work.work);
int btn_type = 0, ret;
unsigned int jack_status = 0, reg;
reg = RT700_VERB_GET_PIN_SENSE | RT700_HP_OUT;
ret = regmap_read(rt700->regmap, reg, &jack_status);
if (ret < 0)
goto io_error;
/* pin attached */
if (jack_status & (1 << 31)) {
if (rt700->jack_type == SND_JACK_HEADSET) {
/* jack is already in, report button event */
btn_type = rt700_button_detect(rt700);
}
} else {
rt700->jack_type = 0;
}
/* cbj comparator */
ret = rt700_index_read(rt700->regmap, RT700_COMBO_JACK_AUTO_CTL2, ®);
if (ret < 0)
goto io_error;
if ((reg & 0xf0) == 0xf0)
btn_type = 0;
dev_dbg(&rt700->slave->dev,
"%s, btn_type=0x%x\n", __func__, btn_type);
snd_soc_jack_report(rt700->hs_jack, rt700->jack_type | btn_type,
SND_JACK_HEADSET |
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3);
if (btn_type) {
/* button released */
snd_soc_jack_report(rt700->hs_jack, rt700->jack_type,
SND_JACK_HEADSET |
SND_JACK_BTN_0 | SND_JACK_BTN_1 |
SND_JACK_BTN_2 | SND_JACK_BTN_3);
mod_delayed_work(system_power_efficient_wq,
&rt700->jack_btn_check_work, msecs_to_jiffies(200));
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/kernel.h`, `linux/init.h`, `linux/delay.h`, `linux/pm_runtime.h`, `linux/pm.h`, `linux/soundwire/sdw.h`.
- Detected declarations: `function rt700_index_write`, `function rt700_index_read`, `function rt700_button_detect`, `function rt700_headset_detect`, `function rt700_jack_detect_handler`, `function rt700_btn_check_handler`, `function rt700_jack_init`, `function rt700_set_jack_detect`, `function rt700_get_gain`, `function rt700_set_amp_gain_put`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.