sound/soc/mediatek/mt2701/mt2701-cs42448.c
Source file repositories/reference/linux-study-clean/sound/soc/mediatek/mt2701/mt2701-cs42448.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/mediatek/mt2701/mt2701-cs42448.c- Extension
.c- Size
- 11938 bytes
- Lines
- 421
- 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.hsound/soc.hlinux/delay.hlinux/gpio/consumer.hlinux/pinctrl/consumer.hmt2701-afe-common.h
Detected Declarations
struct mt2701_cs42448_privatefunction mt2701_cs42448_i2sin1_mux_getfunction mt2701_cs42448_i2sin1_mux_setfunction mt2701_cs42448_fe_ops_startupfunction mt2701_cs42448_be_ops_hw_paramsfunction mt2701_cs42448_machine_probe
Annotated Snippet
struct mt2701_cs42448_private {
int i2s1_in_mux;
struct gpio_desc *i2s1_in_mux_sel_1;
struct gpio_desc *i2s1_in_mux_sel_2;
};
static const char * const i2sin_mux_switch_text[] = {
"ADC_SDOUT2",
"ADC_SDOUT3",
"I2S_IN_1",
"I2S_IN_2",
};
static const struct soc_enum i2sin_mux_enum =
SOC_ENUM_SINGLE_EXT(4, i2sin_mux_switch_text);
static int mt2701_cs42448_i2sin1_mux_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
struct mt2701_cs42448_private *priv = snd_soc_card_get_drvdata(card);
ucontrol->value.integer.value[0] = priv->i2s1_in_mux;
return 0;
}
static int mt2701_cs42448_i2sin1_mux_set(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct snd_soc_card *card = snd_kcontrol_chip(kcontrol);
struct mt2701_cs42448_private *priv = snd_soc_card_get_drvdata(card);
if (ucontrol->value.integer.value[0] == priv->i2s1_in_mux)
return 0;
switch (ucontrol->value.integer.value[0]) {
case 0:
gpiod_set_value(priv->i2s1_in_mux_sel_1, 0);
gpiod_set_value(priv->i2s1_in_mux_sel_2, 0);
break;
case 1:
gpiod_set_value(priv->i2s1_in_mux_sel_1, 1);
gpiod_set_value(priv->i2s1_in_mux_sel_2, 0);
break;
case 2:
gpiod_set_value(priv->i2s1_in_mux_sel_1, 0);
gpiod_set_value(priv->i2s1_in_mux_sel_2, 1);
break;
case 3:
gpiod_set_value(priv->i2s1_in_mux_sel_1, 1);
gpiod_set_value(priv->i2s1_in_mux_sel_2, 1);
break;
default:
dev_warn(card->dev, "%s invalid setting\n", __func__);
}
priv->i2s1_in_mux = ucontrol->value.integer.value[0];
return 0;
}
static const struct snd_soc_dapm_widget
mt2701_cs42448_asoc_card_dapm_widgets[] = {
SND_SOC_DAPM_LINE("Line Out Jack", NULL),
SND_SOC_DAPM_MIC("AMIC", NULL),
SND_SOC_DAPM_LINE("Tuner In", NULL),
SND_SOC_DAPM_LINE("Satellite Tuner In", NULL),
SND_SOC_DAPM_LINE("AUX In", NULL),
};
static const struct snd_kcontrol_new mt2701_cs42448_controls[] = {
SOC_DAPM_PIN_SWITCH("Line Out Jack"),
SOC_DAPM_PIN_SWITCH("AMIC"),
SOC_DAPM_PIN_SWITCH("Tuner In"),
SOC_DAPM_PIN_SWITCH("Satellite Tuner In"),
SOC_DAPM_PIN_SWITCH("AUX In"),
SOC_ENUM_EXT("I2SIN1_MUX_Switch", i2sin_mux_enum,
mt2701_cs42448_i2sin1_mux_get,
mt2701_cs42448_i2sin1_mux_set),
};
static const unsigned int mt2701_cs42448_sampling_rates[] = {48000};
static const struct snd_pcm_hw_constraint_list mt2701_cs42448_constraints_rates = {
.count = ARRAY_SIZE(mt2701_cs42448_sampling_rates),
.list = mt2701_cs42448_sampling_rates,
.mask = 0,
};
static int mt2701_cs42448_fe_ops_startup(struct snd_pcm_substream *substream)
{
Annotation
- Immediate include surface: `linux/module.h`, `sound/soc.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/pinctrl/consumer.h`, `mt2701-afe-common.h`.
- Detected declarations: `struct mt2701_cs42448_private`, `function mt2701_cs42448_i2sin1_mux_get`, `function mt2701_cs42448_i2sin1_mux_set`, `function mt2701_cs42448_fe_ops_startup`, `function mt2701_cs42448_be_ops_hw_params`, `function mt2701_cs42448_machine_probe`.
- 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.