sound/soc/codecs/wm1250-ev1.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wm1250-ev1.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wm1250-ev1.c- Extension
.c- Size
- 5628 bytes
- Lines
- 225
- 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/init.hlinux/module.hlinux/slab.hlinux/i2c.hlinux/gpio/consumer.hsound/soc.hsound/soc-dapm.h
Detected Declarations
struct wm1250_privfunction wm1250_ev1_set_bias_levelfunction wm1250_ev1_hw_paramsfunction wm1250_ev1_pdatafunction wm1250_ev1_probe
Annotated Snippet
struct wm1250_priv {
struct gpio_desc *clk_ena;
struct gpio_desc *clk_sel0;
struct gpio_desc *clk_sel1;
struct gpio_desc *osr;
struct gpio_desc *master;
};
static int wm1250_ev1_set_bias_level(struct snd_soc_component *component,
enum snd_soc_bias_level level)
{
struct wm1250_priv *wm1250 = dev_get_drvdata(component->dev);
switch (level) {
case SND_SOC_BIAS_ON:
break;
case SND_SOC_BIAS_PREPARE:
break;
case SND_SOC_BIAS_STANDBY:
gpiod_set_value_cansleep(wm1250->clk_ena, 1);
break;
case SND_SOC_BIAS_OFF:
gpiod_set_value_cansleep(wm1250->clk_ena, 0);
break;
}
return 0;
}
static const struct snd_soc_dapm_widget wm1250_ev1_dapm_widgets[] = {
SND_SOC_DAPM_ADC("ADC", "wm1250-ev1 Capture", SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_DAC("DAC", "wm1250-ev1 Playback", SND_SOC_NOPM, 0, 0),
SND_SOC_DAPM_INPUT("WM1250 Input"),
SND_SOC_DAPM_OUTPUT("WM1250 Output"),
};
static const struct snd_soc_dapm_route wm1250_ev1_dapm_routes[] = {
{ "ADC", NULL, "WM1250 Input" },
{ "WM1250 Output", NULL, "DAC" },
};
static int wm1250_ev1_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
struct wm1250_priv *wm1250 = snd_soc_component_get_drvdata(dai->component);
switch (params_rate(params)) {
case 8000:
gpiod_set_value(wm1250->clk_sel0, 1);
gpiod_set_value(wm1250->clk_sel1, 1);
break;
case 16000:
gpiod_set_value(wm1250->clk_sel0, 0);
gpiod_set_value(wm1250->clk_sel1, 1);
break;
case 32000:
gpiod_set_value(wm1250->clk_sel0, 1);
gpiod_set_value(wm1250->clk_sel1, 0);
break;
case 64000:
gpiod_set_value(wm1250->clk_sel0, 0);
gpiod_set_value(wm1250->clk_sel1, 0);
break;
default:
return -EINVAL;
}
return 0;
}
static const struct snd_soc_dai_ops wm1250_ev1_ops = {
.hw_params = wm1250_ev1_hw_params,
};
#define WM1250_EV1_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_64000)
static struct snd_soc_dai_driver wm1250_ev1_dai = {
.name = "wm1250-ev1",
.playback = {
.stream_name = "Playback",
.channels_min = 1,
.channels_max = 2,
.rates = WM1250_EV1_RATES,
.formats = SNDRV_PCM_FMTBIT_S16_LE,
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/slab.h`, `linux/i2c.h`, `linux/gpio/consumer.h`, `sound/soc.h`, `sound/soc-dapm.h`.
- Detected declarations: `struct wm1250_priv`, `function wm1250_ev1_set_bias_level`, `function wm1250_ev1_hw_params`, `function wm1250_ev1_pdata`, `function wm1250_ev1_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.