[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 04:53:41 -07:00
|
|
|
/****************************************************************************
|
|
|
|
|
|
|
|
Copyright Echo Digital Audio Corporation (c) 1998 - 2004
|
|
|
|
All rights reserved
|
|
|
|
www.echoaudio.com
|
|
|
|
|
|
|
|
This file is part of Echo Digital Audio's generic driver library.
|
|
|
|
|
|
|
|
Echo Digital Audio's generic driver library is free software;
|
|
|
|
you can redistribute it and/or modify it under the terms of
|
|
|
|
the GNU General Public License as published by the Free Software
|
|
|
|
Foundation.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
|
|
|
MA 02111-1307, USA.
|
|
|
|
|
|
|
|
*************************************************************************
|
|
|
|
|
|
|
|
Translation from C++ and adaptation for use in ALSA-Driver
|
|
|
|
were made by Giuliano Pochini <pochini@shiny.it>
|
|
|
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
static int write_control_reg(struct echoaudio *chip, u32 value, char force);
|
|
|
|
static int set_input_clock(struct echoaudio *chip, u16 clock);
|
|
|
|
static int set_professional_spdif(struct echoaudio *chip, char prof);
|
|
|
|
static int set_digital_mode(struct echoaudio *chip, u8 mode);
|
2010-02-14 10:15:34 -07:00
|
|
|
static int load_asic_generic(struct echoaudio *chip, u32 cmd, short asic);
|
[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 04:53:41 -07:00
|
|
|
static int check_asic_status(struct echoaudio *chip);
|
|
|
|
|
|
|
|
|
|
|
|
static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
|
|
|
|
{
|
|
|
|
int err;
|
|
|
|
|
2008-08-08 08:12:14 -07:00
|
|
|
if (snd_BUG_ON((subdevice_id & 0xfff0) != GINA24))
|
|
|
|
return -ENODEV;
|
[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 04:53:41 -07:00
|
|
|
|
2021-06-08 07:05:13 -07:00
|
|
|
err = init_dsp_comm_page(chip);
|
|
|
|
if (err) {
|
2014-11-03 03:34:13 -07:00
|
|
|
dev_err(chip->card->dev,
|
|
|
|
"init_hw - could not initialize DSP comm page\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 04:53:41 -07:00
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
chip->device_id = device_id;
|
|
|
|
chip->subdevice_id = subdevice_id;
|
2015-08-10 05:02:53 -07:00
|
|
|
chip->bad_board = 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 04:53:41 -07:00
|
|
|
chip->input_clock_types =
|
|
|
|
ECHO_CLOCK_BIT_INTERNAL | ECHO_CLOCK_BIT_SPDIF |
|
|
|
|
ECHO_CLOCK_BIT_ESYNC | ECHO_CLOCK_BIT_ESYNC96 |
|
|
|
|
ECHO_CLOCK_BIT_ADAT;
|
|
|
|
|
|
|
|
/* Gina24 comes in both '301 and '361 flavors */
|
|
|
|
if (chip->device_id == DEVICE_ID_56361) {
|
2010-02-14 10:15:34 -07:00
|
|
|
chip->dsp_code_to_load = FW_GINA24_361_DSP;
|
[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 04:53:41 -07:00
|
|
|
chip->digital_modes =
|
|
|
|
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA |
|
|
|
|
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL |
|
|
|
|
ECHOCAPS_HAS_DIGITAL_MODE_ADAT;
|
|
|
|
} else {
|
2010-02-14 10:15:34 -07:00
|
|
|
chip->dsp_code_to_load = FW_GINA24_301_DSP;
|
[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 04:53:41 -07:00
|
|
|
chip->digital_modes =
|
|
|
|
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_RCA |
|
|
|
|
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_OPTICAL |
|
|
|
|
ECHOCAPS_HAS_DIGITAL_MODE_ADAT |
|
|
|
|
ECHOCAPS_HAS_DIGITAL_MODE_SPDIF_CDROM;
|
|
|
|
}
|
|
|
|
|
2021-06-08 07:05:13 -07:00
|
|
|
err = load_firmware(chip);
|
|
|
|
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 04:53:41 -07:00
|
|
|
return err;
|
2015-08-10 05:02:53 -07:00
|
|
|
chip->bad_board = false;
|
[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 04:53:41 -07:00
|
|
|
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-02-14 10:15:59 -07:00
|
|
|
static int set_mixer_defaults(struct echoaudio *chip)
|
|
|
|
{
|
|
|
|
chip->digital_mode = DIGITAL_MODE_SPDIF_RCA;
|
2015-08-10 05:02:53 -07:00
|
|
|
chip->professional_spdif = false;
|
|
|
|
chip->digital_in_automute = true;
|
2010-02-14 10:15:59 -07:00
|
|
|
return init_line_levels(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 04:53:41 -07:00
|
|
|
static u32 detect_input_clocks(const struct echoaudio *chip)
|
|
|
|
{
|
|
|
|
u32 clocks_from_dsp, clock_bits;
|
|
|
|
|
|
|
|
/* Map the DSP clock detect bits to the generic driver clock
|
|
|
|
detect bits */
|
|
|
|
clocks_from_dsp = le32_to_cpu(chip->comm_page->status_clocks);
|
|
|
|
|
|
|
|
clock_bits = ECHO_CLOCK_BIT_INTERNAL;
|
|
|
|
|
|
|
|
if (clocks_from_dsp & GML_CLOCK_DETECT_BIT_SPDIF)
|
|
|
|
clock_bits |= ECHO_CLOCK_BIT_SPDIF;
|
|
|
|
|
|
|
|
if (clocks_from_dsp & GML_CLOCK_DETECT_BIT_ADAT)
|
|
|
|
clock_bits |= ECHO_CLOCK_BIT_ADAT;
|
|
|
|
|
|
|
|
if (clocks_from_dsp & GML_CLOCK_DETECT_BIT_ESYNC)
|
|
|
|
clock_bits |= ECHO_CLOCK_BIT_ESYNC | ECHO_CLOCK_BIT_ESYNC96;
|
|
|
|
|
|
|
|
return clock_bits;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Gina24 has an ASIC on the PCI card which must be loaded for anything
|
|
|
|
interesting to happen. */
|
|
|
|
static int load_asic(struct echoaudio *chip)
|
|
|
|
{
|
|
|
|
u32 control_reg;
|
|
|
|
int err;
|
2010-02-14 10:15:34 -07:00
|
|
|
short asic;
|
[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 04:53:41 -07:00
|
|
|
|
|
|
|
if (chip->asic_loaded)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* Give the DSP a few milliseconds to settle down */
|
|
|
|
mdelay(10);
|
|
|
|
|
|
|
|
/* Pick the correct ASIC for '301 or '361 Gina24 */
|
|
|
|
if (chip->device_id == DEVICE_ID_56361)
|
2010-02-14 10:15:34 -07:00
|
|
|
asic = FW_GINA24_361_ASIC;
|
[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 04:53:41 -07:00
|
|
|
else
|
2010-02-14 10:15:34 -07:00
|
|
|
asic = FW_GINA24_301_ASIC;
|
[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 04:53:41 -07:00
|
|
|
|
2010-02-14 10:15:34 -07:00
|
|
|
err = load_asic_generic(chip, DSP_FNC_LOAD_GINA24_ASIC, asic);
|
|
|
|
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 04:53:41 -07:00
|
|
|
return err;
|
|
|
|
|
2010-02-14 10:15:34 -07:00
|
|
|
chip->asic_code = asic;
|
[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 04:53:41 -07:00
|
|
|
|
|
|
|
/* Now give the new ASIC a little time to set up */
|
|
|
|
mdelay(10);
|
|
|
|
/* See if it worked */
|
|
|
|
err = check_asic_status(chip);
|
|
|
|
|
|
|
|
/* Set up the control register if the load succeeded -
|
|
|
|
48 kHz, internal clock, S/PDIF RCA mode */
|
|
|
|
if (!err) {
|
|
|
|
control_reg = GML_CONVERTER_ENABLE | GML_48KHZ;
|
2015-08-10 05:02:53 -07:00
|
|
|
err = write_control_reg(chip, control_reg, 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 04:53:41 -07:00
|
|
|
}
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int set_sample_rate(struct echoaudio *chip, u32 rate)
|
|
|
|
{
|
|
|
|
u32 control_reg, clock;
|
|
|
|
|
2008-08-08 08:12:14 -07:00
|
|
|
if (snd_BUG_ON(rate >= 50000 &&
|
|
|
|
chip->digital_mode == DIGITAL_MODE_ADAT))
|
|
|
|
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 04:53:41 -07:00
|
|
|
|
|
|
|
/* Only set the clock for internal mode. */
|
|
|
|
if (chip->input_clock != ECHO_CLOCK_INTERNAL) {
|
2014-11-03 03:34:13 -07:00
|
|
|
dev_warn(chip->card->dev,
|
|
|
|
"Cannot set sample rate - clock not set to CLK_CLOCKININTERNAL\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 04:53:41 -07:00
|
|
|
/* Save the rate anyhow */
|
|
|
|
chip->comm_page->sample_rate = cpu_to_le32(rate);
|
|
|
|
chip->sample_rate = rate;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
clock = 0;
|
|
|
|
|
|
|
|
control_reg = le32_to_cpu(chip->comm_page->control_register);
|
|
|
|
control_reg &= GML_CLOCK_CLEAR_MASK & GML_SPDIF_RATE_CLEAR_MASK;
|
|
|
|
|
|
|
|
switch (rate) {
|
|
|
|
case 96000:
|
|
|
|
clock = GML_96KHZ;
|
|
|
|
break;
|
|
|
|
case 88200:
|
|
|
|
clock = GML_88KHZ;
|
|
|
|
break;
|
|
|
|
case 48000:
|
|
|
|
clock = GML_48KHZ | GML_SPDIF_SAMPLE_RATE1;
|
|
|
|
break;
|
|
|
|
case 44100:
|
|
|
|
clock = GML_44KHZ;
|
|
|
|
/* Professional mode ? */
|
|
|
|
if (control_reg & GML_SPDIF_PRO_MODE)
|
|
|
|
clock |= GML_SPDIF_SAMPLE_RATE0;
|
|
|
|
break;
|
|
|
|
case 32000:
|
|
|
|
clock = GML_32KHZ | GML_SPDIF_SAMPLE_RATE0 |
|
|
|
|
GML_SPDIF_SAMPLE_RATE1;
|
|
|
|
break;
|
|
|
|
case 22050:
|
|
|
|
clock = GML_22KHZ;
|
|
|
|
break;
|
|
|
|
case 16000:
|
|
|
|
clock = GML_16KHZ;
|
|
|
|
break;
|
|
|
|
case 11025:
|
|
|
|
clock = GML_11KHZ;
|
|
|
|
break;
|
|
|
|
case 8000:
|
|
|
|
clock = GML_8KHZ;
|
|
|
|
break;
|
|
|
|
default:
|
2014-11-03 03:34:13 -07:00
|
|
|
dev_err(chip->card->dev,
|
|
|
|
"set_sample_rate: %d invalid!\n", rate);
|
[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 04:53:41 -07:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
control_reg |= clock;
|
|
|
|
|
|
|
|
chip->comm_page->sample_rate = cpu_to_le32(rate); /* ignored by the DSP */
|
|
|
|
chip->sample_rate = rate;
|
2014-11-03 03:34:13 -07:00
|
|
|
dev_dbg(chip->card->dev, "set_sample_rate: %d clock %d\n", rate, clock);
|
[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 04:53:41 -07:00
|
|
|
|
2015-08-10 05:02:53 -07:00
|
|
|
return write_control_reg(chip, control_reg, false);
|
[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 04:53:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int set_input_clock(struct echoaudio *chip, u16 clock)
|
|
|
|
{
|
|
|
|
u32 control_reg, clocks_from_dsp;
|
|
|
|
|
|
|
|
|
|
|
|
/* Mask off the clock select bits */
|
|
|
|
control_reg = le32_to_cpu(chip->comm_page->control_register) &
|
|
|
|
GML_CLOCK_CLEAR_MASK;
|
|
|
|
clocks_from_dsp = le32_to_cpu(chip->comm_page->status_clocks);
|
|
|
|
|
|
|
|
switch (clock) {
|
|
|
|
case ECHO_CLOCK_INTERNAL:
|
|
|
|
chip->input_clock = ECHO_CLOCK_INTERNAL;
|
|
|
|
return set_sample_rate(chip, chip->sample_rate);
|
|
|
|
case ECHO_CLOCK_SPDIF:
|
|
|
|
if (chip->digital_mode == DIGITAL_MODE_ADAT)
|
|
|
|
return -EAGAIN;
|
|
|
|
control_reg |= GML_SPDIF_CLOCK;
|
|
|
|
if (clocks_from_dsp & GML_CLOCK_DETECT_BIT_SPDIF96)
|
|
|
|
control_reg |= GML_DOUBLE_SPEED_MODE;
|
|
|
|
else
|
|
|
|
control_reg &= ~GML_DOUBLE_SPEED_MODE;
|
|
|
|
break;
|
|
|
|
case ECHO_CLOCK_ADAT:
|
|
|
|
if (chip->digital_mode != DIGITAL_MODE_ADAT)
|
|
|
|
return -EAGAIN;
|
|
|
|
control_reg |= GML_ADAT_CLOCK;
|
|
|
|
control_reg &= ~GML_DOUBLE_SPEED_MODE;
|
|
|
|
break;
|
|
|
|
case ECHO_CLOCK_ESYNC:
|
|
|
|
control_reg |= GML_ESYNC_CLOCK;
|
|
|
|
control_reg &= ~GML_DOUBLE_SPEED_MODE;
|
|
|
|
break;
|
|
|
|
case ECHO_CLOCK_ESYNC96:
|
|
|
|
control_reg |= GML_ESYNC_CLOCK | GML_DOUBLE_SPEED_MODE;
|
|
|
|
break;
|
|
|
|
default:
|
2014-11-03 03:34:13 -07:00
|
|
|
dev_err(chip->card->dev,
|
|
|
|
"Input clock 0x%x not supported for Gina24\n", clock);
|
[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 04:53:41 -07:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
chip->input_clock = clock;
|
2015-08-10 05:02:53 -07:00
|
|
|
return write_control_reg(chip, control_reg, 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 04:53:41 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static int dsp_set_digital_mode(struct echoaudio *chip, u8 mode)
|
|
|
|
{
|
|
|
|
u32 control_reg;
|
|
|
|
int err, incompatible_clock;
|
|
|
|
|
|
|
|
/* Set clock to "internal" if it's not compatible with the new mode */
|
2015-08-10 05:02:53 -07:00
|
|
|
incompatible_clock = false;
|
[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 04:53:41 -07:00
|
|
|
switch (mode) {
|
|
|
|
case DIGITAL_MODE_SPDIF_OPTICAL:
|
|
|
|
case DIGITAL_MODE_SPDIF_CDROM:
|
|
|
|
case DIGITAL_MODE_SPDIF_RCA:
|
|
|
|
if (chip->input_clock == ECHO_CLOCK_ADAT)
|
2015-08-10 05:02:53 -07:00
|
|
|
incompatible_clock = 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 04:53:41 -07:00
|
|
|
break;
|
|
|
|
case DIGITAL_MODE_ADAT:
|
|
|
|
if (chip->input_clock == ECHO_CLOCK_SPDIF)
|
2015-08-10 05:02:53 -07:00
|
|
|
incompatible_clock = 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 04:53:41 -07:00
|
|
|
break;
|
|
|
|
default:
|
2014-11-03 03:34:13 -07:00
|
|
|
dev_err(chip->card->dev,
|
|
|
|
"Digital mode not supported: %d\n", mode);
|
[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 04:53:41 -07:00
|
|
|
return -EINVAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_lock_irq(&chip->lock);
|
|
|
|
|
|
|
|
if (incompatible_clock) { /* Switch to 48KHz, internal */
|
|
|
|
chip->sample_rate = 48000;
|
|
|
|
set_input_clock(chip, ECHO_CLOCK_INTERNAL);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear the current digital mode */
|
|
|
|
control_reg = le32_to_cpu(chip->comm_page->control_register);
|
|
|
|
control_reg &= GML_DIGITAL_MODE_CLEAR_MASK;
|
|
|
|
|
|
|
|
/* Tweak the control reg */
|
|
|
|
switch (mode) {
|
|
|
|
case DIGITAL_MODE_SPDIF_OPTICAL:
|
|
|
|
control_reg |= GML_SPDIF_OPTICAL_MODE;
|
|
|
|
break;
|
|
|
|
case DIGITAL_MODE_SPDIF_CDROM:
|
|
|
|
/* '361 Gina24 cards do not have the S/PDIF CD-ROM mode */
|
|
|
|
if (chip->device_id == DEVICE_ID_56301)
|
|
|
|
control_reg |= GML_SPDIF_CDROM_MODE;
|
|
|
|
break;
|
|
|
|
case DIGITAL_MODE_SPDIF_RCA:
|
|
|
|
/* GML_SPDIF_OPTICAL_MODE bit cleared */
|
|
|
|
break;
|
|
|
|
case DIGITAL_MODE_ADAT:
|
|
|
|
control_reg |= GML_ADAT_MODE;
|
|
|
|
control_reg &= ~GML_DOUBLE_SPEED_MODE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2015-08-10 05:02:53 -07:00
|
|
|
err = write_control_reg(chip, control_reg, 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 04:53:41 -07:00
|
|
|
spin_unlock_irq(&chip->lock);
|
|
|
|
if (err < 0)
|
|
|
|
return err;
|
|
|
|
chip->digital_mode = mode;
|
|
|
|
|
2014-11-03 03:34:13 -07:00
|
|
|
dev_dbg(chip->card->dev,
|
|
|
|
"set_digital_mode to %d\n", chip->digital_mode);
|
[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 04:53:41 -07:00
|
|
|
return incompatible_clock;
|
|
|
|
}
|