linux/sound/pci/emu10k1/p16v.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  Copyright (c) by James Courtier-Dutton <[email protected]>
 *  Driver p16v chips
 *  Version: 0.25
 *
 *  FEATURES currently supported:
 *    Output fixed at S32_LE, 2 channel to hw:0,0
 *    Rates: 44.1, 48, 96, 192.
 *
 *  Changelog:
 *  0.8
 *    Use separate card based buffer for periods table.
 *  0.9
 *    Use 2 channel output streams instead of 8 channel.
 *       (8 channel output streams might be good for ASIO type output)
 *    Corrected speaker output, so Front -> Front etc.
 *  0.10
 *    Fixed missed interrupts.
 *  0.11
 *    Add Sound card model number and names.
 *    Add Analog volume controls.
 *  0.12
 *    Corrected playback interrupts. Now interrupt per period, instead of half period.
 *  0.13
 *    Use single trigger for multichannel.
 *  0.14
 *    Mic capture now works at fixed: S32_LE, 96000Hz, Stereo.
 *  0.15
 *    Force buffer_size / period_size == INTEGER.
 *  0.16
 *    Update p16v.c to work with changed alsa api.
 *  0.17
 *    Update p16v.c to work with changed alsa api. Removed boot_devs.
 *  0.18
 *    Merging with snd-emu10k1 driver.
 *  0.19
 *    One stereo channel at 24bit now works.
 *  0.20
 *    Added better register defines.
 *  0.21
 *    Integrated with snd-emu10k1 driver.
 *  0.22
 *    Removed #if 0 ... #endif
 *  0.23
 *    Implement different capture rates.
 *  0.24
 *    Implement different capture source channels.
 *    e.g. When HD Capture source is set to SPDIF,
 *    setting HD Capture channel to 0 captures from CDROM digital input.
 *    setting HD Capture channel to 1 captures from SPDIF in.
 *  0.25
 *    Include capture buffer sizes.
 *
 *  BUGS:
 *    Some stability problems when unloading the snd-p16v kernel module.
 *    --
 *
 *  TODO:
 *    SPDIF out.
 *    Find out how to change capture sample rates. E.g. To record SPDIF at 48000Hz.
 *    Currently capture fixed at 48000Hz.
 *
 *    --
 *  GENERAL INFO:
 *    Model: SB0240
 *    P16V Chip: CA0151-DBS
 *    Audigy 2 Chip: CA0102-IAT
 *    AC97 Codec: STAC 9721
 *    ADC: Philips 1361T (Stereo 24bit)
 *    DAC: CS4382-K (8-channel, 24bit, 192Khz)
 *
 *  This code was initially based on code from ALSA's emu10k1x.c which is:
 *  Copyright (c) by Francisco Moraes <[email protected]>
 */
#include <linux/delay.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/moduleparam.h>
#include <sound/core.h>
#include <sound/initval.h>
#include <sound/pcm.h>
#include <sound/ac97_codec.h>
#include <sound/info.h>
#include <sound/tlv.h>
#include <sound/emu10k1.h>
#include "p16v.h"

#define SET_CHANNEL
#define PCM_FRONT_CHANNEL
#define PCM_REAR_CHANNEL
#define PCM_CENTER_LFE_CHANNEL
#define PCM_SIDE_CHANNEL
#define CONTROL_FRONT_CHANNEL
#define CONTROL_REAR_CHANNEL
#define CONTROL_CENTER_LFE_CHANNEL
#define CONTROL_SIDE_CHANNEL

/* Card IDs:
 * Class 0401: 1102:0004 (rev 04) Subsystem: 1102:2002 -> Audigy2 ZS 7.1 Model:SB0350
 * Class 0401: 1102:0004 (rev 04) Subsystem: 1102:1007 -> Audigy2 6.1    Model:SB0240
 * Class 0401: 1102:0004 (rev 04) Subsystem: 1102:1002 -> Audigy2 Platinum  Model:SB msb0240230009266
 * Class 0401: 1102:0004 (rev 04) Subsystem: 1102:2007 -> Audigy4 Pro Model:SB0380 M1SB0380472001901E
 *
 */

 /* hardware definition */
static const struct snd_pcm_hardware snd_p16v_playback_hw =;

static const struct snd_pcm_hardware snd_p16v_capture_hw =;

/* open_playback callback */
static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substream, int channel_id)
{}

/* open_capture callback */
static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream, int channel_id)
{}


/* close callback */
static int snd_p16v_pcm_close_playback(struct snd_pcm_substream *substream)
{}

/* close callback */
static int snd_p16v_pcm_close_capture(struct snd_pcm_substream *substream)
{}

static int snd_p16v_pcm_open_playback_front(struct snd_pcm_substream *substream)
{}

static int snd_p16v_pcm_open_capture(struct snd_pcm_substream *substream)
{}

static int snd_p16v_pcm_ioctl_playback(struct snd_pcm_substream *substream,
				       unsigned int cmd, void *arg)
{}

/* prepare playback callback */
static int snd_p16v_pcm_prepare_playback(struct snd_pcm_substream *substream)
{}

/* prepare capture callback */
static int snd_p16v_pcm_prepare_capture(struct snd_pcm_substream *substream)
{}

static void snd_p16v_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb)
{}

static void snd_p16v_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb)
{}

static void snd_p16v_interrupt(struct snd_emu10k1 *emu)
{}

/* trigger_playback callback */
static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream,
				    int cmd)
{}

/* trigger_capture callback */
static int snd_p16v_pcm_trigger_capture(struct snd_pcm_substream *substream,
                                   int cmd)
{}

/* pointer_playback callback */
static snd_pcm_uframes_t
snd_p16v_pcm_pointer_playback(struct snd_pcm_substream *substream)
{}

/* pointer_capture callback */
static snd_pcm_uframes_t
snd_p16v_pcm_pointer_capture(struct snd_pcm_substream *substream)
{}

/* operators */
static const struct snd_pcm_ops snd_p16v_playback_front_ops =;

static const struct snd_pcm_ops snd_p16v_capture_ops =;

int snd_p16v_pcm(struct snd_emu10k1 *emu, int device)
{}

static int snd_p16v_volume_info(struct snd_kcontrol *kcontrol,
				struct snd_ctl_elem_info *uinfo)
{}

static int snd_p16v_volume_get(struct snd_kcontrol *kcontrol,
			       struct snd_ctl_elem_value *ucontrol)
{}

static int snd_p16v_volume_put(struct snd_kcontrol *kcontrol,
			       struct snd_ctl_elem_value *ucontrol)
{}

static int snd_p16v_capture_source_info(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_info *uinfo)
{}

static int snd_p16v_capture_source_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{}

static int snd_p16v_capture_source_put(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{}

static int snd_p16v_capture_channel_info(struct snd_kcontrol *kcontrol,
					 struct snd_ctl_elem_info *uinfo)
{}

static int snd_p16v_capture_channel_get(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{}

static int snd_p16v_capture_channel_put(struct snd_kcontrol *kcontrol,
					struct snd_ctl_elem_value *ucontrol)
{}
static const DECLARE_TLV_DB_SCALE(snd_p16v_db_scale1, -5175, 25, 1);

#define P16V_VOL(xname,xreg,xhl)

static const struct snd_kcontrol_new p16v_mixer_controls[] =;


int snd_p16v_mixer(struct snd_emu10k1 *emu)
{}

#ifdef CONFIG_PM_SLEEP

#define NUM_CHS

int snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu)
{}

void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu)
{}

void snd_p16v_suspend(struct snd_emu10k1 *emu)
{}

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