sound/firewire/dice/dice.h

Source file repositories/reference/linux-study-clean/sound/firewire/dice/dice.h

File Facts

System
Linux kernel
Corpus path
sound/firewire/dice/dice.h
Extension
.h
Size
7642 bytes
Lines
239
Domain
Driver Families
Bucket
sound/firewire
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct snd_dice {
	struct snd_card *card;
	struct fw_unit *unit;
	spinlock_t lock;
	struct mutex mutex;

	/* Offsets for sub-addresses */
	unsigned int global_offset;
	unsigned int rx_offset;
	unsigned int tx_offset;
	unsigned int sync_offset;
	unsigned int rsrv_offset;

	unsigned int clock_caps;
	unsigned int tx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
	unsigned int rx_pcm_chs[MAX_STREAMS][SND_DICE_RATE_MODE_COUNT];
	unsigned int tx_midi_ports[MAX_STREAMS];
	unsigned int rx_midi_ports[MAX_STREAMS];

	struct fw_address_handler notification_handler;
	int owner_generation;
	u32 notification_bits;

	/* For uapi */
	int dev_lock_count; /* > 0 driver, < 0 userspace */
	bool dev_lock_changed;
	wait_queue_head_t hwdep_wait;

	/* For streaming */
	struct fw_iso_resources tx_resources[MAX_STREAMS];
	struct fw_iso_resources rx_resources[MAX_STREAMS];
	struct amdtp_stream tx_stream[MAX_STREAMS];
	struct amdtp_stream rx_stream[MAX_STREAMS];
	bool global_enabled:1;
	bool disable_double_pcm_frames:1;
	struct completion clock_accepted;
	unsigned int substreams_counter;

	struct amdtp_domain domain;
};

enum snd_dice_addr_type {
	SND_DICE_ADDR_TYPE_PRIVATE,
	SND_DICE_ADDR_TYPE_GLOBAL,
	SND_DICE_ADDR_TYPE_TX,
	SND_DICE_ADDR_TYPE_RX,
	SND_DICE_ADDR_TYPE_SYNC,
	SND_DICE_ADDR_TYPE_RSRV,
};

int snd_dice_transaction_write(struct snd_dice *dice,
			       enum snd_dice_addr_type type,
			       unsigned int offset,
			       void *buf, unsigned int len);
int snd_dice_transaction_read(struct snd_dice *dice,
			      enum snd_dice_addr_type type, unsigned int offset,
			      void *buf, unsigned int len);

static inline int snd_dice_transaction_write_global(struct snd_dice *dice,
						    unsigned int offset,
						    void *buf, unsigned int len)
{
	return snd_dice_transaction_write(dice,
					  SND_DICE_ADDR_TYPE_GLOBAL, offset,
					  buf, len);
}
static inline int snd_dice_transaction_read_global(struct snd_dice *dice,
						   unsigned int offset,
						   void *buf, unsigned int len)
{
	return snd_dice_transaction_read(dice,
					 SND_DICE_ADDR_TYPE_GLOBAL, offset,
					 buf, len);
}
static inline int snd_dice_transaction_write_tx(struct snd_dice *dice,
						unsigned int offset,
						void *buf, unsigned int len)
{
	return snd_dice_transaction_write(dice, SND_DICE_ADDR_TYPE_TX, offset,
					  buf, len);
}
static inline int snd_dice_transaction_read_tx(struct snd_dice *dice,
					       unsigned int offset,
					       void *buf, unsigned int len)
{
	return snd_dice_transaction_read(dice, SND_DICE_ADDR_TYPE_TX, offset,
					 buf, len);
}
static inline int snd_dice_transaction_write_rx(struct snd_dice *dice,
						unsigned int offset,

Annotation

Implementation Notes