linux/sound/pci/emu10k1/emu10k1_main.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright (c) by Jaroslav Kysela <[email protected]>
 *                   James Courtier-Dutton <[email protected]>
 *                   Oswald Buddenhagen <[email protected]>
 *                   Creative Labs, Inc.
 *
 *  Routines for control of EMU10K1 chips
 */

#include <linux/sched.h>
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/iommu.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/mutex.h>


#include <sound/core.h>
#include <sound/emu10k1.h>
#include <linux/firmware.h>
#include "p16v.h"
#include "tina2.h"
#include "p17v.h"


#define HANA_FILENAME
#define DOCK_FILENAME
#define EMU1010B_FILENAME
#define MICRO_DOCK_FILENAME
#define EMU0404_FILENAME
#define EMU1010_NOTEBOOK_FILENAME

MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();


/*************************************************************************
 * EMU10K1 init / done
 *************************************************************************/

void snd_emu10k1_voice_init(struct snd_emu10k1 *emu, int ch)
{}

static const unsigned int spi_dac_init[] =;

static const unsigned int i2c_adc_init[][2] =;

static int snd_emu10k1_init(struct snd_emu10k1 *emu, int enable_ir)
{}

static void snd_emu10k1_audio_enable(struct snd_emu10k1 *emu)
{}

int snd_emu10k1_done(struct snd_emu10k1 *emu)
{}

/*************************************************************************
 * ECARD functional implementation
 *************************************************************************/

/* In A1 Silicon, these bits are in the HC register */
#define HOOKN_BIT
#define HANDN_BIT
#define PULSEN_BIT

#define EC_GDI1
#define EC_GDI0

#define EC_NUM_CONTROL_BITS

#define EC_AC3_DATA_SELN
#define EC_EE_DATA_SEL
#define EC_EE_CNTRL_SELN
#define EC_EECLK
#define EC_EECS
#define EC_EESDO
#define EC_TRIM_CSN
#define EC_TRIM_SCLK
#define EC_TRIM_SDATA
#define EC_TRIM_MUTEN
#define EC_ADCCAL
#define EC_ADCRSTN
#define EC_DACCAL
#define EC_DACMUTEN
#define EC_LEDN

#define EC_SPDIF0_SEL_SHIFT
#define EC_SPDIF1_SEL_SHIFT
#define EC_SPDIF0_SEL_MASK
#define EC_SPDIF1_SEL_MASK
#define EC_SPDIF0_SELECT(_x)
#define EC_SPDIF1_SELECT(_x)
#define EC_CURRENT_PROM_VERSION

#define EC_EEPROM_SIZE

/* Addresses for special values stored in to EEPROM */
#define EC_PROM_VERSION_ADDR
#define EC_BOARDREV0_ADDR
#define EC_BOARDREV1_ADDR

#define EC_LAST_PROMFILE_ADDR

#define EC_SERIALNUM_ADDR
#define EC_CHECKSUM_ADDR


/* Most of this stuff is pretty self-evident.  According to the hardware
 * dudes, we need to leave the ADCCAL bit low in order to avoid a DC
 * offset problem.  Weird.
 */
#define EC_RAW_RUN_MODE


#define EC_DEFAULT_ADC_GAIN
#define EC_DEFAULT_SPDIF0_SEL
#define EC_DEFAULT_SPDIF1_SEL

/**************************************************************************
 * @func Clock bits into the Ecard's control latch.  The Ecard uses a
 *  control latch will is loaded bit-serially by toggling the Modem control
 *  lines from function 2 on the E8010.  This function hides these details
 *  and presents the illusion that we are actually writing to a distinct
 *  register.
 */

static void snd_emu10k1_ecard_write(struct snd_emu10k1 *emu, unsigned int value)
{}

/**************************************************************************
 * @func Set the gain of the ECARD's CS3310 Trim/gain controller.  The
 * trim value consists of a 16bit value which is composed of two
 * 8 bit gain/trim values, one for the left channel and one for the
 * right channel.  The following table maps from the Gain/Attenuation
 * value in decibels into the corresponding bit pattern for a single
 * channel.
 */

static void snd_emu10k1_ecard_setadcgain(struct snd_emu10k1 *emu,
					 unsigned short gain)
{}

static int snd_emu10k1_ecard_init(struct snd_emu10k1 *emu)
{}

static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu)
{}

/* firmware file names, per model, init-fw and dock-fw (optional) */
static const char * const firmware_names[5][2] =;

static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, int dock,
				     const struct firmware **fw)
{}

static void snd_emu1010_load_dock_firmware(struct snd_emu10k1 *emu)
{}

static void emu1010_dock_event(struct snd_emu10k1 *emu)
{}

static void emu1010_clock_event(struct snd_emu10k1 *emu)
{}

static void emu1010_work(struct work_struct *work)
{}

static void emu1010_interrupt(struct snd_emu10k1 *emu)
{}

/*
 * Current status of the driver:
 * ----------------------------
 * 	* only 44.1/48kHz supported (the MS Win driver supports up to 192 kHz)
 * 	* PCM device nb. 2:
 *		16 x 16-bit playback - snd_emu10k1_fx8010_playback_ops
 * 		16 x 32-bit capture - snd_emu10k1_capture_efx_ops
 */
static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
{}
/*
 *  Create the EMU10K1 instance
 */

#ifdef CONFIG_PM_SLEEP
static int alloc_pm_buffer(struct snd_emu10k1 *emu);
static void free_pm_buffer(struct snd_emu10k1 *emu);
#endif

static void snd_emu10k1_free(struct snd_card *card)
{}

static const struct snd_emu_chip_details emu_chip_details[] =;

/*
 * The chip (at least the Audigy 2 CA0102 chip, but most likely others, too)
 * has a problem that from time to time it likes to do few DMA reads a bit
 * beyond its normal allocation and gets very confused if these reads get
 * blocked by a IOMMU.
 *
 * This behaviour has been observed for the first (reserved) page
 * (for which it happens multiple times at every playback), often for various
 * synth pages and sometimes for PCM playback buffers and the page table
 * memory itself.
 *
 * As a workaround let's widen these DMA allocations by an extra page if we
 * detect that the device is behind a non-passthrough IOMMU.
 */
static void snd_emu10k1_detect_iommu(struct snd_emu10k1 *emu)
{}

int snd_emu10k1_create(struct snd_card *card,
		       struct pci_dev *pci,
		       unsigned short extin_mask,
		       unsigned short extout_mask,
		       long max_cache_bytes,
		       int enable_ir,
		       uint subsystem)
{}

#ifdef CONFIG_PM_SLEEP
static const unsigned char saved_regs[] =;
static const unsigned char saved_regs_audigy[] =;

static int alloc_pm_buffer(struct snd_emu10k1 *emu)
{}

static void free_pm_buffer(struct snd_emu10k1 *emu)
{}

void snd_emu10k1_suspend_regs(struct snd_emu10k1 *emu)
{}

void snd_emu10k1_resume_init(struct snd_emu10k1 *emu)
{}

void snd_emu10k1_resume_regs(struct snd_emu10k1 *emu)
{}
#endif