11a59d1b8SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */ 21da177e4SLinus Torvalds #ifndef __SOUND_SEQ_DEVICE_H 31da177e4SLinus Torvalds #define __SOUND_SEQ_DEVICE_H 41da177e4SLinus Torvalds 51da177e4SLinus Torvalds /* 61da177e4SLinus Torvalds * ALSA sequencer device management 71da177e4SLinus Torvalds * Copyright (c) 1999 by Takashi Iwai <tiwai@suse.de> 81da177e4SLinus Torvalds */ 91da177e4SLinus Torvalds 101da177e4SLinus Torvalds /* 111da177e4SLinus Torvalds * registered device information 121da177e4SLinus Torvalds */ 131da177e4SLinus Torvalds 141da177e4SLinus Torvalds struct snd_seq_device { 151da177e4SLinus Torvalds /* device info */ 16c7e0b5bfSTakashi Iwai struct snd_card *card; /* sound card */ 171da177e4SLinus Torvalds int device; /* device number */ 18af03c243STakashi Iwai const char *id; /* driver id */ 191da177e4SLinus Torvalds char name[80]; /* device name */ 201da177e4SLinus Torvalds int argsize; /* size of the argument */ 211da177e4SLinus Torvalds void *driver_data; /* private data for driver */ 221da177e4SLinus Torvalds void *private_data; /* private data for the caller */ 23c7e0b5bfSTakashi Iwai void (*private_free)(struct snd_seq_device *device); 247c37ae5cSTakashi Iwai struct device dev; 251da177e4SLinus Torvalds }; 261da177e4SLinus Torvalds 277c37ae5cSTakashi Iwai #define to_seq_dev(_dev) \ 287c37ae5cSTakashi Iwai container_of(_dev, struct snd_seq_device, dev) 291da177e4SLinus Torvalds 3005662205STakashi Iwai /* sequencer driver */ 3105662205STakashi Iwai 321da177e4SLinus Torvalds /* driver operators 3305662205STakashi Iwai * probe: 341da177e4SLinus Torvalds * Initialize the device with given parameters. 351da177e4SLinus Torvalds * Typically, 361da177e4SLinus Torvalds * 1. call snd_hwdep_new 371da177e4SLinus Torvalds * 2. allocate private data and initialize it 381da177e4SLinus Torvalds * 3. call snd_hwdep_register 391da177e4SLinus Torvalds * 4. store the instance to dev->driver_data pointer. 401da177e4SLinus Torvalds * 4105662205STakashi Iwai * remove: 421da177e4SLinus Torvalds * Release the private data. 431da177e4SLinus Torvalds * Typically, call snd_device_free(dev->card, dev->driver_data) 441da177e4SLinus Torvalds */ 4505662205STakashi Iwai struct snd_seq_driver { 4605662205STakashi Iwai struct device_driver driver; 4705662205STakashi Iwai char *id; 4805662205STakashi Iwai int argsize; 491da177e4SLinus Torvalds }; 501da177e4SLinus Torvalds 5105662205STakashi Iwai #define to_seq_drv(_drv) \ 5205662205STakashi Iwai container_of(_drv, struct snd_seq_driver, driver) 5305662205STakashi Iwai 541da177e4SLinus Torvalds /* 551da177e4SLinus Torvalds * prototypes 561da177e4SLinus Torvalds */ 5772496edcSTakashi Iwai #ifdef CONFIG_MODULES 581da177e4SLinus Torvalds void snd_seq_device_load_drivers(void); 5972496edcSTakashi Iwai #else 6072496edcSTakashi Iwai #define snd_seq_device_load_drivers() 6172496edcSTakashi Iwai #endif 62af03c243STakashi Iwai int snd_seq_device_new(struct snd_card *card, int device, const char *id, 63af03c243STakashi Iwai int argsize, struct snd_seq_device **result); 641da177e4SLinus Torvalds 65c7e0b5bfSTakashi Iwai #define SNDRV_SEQ_DEVICE_ARGPTR(dev) (void *)((char *)(dev) + sizeof(struct snd_seq_device)) 661da177e4SLinus Torvalds 6705662205STakashi Iwai int __must_check __snd_seq_driver_register(struct snd_seq_driver *drv, 6805662205STakashi Iwai struct module *mod); 6905662205STakashi Iwai #define snd_seq_driver_register(drv) \ 7005662205STakashi Iwai __snd_seq_driver_register(drv, THIS_MODULE) 7105662205STakashi Iwai void snd_seq_driver_unregister(struct snd_seq_driver *drv); 7205662205STakashi Iwai 7305662205STakashi Iwai #define module_snd_seq_driver(drv) \ 7405662205STakashi Iwai module_driver(drv, snd_seq_driver_register, snd_seq_driver_unregister) 751da177e4SLinus Torvalds 761da177e4SLinus Torvalds /* 771da177e4SLinus Torvalds * id strings for generic devices 781da177e4SLinus Torvalds */ 791da177e4SLinus Torvalds #define SNDRV_SEQ_DEV_ID_MIDISYNTH "seq-midi" 801da177e4SLinus Torvalds #define SNDRV_SEQ_DEV_ID_OPL3 "opl3-synth" 81*81fd444aSTakashi Iwai #define SNDRV_SEQ_DEV_ID_UMP "seq-ump-client" 821da177e4SLinus Torvalds 831da177e4SLinus Torvalds #endif /* __SOUND_SEQ_DEVICE_H */ 84