sound/sparc/cs4231.c
Source file repositories/reference/linux-study-clean/sound/sparc/cs4231.c
File Facts
- System
- Linux kernel
- Corpus path
sound/sparc/cs4231.c- Extension
.c- Size
- 55007 bytes
- Lines
- 2037
- Domain
- Driver Families
- Bucket
- sound/sparc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/kernel.hlinux/delay.hlinux/init.hlinux/interrupt.hlinux/moduleparam.hlinux/irq.hlinux/io.hlinux/of.hlinux/platform_device.hsound/core.hsound/pcm.hsound/info.hsound/control.hsound/timer.hsound/initval.hsound/pcm_params.hlinux/pci.hasm/ebus_dma.hsound/cs4231-regs.h
Detected Declarations
struct sbus_dma_infostruct snd_cs4231struct cs4231_dma_controlstruct snd_cs4231function snd_cs4231_xratefunction __cs4231_readbfunction __cs4231_writebfunction snd_cs4231_readyfunction snd_cs4231_doutfunction snd_cs4231_outmfunction snd_cs4231_outfunction snd_cs4231_infunction snd_cs4231_busy_waitfunction snd_cs4231_mce_upfunction snd_cs4231_mce_downfunction snd_cs4231_advance_dmafunction cs4231_dma_triggerfunction snd_cs4231_triggerfunction snd_pcm_group_for_each_entryfunction snd_cs4231_get_ratefunction snd_cs4231_get_formatfunction snd_cs4231_calibrate_mutefunction snd_cs4231_playback_formatfunction scoped_guardfunction snd_cs4231_capture_formatfunction snd_cs4231_timer_resolutionfunction snd_cs4231_timer_startfunction snd_cs4231_timer_stopfunction snd_cs4231_initfunction scoped_guardfunction snd_cs4231_openfunction snd_cs4231_closefunction snd_cs4231_timer_openfunction snd_cs4231_timer_closefunction snd_cs4231_playback_hw_paramsfunction snd_cs4231_playback_preparefunction snd_cs4231_capture_hw_paramsfunction snd_cs4231_capture_preparefunction snd_cs4231_overrangefunction snd_cs4231_play_callbackfunction snd_cs4231_capture_callbackfunction snd_cs4231_playback_pointerfunction snd_cs4231_capture_pointerfunction snd_cs4231_probefunction scoped_guardfunction scoped_guardfunction snd_cs4231_playback_openfunction snd_cs4231_capture_open
Annotated Snippet
struct sbus_dma_info {
spinlock_t lock; /* DMA access lock */
int dir;
void __iomem *regs;
};
#endif
struct snd_cs4231;
struct cs4231_dma_control {
void (*prepare)(struct cs4231_dma_control *dma_cont,
int dir);
void (*enable)(struct cs4231_dma_control *dma_cont, int on);
int (*request)(struct cs4231_dma_control *dma_cont,
dma_addr_t bus_addr, size_t len);
unsigned int (*address)(struct cs4231_dma_control *dma_cont);
#ifdef EBUS_SUPPORT
struct ebus_dma_info ebus_info;
#endif
#ifdef SBUS_SUPPORT
struct sbus_dma_info sbus_info;
#endif
};
struct snd_cs4231 {
spinlock_t lock; /* registers access lock */
void __iomem *port;
struct cs4231_dma_control p_dma;
struct cs4231_dma_control c_dma;
u32 flags;
#define CS4231_FLAG_EBUS 0x00000001
#define CS4231_FLAG_PLAYBACK 0x00000002
#define CS4231_FLAG_CAPTURE 0x00000004
struct snd_card *card;
struct snd_pcm *pcm;
struct snd_pcm_substream *playback_substream;
unsigned int p_periods_sent;
struct snd_pcm_substream *capture_substream;
unsigned int c_periods_sent;
struct snd_timer *timer;
unsigned short mode;
#define CS4231_MODE_NONE 0x0000
#define CS4231_MODE_PLAY 0x0001
#define CS4231_MODE_RECORD 0x0002
#define CS4231_MODE_TIMER 0x0004
#define CS4231_MODE_OPEN (CS4231_MODE_PLAY | CS4231_MODE_RECORD | \
CS4231_MODE_TIMER)
unsigned char image[32]; /* registers image */
int mce_bit;
int calibrate_mute;
struct mutex mce_mutex; /* mutex for mce register */
struct mutex open_mutex; /* mutex for ALSA open/close */
struct platform_device *op;
unsigned int irq[2];
unsigned int regs_size;
struct snd_cs4231 *next;
};
/* Eventually we can use sound/isa/cs423x/cs4231_lib.c directly, but for
* now.... -DaveM
*/
/* IO ports */
#include <sound/cs4231-regs.h>
/* XXX offsets are different than PC ISA chips... */
#define CS4231U(chip, x) ((chip)->port + ((c_d_c_CS4231##x) << 2))
/* SBUS DMA register defines. */
#define APCCSR 0x10UL /* APC DMA CSR */
#define APCCVA 0x20UL /* APC Capture DMA Address */
#define APCCC 0x24UL /* APC Capture Count */
#define APCCNVA 0x28UL /* APC Capture DMA Next Address */
#define APCCNC 0x2cUL /* APC Capture Next Count */
#define APCPVA 0x30UL /* APC Play DMA Address */
#define APCPC 0x34UL /* APC Play Count */
#define APCPNVA 0x38UL /* APC Play DMA Next Address */
#define APCPNC 0x3cUL /* APC Play Next Count */
/* Defines for SBUS DMA-routines */
#define APCVA 0x0UL /* APC DMA Address */
#define APCC 0x4UL /* APC Count */
#define APCNVA 0x8UL /* APC DMA Next Address */
Annotation
- Immediate include surface: `linux/module.h`, `linux/kernel.h`, `linux/delay.h`, `linux/init.h`, `linux/interrupt.h`, `linux/moduleparam.h`, `linux/irq.h`, `linux/io.h`.
- Detected declarations: `struct sbus_dma_info`, `struct snd_cs4231`, `struct cs4231_dma_control`, `struct snd_cs4231`, `function snd_cs4231_xrate`, `function __cs4231_readb`, `function __cs4231_writeb`, `function snd_cs4231_ready`, `function snd_cs4231_dout`, `function snd_cs4231_outm`.
- Atlas domain: Driver Families / sound/sparc.
- 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.