sound/hda/codecs/cm9825.c
Source file repositories/reference/linux-study-clean/sound/hda/codecs/cm9825.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/codecs/cm9825.c- Extension
.c- Size
- 16401 bytes
- Lines
- 589
- Domain
- Driver Families
- Bucket
- sound/hda
- 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/init.hlinux/slab.hlinux/module.hsound/core.hsound/hda_codec.hhda_local.hhda_auto_parser.hhda_jack.hgeneric.h
Detected Declarations
struct cmi_specfunction cm9825_update_jk_plug_statusfunction cm9825_unsol_inputs_delayedfunction cm9825_unsol_lineout_delayedfunction cm9825_unsol_hp_delayedfunction hp_callbackfunction cm9825_setup_unsolfunction cm9825_playback_pcm_hookfunction cm9825_initfunction cm9825_removefunction cm9825_suspendfunction cm9825_cm_std_resumefunction cm9825_resumefunction cm9825_probe
Annotated Snippet
struct cmi_spec {
struct hda_gen_spec gen;
const struct hda_verb *chip_d0_verbs;
const struct hda_verb *chip_d3_verbs;
const struct hda_verb *chip_hp_present_verbs;
const struct hda_verb *chip_hp_remove_verbs;
struct hda_codec *codec;
struct delayed_work unsol_inputs_work;
struct delayed_work unsol_lineout_work;
struct delayed_work unsol_hp_work;
hda_nid_t jd_cap_hp;
hda_nid_t jd_cap_lineout;
hda_nid_t jd_cap_inputs[AUTO_CFG_MAX_INS];
int quirk;
};
static const struct hda_verb cm9825_std_d3_verbs[] = {
/* chip sleep verbs */
{0x43, CM9825_VERB_SET_D2S, 0x62}, /* depop */
{0x43, CM9825_VERB_SET_PLL, 0x01}, /* PLL set */
{0x43, CM9825_VERB_SET_NEG, 0xc2}, /* NEG set */
{0x43, CM9825_VERB_SET_ADCL, 0x00}, /* ADC */
{0x43, CM9825_VERB_SET_DACL, 0x02}, /* DACL */
{0x43, CM9825_VERB_SET_VNEG, 0x50}, /* VOL NEG */
{0x43, CM9825_VERB_SET_MBIAS, 0x00}, /* MBIAS */
{0x43, CM9825_VERB_SET_PDNEG, 0x04}, /* SEL OSC */
{0x43, CM9825_VERB_SET_CDALR, 0xf6}, /* Class D */
{0x43, CM9825_VERB_SET_OTP, 0xcd}, /* OTP set */
{}
};
static const struct hda_verb cm9825_std_d0_verbs[] = {
/* chip init verbs */
{0x34, AC_VERB_SET_EAPD_BTLENABLE, 0x02}, /* EAPD set */
{0x43, CM9825_VERB_SET_SNR, 0x30}, /* SNR set */
{0x43, CM9825_VERB_SET_PLL, 0x00}, /* PLL set */
{0x43, CM9825_VERB_SET_ADCL, 0x00}, /* ADC */
{0x43, CM9825_VERB_SET_DACL, 0x02}, /* DACL */
{0x43, CM9825_VERB_SET_MBIAS, 0x00}, /* MBIAS */
{0x43, CM9825_VERB_SET_VNEG, 0x56}, /* VOL NEG */
{0x43, CM9825_VERB_SET_D2S, 0x62}, /* depop */
{0x43, CM9825_VERB_SET_DACTRL, 0x00}, /* DACTRL set */
{0x43, CM9825_VERB_SET_PDNEG, 0x0c}, /* SEL OSC */
{0x43, CM9825_VERB_SET_VDO, 0x80}, /* VDO set */
{0x43, CM9825_VERB_SET_CDALR, 0xf4}, /* Class D */
{0x43, CM9825_VERB_SET_OTP, 0xcd}, /* OTP set */
{0x43, CM9825_VERB_SET_MTCBA, 0x61}, /* SR set */
{0x43, CM9825_VERB_SET_OCP, 0x33}, /* OTP set */
{0x43, CM9825_VERB_SET_GAD, 0x07}, /* ADC -3db */
{0x43, CM9825_VERB_SET_TMOD, 0x26}, /* Class D clk */
{0x3C, AC_VERB_SET_AMP_GAIN_MUTE |
AC_AMP_SET_OUTPUT | AC_AMP_SET_RIGHT, 0x2d}, /* Gain set */
{0x3C, AC_VERB_SET_AMP_GAIN_MUTE |
AC_AMP_SET_OUTPUT | AC_AMP_SET_LEFT, 0x2d}, /* Gain set */
{0x43, CM9825_VERB_SET_HPF_1, 0x40}, /* HPF set */
{0x43, CM9825_VERB_SET_HPF_2, 0x40}, /* HPF set */
{}
};
static const struct hda_verb cm9825_hp_present_verbs[] = {
{0x42, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00}, /* PIN off */
{0x43, CM9825_VERB_SET_ADCL, 0x88}, /* ADC */
{0x43, CM9825_VERB_SET_DACL, 0xaa}, /* DACL */
{0x43, CM9825_VERB_SET_MBIAS, 0x10}, /* MBIAS */
{0x43, CM9825_VERB_SET_D2S, 0xf2}, /* depop */
{0x43, CM9825_VERB_SET_DACTRL, 0x00}, /* DACTRL set */
{0x43, CM9825_VERB_SET_VDO, 0xc4}, /* VDO set */
{}
};
static const struct hda_verb cm9825_hp_remove_verbs[] = {
{0x43, CM9825_VERB_SET_ADCL, 0x00}, /* ADC */
{0x43, CM9825_VERB_SET_DACL, 0x56}, /* DACL */
{0x43, CM9825_VERB_SET_MBIAS, 0x00}, /* MBIAS */
{0x43, CM9825_VERB_SET_D2S, 0x62}, /* depop */
{0x43, CM9825_VERB_SET_DACTRL, 0xe0}, /* DACTRL set */
{0x43, CM9825_VERB_SET_VDO, 0x80}, /* VDO set */
{0x42, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40}, /* PIN on */
{}
};
/*
* To save power, AD/CLK is turned off.
*/
static const struct hda_verb cm9825_gene_twl7_d3_verbs[] = {
{0x43, CM9825_VERB_SET_D2S, 0x62},
{0x43, CM9825_VERB_SET_PLL, 0x01},
{0x43, CM9825_VERB_SET_NEG, 0xc2},
{0x43, CM9825_VERB_SET_ADCL, 0x00},
{0x43, CM9825_VERB_SET_DACL, 0x02},
Annotation
- Immediate include surface: `linux/init.h`, `linux/slab.h`, `linux/module.h`, `sound/core.h`, `sound/hda_codec.h`, `hda_local.h`, `hda_auto_parser.h`, `hda_jack.h`.
- Detected declarations: `struct cmi_spec`, `function cm9825_update_jk_plug_status`, `function cm9825_unsol_inputs_delayed`, `function cm9825_unsol_lineout_delayed`, `function cm9825_unsol_hp_delayed`, `function hp_callback`, `function cm9825_setup_unsol`, `function cm9825_playback_pcm_hook`, `function cm9825_init`, `function cm9825_remove`.
- Atlas domain: Driver Families / sound/hda.
- 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.