Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbbbd674 authored by Clemens Ladisch's avatar Clemens Ladisch
Browse files

ALSA: oxygen: configure MIDI via device_config



To enable the MIDI port, model drivers must now set flags in
device_config, not only in misc_flags.  This allows model drivers to
enable the UART without creating an ALSA MIDI device.

Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
parent d76596b1
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
@@ -297,6 +297,7 @@ static int generic_probe(struct oxygen *chip, unsigned long driver_data)
					    CAPTURE_0_FROM_I2S_2 |
					    CAPTURE_0_FROM_I2S_2 |
					    CAPTURE_1_FROM_SPDIF;
					    CAPTURE_1_FROM_SPDIF;
		chip->model.misc_flags = OXYGEN_MISC_MIDI;
		chip->model.misc_flags = OXYGEN_MISC_MIDI;
		chip->model.device_config |= MIDI_OUTPUT | MIDI_INPUT;
	}
	}
	return 0;
	return 0;
}
}
+13 −8
Original line number Original line Diff line number Diff line
@@ -19,14 +19,19 @@
#define OXYGEN_IO_SIZE	0x100
#define OXYGEN_IO_SIZE	0x100


/* model-specific configuration of outputs/inputs */
/* model-specific configuration of outputs/inputs */
#define PLAYBACK_0_TO_I2S	0x001
#define PLAYBACK_0_TO_I2S	0x0001
#define PLAYBACK_1_TO_SPDIF	0x004
     /* PLAYBACK_0_TO_AC97_0		not implemented */
#define PLAYBACK_2_TO_AC97_1	0x008
#define PLAYBACK_1_TO_SPDIF	0x0004
#define CAPTURE_0_FROM_I2S_1	0x010
#define PLAYBACK_2_TO_AC97_1	0x0008
#define CAPTURE_0_FROM_I2S_2	0x020
#define CAPTURE_0_FROM_I2S_1	0x0010
#define CAPTURE_1_FROM_SPDIF	0x080
#define CAPTURE_0_FROM_I2S_2	0x0020
#define CAPTURE_2_FROM_I2S_2	0x100
     /* CAPTURE_0_FROM_AC97_0		not implemented */
#define CAPTURE_2_FROM_AC97_1	0x200
#define CAPTURE_1_FROM_SPDIF	0x0080
#define CAPTURE_2_FROM_I2S_2	0x0100
#define CAPTURE_2_FROM_AC97_1	0x0200
     /* CAPTURE_3_FROM_I2S_3		not implemented */
#define MIDI_OUTPUT		0x0800
#define MIDI_INPUT		0x1000


enum {
enum {
	CONTROL_SPDIF_PCM,
	CONTROL_SPDIF_PCM,
+7 −2
Original line number Original line Diff line number Diff line
@@ -502,10 +502,15 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
	if (err < 0)
	if (err < 0)
		goto err_card;
		goto err_card;


	if (chip->model.misc_flags & OXYGEN_MISC_MIDI) {
	if (chip->model.device_config & (MIDI_OUTPUT | MIDI_INPUT)) {
		unsigned int info_flags = MPU401_INFO_INTEGRATED;
		if (chip->model.device_config & MIDI_OUTPUT)
			info_flags |= MPU401_INFO_OUTPUT;
		if (chip->model.device_config & MIDI_INPUT)
			info_flags |= MPU401_INFO_INPUT;
		err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
		err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
					  chip->addr + OXYGEN_MPU401,
					  chip->addr + OXYGEN_MPU401,
					  MPU401_INFO_INTEGRATED, 0, 0,
					  info_flags, 0, 0,
					  &chip->midi);
					  &chip->midi);
		if (err < 0)
		if (err < 0)
			goto err_card;
			goto err_card;
+3 −1
Original line number Original line Diff line number Diff line
@@ -569,7 +569,9 @@ static const struct oxygen_model model_xonar_d2 = {
	.device_config = PLAYBACK_0_TO_I2S |
	.device_config = PLAYBACK_0_TO_I2S |
			 PLAYBACK_1_TO_SPDIF |
			 PLAYBACK_1_TO_SPDIF |
			 CAPTURE_0_FROM_I2S_2 |
			 CAPTURE_0_FROM_I2S_2 |
			 CAPTURE_1_FROM_SPDIF,
			 CAPTURE_1_FROM_SPDIF |
			 MIDI_OUTPUT |
			 MIDI_INPUT,
	.dac_channels = 8,
	.dac_channels = 8,
	.dac_volume_min = 0x0f,
	.dac_volume_min = 0x0f,
	.dac_volume_max = 0xff,
	.dac_volume_max = 0xff,