2019-05-27 06:55:15 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
/*
|
|
|
|
* ALSA driver for Echoaudio soundcards.
|
|
|
|
* Copyright (C) 2003-2004 Giuliano Pochini <pochini@shiny.it>
|
2020-07-08 10:18:48 +00:00
|
|
|
* Copyright (C) 2020 Mark Hills <mark@xwax.org>
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
*/
|
|
|
|
|
2011-07-15 16:38:28 +00:00
|
|
|
#include <linux/module.h>
|
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
MODULE_AUTHOR("Giuliano Pochini <pochini@shiny.it>");
|
|
|
|
MODULE_LICENSE("GPL v2");
|
|
|
|
MODULE_DESCRIPTION("Echoaudio " ECHOCARD_NAME " soundcards driver");
|
|
|
|
MODULE_DEVICE_TABLE(pci, snd_echo_ids);
|
|
|
|
|
|
|
|
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
|
|
|
|
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
|
2011-12-15 03:19:36 +00:00
|
|
|
static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
module_param_array(index, int, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(index, "Index value for " ECHOCARD_NAME " soundcard.");
|
|
|
|
module_param_array(id, charp, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(id, "ID string for " ECHOCARD_NAME " soundcard.");
|
|
|
|
module_param_array(enable, bool, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(enable, "Enable " ECHOCARD_NAME " soundcard.");
|
|
|
|
|
2020-01-05 14:48:17 +00:00
|
|
|
static const unsigned int channels_list[10] = {1, 2, 4, 6, 8, 10, 12, 14, 16, 999999};
|
2007-01-29 14:33:49 +00:00
|
|
|
static const DECLARE_TLV_DB_SCALE(db_scale_output_gain, -12800, 100, 1);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2010-02-14 17:15:34 +00:00
|
|
|
|
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
static int get_firmware(const struct firmware **fw_entry,
|
2010-02-14 17:15:34 +00:00
|
|
|
struct echoaudio *chip, const short fw_index)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
{
|
|
|
|
int err;
|
|
|
|
char name[30];
|
2010-02-14 17:15:34 +00:00
|
|
|
|
2012-08-14 16:12:04 +00:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2010-02-14 17:15:51 +00:00
|
|
|
if (chip->fw_cache[fw_index]) {
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"firmware requested: %s is cached\n",
|
|
|
|
card_fw[fw_index].data);
|
2010-02-14 17:15:51 +00:00
|
|
|
*fw_entry = chip->fw_cache[fw_index];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"firmware requested: %s\n", card_fw[fw_index].data);
|
2010-02-14 17:15:51 +00:00
|
|
|
snprintf(name, sizeof(name), "ea/%s", card_fw[fw_index].data);
|
2018-05-24 09:20:06 +00:00
|
|
|
err = request_firmware(fw_entry, name, &chip->pci->dev);
|
2010-02-14 17:15:51 +00:00
|
|
|
if (err < 0)
|
2014-02-25 15:43:02 +00:00
|
|
|
dev_err(chip->card->dev,
|
|
|
|
"get_firmware(): Firmware not available (%d)\n", err);
|
2012-08-14 16:12:04 +00:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2010-02-14 17:15:51 +00:00
|
|
|
else
|
|
|
|
chip->fw_cache[fw_index] = *fw_entry;
|
|
|
|
#endif
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2010-02-14 17:15:34 +00:00
|
|
|
|
|
|
|
|
2014-11-03 10:34:12 +00:00
|
|
|
static void free_firmware(const struct firmware *fw_entry,
|
|
|
|
struct echoaudio *chip)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
{
|
2012-08-14 16:12:04 +00:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev, "firmware not released (kept in cache)\n");
|
2010-02-14 17:15:51 +00:00
|
|
|
#else
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
release_firmware(fw_entry);
|
2010-02-14 17:15:51 +00:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void free_firmware_cache(struct echoaudio *chip)
|
|
|
|
{
|
2012-08-14 16:12:04 +00:00
|
|
|
#ifdef CONFIG_PM_SLEEP
|
2010-02-14 17:15:51 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < 8 ; i++)
|
|
|
|
if (chip->fw_cache[i]) {
|
|
|
|
release_firmware(chip->fw_cache[i]);
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev, "release_firmware(%d)\n", i);
|
2010-02-14 17:15:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
PCM interface
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
static void audiopipe_free(struct snd_pcm_runtime *runtime)
|
|
|
|
{
|
|
|
|
struct audiopipe *pipe = runtime->private_data;
|
|
|
|
|
|
|
|
if (pipe->sgpage.area)
|
|
|
|
snd_dma_free_pages(&pipe->sgpage);
|
|
|
|
kfree(pipe);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int hw_rule_capture_format_by_channels(struct snd_pcm_hw_params *params,
|
|
|
|
struct snd_pcm_hw_rule *rule)
|
|
|
|
{
|
|
|
|
struct snd_interval *c = hw_param_interval(params,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS);
|
|
|
|
struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
|
|
|
struct snd_mask fmt;
|
|
|
|
|
|
|
|
snd_mask_any(&fmt);
|
|
|
|
|
|
|
|
#ifndef ECHOCARD_HAS_STEREO_BIG_ENDIAN32
|
|
|
|
/* >=2 channels cannot be S32_BE */
|
|
|
|
if (c->min == 2) {
|
|
|
|
fmt.bits[0] &= ~SNDRV_PCM_FMTBIT_S32_BE;
|
|
|
|
return snd_mask_refine(f, &fmt);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
/* > 2 channels cannot be U8 and S32_BE */
|
|
|
|
if (c->min > 2) {
|
|
|
|
fmt.bits[0] &= ~(SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S32_BE);
|
|
|
|
return snd_mask_refine(f, &fmt);
|
|
|
|
}
|
|
|
|
/* Mono is ok with any format */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int hw_rule_capture_channels_by_format(struct snd_pcm_hw_params *params,
|
|
|
|
struct snd_pcm_hw_rule *rule)
|
|
|
|
{
|
|
|
|
struct snd_interval *c = hw_param_interval(params,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS);
|
|
|
|
struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
|
|
|
struct snd_interval ch;
|
|
|
|
|
|
|
|
snd_interval_any(&ch);
|
|
|
|
|
|
|
|
/* S32_BE is mono (and stereo) only */
|
|
|
|
if (f->bits[0] == SNDRV_PCM_FMTBIT_S32_BE) {
|
|
|
|
ch.min = 1;
|
|
|
|
#ifdef ECHOCARD_HAS_STEREO_BIG_ENDIAN32
|
|
|
|
ch.max = 2;
|
|
|
|
#else
|
|
|
|
ch.max = 1;
|
|
|
|
#endif
|
|
|
|
ch.integer = 1;
|
|
|
|
return snd_interval_refine(c, &ch);
|
|
|
|
}
|
|
|
|
/* U8 can be only mono or stereo */
|
|
|
|
if (f->bits[0] == SNDRV_PCM_FMTBIT_U8) {
|
|
|
|
ch.min = 1;
|
|
|
|
ch.max = 2;
|
|
|
|
ch.integer = 1;
|
|
|
|
return snd_interval_refine(c, &ch);
|
|
|
|
}
|
|
|
|
/* S16_LE, S24_3LE and S32_LE support any number of channels. */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int hw_rule_playback_format_by_channels(struct snd_pcm_hw_params *params,
|
|
|
|
struct snd_pcm_hw_rule *rule)
|
|
|
|
{
|
|
|
|
struct snd_interval *c = hw_param_interval(params,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS);
|
|
|
|
struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
|
|
|
struct snd_mask fmt;
|
|
|
|
u64 fmask;
|
|
|
|
snd_mask_any(&fmt);
|
|
|
|
|
|
|
|
fmask = fmt.bits[0] + ((u64)fmt.bits[1] << 32);
|
|
|
|
|
|
|
|
/* >2 channels must be S16_LE, S24_3LE or S32_LE */
|
|
|
|
if (c->min > 2) {
|
|
|
|
fmask &= SNDRV_PCM_FMTBIT_S16_LE |
|
|
|
|
SNDRV_PCM_FMTBIT_S24_3LE |
|
|
|
|
SNDRV_PCM_FMTBIT_S32_LE;
|
|
|
|
/* 1 channel must be S32_BE or S32_LE */
|
|
|
|
} else if (c->max == 1)
|
|
|
|
fmask &= SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE;
|
|
|
|
#ifndef ECHOCARD_HAS_STEREO_BIG_ENDIAN32
|
|
|
|
/* 2 channels cannot be S32_BE */
|
|
|
|
else if (c->min == 2 && c->max == 2)
|
|
|
|
fmask &= ~SNDRV_PCM_FMTBIT_S32_BE;
|
|
|
|
#endif
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
fmt.bits[0] &= (u32)fmask;
|
|
|
|
fmt.bits[1] &= (u32)(fmask >> 32);
|
|
|
|
return snd_mask_refine(f, &fmt);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int hw_rule_playback_channels_by_format(struct snd_pcm_hw_params *params,
|
|
|
|
struct snd_pcm_hw_rule *rule)
|
|
|
|
{
|
|
|
|
struct snd_interval *c = hw_param_interval(params,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS);
|
|
|
|
struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
|
|
|
|
struct snd_interval ch;
|
|
|
|
u64 fmask;
|
|
|
|
|
|
|
|
snd_interval_any(&ch);
|
|
|
|
ch.integer = 1;
|
|
|
|
fmask = f->bits[0] + ((u64)f->bits[1] << 32);
|
|
|
|
|
|
|
|
/* S32_BE is mono (and stereo) only */
|
|
|
|
if (fmask == SNDRV_PCM_FMTBIT_S32_BE) {
|
|
|
|
ch.min = 1;
|
|
|
|
#ifdef ECHOCARD_HAS_STEREO_BIG_ENDIAN32
|
|
|
|
ch.max = 2;
|
|
|
|
#else
|
|
|
|
ch.max = 1;
|
|
|
|
#endif
|
|
|
|
/* U8 is stereo only */
|
|
|
|
} else if (fmask == SNDRV_PCM_FMTBIT_U8)
|
|
|
|
ch.min = ch.max = 2;
|
|
|
|
/* S16_LE and S24_3LE must be at least stereo */
|
|
|
|
else if (!(fmask & ~(SNDRV_PCM_FMTBIT_S16_LE |
|
|
|
|
SNDRV_PCM_FMTBIT_S24_3LE)))
|
|
|
|
ch.min = 2;
|
|
|
|
else
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return snd_interval_refine(c, &ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Since the sample rate is a global setting, do allow the user to change the
|
|
|
|
sample rate only if there is only one pcm device open. */
|
|
|
|
static int hw_rule_sample_rate(struct snd_pcm_hw_params *params,
|
|
|
|
struct snd_pcm_hw_rule *rule)
|
|
|
|
{
|
|
|
|
struct snd_interval *rate = hw_param_interval(params,
|
|
|
|
SNDRV_PCM_HW_PARAM_RATE);
|
|
|
|
struct echoaudio *chip = rule->private;
|
|
|
|
struct snd_interval fixed;
|
2020-07-08 10:18:45 +00:00
|
|
|
int err;
|
|
|
|
|
|
|
|
mutex_lock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2020-07-08 10:18:45 +00:00
|
|
|
if (chip->can_set_rate) {
|
|
|
|
err = 0;
|
|
|
|
} else {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
snd_interval_any(&fixed);
|
|
|
|
fixed.min = fixed.max = chip->sample_rate;
|
2020-07-08 10:18:45 +00:00
|
|
|
err = snd_interval_refine(rate, &fixed);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
2020-07-08 10:18:45 +00:00
|
|
|
|
|
|
|
mutex_unlock(&chip->mode_mutex);
|
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int pcm_open(struct snd_pcm_substream *substream,
|
|
|
|
signed char max_channels)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
struct snd_pcm_runtime *runtime;
|
|
|
|
struct audiopipe *pipe;
|
|
|
|
int err, i;
|
|
|
|
|
|
|
|
if (max_channels <= 0)
|
|
|
|
return -EAGAIN;
|
|
|
|
|
|
|
|
chip = snd_pcm_substream_chip(substream);
|
|
|
|
runtime = substream->runtime;
|
|
|
|
|
2006-07-25 13:28:03 +00:00
|
|
|
pipe = kzalloc(sizeof(struct audiopipe), GFP_KERNEL);
|
|
|
|
if (!pipe)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return -ENOMEM;
|
|
|
|
pipe->index = -1; /* Not configured yet */
|
|
|
|
|
|
|
|
/* Set up hw capabilities and contraints */
|
|
|
|
memcpy(&pipe->hw, &pcm_hardware_skel, sizeof(struct snd_pcm_hardware));
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev, "max_channels=%d\n", max_channels);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
pipe->constr.list = channels_list;
|
|
|
|
pipe->constr.mask = 0;
|
|
|
|
for (i = 0; channels_list[i] <= max_channels; i++);
|
|
|
|
pipe->constr.count = i;
|
|
|
|
if (pipe->hw.channels_max > max_channels)
|
|
|
|
pipe->hw.channels_max = max_channels;
|
|
|
|
if (chip->digital_mode == DIGITAL_MODE_ADAT) {
|
|
|
|
pipe->hw.rate_max = 48000;
|
|
|
|
pipe->hw.rates &= SNDRV_PCM_RATE_8000_48000;
|
|
|
|
}
|
|
|
|
|
|
|
|
runtime->hw = pipe->hw;
|
|
|
|
runtime->private_data = pipe;
|
|
|
|
runtime->private_free = audiopipe_free;
|
|
|
|
snd_pcm_set_sync(substream);
|
|
|
|
|
|
|
|
/* Only mono and any even number of channels are allowed */
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_constraint_list(runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS,
|
|
|
|
&pipe->constr);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
|
|
|
|
/* All periods should have the same size */
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_constraint_integer(runtime,
|
|
|
|
SNDRV_PCM_HW_PARAM_PERIODS);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
|
|
|
|
/* The hw accesses memory in chunks 32 frames long and they should be
|
|
|
|
32-bytes-aligned. It's not a requirement, but it seems that IRQs are
|
|
|
|
generated with a resolution of 32 frames. Thus we need the following */
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_constraint_step(runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 32);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_constraint_step(runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_BUFFER_SIZE, 32);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_rule_add(substream->runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_RATE,
|
|
|
|
hw_rule_sample_rate, chip,
|
|
|
|
SNDRV_PCM_HW_PARAM_RATE, -1);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
|
2020-07-08 10:18:45 +00:00
|
|
|
/* Allocate a page for the scatter-gather list */
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV,
|
|
|
|
&chip->pci->dev,
|
|
|
|
PAGE_SIZE, &pipe->sgpage);
|
|
|
|
if (err < 0) {
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_err(chip->card->dev, "s-g list allocation failed\n");
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2020-07-08 10:18:45 +00:00
|
|
|
/*
|
|
|
|
* Sole ownership required to set the rate
|
|
|
|
*/
|
|
|
|
|
|
|
|
dev_dbg(chip->card->dev, "pcm_open opencount=%d can_set_rate=%d, rate_set=%d",
|
|
|
|
chip->opencount, chip->can_set_rate, chip->rate_set);
|
|
|
|
|
|
|
|
chip->opencount++;
|
|
|
|
if (chip->opencount > 1 && chip->rate_set)
|
|
|
|
chip->can_set_rate = 0;
|
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int pcm_analog_in_open(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
|
|
|
int err;
|
|
|
|
|
2021-06-08 14:05:13 +00:00
|
|
|
err = pcm_open(substream,
|
|
|
|
num_analog_busses_in(chip) - substream->number);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_rule_add(substream->runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS,
|
|
|
|
hw_rule_capture_channels_by_format, NULL,
|
|
|
|
SNDRV_PCM_HW_PARAM_FORMAT, -1);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_rule_add(substream->runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_FORMAT,
|
|
|
|
hw_rule_capture_format_by_channels, NULL,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS, -1);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
2020-07-08 10:18:45 +00:00
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int pcm_analog_out_open(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
|
|
|
int max_channels, err;
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_VMIXER
|
|
|
|
max_channels = num_pipes_out(chip);
|
|
|
|
#else
|
|
|
|
max_channels = num_analog_busses_out(chip);
|
|
|
|
#endif
|
2021-06-08 14:05:13 +00:00
|
|
|
err = pcm_open(substream, max_channels - substream->number);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_rule_add(substream->runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS,
|
|
|
|
hw_rule_playback_channels_by_format,
|
|
|
|
NULL,
|
|
|
|
SNDRV_PCM_HW_PARAM_FORMAT, -1);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_rule_add(substream->runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_FORMAT,
|
|
|
|
hw_rule_playback_format_by_channels,
|
|
|
|
NULL,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS, -1);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
2020-07-08 10:18:45 +00:00
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_IO
|
|
|
|
|
|
|
|
static int pcm_digital_in_open(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
|
|
|
int err, max_channels;
|
|
|
|
|
|
|
|
max_channels = num_digital_busses_in(chip) - substream->number;
|
2007-12-03 16:08:40 +00:00
|
|
|
mutex_lock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
if (chip->digital_mode == DIGITAL_MODE_ADAT)
|
|
|
|
err = pcm_open(substream, max_channels);
|
|
|
|
else /* If the card has ADAT, subtract the 6 channels
|
|
|
|
* that S/PDIF doesn't have
|
|
|
|
*/
|
|
|
|
err = pcm_open(substream, max_channels - ECHOCARD_HAS_ADAT);
|
|
|
|
|
|
|
|
if (err < 0)
|
|
|
|
goto din_exit;
|
|
|
|
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_rule_add(substream->runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS,
|
|
|
|
hw_rule_capture_channels_by_format, NULL,
|
|
|
|
SNDRV_PCM_HW_PARAM_FORMAT, -1);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
goto din_exit;
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_rule_add(substream->runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_FORMAT,
|
|
|
|
hw_rule_capture_format_by_channels, NULL,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS, -1);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
goto din_exit;
|
|
|
|
|
|
|
|
din_exit:
|
2007-12-03 16:08:40 +00:00
|
|
|
mutex_unlock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ECHOCARD_HAS_VMIXER /* See the note in snd_echo_new_pcm() */
|
|
|
|
|
|
|
|
static int pcm_digital_out_open(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
|
|
|
int err, max_channels;
|
|
|
|
|
|
|
|
max_channels = num_digital_busses_out(chip) - substream->number;
|
2007-12-03 16:08:40 +00:00
|
|
|
mutex_lock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
if (chip->digital_mode == DIGITAL_MODE_ADAT)
|
|
|
|
err = pcm_open(substream, max_channels);
|
|
|
|
else /* If the card has ADAT, subtract the 6 channels
|
|
|
|
* that S/PDIF doesn't have
|
|
|
|
*/
|
|
|
|
err = pcm_open(substream, max_channels - ECHOCARD_HAS_ADAT);
|
|
|
|
|
|
|
|
if (err < 0)
|
|
|
|
goto dout_exit;
|
|
|
|
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_rule_add(substream->runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_CHANNELS,
|
|
|
|
hw_rule_playback_channels_by_format,
|
|
|
|
NULL, SNDRV_PCM_HW_PARAM_FORMAT,
|
|
|
|
-1);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
goto dout_exit;
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_hw_rule_add(substream->runtime, 0,
|
|
|
|
SNDRV_PCM_HW_PARAM_FORMAT,
|
|
|
|
hw_rule_playback_format_by_channels,
|
|
|
|
NULL, SNDRV_PCM_HW_PARAM_CHANNELS,
|
|
|
|
-1);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
goto dout_exit;
|
2020-07-08 10:18:45 +00:00
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
dout_exit:
|
2007-12-03 16:08:40 +00:00
|
|
|
mutex_unlock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* !ECHOCARD_HAS_VMIXER */
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_DIGITAL_IO */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int pcm_close(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
|
|
|
|
|
|
|
/* Nothing to do here. Audio is already off and pipe will be
|
|
|
|
* freed by its callback
|
|
|
|
*/
|
|
|
|
|
2020-07-08 10:18:45 +00:00
|
|
|
mutex_lock(&chip->mode_mutex);
|
|
|
|
|
|
|
|
dev_dbg(chip->card->dev, "pcm_open opencount=%d can_set_rate=%d, rate_set=%d",
|
|
|
|
chip->opencount, chip->can_set_rate, chip->rate_set);
|
|
|
|
|
|
|
|
chip->opencount--;
|
|
|
|
|
|
|
|
switch (chip->opencount) {
|
|
|
|
case 1:
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
chip->can_set_rate = 1;
|
2020-07-08 10:18:45 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case 0:
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
chip->rate_set = 0;
|
2020-07-08 10:18:45 +00:00
|
|
|
break;
|
|
|
|
}
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2020-07-08 10:18:45 +00:00
|
|
|
mutex_unlock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Channel allocation and scatter-gather list setup */
|
|
|
|
static int init_engine(struct snd_pcm_substream *substream,
|
|
|
|
struct snd_pcm_hw_params *hw_params,
|
|
|
|
int pipe_index, int interleave)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int err, per, rest, page, edge, offs;
|
|
|
|
struct audiopipe *pipe;
|
|
|
|
|
|
|
|
chip = snd_pcm_substream_chip(substream);
|
|
|
|
pipe = (struct audiopipe *) substream->runtime->private_data;
|
|
|
|
|
|
|
|
/* Sets up che hardware. If it's already initialized, reset and
|
|
|
|
* redo with the new parameters
|
|
|
|
*/
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
if (pipe->index >= 0) {
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev, "hwp_ie free(%d)\n", pipe->index);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
err = free_pipes(chip, pipe);
|
2008-08-08 15:12:14 +00:00
|
|
|
snd_BUG_ON(err);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
chip->substream[pipe->index] = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
err = allocate_pipes(chip, pipe, pipe_index, interleave);
|
|
|
|
if (err < 0) {
|
|
|
|
spin_unlock_irq(&chip->lock);
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_err(chip->card->dev, "allocate_pipes(%d) err=%d\n",
|
|
|
|
pipe_index, err);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
spin_unlock_irq(&chip->lock);
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev, "allocate_pipes()=%d\n", pipe_index);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"pcm_hw_params (bufsize=%dB periods=%d persize=%dB)\n",
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
params_buffer_bytes(hw_params), params_periods(hw_params),
|
2014-11-03 10:34:13 +00:00
|
|
|
params_period_bytes(hw_params));
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
sglist_init(chip, pipe);
|
|
|
|
edge = PAGE_SIZE;
|
|
|
|
for (offs = page = per = 0; offs < params_buffer_bytes(hw_params);
|
|
|
|
per++) {
|
|
|
|
rest = params_period_bytes(hw_params);
|
|
|
|
if (offs + rest > params_buffer_bytes(hw_params))
|
|
|
|
rest = params_buffer_bytes(hw_params) - offs;
|
|
|
|
while (rest) {
|
2008-08-21 11:00:13 +00:00
|
|
|
dma_addr_t addr;
|
|
|
|
addr = snd_pcm_sgbuf_get_addr(substream, offs);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
if (rest <= edge - offs) {
|
2008-08-21 11:00:13 +00:00
|
|
|
sglist_add_mapping(chip, pipe, addr, rest);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
sglist_add_irq(chip, pipe);
|
|
|
|
offs += rest;
|
|
|
|
rest = 0;
|
|
|
|
} else {
|
2008-08-21 11:00:13 +00:00
|
|
|
sglist_add_mapping(chip, pipe, addr,
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
edge - offs);
|
|
|
|
rest -= edge - offs;
|
|
|
|
offs = edge;
|
|
|
|
}
|
|
|
|
if (offs == edge) {
|
|
|
|
edge += PAGE_SIZE;
|
|
|
|
page++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Close the ring buffer */
|
|
|
|
sglist_wrap(chip, pipe);
|
|
|
|
|
|
|
|
/* This stuff is used by the irq handler, so it must be
|
|
|
|
* initialized before chip->substream
|
|
|
|
*/
|
2020-07-08 10:18:48 +00:00
|
|
|
pipe->last_period = 0;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
pipe->last_counter = 0;
|
|
|
|
pipe->position = 0;
|
|
|
|
smp_wmb();
|
|
|
|
chip->substream[pipe_index] = substream;
|
|
|
|
chip->rate_set = 1;
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
set_sample_rate(chip, hw_params->rate_num / hw_params->rate_den);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int pcm_analog_in_hw_params(struct snd_pcm_substream *substream,
|
|
|
|
struct snd_pcm_hw_params *hw_params)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
|
|
|
|
|
|
|
return init_engine(substream, hw_params, px_analog_in(chip) +
|
|
|
|
substream->number, params_channels(hw_params));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int pcm_analog_out_hw_params(struct snd_pcm_substream *substream,
|
|
|
|
struct snd_pcm_hw_params *hw_params)
|
|
|
|
{
|
|
|
|
return init_engine(substream, hw_params, substream->number,
|
|
|
|
params_channels(hw_params));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_IO
|
|
|
|
|
|
|
|
static int pcm_digital_in_hw_params(struct snd_pcm_substream *substream,
|
|
|
|
struct snd_pcm_hw_params *hw_params)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
|
|
|
|
|
|
|
return init_engine(substream, hw_params, px_digital_in(chip) +
|
|
|
|
substream->number, params_channels(hw_params));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef ECHOCARD_HAS_VMIXER /* See the note in snd_echo_new_pcm() */
|
|
|
|
static int pcm_digital_out_hw_params(struct snd_pcm_substream *substream,
|
|
|
|
struct snd_pcm_hw_params *hw_params)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
|
|
|
|
|
|
|
return init_engine(substream, hw_params, px_digital_out(chip) +
|
|
|
|
substream->number, params_channels(hw_params));
|
|
|
|
}
|
|
|
|
#endif /* !ECHOCARD_HAS_VMIXER */
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_DIGITAL_IO */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int pcm_hw_free(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
struct audiopipe *pipe;
|
|
|
|
|
|
|
|
chip = snd_pcm_substream_chip(substream);
|
|
|
|
pipe = (struct audiopipe *) substream->runtime->private_data;
|
|
|
|
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
if (pipe->index >= 0) {
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev, "pcm_hw_free(%d)\n", pipe->index);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
free_pipes(chip, pipe);
|
|
|
|
chip->substream[pipe->index] = NULL;
|
|
|
|
pipe->index = -1;
|
|
|
|
}
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int pcm_prepare(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
|
|
|
struct audioformat format;
|
|
|
|
int pipe_index = ((struct audiopipe *)runtime->private_data)->index;
|
|
|
|
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev, "Prepare rate=%d format=%d channels=%d\n",
|
|
|
|
runtime->rate, runtime->format, runtime->channels);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
format.interleave = runtime->channels;
|
|
|
|
format.data_are_bigendian = 0;
|
|
|
|
format.mono_to_stereo = 0;
|
|
|
|
switch (runtime->format) {
|
|
|
|
case SNDRV_PCM_FORMAT_U8:
|
|
|
|
format.bits_per_sample = 8;
|
|
|
|
break;
|
|
|
|
case SNDRV_PCM_FORMAT_S16_LE:
|
|
|
|
format.bits_per_sample = 16;
|
|
|
|
break;
|
|
|
|
case SNDRV_PCM_FORMAT_S24_3LE:
|
|
|
|
format.bits_per_sample = 24;
|
|
|
|
break;
|
|
|
|
case SNDRV_PCM_FORMAT_S32_BE:
|
|
|
|
format.data_are_bigendian = 1;
|
2020-07-08 20:32:36 +00:00
|
|
|
fallthrough;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
case SNDRV_PCM_FORMAT_S32_LE:
|
|
|
|
format.bits_per_sample = 32;
|
|
|
|
break;
|
|
|
|
default:
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_err(chip->card->dev,
|
|
|
|
"Prepare error: unsupported format %d\n",
|
|
|
|
runtime->format);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
2008-08-08 15:12:14 +00:00
|
|
|
if (snd_BUG_ON(pipe_index >= px_num(chip)))
|
|
|
|
return -EINVAL;
|
2020-07-08 10:18:46 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* We passed checks we can do independently; now take
|
|
|
|
* exclusive control
|
|
|
|
*/
|
|
|
|
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
|
|
|
|
if (snd_BUG_ON(!is_pipe_allocated(chip, pipe_index))) {
|
2020-07-13 10:53:24 +00:00
|
|
|
spin_unlock_irq(&chip->lock);
|
2008-08-08 15:12:14 +00:00
|
|
|
return -EINVAL;
|
2020-07-08 10:18:46 +00:00
|
|
|
}
|
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
set_audio_format(chip, pipe_index, &format);
|
2020-07-08 10:18:46 +00:00
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int pcm_trigger(struct snd_pcm_substream *substream, int cmd)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_pcm_substream_chip(substream);
|
2018-03-12 15:01:00 +00:00
|
|
|
struct audiopipe *pipe;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
int i, err;
|
|
|
|
u32 channelmask = 0;
|
|
|
|
struct snd_pcm_substream *s;
|
|
|
|
|
2007-02-22 11:52:53 +00:00
|
|
|
snd_pcm_group_for_each_entry(s, substream) {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
for (i = 0; i < DSP_MAXPIPES; i++) {
|
|
|
|
if (s == chip->substream[i]) {
|
|
|
|
channelmask |= 1 << i;
|
|
|
|
snd_pcm_trigger_done(s, substream);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_lock(&chip->lock);
|
|
|
|
switch (cmd) {
|
2010-02-14 17:16:10 +00:00
|
|
|
case SNDRV_PCM_TRIGGER_RESUME:
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
case SNDRV_PCM_TRIGGER_START:
|
|
|
|
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
|
|
|
|
for (i = 0; i < DSP_MAXPIPES; i++) {
|
|
|
|
if (channelmask & (1 << i)) {
|
|
|
|
pipe = chip->substream[i]->runtime->private_data;
|
|
|
|
switch (pipe->state) {
|
|
|
|
case PIPE_STATE_STOPPED:
|
2020-07-08 10:18:48 +00:00
|
|
|
pipe->last_period = 0;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
pipe->last_counter = 0;
|
|
|
|
pipe->position = 0;
|
|
|
|
*pipe->dma_counter = 0;
|
2020-07-08 20:32:36 +00:00
|
|
|
fallthrough;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
case PIPE_STATE_PAUSED:
|
|
|
|
pipe->state = PIPE_STATE_STARTED;
|
|
|
|
break;
|
|
|
|
case PIPE_STATE_STARTED:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
err = start_transport(chip, channelmask,
|
|
|
|
chip->pipe_cyclic_mask);
|
|
|
|
break;
|
2010-02-14 17:16:10 +00:00
|
|
|
case SNDRV_PCM_TRIGGER_SUSPEND:
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
case SNDRV_PCM_TRIGGER_STOP:
|
|
|
|
for (i = 0; i < DSP_MAXPIPES; i++) {
|
|
|
|
if (channelmask & (1 << i)) {
|
|
|
|
pipe = chip->substream[i]->runtime->private_data;
|
|
|
|
pipe->state = PIPE_STATE_STOPPED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
err = stop_transport(chip, channelmask);
|
|
|
|
break;
|
|
|
|
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
|
|
|
|
for (i = 0; i < DSP_MAXPIPES; i++) {
|
|
|
|
if (channelmask & (1 << i)) {
|
|
|
|
pipe = chip->substream[i]->runtime->private_data;
|
|
|
|
pipe->state = PIPE_STATE_PAUSED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
err = pause_transport(chip, channelmask);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
err = -EINVAL;
|
|
|
|
}
|
|
|
|
spin_unlock(&chip->lock);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static snd_pcm_uframes_t pcm_pointer(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
|
|
|
struct audiopipe *pipe = runtime->private_data;
|
2020-07-08 10:18:48 +00:00
|
|
|
u32 counter, step;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2020-07-08 10:18:48 +00:00
|
|
|
/*
|
|
|
|
* IRQ handling runs concurrently. Do not share tracking of
|
|
|
|
* counter with it, which would race or require locking
|
|
|
|
*/
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2020-07-08 10:18:48 +00:00
|
|
|
counter = le32_to_cpu(*pipe->dma_counter); /* presumed atomic */
|
|
|
|
|
|
|
|
step = counter - pipe->last_counter; /* handles wrapping */
|
|
|
|
pipe->last_counter = counter;
|
|
|
|
|
|
|
|
/* counter doesn't neccessarily wrap on a multiple of
|
|
|
|
* buffer_size, so can't derive the position; must
|
|
|
|
* accumulate */
|
|
|
|
|
|
|
|
pipe->position += step;
|
|
|
|
pipe->position %= frames_to_bytes(runtime, runtime->buffer_size); /* wrap */
|
|
|
|
|
|
|
|
return bytes_to_frames(runtime, pipe->position);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* pcm *_ops structures */
|
2017-08-10 11:47:34 +00:00
|
|
|
static const struct snd_pcm_ops analog_playback_ops = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.open = pcm_analog_out_open,
|
|
|
|
.close = pcm_close,
|
|
|
|
.hw_params = pcm_analog_out_hw_params,
|
|
|
|
.hw_free = pcm_hw_free,
|
|
|
|
.prepare = pcm_prepare,
|
|
|
|
.trigger = pcm_trigger,
|
|
|
|
.pointer = pcm_pointer,
|
|
|
|
};
|
2017-08-10 11:47:34 +00:00
|
|
|
static const struct snd_pcm_ops analog_capture_ops = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.open = pcm_analog_in_open,
|
|
|
|
.close = pcm_close,
|
|
|
|
.hw_params = pcm_analog_in_hw_params,
|
|
|
|
.hw_free = pcm_hw_free,
|
|
|
|
.prepare = pcm_prepare,
|
|
|
|
.trigger = pcm_trigger,
|
|
|
|
.pointer = pcm_pointer,
|
|
|
|
};
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_IO
|
|
|
|
#ifndef ECHOCARD_HAS_VMIXER
|
2017-08-10 11:47:34 +00:00
|
|
|
static const struct snd_pcm_ops digital_playback_ops = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.open = pcm_digital_out_open,
|
|
|
|
.close = pcm_close,
|
|
|
|
.hw_params = pcm_digital_out_hw_params,
|
|
|
|
.hw_free = pcm_hw_free,
|
|
|
|
.prepare = pcm_prepare,
|
|
|
|
.trigger = pcm_trigger,
|
|
|
|
.pointer = pcm_pointer,
|
|
|
|
};
|
|
|
|
#endif /* !ECHOCARD_HAS_VMIXER */
|
2017-08-10 11:47:34 +00:00
|
|
|
static const struct snd_pcm_ops digital_capture_ops = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.open = pcm_digital_in_open,
|
|
|
|
.close = pcm_close,
|
|
|
|
.hw_params = pcm_digital_in_hw_params,
|
|
|
|
.hw_free = pcm_hw_free,
|
|
|
|
.prepare = pcm_prepare,
|
|
|
|
.trigger = pcm_trigger,
|
|
|
|
.pointer = pcm_pointer,
|
|
|
|
};
|
|
|
|
#endif /* ECHOCARD_HAS_DIGITAL_IO */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Preallocate memory only for the first substream because it's the most
|
|
|
|
* used one
|
|
|
|
*/
|
2019-11-05 15:18:52 +00:00
|
|
|
static void snd_echo_preallocate_pages(struct snd_pcm *pcm, struct device *dev)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
{
|
|
|
|
struct snd_pcm_substream *ss;
|
2019-02-04 15:32:09 +00:00
|
|
|
int stream;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
for (stream = 0; stream < 2; stream++)
|
2019-02-04 15:32:09 +00:00
|
|
|
for (ss = pcm->streams[stream].substream; ss; ss = ss->next)
|
2019-12-09 09:49:06 +00:00
|
|
|
snd_pcm_set_managed_buffer(ss, SNDRV_DMA_TYPE_DEV_SG,
|
|
|
|
dev,
|
|
|
|
ss->number ? 0 : 128<<10,
|
|
|
|
256<<10);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*<--snd_echo_probe() */
|
2012-12-06 17:35:10 +00:00
|
|
|
static int snd_echo_new_pcm(struct echoaudio *chip)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
{
|
|
|
|
struct snd_pcm *pcm;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_VMIXER
|
|
|
|
/* This card has a Vmixer, that is there is no direct mapping from PCM
|
|
|
|
streams to physical outputs. The user can mix the streams as he wishes
|
|
|
|
via control interface and it's possible to send any stream to any
|
|
|
|
output, thus it makes no sense to keep analog and digital outputs
|
|
|
|
separated */
|
|
|
|
|
|
|
|
/* PCM#0 Virtual outputs and analog inputs */
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_new(chip->card, "PCM", 0, num_pipes_out(chip),
|
|
|
|
num_analog_busses_in(chip), &pcm);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
pcm->private_data = chip;
|
|
|
|
chip->analog_pcm = pcm;
|
|
|
|
strcpy(pcm->name, chip->card->shortname);
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &analog_playback_ops);
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &analog_capture_ops);
|
2019-11-05 15:18:52 +00:00
|
|
|
snd_echo_preallocate_pages(pcm, &chip->pci->dev);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_IO
|
|
|
|
/* PCM#1 Digital inputs, no outputs */
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_new(chip->card, "Digital PCM", 1, 0,
|
|
|
|
num_digital_busses_in(chip), &pcm);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
pcm->private_data = chip;
|
|
|
|
chip->digital_pcm = pcm;
|
|
|
|
strcpy(pcm->name, chip->card->shortname);
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &digital_capture_ops);
|
2019-11-05 15:18:52 +00:00
|
|
|
snd_echo_preallocate_pages(pcm, &chip->pci->dev);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif /* ECHOCARD_HAS_DIGITAL_IO */
|
|
|
|
|
|
|
|
#else /* ECHOCARD_HAS_VMIXER */
|
|
|
|
|
|
|
|
/* The card can manage substreams formed by analog and digital channels
|
|
|
|
at the same time, but I prefer to keep analog and digital channels
|
|
|
|
separated, because that mixed thing is confusing and useless. So we
|
|
|
|
register two PCM devices: */
|
|
|
|
|
|
|
|
/* PCM#0 Analog i/o */
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_new(chip->card, "Analog PCM", 0,
|
|
|
|
num_analog_busses_out(chip),
|
|
|
|
num_analog_busses_in(chip), &pcm);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
pcm->private_data = chip;
|
|
|
|
chip->analog_pcm = pcm;
|
|
|
|
strcpy(pcm->name, chip->card->shortname);
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &analog_playback_ops);
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &analog_capture_ops);
|
2019-11-05 15:18:52 +00:00
|
|
|
snd_echo_preallocate_pages(pcm, &chip->pci->dev);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_IO
|
|
|
|
/* PCM#1 Digital i/o */
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_pcm_new(chip->card, "Digital PCM", 1,
|
|
|
|
num_digital_busses_out(chip),
|
|
|
|
num_digital_busses_in(chip), &pcm);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
pcm->private_data = chip;
|
|
|
|
chip->digital_pcm = pcm;
|
|
|
|
strcpy(pcm->name, chip->card->shortname);
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &digital_playback_ops);
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &digital_capture_ops);
|
2019-11-05 15:18:52 +00:00
|
|
|
snd_echo_preallocate_pages(pcm, &chip->pci->dev);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif /* ECHOCARD_HAS_DIGITAL_IO */
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_VMIXER */
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
Control interface
|
|
|
|
******************************************************************************/
|
|
|
|
|
2009-09-30 06:26:45 +00:00
|
|
|
#if !defined(ECHOCARD_HAS_VMIXER) || defined(ECHOCARD_HAS_LINE_OUT_GAIN)
|
2009-03-15 20:33:34 +00:00
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
/******************* PCM output volume *******************/
|
|
|
|
static int snd_echo_output_gain_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
|
|
|
uinfo->count = num_busses_out(chip);
|
|
|
|
uinfo->value.integer.min = ECHOGAIN_MINOUT;
|
|
|
|
uinfo->value.integer.max = ECHOGAIN_MAXOUT;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_output_gain_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
for (c = 0; c < num_busses_out(chip); c++)
|
|
|
|
ucontrol->value.integer.value[c] = chip->output_gain[c];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int c, changed, gain;
|
|
|
|
|
|
|
|
changed = 0;
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
for (c = 0; c < num_busses_out(chip); c++) {
|
|
|
|
gain = ucontrol->value.integer.value[c];
|
|
|
|
/* Ignore out of range values */
|
|
|
|
if (gain < ECHOGAIN_MINOUT || gain > ECHOGAIN_MAXOUT)
|
|
|
|
continue;
|
|
|
|
if (chip->output_gain[c] != gain) {
|
|
|
|
set_output_gain(chip, c, gain);
|
|
|
|
changed = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changed)
|
|
|
|
update_output_line_level(chip);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2009-09-30 06:26:45 +00:00
|
|
|
#ifdef ECHOCARD_HAS_LINE_OUT_GAIN
|
|
|
|
/* On the Mia this one controls the line-out volume */
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_line_output_gain = {
|
2009-09-30 06:26:45 +00:00
|
|
|
.name = "Line Playback Volume",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
|
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
|
|
|
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
|
|
|
.info = snd_echo_output_gain_info,
|
|
|
|
.get = snd_echo_output_gain_get,
|
|
|
|
.put = snd_echo_output_gain_put,
|
|
|
|
.tlv = {.p = db_scale_output_gain},
|
|
|
|
};
|
|
|
|
#else
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_pcm_output_gain = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "PCM Playback Volume",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
2006-11-24 12:03:58 +00:00
|
|
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.info = snd_echo_output_gain_info,
|
|
|
|
.get = snd_echo_output_gain_get,
|
|
|
|
.put = snd_echo_output_gain_put,
|
2006-11-24 12:03:58 +00:00
|
|
|
.tlv = {.p = db_scale_output_gain},
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2009-09-30 06:26:45 +00:00
|
|
|
#endif /* !ECHOCARD_HAS_VMIXER || ECHOCARD_HAS_LINE_OUT_GAIN */
|
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_INPUT_GAIN
|
|
|
|
|
|
|
|
/******************* Analog input volume *******************/
|
|
|
|
static int snd_echo_input_gain_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
|
|
|
uinfo->count = num_analog_busses_in(chip);
|
|
|
|
uinfo->value.integer.min = ECHOGAIN_MININP;
|
|
|
|
uinfo->value.integer.max = ECHOGAIN_MAXINP;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_input_gain_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
for (c = 0; c < num_analog_busses_in(chip); c++)
|
|
|
|
ucontrol->value.integer.value[c] = chip->input_gain[c];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_input_gain_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int c, gain, changed;
|
|
|
|
|
|
|
|
changed = 0;
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
for (c = 0; c < num_analog_busses_in(chip); c++) {
|
|
|
|
gain = ucontrol->value.integer.value[c];
|
|
|
|
/* Ignore out of range values */
|
|
|
|
if (gain < ECHOGAIN_MININP || gain > ECHOGAIN_MAXINP)
|
|
|
|
continue;
|
|
|
|
if (chip->input_gain[c] != gain) {
|
|
|
|
set_input_gain(chip, c, gain);
|
|
|
|
changed = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changed)
|
|
|
|
update_input_line_level(chip);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2007-01-29 14:33:49 +00:00
|
|
|
static const DECLARE_TLV_DB_SCALE(db_scale_input_gain, -2500, 50, 0);
|
2006-11-24 12:03:58 +00:00
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_line_input_gain = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "Line Capture Volume",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
2006-11-24 12:03:58 +00:00
|
|
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.info = snd_echo_input_gain_info,
|
|
|
|
.get = snd_echo_input_gain_get,
|
|
|
|
.put = snd_echo_input_gain_put,
|
2006-11-24 12:03:58 +00:00
|
|
|
.tlv = {.p = db_scale_input_gain},
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_INPUT_GAIN */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL
|
|
|
|
|
|
|
|
/************ Analog output nominal level (+4dBu / -10dBV) ***************/
|
|
|
|
static int snd_echo_output_nominal_info (struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
|
|
|
|
uinfo->count = num_analog_busses_out(chip);
|
|
|
|
uinfo->value.integer.min = 0;
|
|
|
|
uinfo->value.integer.max = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_output_nominal_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
for (c = 0; c < num_analog_busses_out(chip); c++)
|
|
|
|
ucontrol->value.integer.value[c] = chip->nominal_level[c];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_output_nominal_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int c, changed;
|
|
|
|
|
|
|
|
changed = 0;
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
for (c = 0; c < num_analog_busses_out(chip); c++) {
|
|
|
|
if (chip->nominal_level[c] != ucontrol->value.integer.value[c]) {
|
|
|
|
set_nominal_level(chip, c,
|
|
|
|
ucontrol->value.integer.value[c]);
|
|
|
|
changed = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changed)
|
|
|
|
update_output_line_level(chip);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_output_nominal_level = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "Line Playback Switch (-10dBV)",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
|
|
.info = snd_echo_output_nominal_info,
|
|
|
|
.get = snd_echo_output_nominal_get,
|
|
|
|
.put = snd_echo_output_nominal_put,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_INPUT_NOMINAL_LEVEL
|
|
|
|
|
|
|
|
/*************** Analog input nominal level (+4dBu / -10dBV) ***************/
|
|
|
|
static int snd_echo_input_nominal_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
|
|
|
|
uinfo->count = num_analog_busses_in(chip);
|
|
|
|
uinfo->value.integer.min = 0;
|
|
|
|
uinfo->value.integer.max = 1;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_input_nominal_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int c;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
for (c = 0; c < num_analog_busses_in(chip); c++)
|
|
|
|
ucontrol->value.integer.value[c] =
|
|
|
|
chip->nominal_level[bx_analog_in(chip) + c];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_input_nominal_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int c, changed;
|
|
|
|
|
|
|
|
changed = 0;
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
for (c = 0; c < num_analog_busses_in(chip); c++) {
|
|
|
|
if (chip->nominal_level[bx_analog_in(chip) + c] !=
|
|
|
|
ucontrol->value.integer.value[c]) {
|
|
|
|
set_nominal_level(chip, bx_analog_in(chip) + c,
|
|
|
|
ucontrol->value.integer.value[c]);
|
|
|
|
changed = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (changed)
|
|
|
|
update_output_line_level(chip); /* "Output" is not a mistake
|
|
|
|
* here.
|
|
|
|
*/
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_intput_nominal_level = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "Line Capture Switch (-10dBV)",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
|
|
|
.info = snd_echo_input_nominal_info,
|
|
|
|
.get = snd_echo_input_nominal_get,
|
|
|
|
.put = snd_echo_input_nominal_put,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_INPUT_NOMINAL_LEVEL */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_MONITOR
|
|
|
|
|
|
|
|
/******************* Monitor mixer *******************/
|
|
|
|
static int snd_echo_mixer_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
|
|
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
2017-09-26 00:11:49 +00:00
|
|
|
uinfo->count = 1;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
uinfo->value.integer.min = ECHOGAIN_MINOUT;
|
|
|
|
uinfo->value.integer.max = ECHOGAIN_MAXOUT;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_mixer_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
2015-03-23 09:41:31 +00:00
|
|
|
struct echoaudio *chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
unsigned int out = ucontrol->id.index / num_busses_in(chip);
|
|
|
|
unsigned int in = ucontrol->id.index % num_busses_in(chip);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2015-03-23 09:41:31 +00:00
|
|
|
if (out >= ECHO_MAXAUDIOOUTPUTS || in >= ECHO_MAXAUDIOINPUTS)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
ucontrol->value.integer.value[0] = chip->monitor_gain[out][in];
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_mixer_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int changed, gain;
|
2015-03-23 09:41:31 +00:00
|
|
|
unsigned int out, in;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
changed = 0;
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
out = ucontrol->id.index / num_busses_in(chip);
|
|
|
|
in = ucontrol->id.index % num_busses_in(chip);
|
2015-03-23 09:41:31 +00:00
|
|
|
if (out >= ECHO_MAXAUDIOOUTPUTS || in >= ECHO_MAXAUDIOINPUTS)
|
|
|
|
return -EINVAL;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
gain = ucontrol->value.integer.value[0];
|
|
|
|
if (gain < ECHOGAIN_MINOUT || gain > ECHOGAIN_MAXOUT)
|
|
|
|
return -EINVAL;
|
|
|
|
if (chip->monitor_gain[out][in] != gain) {
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
set_monitor_gain(chip, out, in, gain);
|
|
|
|
update_output_line_level(chip);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
changed = 1;
|
|
|
|
}
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2012-12-06 17:35:10 +00:00
|
|
|
static struct snd_kcontrol_new snd_echo_monitor_mixer = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "Monitor Mixer Volume",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
2006-11-24 12:03:58 +00:00
|
|
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.info = snd_echo_mixer_info,
|
|
|
|
.get = snd_echo_mixer_get,
|
|
|
|
.put = snd_echo_mixer_put,
|
2006-11-24 12:03:58 +00:00
|
|
|
.tlv = {.p = db_scale_output_gain},
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_MONITOR */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_VMIXER
|
|
|
|
|
|
|
|
/******************* Vmixer *******************/
|
|
|
|
static int snd_echo_vmixer_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
|
|
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
2017-09-26 00:11:49 +00:00
|
|
|
uinfo->count = 1;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
uinfo->value.integer.min = ECHOGAIN_MINOUT;
|
|
|
|
uinfo->value.integer.max = ECHOGAIN_MAXOUT;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_vmixer_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
ucontrol->value.integer.value[0] =
|
|
|
|
chip->vmixer_gain[ucontrol->id.index / num_pipes_out(chip)]
|
|
|
|
[ucontrol->id.index % num_pipes_out(chip)];
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_vmixer_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int gain, changed;
|
|
|
|
short vch, out;
|
|
|
|
|
|
|
|
changed = 0;
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
out = ucontrol->id.index / num_pipes_out(chip);
|
|
|
|
vch = ucontrol->id.index % num_pipes_out(chip);
|
|
|
|
gain = ucontrol->value.integer.value[0];
|
|
|
|
if (gain < ECHOGAIN_MINOUT || gain > ECHOGAIN_MAXOUT)
|
|
|
|
return -EINVAL;
|
|
|
|
if (chip->vmixer_gain[out][vch] != ucontrol->value.integer.value[0]) {
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
set_vmixer_gain(chip, out, vch, ucontrol->value.integer.value[0]);
|
|
|
|
update_vmixer_level(chip);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
changed = 1;
|
|
|
|
}
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2012-12-06 17:35:10 +00:00
|
|
|
static struct snd_kcontrol_new snd_echo_vmixer = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "VMixer Volume",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
2006-11-24 12:03:58 +00:00
|
|
|
.access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.info = snd_echo_vmixer_info,
|
|
|
|
.get = snd_echo_vmixer_get,
|
|
|
|
.put = snd_echo_vmixer_put,
|
2006-11-24 12:03:58 +00:00
|
|
|
.tlv = {.p = db_scale_output_gain},
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_VMIXER */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_MODE_SWITCH
|
|
|
|
|
|
|
|
/******************* Digital mode switch *******************/
|
|
|
|
static int snd_echo_digital_mode_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
2014-10-20 16:16:38 +00:00
|
|
|
static const char * const names[4] = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
"S/PDIF Coaxial", "S/PDIF Optical", "ADAT Optical",
|
|
|
|
"S/PDIF Cdrom"
|
|
|
|
};
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
2014-10-20 16:16:38 +00:00
|
|
|
return snd_ctl_enum_info(uinfo, 1, chip->num_digital_modes, names);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_digital_mode_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int i, mode;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
mode = chip->digital_mode;
|
|
|
|
for (i = chip->num_digital_modes - 1; i >= 0; i--)
|
|
|
|
if (mode == chip->digital_mode_list[i]) {
|
|
|
|
ucontrol->value.enumerated.item[0] = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_digital_mode_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int changed;
|
|
|
|
unsigned short emode, dmode;
|
|
|
|
|
|
|
|
changed = 0;
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
|
|
|
|
emode = ucontrol->value.enumerated.item[0];
|
|
|
|
if (emode >= chip->num_digital_modes)
|
|
|
|
return -EINVAL;
|
|
|
|
dmode = chip->digital_mode_list[emode];
|
|
|
|
|
|
|
|
if (dmode != chip->digital_mode) {
|
|
|
|
/* mode_mutex is required to make this operation atomic wrt
|
|
|
|
pcm_digital_*_open() and set_input_clock() functions. */
|
2007-12-03 16:08:40 +00:00
|
|
|
mutex_lock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
/* Do not allow the user to change the digital mode when a pcm
|
|
|
|
device is open because it also changes the number of channels
|
|
|
|
and the allowed sample rates */
|
2020-07-08 10:18:45 +00:00
|
|
|
if (chip->opencount) {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
changed = -EAGAIN;
|
|
|
|
} else {
|
|
|
|
changed = set_digital_mode(chip, dmode);
|
|
|
|
/* If we had to change the clock source, report it */
|
|
|
|
if (changed > 0 && chip->clock_src_ctl) {
|
|
|
|
snd_ctl_notify(chip->card,
|
|
|
|
SNDRV_CTL_EVENT_MASK_VALUE,
|
|
|
|
&chip->clock_src_ctl->id);
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"SDM() =%d\n", changed);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
if (changed >= 0)
|
|
|
|
changed = 1; /* No errors */
|
|
|
|
}
|
2007-12-03 16:08:40 +00:00
|
|
|
mutex_unlock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_digital_mode_switch = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "Digital mode Switch",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
|
|
|
|
.info = snd_echo_digital_mode_info,
|
|
|
|
.get = snd_echo_digital_mode_get,
|
|
|
|
.put = snd_echo_digital_mode_put,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_DIGITAL_MODE_SWITCH */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_IO
|
|
|
|
|
|
|
|
/******************* S/PDIF mode switch *******************/
|
|
|
|
static int snd_echo_spdif_mode_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
2014-10-20 16:16:38 +00:00
|
|
|
static const char * const names[2] = {"Consumer", "Professional"};
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2014-10-20 16:16:38 +00:00
|
|
|
return snd_ctl_enum_info(uinfo, 1, 2, names);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_spdif_mode_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
ucontrol->value.enumerated.item[0] = !!chip->professional_spdif;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_spdif_mode_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int mode;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
mode = !!ucontrol->value.enumerated.item[0];
|
|
|
|
if (mode != chip->professional_spdif) {
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
set_professional_spdif(chip, mode);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_spdif_mode_switch = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "S/PDIF mode Switch",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
|
|
|
|
.info = snd_echo_spdif_mode_info,
|
|
|
|
.get = snd_echo_spdif_mode_get,
|
|
|
|
.put = snd_echo_spdif_mode_put,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_DIGITAL_IO */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_EXTERNAL_CLOCK
|
|
|
|
|
|
|
|
/******************* Select input clock source *******************/
|
|
|
|
static int snd_echo_clock_source_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
2014-10-20 16:16:38 +00:00
|
|
|
static const char * const names[8] = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
"Internal", "Word", "Super", "S/PDIF", "ADAT", "ESync",
|
|
|
|
"ESync96", "MTC"
|
|
|
|
};
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
2014-10-20 16:16:38 +00:00
|
|
|
return snd_ctl_enum_info(uinfo, 1, chip->num_clock_sources, names);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_clock_source_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int i, clock;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
clock = chip->input_clock;
|
|
|
|
|
|
|
|
for (i = 0; i < chip->num_clock_sources; i++)
|
|
|
|
if (clock == chip->clock_source_list[i])
|
|
|
|
ucontrol->value.enumerated.item[0] = i;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_clock_source_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int changed;
|
|
|
|
unsigned int eclock, dclock;
|
|
|
|
|
|
|
|
changed = 0;
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
eclock = ucontrol->value.enumerated.item[0];
|
|
|
|
if (eclock >= chip->input_clock_types)
|
|
|
|
return -EINVAL;
|
|
|
|
dclock = chip->clock_source_list[eclock];
|
|
|
|
if (chip->input_clock != dclock) {
|
2007-12-03 16:08:40 +00:00
|
|
|
mutex_lock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
spin_lock_irq(&chip->lock);
|
2021-06-08 14:05:13 +00:00
|
|
|
changed = set_input_clock(chip, dclock);
|
|
|
|
if (!changed)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
changed = 1; /* no errors */
|
|
|
|
spin_unlock_irq(&chip->lock);
|
2007-12-03 16:08:40 +00:00
|
|
|
mutex_unlock(&chip->mode_mutex);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (changed < 0)
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"seticlk val%d err 0x%x\n", dclock, changed);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_clock_source_switch = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "Sample Clock Source",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_PCM,
|
|
|
|
.info = snd_echo_clock_source_info,
|
|
|
|
.get = snd_echo_clock_source_get,
|
|
|
|
.put = snd_echo_clock_source_put,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_EXTERNAL_CLOCK */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_PHANTOM_POWER
|
|
|
|
|
|
|
|
/******************* Phantom power switch *******************/
|
2007-07-23 13:42:26 +00:00
|
|
|
#define snd_echo_phantom_power_info snd_ctl_boolean_mono_info
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
static int snd_echo_phantom_power_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
|
|
|
|
ucontrol->value.integer.value[0] = chip->phantom_power;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_phantom_power_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
int power, changed = 0;
|
|
|
|
|
|
|
|
power = !!ucontrol->value.integer.value[0];
|
|
|
|
if (chip->phantom_power != power) {
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
changed = set_phantom_power(chip, power);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
if (changed == 0)
|
|
|
|
changed = 1; /* no errors */
|
|
|
|
}
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_phantom_power_switch = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "Phantom power Switch",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
|
|
|
|
.info = snd_echo_phantom_power_info,
|
|
|
|
.get = snd_echo_phantom_power_get,
|
|
|
|
.put = snd_echo_phantom_power_put,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_PHANTOM_POWER */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE
|
|
|
|
|
|
|
|
/******************* Digital input automute switch *******************/
|
2007-07-23 13:42:26 +00:00
|
|
|
#define snd_echo_automute_info snd_ctl_boolean_mono_info
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
static int snd_echo_automute_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
|
|
|
|
ucontrol->value.integer.value[0] = chip->digital_in_automute;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_automute_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
int automute, changed = 0;
|
|
|
|
|
|
|
|
automute = !!ucontrol->value.integer.value[0];
|
|
|
|
if (chip->digital_in_automute != automute) {
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
changed = set_input_auto_mute(chip, automute);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
if (changed == 0)
|
|
|
|
changed = 1; /* no errors */
|
|
|
|
}
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_automute_switch = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "Digital Capture Switch (automute)",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
|
|
|
|
.info = snd_echo_automute_info,
|
|
|
|
.get = snd_echo_automute_get,
|
|
|
|
.put = snd_echo_automute_put,
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************* VU-meters switch *******************/
|
2007-07-23 13:42:26 +00:00
|
|
|
#define snd_echo_vumeters_switch_info snd_ctl_boolean_mono_info
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
static int snd_echo_vumeters_switch_put(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
set_meters_on(chip, ucontrol->value.integer.value[0]);
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_vumeters_switch = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "VU-meters Switch",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_CARD,
|
|
|
|
.access = SNDRV_CTL_ELEM_ACCESS_WRITE,
|
|
|
|
.info = snd_echo_vumeters_switch_info,
|
|
|
|
.put = snd_echo_vumeters_switch_put,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***** Read VU-meters (input, output, analog and digital together) *****/
|
|
|
|
static int snd_echo_vumeters_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
|
|
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
2017-09-26 00:11:49 +00:00
|
|
|
uinfo->count = 96;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
uinfo->value.integer.min = ECHOGAIN_MINOUT;
|
|
|
|
uinfo->value.integer.max = 0;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_vumeters_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
get_audio_meters(chip, ucontrol->value.integer.value);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_vumeters = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "VU-meters",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
2006-11-24 12:03:58 +00:00
|
|
|
.access = SNDRV_CTL_ELEM_ACCESS_READ |
|
|
|
|
SNDRV_CTL_ELEM_ACCESS_VOLATILE |
|
|
|
|
SNDRV_CTL_ELEM_ACCESS_TLV_READ,
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.info = snd_echo_vumeters_info,
|
|
|
|
.get = snd_echo_vumeters_get,
|
2006-11-24 12:03:58 +00:00
|
|
|
.tlv = {.p = db_scale_output_gain},
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*** Channels info - it exports informations about the number of channels ***/
|
|
|
|
static int snd_echo_channels_info_info(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_info *uinfo)
|
|
|
|
{
|
|
|
|
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
|
|
|
|
uinfo->count = 6;
|
|
|
|
uinfo->value.integer.min = 0;
|
|
|
|
uinfo->value.integer.max = 1 << ECHO_CLOCK_NUMBER;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int snd_echo_channels_info_get(struct snd_kcontrol *kcontrol,
|
|
|
|
struct snd_ctl_elem_value *ucontrol)
|
|
|
|
{
|
|
|
|
struct echoaudio *chip;
|
|
|
|
int detected, clocks, bit, src;
|
|
|
|
|
|
|
|
chip = snd_kcontrol_chip(kcontrol);
|
|
|
|
ucontrol->value.integer.value[0] = num_busses_in(chip);
|
|
|
|
ucontrol->value.integer.value[1] = num_analog_busses_in(chip);
|
|
|
|
ucontrol->value.integer.value[2] = num_busses_out(chip);
|
|
|
|
ucontrol->value.integer.value[3] = num_analog_busses_out(chip);
|
|
|
|
ucontrol->value.integer.value[4] = num_pipes_out(chip);
|
|
|
|
|
|
|
|
/* Compute the bitmask of the currently valid input clocks */
|
|
|
|
detected = detect_input_clocks(chip);
|
|
|
|
clocks = 0;
|
|
|
|
src = chip->num_clock_sources - 1;
|
|
|
|
for (bit = ECHO_CLOCK_NUMBER - 1; bit >= 0; bit--)
|
|
|
|
if (detected & (1 << bit))
|
|
|
|
for (; src >= 0; src--)
|
|
|
|
if (bit == chip->clock_source_list[src]) {
|
|
|
|
clocks |= 1 << src;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ucontrol->value.integer.value[5] = clocks;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2017-02-19 18:48:09 +00:00
|
|
|
static const struct snd_kcontrol_new snd_echo_channels_info = {
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.name = "Channels info",
|
|
|
|
.iface = SNDRV_CTL_ELEM_IFACE_HWDEP,
|
|
|
|
.access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
|
|
|
|
.info = snd_echo_channels_info_info,
|
|
|
|
.get = snd_echo_channels_info_get,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
2020-07-08 10:18:48 +00:00
|
|
|
IRQ Handling
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
******************************************************************************/
|
2020-07-08 10:18:48 +00:00
|
|
|
/* Check if a period has elapsed since last interrupt
|
|
|
|
*
|
|
|
|
* Don't make any updates to state; PCM core handles this with the
|
|
|
|
* correct locks.
|
|
|
|
*
|
|
|
|
* \return true if a period has elapsed, otherwise false
|
|
|
|
*/
|
|
|
|
static bool period_has_elapsed(struct snd_pcm_substream *substream)
|
|
|
|
{
|
|
|
|
struct snd_pcm_runtime *runtime = substream->runtime;
|
|
|
|
struct audiopipe *pipe = runtime->private_data;
|
|
|
|
u32 counter, step;
|
|
|
|
size_t period_bytes;
|
|
|
|
|
|
|
|
if (pipe->state != PIPE_STATE_STARTED)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
period_bytes = frames_to_bytes(runtime, runtime->period_size);
|
|
|
|
|
|
|
|
counter = le32_to_cpu(*pipe->dma_counter); /* presumed atomic */
|
|
|
|
|
|
|
|
step = counter - pipe->last_period; /* handles wrapping */
|
|
|
|
step -= step % period_bytes; /* acknowledge whole periods only */
|
|
|
|
|
|
|
|
if (step == 0)
|
|
|
|
return false; /* haven't advanced a whole period yet */
|
|
|
|
|
|
|
|
pipe->last_period += step; /* used exclusively by us */
|
|
|
|
return true;
|
|
|
|
}
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 13:55:46 +00:00
|
|
|
static irqreturn_t snd_echo_interrupt(int irq, void *dev_id)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
{
|
|
|
|
struct echoaudio *chip = dev_id;
|
2020-07-08 10:18:48 +00:00
|
|
|
int ss, st;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
spin_lock(&chip->lock);
|
|
|
|
st = service_irq(chip);
|
|
|
|
if (st < 0) {
|
|
|
|
spin_unlock(&chip->lock);
|
|
|
|
return IRQ_NONE;
|
|
|
|
}
|
|
|
|
/* The hardware doesn't tell us which substream caused the irq,
|
|
|
|
thus we have to check all running substreams. */
|
|
|
|
for (ss = 0; ss < DSP_MAXPIPES; ss++) {
|
2020-07-08 10:18:48 +00:00
|
|
|
struct snd_pcm_substream *substream;
|
|
|
|
|
2010-02-16 23:57:44 +00:00
|
|
|
substream = chip->substream[ss];
|
2020-07-08 10:18:48 +00:00
|
|
|
if (substream && period_has_elapsed(substream)) {
|
|
|
|
spin_unlock(&chip->lock);
|
|
|
|
snd_pcm_period_elapsed(substream);
|
|
|
|
spin_lock(&chip->lock);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
spin_unlock(&chip->lock);
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_MIDI
|
|
|
|
if (st > 0 && chip->midi_in) {
|
|
|
|
snd_rawmidi_receive(chip->midi_in, chip->midi_buffer, st);
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(chip->card->dev, "rawmidi_iread=%d\n", st);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
return IRQ_HANDLED;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/******************************************************************************
|
|
|
|
Module construction / destruction
|
|
|
|
******************************************************************************/
|
|
|
|
|
2021-07-15 07:58:54 +00:00
|
|
|
static void snd_echo_free(struct snd_card *card)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
{
|
2021-07-15 07:58:54 +00:00
|
|
|
struct echoaudio *chip = card->private_data;
|
|
|
|
|
2008-04-22 15:28:11 +00:00
|
|
|
if (chip->comm_page)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
rest_in_peace(chip);
|
|
|
|
|
|
|
|
if (chip->irq >= 0)
|
2006-11-21 11:14:23 +00:00
|
|
|
free_irq(chip->irq, chip);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
/* release chip data */
|
2010-02-14 17:15:51 +00:00
|
|
|
free_firmware_cache(chip);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* <--snd_echo_probe() */
|
2012-12-06 17:35:10 +00:00
|
|
|
static int snd_echo_create(struct snd_card *card,
|
2021-07-15 07:58:54 +00:00
|
|
|
struct pci_dev *pci)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
{
|
2021-07-15 07:58:54 +00:00
|
|
|
struct echoaudio *chip = card->private_data;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
int err;
|
|
|
|
size_t sz;
|
|
|
|
|
|
|
|
pci_write_config_byte(pci, PCI_LATENCY_TIMER, 0xC0);
|
|
|
|
|
2021-07-15 07:58:54 +00:00
|
|
|
err = pcim_enable_device(pci);
|
2021-06-08 14:05:13 +00:00
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
pci_set_master(pci);
|
|
|
|
|
2010-02-14 17:16:10 +00:00
|
|
|
/* Allocate chip if needed */
|
2021-07-15 07:58:54 +00:00
|
|
|
spin_lock_init(&chip->lock);
|
|
|
|
chip->card = card;
|
|
|
|
chip->pci = pci;
|
|
|
|
chip->irq = -1;
|
|
|
|
chip->opencount = 0;
|
|
|
|
mutex_init(&chip->mode_mutex);
|
|
|
|
chip->can_set_rate = 1;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
/* PCI resource allocation */
|
2021-07-15 07:58:54 +00:00
|
|
|
err = pci_request_regions(pci, ECHOCARD_NAME);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
chip->dsp_registers_phys = pci_resource_start(pci, 0);
|
|
|
|
sz = pci_resource_len(pci, 0);
|
|
|
|
if (sz > PAGE_SIZE)
|
|
|
|
sz = PAGE_SIZE; /* We map only the required part */
|
|
|
|
|
2021-07-15 07:58:54 +00:00
|
|
|
chip->dsp_registers = devm_ioremap(&pci->dev, chip->dsp_registers_phys, sz);
|
2019-03-15 03:58:29 +00:00
|
|
|
if (!chip->dsp_registers) {
|
|
|
|
dev_err(chip->card->dev, "ioremap failed\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2006-11-21 11:14:23 +00:00
|
|
|
if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
|
2011-06-10 14:36:37 +00:00
|
|
|
KBUILD_MODNAME, chip)) {
|
2014-02-25 15:43:02 +00:00
|
|
|
dev_err(chip->card->dev, "cannot grab irq\n");
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
chip->irq = pci->irq;
|
2019-12-10 06:34:14 +00:00
|
|
|
card->sync_irq = chip->irq;
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(card->dev, "pci=%p irq=%d subdev=%04x Init hardware...\n",
|
|
|
|
chip->pci, chip->irq, chip->pci->subsystem_device);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2021-07-15 07:58:54 +00:00
|
|
|
card->private_free = snd_echo_free;
|
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
/* Create the DSP comm page - this is the area of memory used for most
|
|
|
|
of the communication with the DSP, which accesses it via bus mastering */
|
2021-07-15 07:58:54 +00:00
|
|
|
chip->commpage_dma_buf =
|
|
|
|
snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV,
|
|
|
|
sizeof(struct comm_page));
|
|
|
|
if (!chip->commpage_dma_buf)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return -ENOMEM;
|
2021-07-15 07:58:54 +00:00
|
|
|
chip->comm_page_phys = chip->commpage_dma_buf->addr;
|
|
|
|
chip->comm_page = (struct comm_page *)chip->commpage_dma_buf->area;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);
|
2010-02-14 17:16:10 +00:00
|
|
|
if (err >= 0)
|
|
|
|
err = set_mixer_defaults(chip);
|
|
|
|
if (err < 0) {
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_err(card->dev, "init_hw err=%d\n", err);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* constructor */
|
2022-04-12 09:31:41 +00:00
|
|
|
static int __snd_echo_probe(struct pci_dev *pci,
|
|
|
|
const struct pci_device_id *pci_id)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
{
|
|
|
|
static int dev;
|
|
|
|
struct snd_card *card;
|
|
|
|
struct echoaudio *chip;
|
|
|
|
char *dsp;
|
2020-07-02 19:35:47 +00:00
|
|
|
__maybe_unused int i;
|
|
|
|
int err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
if (dev >= SNDRV_CARDS)
|
|
|
|
return -ENODEV;
|
|
|
|
if (!enable[dev]) {
|
|
|
|
dev++;
|
|
|
|
return -ENOENT;
|
|
|
|
}
|
|
|
|
|
|
|
|
i = 0;
|
2021-07-15 07:58:54 +00:00
|
|
|
err = snd_devm_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
|
|
|
|
sizeof(*chip), &card);
|
2008-12-28 15:44:30 +00:00
|
|
|
if (err < 0)
|
|
|
|
return err;
|
2021-07-15 07:58:54 +00:00
|
|
|
chip = card->private_data;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2021-07-15 07:58:54 +00:00
|
|
|
err = snd_echo_create(card, pci);
|
|
|
|
if (err < 0)
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
|
|
|
|
strcpy(card->driver, "Echo_" ECHOCARD_NAME);
|
|
|
|
strcpy(card->shortname, chip->card_name);
|
|
|
|
|
|
|
|
dsp = "56301";
|
|
|
|
if (pci_id->device == 0x3410)
|
|
|
|
dsp = "56361";
|
|
|
|
|
|
|
|
sprintf(card->longname, "%s rev.%d (DSP%s) at 0x%lx irq %i",
|
|
|
|
card->shortname, pci_id->subdevice & 0x000f, dsp,
|
|
|
|
chip->dsp_registers_phys, chip->irq);
|
|
|
|
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_echo_new_pcm(chip);
|
|
|
|
if (err < 0) {
|
2014-02-25 15:43:02 +00:00
|
|
|
dev_err(chip->card->dev, "new pcm error %d\n", err);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_MIDI
|
|
|
|
if (chip->has_midi) { /* Some Mia's do not have midi */
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_echo_midi_create(card, chip);
|
|
|
|
if (err < 0) {
|
2014-02-25 15:43:02 +00:00
|
|
|
dev_err(chip->card->dev, "new midi error %d\n", err);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_VMIXER
|
|
|
|
snd_echo_vmixer.count = num_pipes_out(chip) * num_busses_out(chip);
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vmixer, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
2009-09-30 06:26:45 +00:00
|
|
|
#ifdef ECHOCARD_HAS_LINE_OUT_GAIN
|
|
|
|
err = snd_ctl_add(chip->card,
|
|
|
|
snd_ctl_new1(&snd_echo_line_output_gain, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif
|
2009-09-30 06:26:45 +00:00
|
|
|
#else /* ECHOCARD_HAS_VMIXER */
|
|
|
|
err = snd_ctl_add(chip->card,
|
|
|
|
snd_ctl_new1(&snd_echo_pcm_output_gain, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
2009-09-30 06:26:45 +00:00
|
|
|
#endif /* ECHOCARD_HAS_VMIXER */
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_INPUT_GAIN
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_line_input_gain, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_INPUT_NOMINAL_LEVEL
|
2021-06-08 14:05:13 +00:00
|
|
|
if (!chip->hasnt_input_nominal_level) {
|
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_intput_nominal_level, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
2021-06-08 14:05:13 +00:00
|
|
|
}
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_OUTPUT_NOMINAL_LEVEL
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_output_nominal_level, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif
|
|
|
|
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vumeters_switch, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_vumeters, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_MONITOR
|
|
|
|
snd_echo_monitor_mixer.count = num_busses_in(chip) * num_busses_out(chip);
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_monitor_mixer, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_IN_AUTOMUTE
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_automute_switch, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif
|
|
|
|
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_channels_info, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_MODE_SWITCH
|
|
|
|
/* Creates a list of available digital modes */
|
|
|
|
chip->num_digital_modes = 0;
|
|
|
|
for (i = 0; i < 6; i++)
|
|
|
|
if (chip->digital_modes & (1 << i))
|
|
|
|
chip->digital_mode_list[chip->num_digital_modes++] = i;
|
|
|
|
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_digital_mode_switch, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif /* ECHOCARD_HAS_DIGITAL_MODE_SWITCH */
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_EXTERNAL_CLOCK
|
|
|
|
/* Creates a list of available clock sources */
|
|
|
|
chip->num_clock_sources = 0;
|
|
|
|
for (i = 0; i < 10; i++)
|
|
|
|
if (chip->input_clock_types & (1 << i))
|
|
|
|
chip->clock_source_list[chip->num_clock_sources++] = i;
|
|
|
|
|
|
|
|
if (chip->num_clock_sources > 1) {
|
|
|
|
chip->clock_src_ctl = snd_ctl_new1(&snd_echo_clock_source_switch, chip);
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, chip->clock_src_ctl);
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
}
|
|
|
|
#endif /* ECHOCARD_HAS_EXTERNAL_CLOCK */
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_DIGITAL_IO
|
2021-06-08 14:05:13 +00:00
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_spdif_mode_switch, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_PHANTOM_POWER
|
2021-06-08 14:05:13 +00:00
|
|
|
if (chip->has_phantom_power) {
|
|
|
|
err = snd_ctl_add(chip->card, snd_ctl_new1(&snd_echo_phantom_power_switch, chip));
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
2021-06-08 14:05:13 +00:00
|
|
|
}
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
#endif
|
|
|
|
|
2010-04-02 12:47:59 +00:00
|
|
|
err = snd_card_register(card);
|
|
|
|
if (err < 0)
|
2021-07-15 07:58:54 +00:00
|
|
|
return err;
|
2014-02-25 15:43:02 +00:00
|
|
|
dev_info(card->dev, "Card registered: %s\n", card->longname);
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
pci_set_drvdata(pci, chip);
|
|
|
|
dev++;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-04-12 09:31:41 +00:00
|
|
|
static int snd_echo_probe(struct pci_dev *pci,
|
|
|
|
const struct pci_device_id *pci_id)
|
|
|
|
{
|
|
|
|
return snd_card_free_on_error(&pci->dev, __snd_echo_probe(pci, pci_id));
|
|
|
|
}
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
|
|
|
|
|
2012-08-14 16:12:04 +00:00
|
|
|
#if defined(CONFIG_PM_SLEEP)
|
2010-02-14 17:16:10 +00:00
|
|
|
|
2012-07-02 13:20:37 +00:00
|
|
|
static int snd_echo_suspend(struct device *dev)
|
2010-02-14 17:16:10 +00:00
|
|
|
{
|
2012-07-02 13:20:37 +00:00
|
|
|
struct echoaudio *chip = dev_get_drvdata(dev);
|
2010-02-14 17:16:10 +00:00
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_MIDI
|
|
|
|
/* This call can sleep */
|
|
|
|
if (chip->midi_out)
|
|
|
|
snd_echo_midi_output_trigger(chip->midi_out, 0);
|
|
|
|
#endif
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
if (wait_handshake(chip)) {
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
clear_handshake(chip);
|
|
|
|
if (send_vector(chip, DSP_VC_GO_COMATOSE) < 0) {
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
|
|
|
|
chip->dsp_code = NULL;
|
|
|
|
free_irq(chip->irq, chip);
|
|
|
|
chip->irq = -1;
|
2019-12-10 06:34:14 +00:00
|
|
|
chip->card->sync_irq = -1;
|
2010-02-14 17:16:10 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-07-02 13:20:37 +00:00
|
|
|
static int snd_echo_resume(struct device *dev)
|
2010-02-14 17:16:10 +00:00
|
|
|
{
|
2012-07-02 13:20:37 +00:00
|
|
|
struct pci_dev *pci = to_pci_dev(dev);
|
|
|
|
struct echoaudio *chip = dev_get_drvdata(dev);
|
2010-02-14 17:16:10 +00:00
|
|
|
struct comm_page *commpage, *commpage_bak;
|
|
|
|
u32 pipe_alloc_mask;
|
|
|
|
int err;
|
|
|
|
|
2019-07-25 02:09:24 +00:00
|
|
|
commpage = chip->comm_page;
|
|
|
|
commpage_bak = kmemdup(commpage, sizeof(*commpage), GFP_KERNEL);
|
2010-07-16 16:15:43 +00:00
|
|
|
if (commpage_bak == NULL)
|
|
|
|
return -ENOMEM;
|
2010-02-14 17:16:10 +00:00
|
|
|
|
|
|
|
err = init_hw(chip, chip->pci->device, chip->pci->subsystem_device);
|
|
|
|
if (err < 0) {
|
|
|
|
kfree(commpage_bak);
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_err(dev, "resume init_hw err=%d\n", err);
|
2010-02-14 17:16:10 +00:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Temporarily set chip->pipe_alloc_mask=0 otherwise
|
|
|
|
* restore_dsp_settings() fails.
|
|
|
|
*/
|
|
|
|
pipe_alloc_mask = chip->pipe_alloc_mask;
|
|
|
|
chip->pipe_alloc_mask = 0;
|
|
|
|
err = restore_dsp_rettings(chip);
|
|
|
|
chip->pipe_alloc_mask = pipe_alloc_mask;
|
|
|
|
if (err < 0) {
|
|
|
|
kfree(commpage_bak);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
memcpy(&commpage->audio_format, &commpage_bak->audio_format,
|
|
|
|
sizeof(commpage->audio_format));
|
|
|
|
memcpy(&commpage->sglist_addr, &commpage_bak->sglist_addr,
|
|
|
|
sizeof(commpage->sglist_addr));
|
|
|
|
memcpy(&commpage->midi_output, &commpage_bak->midi_output,
|
|
|
|
sizeof(commpage->midi_output));
|
|
|
|
kfree(commpage_bak);
|
|
|
|
|
|
|
|
if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
|
2011-06-10 14:36:37 +00:00
|
|
|
KBUILD_MODNAME, chip)) {
|
2014-02-25 15:43:02 +00:00
|
|
|
dev_err(chip->card->dev, "cannot grab irq\n");
|
2010-02-14 17:16:10 +00:00
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
chip->irq = pci->irq;
|
2019-12-10 06:34:14 +00:00
|
|
|
chip->card->sync_irq = chip->irq;
|
2014-11-03 10:34:13 +00:00
|
|
|
dev_dbg(dev, "resume irq=%d\n", chip->irq);
|
2010-02-14 17:16:10 +00:00
|
|
|
|
|
|
|
#ifdef ECHOCARD_HAS_MIDI
|
|
|
|
if (chip->midi_input_enabled)
|
2015-08-10 12:02:53 +00:00
|
|
|
enable_midi_input(chip, true);
|
2010-02-14 17:16:10 +00:00
|
|
|
if (chip->midi_out)
|
|
|
|
snd_echo_midi_output_trigger(chip->midi_out, 1);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-07-02 13:20:37 +00:00
|
|
|
static SIMPLE_DEV_PM_OPS(snd_echo_pm, snd_echo_suspend, snd_echo_resume);
|
|
|
|
#define SND_ECHO_PM_OPS &snd_echo_pm
|
|
|
|
#else
|
|
|
|
#define SND_ECHO_PM_OPS NULL
|
2012-08-14 16:12:04 +00:00
|
|
|
#endif /* CONFIG_PM_SLEEP */
|
2010-02-14 17:16:10 +00:00
|
|
|
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
/******************************************************************************
|
|
|
|
Everything starts and ends here
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/* pci_driver definition */
|
2012-04-24 10:25:00 +00:00
|
|
|
static struct pci_driver echo_driver = {
|
2011-06-10 14:20:20 +00:00
|
|
|
.name = KBUILD_MODNAME,
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
.id_table = snd_echo_ids,
|
|
|
|
.probe = snd_echo_probe,
|
2012-07-02 13:20:37 +00:00
|
|
|
.driver = {
|
|
|
|
.pm = SND_ECHO_PM_OPS,
|
|
|
|
},
|
[ALSA] Add echoaudio sound drivers
From: Giuliano Pochini <pochini@shiny.it>Add echoaudio sound drivers (darla20, darla24, echo3g, gina20, gina24,
indigo, indigodj, indigoio, layla20, lala24, mia, mona)
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
2006-06-28 11:53:41 +00:00
|
|
|
};
|
|
|
|
|
2012-04-24 10:25:00 +00:00
|
|
|
module_pci_driver(echo_driver);
|