Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) // SPDX-License-Identifier: GPL-2.0-or-later
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  *  Interface for OSS sequencer emulation
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  *  Copyright (C) 2000 Uros Bizjak <uros@kss-loka.si>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8) #include <linux/export.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9) #include "opl3_voice.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) static int snd_opl3_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) static int snd_opl3_close_seq_oss(struct snd_seq_oss_arg *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) static int snd_opl3_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd, unsigned long ioarg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) static int snd_opl3_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format, const char __user *buf, int offs, int count);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) static int snd_opl3_reset_seq_oss(struct snd_seq_oss_arg *arg);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) /* operators */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) static const struct snd_seq_oss_callback oss_callback = {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) 	.owner = 	THIS_MODULE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) 	.open =		snd_opl3_open_seq_oss,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 	.close =	snd_opl3_close_seq_oss,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) 	.ioctl =	snd_opl3_ioctl_seq_oss,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) 	.load_patch =	snd_opl3_load_patch_seq_oss,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 	.reset =	snd_opl3_reset_seq_oss,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) static int snd_opl3_oss_event_input(struct snd_seq_event *ev, int direct,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) 				    void *private_data, int atomic, int hop)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) 	struct snd_opl3 *opl3 = private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 	if (ev->type != SNDRV_SEQ_EVENT_OSS)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) 		snd_midi_process_event(&opl3_ops, ev, opl3->oss_chset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) /* ------------------------------ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) static void snd_opl3_oss_free_port(void *private_data)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 	struct snd_opl3 *opl3 = private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) 	snd_midi_channel_free_set(opl3->oss_chset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) static int snd_opl3_oss_create_port(struct snd_opl3 * opl3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	struct snd_seq_port_callback callbacks;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	char name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) 	int voices, opl_ver;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) 	voices = (opl3->hardware < OPL3_HW_OPL3) ?
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54) 		MAX_OPL2_VOICES : MAX_OPL3_VOICES;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55) 	opl3->oss_chset = snd_midi_channel_alloc_set(voices);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56) 	if (opl3->oss_chset == NULL)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57) 		return -ENOMEM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) 	opl3->oss_chset->private_data = opl3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	memset(&callbacks, 0, sizeof(callbacks));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) 	callbacks.owner = THIS_MODULE;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 	callbacks.event_input = snd_opl3_oss_event_input;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) 	callbacks.private_free = snd_opl3_oss_free_port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64) 	callbacks.private_data = opl3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66) 	opl_ver = (opl3->hardware & OPL3_HW_MASK) >> 8;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67) 	sprintf(name, "OPL%i OSS Port", opl_ver);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) 	opl3->oss_chset->client = opl3->seq_client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	opl3->oss_chset->port = snd_seq_event_port_attach(opl3->seq_client, &callbacks,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 							  SNDRV_SEQ_PORT_CAP_WRITE,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 							  SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 							  SNDRV_SEQ_PORT_TYPE_MIDI_GM |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 							  SNDRV_SEQ_PORT_TYPE_HARDWARE |
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 							  SNDRV_SEQ_PORT_TYPE_SYNTHESIZER,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 							  voices, voices,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 							  name);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	if (opl3->oss_chset->port < 0) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 		int port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 		port = opl3->oss_chset->port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 		snd_midi_channel_free_set(opl3->oss_chset);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 		return port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) /* ------------------------------ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) /* register OSS synth */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) void snd_opl3_init_seq_oss(struct snd_opl3 *opl3, char *name)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 	struct snd_seq_oss_reg *arg;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	struct snd_seq_device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	if (snd_seq_device_new(opl3->card, 0, SNDRV_SEQ_DEV_ID_OSS,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 			       sizeof(struct snd_seq_oss_reg), &dev) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 		return;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	opl3->oss_seq_dev = dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	strlcpy(dev->name, name, sizeof(dev->name));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	arg = SNDRV_SEQ_DEVICE_ARGPTR(dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	arg->type = SYNTH_TYPE_FM;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	if (opl3->hardware < OPL3_HW_OPL3) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 		arg->subtype = FM_TYPE_ADLIB;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) 		arg->nvoices = MAX_OPL2_VOICES;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 	} else {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) 		arg->subtype = FM_TYPE_OPL3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108) 		arg->nvoices = MAX_OPL3_VOICES;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	arg->oper = oss_callback;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	arg->private_data = opl3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	if (snd_opl3_oss_create_port(opl3)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 		/* register to OSS synth table */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 		snd_device_register(opl3->card, dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) /* unregister */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) void snd_opl3_free_seq_oss(struct snd_opl3 *opl3)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	if (opl3->oss_seq_dev) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 		/* The instance should have been released in prior */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 		opl3->oss_seq_dev = NULL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) /* ------------------------------ */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) /* open OSS sequencer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) static int snd_opl3_open_seq_oss(struct snd_seq_oss_arg *arg, void *closure)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	struct snd_opl3 *opl3 = closure;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	int err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	if (snd_BUG_ON(!arg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 		return -ENXIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	if ((err = snd_opl3_synth_setup(opl3)) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 		return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	/* fill the argument data */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	arg->private_data = opl3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	arg->addr.client = opl3->oss_chset->client;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	arg->addr.port = opl3->oss_chset->port;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 	if ((err = snd_opl3_synth_use_inc(opl3)) < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 		return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	opl3->synth_mode = SNDRV_OPL3_MODE_SYNTH;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) /* close OSS sequencer */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) static int snd_opl3_close_seq_oss(struct snd_seq_oss_arg *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	struct snd_opl3 *opl3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	if (snd_BUG_ON(!arg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 		return -ENXIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	opl3 = arg->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	snd_opl3_synth_cleanup(opl3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	snd_opl3_synth_use_dec(opl3);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) /* load patch */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) /* from sound_config.h */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) #define SBFM_MAXINSTR	256
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) static int snd_opl3_load_patch_seq_oss(struct snd_seq_oss_arg *arg, int format,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 				       const char __user *buf, int offs, int count)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	struct snd_opl3 *opl3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	struct sbi_instrument sbi;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	char name[32];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	int err, type;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 	if (snd_BUG_ON(!arg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 		return -ENXIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	opl3 = arg->private_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	if (format == FM_PATCH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 		type = FM_PATCH_OPL2;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	else if (format == OPL3_PATCH)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 		type = FM_PATCH_OPL3;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	if (count < (int)sizeof(sbi)) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 		snd_printk(KERN_ERR "FM Error: Patch record too short\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	if (copy_from_user(&sbi, buf, sizeof(sbi)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 		return -EFAULT;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	if (sbi.channel < 0 || sbi.channel >= SBFM_MAXINSTR) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 		snd_printk(KERN_ERR "FM Error: Invalid instrument number %d\n",
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 			   sbi.channel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 		return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	memset(name, 0, sizeof(name));
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	sprintf(name, "Chan%d", sbi.channel);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	err = snd_opl3_load_patch(opl3, sbi.channel, 127, type, name, NULL,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 				  sbi.operators);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 	if (err < 0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		return err;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	return sizeof(sbi);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) /* ioctl */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) static int snd_opl3_ioctl_seq_oss(struct snd_seq_oss_arg *arg, unsigned int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) 				  unsigned long ioarg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) 	if (snd_BUG_ON(!arg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) 		return -ENXIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) 	switch (cmd) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) 		case SNDCTL_FM_LOAD_INSTR:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) 			snd_printk(KERN_ERR "OPL3: "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) 				   "Obsolete ioctl(SNDCTL_FM_LOAD_INSTR) used. "
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 				   "Fix the program.\n");
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 			return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 		case SNDCTL_SYNTH_MEMAVL:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 			return 0x7fffffff;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 		case SNDCTL_FM_4OP_ENABLE:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 			// handled automatically by OPL instrument type
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) 			return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 		default:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) 			return -EINVAL;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) 	}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) /* reset device */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) static int snd_opl3_reset_seq_oss(struct snd_seq_oss_arg *arg)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 	if (snd_BUG_ON(!arg))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 		return -ENXIO;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) 	return 0;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) }