linux/sound/isa/cmi8328.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Driver for C-Media CMI8328-based soundcards, such as AudioExcel AV500
 * Copyright (c) 2012 Ondrej Zary
 *
 * AudioExcel AV500 card consists of:
 *  - CMI8328 - main chip (SB Pro emulation, gameport, OPL3, MPU401, CD-ROM)
 *  - CS4231A - WSS codec
 *  - Dream SAM9233+GMS950400+RAM+ROM: Wavetable MIDI, connected to MPU401
 */

#include <linux/init.h>
#include <linux/isa.h>
#include <linux/module.h>
#include <linux/gameport.h>
#include <asm/dma.h>
#include <sound/core.h>
#include <sound/wss.h>
#include <sound/opl3.h>
#include <sound/mpu401.h>
#define SNDRV_LEGACY_FIND_FREE_IOPORT
#define SNDRV_LEGACY_FIND_FREE_IRQ
#define SNDRV_LEGACY_FIND_FREE_DMA
#include <sound/initval.h>

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

#if IS_ENABLED(CONFIG_GAMEPORT)
#define SUPPORT_JOYSTICK
#endif

/* I/O port is configured by jumpers on the card to one of these */
static const int cmi8328_ports[] =;
#define CMI8328_MAX

static int index[CMI8328_MAX] =;
static char *id[CMI8328_MAX] =;
static long port[CMI8328_MAX] =;
static int irq[CMI8328_MAX] =;
static int dma1[CMI8328_MAX] =;
static int dma2[CMI8328_MAX] =;
static long mpuport[CMI8328_MAX] =;
static int mpuirq[CMI8328_MAX] =;
#ifdef SUPPORT_JOYSTICK
static bool gameport[CMI8328_MAX] =;
#endif

module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();

module_param_hw_array(port, long, ioport, NULL, 0444);
MODULE_PARM_DESC();
module_param_hw_array(irq, int, irq, NULL, 0444);
MODULE_PARM_DESC();
module_param_hw_array(dma1, int, dma, NULL, 0444);
MODULE_PARM_DESC();
module_param_hw_array(dma2, int, dma, NULL, 0444);
MODULE_PARM_DESC();

module_param_hw_array(mpuport, long, ioport, NULL, 0444);
MODULE_PARM_DESC();
module_param_hw_array(mpuirq, int, irq, NULL, 0444);
MODULE_PARM_DESC();
#ifdef SUPPORT_JOYSTICK
module_param_array();
MODULE_PARM_DESC();
#endif

struct snd_cmi8328 {};

/* CMI8328 configuration registers */
#define CFG1
#define CFG1_SB_DISABLE
#define CFG1_GAMEPORT
/*
 * bit 0:    SB: 0=enabled, 1=disabled
 * bit 1:    gameport: 0=disabled, 1=enabled
 * bits 2-4: SB IRQ: 001=3, 010=5, 011=7, 100=9, 101=10, 110=11
 * bits 5-6: SB DMA: 00=disabled (when SB disabled), 01=DMA0, 10=DMA1, 11=DMA3
 * bit 7:    SB port: 0=0x220, 1=0x240
 */
#define CFG2
#define CFG2_MPU_ENABLE
/*
 * bits 0-1: CD-ROM mode: 00=disabled, 01=Panasonic, 10=Sony/Mitsumi/Wearnes,
			  11=IDE
 * bit 2:    MPU401: 0=disabled, 1=enabled
 * bits 3-4: MPU401 IRQ: 00=3, 01=5, 10=7, 11=9,
 * bits 5-7: MPU401 port: 000=0x300, 001=0x310, 010=0x320, 011=0x330, 100=0x332,
			  101=0x334, 110=0x336
 */
#define CFG3
/*
 * bits 0-2: CD-ROM IRQ: 000=disabled, 001=3, 010=5, 011=7, 100=9, 101=10,
			 110=11
 * bits 3-4: CD-ROM DMA: 00=disabled, 01=DMA0, 10=DMA1, 11=DMA3
 * bits 5-7: CD-ROM port: 000=0x300, 001=0x310, 010=0x320, 011=0x330, 100=0x340,
			  101=0x350, 110=0x360, 111=0x370
 */

static u8 snd_cmi8328_cfg_read(u16 port, u8 reg)
{}

static void snd_cmi8328_cfg_write(u16 port, u8 reg, u8 val)
{}

#ifdef CONFIG_PM
static void snd_cmi8328_cfg_save(u16 port, u8 cfg[])
{}

static void snd_cmi8328_cfg_restore(u16 port, u8 cfg[])
{}
#endif /* CONFIG_PM */

static int snd_cmi8328_mixer(struct snd_wss *chip)
{}

/* find index of an item in "-1"-ended array */
static int array_find(const int array[], int item)
{}
/* the same for long */
static int array_find_l(const long array[], long item)
{}

static int snd_cmi8328_probe(struct device *pdev, unsigned int ndev)
{}

static void snd_cmi8328_remove(struct device *pdev, unsigned int dev)
{}

#ifdef CONFIG_PM
static int snd_cmi8328_suspend(struct device *pdev, unsigned int n,
				pm_message_t state)
{}

static int snd_cmi8328_resume(struct device *pdev, unsigned int n)
{}
#endif

static struct isa_driver snd_cmi8328_driver =;

module_isa_driver(snd_cmi8328_driver, CMI8328_MAX);