18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci#ifndef __SOUND_MINORS_H
38c2ecf20Sopenharmony_ci#define __SOUND_MINORS_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci/*
68c2ecf20Sopenharmony_ci *  MINOR numbers
78c2ecf20Sopenharmony_ci */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#define SNDRV_OS_MINORS			256
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define SNDRV_MINOR_DEVICES		32
128c2ecf20Sopenharmony_ci#define SNDRV_MINOR_CARD(minor)		((minor) >> 5)
138c2ecf20Sopenharmony_ci#define SNDRV_MINOR_DEVICE(minor)	((minor) & 0x001f)
148c2ecf20Sopenharmony_ci#define SNDRV_MINOR(card, dev)		(((card) << 5) | (dev))
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/* these minors can still be used for autoloading devices (/dev/aload*) */
178c2ecf20Sopenharmony_ci#define SNDRV_MINOR_CONTROL		0	/* 0 */
188c2ecf20Sopenharmony_ci#define SNDRV_MINOR_GLOBAL		1	/* 1 */
198c2ecf20Sopenharmony_ci#define SNDRV_MINOR_SEQUENCER		1	/* SNDRV_MINOR_GLOBAL + 0 * 32 */
208c2ecf20Sopenharmony_ci#define SNDRV_MINOR_TIMER		33	/* SNDRV_MINOR_GLOBAL + 1 * 32 */
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci#ifndef CONFIG_SND_DYNAMIC_MINORS
238c2ecf20Sopenharmony_ci#define SNDRV_MINOR_COMPRESS		2	/* 2 - 3 */
248c2ecf20Sopenharmony_ci#define SNDRV_MINOR_HWDEP		4	/* 4 - 7 */
258c2ecf20Sopenharmony_ci#define SNDRV_MINOR_RAWMIDI		8	/* 8 - 15 */
268c2ecf20Sopenharmony_ci#define SNDRV_MINOR_PCM_PLAYBACK	16	/* 16 - 23 */
278c2ecf20Sopenharmony_ci#define SNDRV_MINOR_PCM_CAPTURE		24	/* 24 - 31 */
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_ci/* same as first respective minor number to make minor allocation easier */
308c2ecf20Sopenharmony_ci#define SNDRV_DEVICE_TYPE_CONTROL	SNDRV_MINOR_CONTROL
318c2ecf20Sopenharmony_ci#define SNDRV_DEVICE_TYPE_HWDEP		SNDRV_MINOR_HWDEP
328c2ecf20Sopenharmony_ci#define SNDRV_DEVICE_TYPE_RAWMIDI	SNDRV_MINOR_RAWMIDI
338c2ecf20Sopenharmony_ci#define SNDRV_DEVICE_TYPE_PCM_PLAYBACK	SNDRV_MINOR_PCM_PLAYBACK
348c2ecf20Sopenharmony_ci#define SNDRV_DEVICE_TYPE_PCM_CAPTURE	SNDRV_MINOR_PCM_CAPTURE
358c2ecf20Sopenharmony_ci#define SNDRV_DEVICE_TYPE_SEQUENCER	SNDRV_MINOR_SEQUENCER
368c2ecf20Sopenharmony_ci#define SNDRV_DEVICE_TYPE_TIMER		SNDRV_MINOR_TIMER
378c2ecf20Sopenharmony_ci#define SNDRV_DEVICE_TYPE_COMPRESS	SNDRV_MINOR_COMPRESS
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci#else /* CONFIG_SND_DYNAMIC_MINORS */
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_cienum {
428c2ecf20Sopenharmony_ci	SNDRV_DEVICE_TYPE_CONTROL,
438c2ecf20Sopenharmony_ci	SNDRV_DEVICE_TYPE_SEQUENCER,
448c2ecf20Sopenharmony_ci	SNDRV_DEVICE_TYPE_TIMER,
458c2ecf20Sopenharmony_ci	SNDRV_DEVICE_TYPE_HWDEP,
468c2ecf20Sopenharmony_ci	SNDRV_DEVICE_TYPE_RAWMIDI,
478c2ecf20Sopenharmony_ci	SNDRV_DEVICE_TYPE_PCM_PLAYBACK,
488c2ecf20Sopenharmony_ci	SNDRV_DEVICE_TYPE_PCM_CAPTURE,
498c2ecf20Sopenharmony_ci	SNDRV_DEVICE_TYPE_COMPRESS,
508c2ecf20Sopenharmony_ci};
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#endif /* CONFIG_SND_DYNAMIC_MINORS */
538c2ecf20Sopenharmony_ci
548c2ecf20Sopenharmony_ci#define SNDRV_MINOR_HWDEPS		4
558c2ecf20Sopenharmony_ci#define SNDRV_MINOR_RAWMIDIS		8
568c2ecf20Sopenharmony_ci#define SNDRV_MINOR_PCMS		8
578c2ecf20Sopenharmony_ci
588c2ecf20Sopenharmony_ci
598c2ecf20Sopenharmony_ci#ifdef CONFIG_SND_OSSEMUL
608c2ecf20Sopenharmony_ci
618c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_DEVICES		16
628c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_CARD(minor)	((minor) >> 4)
638c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_DEVICE(minor)	((minor) & 0x000f)
648c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS(card, dev)	(((card) << 4) | (dev))
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_MIXER		0	/* /dev/mixer - OSS 3.XX compatible */
678c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_SEQUENCER	1	/* /dev/sequencer - OSS 3.XX compatible */
688c2ecf20Sopenharmony_ci#define	SNDRV_MINOR_OSS_MIDI		2	/* /dev/midi - native midi interface - OSS 3.XX compatible - UART */
698c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_PCM		3	/* alias */
708c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_PCM_8		3	/* /dev/dsp - 8bit PCM - OSS 3.XX compatible */
718c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_AUDIO		4	/* /dev/audio - SunSparc compatible */
728c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_PCM_16		5	/* /dev/dsp16 - 16bit PCM - OSS 3.XX compatible */
738c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_SNDSTAT		6	/* /dev/sndstat - for compatibility with OSS */
748c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_RESERVED7	7	/* reserved for future use */
758c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_MUSIC		8	/* /dev/music - OSS 3.XX compatible */
768c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_DMMIDI		9	/* /dev/dmmidi0 - this device can have another minor # with OSS */
778c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_DMFM		10	/* /dev/dmfm0 - this device can have another minor # with OSS */
788c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_MIXER1		11	/* alternate mixer */
798c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_PCM1		12	/* alternate PCM (GF-A-1) */
808c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_MIDI1		13	/* alternate midi - SYNTH */
818c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_DMMIDI1		14	/* alternate dmmidi - SYNTH */
828c2ecf20Sopenharmony_ci#define SNDRV_MINOR_OSS_RESERVED15	15	/* reserved for future use */
838c2ecf20Sopenharmony_ci
848c2ecf20Sopenharmony_ci#define SNDRV_OSS_DEVICE_TYPE_MIXER	0
858c2ecf20Sopenharmony_ci#define SNDRV_OSS_DEVICE_TYPE_SEQUENCER	1
868c2ecf20Sopenharmony_ci#define SNDRV_OSS_DEVICE_TYPE_PCM	2
878c2ecf20Sopenharmony_ci#define SNDRV_OSS_DEVICE_TYPE_MIDI	3
888c2ecf20Sopenharmony_ci#define SNDRV_OSS_DEVICE_TYPE_DMFM	4
898c2ecf20Sopenharmony_ci#define SNDRV_OSS_DEVICE_TYPE_SNDSTAT	5
908c2ecf20Sopenharmony_ci#define SNDRV_OSS_DEVICE_TYPE_MUSIC	6
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci#define MODULE_ALIAS_SNDRV_MINOR(type) \
938c2ecf20Sopenharmony_ci	MODULE_ALIAS("sound-service-?-" __stringify(type))
948c2ecf20Sopenharmony_ci
958c2ecf20Sopenharmony_ci#endif
968c2ecf20Sopenharmony_ci
978c2ecf20Sopenharmony_ci#endif /* __SOUND_MINORS_H */
98