drivers/media/pci/solo6x10/solo6x10-g723.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/solo6x10/solo6x10-g723.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/solo6x10/solo6x10-g723.c- Extension
.c- Size
- 9805 bytes
- Lines
- 394
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- 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/kernel.hlinux/mempool.hlinux/poll.hlinux/kthread.hlinux/freezer.hlinux/module.hlinux/slab.hsound/core.hsound/initval.hsound/pcm.hsound/control.hsolo6x10.hsolo6x10-tw28.h
Detected Declarations
struct solo_snd_pcmfunction solo_g723_configfunction solo_g723_isrfunction snd_solo_pcm_openfunction snd_solo_pcm_closefunction snd_solo_pcm_triggerfunction snd_solo_pcm_preparefunction snd_solo_pcm_pointerfunction snd_solo_pcm_copyfunction snd_solo_capture_volume_infofunction snd_solo_capture_volume_getfunction snd_solo_capture_volume_putfunction solo_snd_pcm_initfunction solo_g723_initfunction solo_g723_exit
Annotated Snippet
struct solo_snd_pcm {
int on;
spinlock_t lock;
struct solo_dev *solo_dev;
u8 *g723_buf;
dma_addr_t g723_dma;
};
static void solo_g723_config(struct solo_dev *solo_dev)
{
int clk_div;
clk_div = (solo_dev->clock_mhz * 1000000)
/ (SAMPLERATE * (BITRATE * 2) * 2);
solo_reg_write(solo_dev, SOLO_AUDIO_SAMPLE,
SOLO_AUDIO_BITRATE(BITRATE)
| SOLO_AUDIO_CLK_DIV(clk_div));
solo_reg_write(solo_dev, SOLO_AUDIO_FDMA_INTR,
SOLO_AUDIO_FDMA_INTERVAL(1)
| SOLO_AUDIO_INTR_ORDER(G723_INTR_ORDER)
| SOLO_AUDIO_FDMA_BASE(SOLO_G723_EXT_ADDR(solo_dev) >> 16));
solo_reg_write(solo_dev, SOLO_AUDIO_CONTROL,
SOLO_AUDIO_ENABLE
| SOLO_AUDIO_I2S_MODE
| SOLO_AUDIO_I2S_MULTI(3)
| SOLO_AUDIO_MODE(OUTMODE_MASK));
}
void solo_g723_isr(struct solo_dev *solo_dev)
{
struct snd_pcm_str *pstr =
&solo_dev->snd_pcm->streams[SNDRV_PCM_STREAM_CAPTURE];
struct snd_pcm_substream *ss;
struct solo_snd_pcm *solo_pcm;
for (ss = pstr->substream; ss != NULL; ss = ss->next) {
if (snd_pcm_substream_chip(ss) == NULL)
continue;
/* This means open() hasn't been called on this one */
if (snd_pcm_substream_chip(ss) == solo_dev)
continue;
/* Haven't triggered a start yet */
solo_pcm = snd_pcm_substream_chip(ss);
if (!solo_pcm->on)
continue;
snd_pcm_period_elapsed(ss);
}
}
static const struct snd_pcm_hardware snd_solo_pcm_hw = {
.info = (SNDRV_PCM_INFO_MMAP |
SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_BLOCK_TRANSFER |
SNDRV_PCM_INFO_MMAP_VALID),
.formats = SNDRV_PCM_FMTBIT_U8,
.rates = SNDRV_PCM_RATE_8000,
.rate_min = SAMPLERATE,
.rate_max = SAMPLERATE,
.channels_min = 1,
.channels_max = 1,
.buffer_bytes_max = G723_PERIOD_BYTES * PERIODS,
.period_bytes_min = G723_PERIOD_BYTES,
.period_bytes_max = G723_PERIOD_BYTES,
.periods_min = PERIODS,
.periods_max = PERIODS,
};
static int snd_solo_pcm_open(struct snd_pcm_substream *ss)
{
struct solo_dev *solo_dev = snd_pcm_substream_chip(ss);
struct solo_snd_pcm *solo_pcm;
solo_pcm = kzalloc_obj(*solo_pcm);
if (solo_pcm == NULL)
goto oom;
solo_pcm->g723_buf = dma_alloc_coherent(&solo_dev->pdev->dev,
G723_PERIOD_BYTES,
&solo_pcm->g723_dma,
GFP_KERNEL);
if (solo_pcm->g723_buf == NULL)
goto oom;
spin_lock_init(&solo_pcm->lock);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/mempool.h`, `linux/poll.h`, `linux/kthread.h`, `linux/freezer.h`, `linux/module.h`, `linux/slab.h`, `sound/core.h`.
- Detected declarations: `struct solo_snd_pcm`, `function solo_g723_config`, `function solo_g723_isr`, `function snd_solo_pcm_open`, `function snd_solo_pcm_close`, `function snd_solo_pcm_trigger`, `function snd_solo_pcm_prepare`, `function snd_solo_pcm_pointer`, `function snd_solo_pcm_copy`, `function snd_solo_capture_volume_info`.
- Atlas domain: Driver Families / drivers/media.
- 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.