Browse Source

add ice1712 support to alsa driver

git-svn-id: svn+ssh://jackaudio.org/trunk/jack@196 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.109.0
pbd 24 years ago
parent
commit
bd05823854
6 changed files with 171 additions and 5 deletions
  1. +1
    -1
      Makefile.am
  2. +1
    -1
      configure.in
  3. +2
    -1
      drivers/alsa/Makefile.am
  4. +14
    -1
      drivers/alsa/alsa_driver.c
  5. +152
    -0
      drivers/alsa/ice1712.c
  6. +1
    -1
      jackd/Makefile.am

+ 1
- 1
Makefile.am View File

@@ -24,4 +24,4 @@ pkgconfig_DATA = jack.pc
rpm: dist
rpm -ta $(distdir).tar.gz

dist-hook: dist-check-doxygen
dist-hook: dist-check-doxygen

+ 1
- 1
configure.in View File

@@ -4,7 +4,7 @@ AC_INIT(jackd/jackd.c)
AC_CONFIG_AUX_DIR(.)

JACK_MAJOR_VERSION=0
JACK_MINOR_VERSION=31
JACK_MINOR_VERSION=32
JACK_MICRO_VERSION=0

BETA=


+ 2
- 1
drivers/alsa/Makefile.am View File

@@ -5,5 +5,6 @@ plugindir = $(ADDON_DIR)
plugin_LTLIBRARIES = jack_alsa.la

jack_alsa_la_LDFLAGS = -module
jack_alsa_la_SOURCES = alsa_driver.c hammerfall.c generic_hw.c memops.c
jack_alsa_la_SOURCES = alsa_driver.c generic_hw.c memops.c \
hammerfall.c ice1712.c
jack_alsa_la_LIBADD = -lasound $(GLIB_LIBS) -lm

+ 14
- 1
drivers/alsa/alsa_driver.c View File

@@ -33,6 +33,7 @@
#include <jack/internal.h>
#include <jack/engine.h>
#include <jack/hammerfall.h>
#include <jack/ice1712.h>
#include <jack/generic.h>
#include <jack/cycles.h>

@@ -106,6 +107,14 @@ alsa_driver_hammerfall_hardware (alsa_driver_t *driver)
return 0;
}

static int
alsa_driver_ice1712_hardware (alsa_driver_t *driver)

{
driver->hw = jack_alsa_ice1712_hw_new (driver);
return 0;
}

static int
alsa_driver_generic_hardware (alsa_driver_t *driver)

@@ -124,8 +133,12 @@ alsa_driver_hw_specific (alsa_driver_t *driver, int hw_monitoring)
if ((err = alsa_driver_hammerfall_hardware (driver)) != 0) {
return err;
}
} else if (!strcmp(driver->alsa_driver, "ICE1712")) {
if ((err = alsa_driver_ice1712_hardware (driver)) !=0) {
return err;
}
} else {
if ((err = alsa_driver_generic_hardware (driver)) != 0) {
if ((err = alsa_driver_generic_hardware (driver)) != 0) {
return err;
}
}


+ 152
- 0
drivers/alsa/ice1712.c View File

@@ -0,0 +1,152 @@
/*
Copyright (C) 2002 Anthony Van Groningen

Parts based on source code taken from the
"Env24 chipset (ICE1712) control utility" that is

Copyright (C) 2000 by Jaroslav Kysela <perex@suse.cz>

This program 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; either version 2 of the License, or
(at your option) any later version.

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., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include <jack/hardware.h>
#include <jack/alsa_driver.h>
#include <jack/ice1712.h>
#include <jack/error.h>

static int
ice1712_hw_monitor_toggle(jack_hardware_t *hw, int idx, int onoff)

{
ice1712_t *h = (ice1712_t *) hw->private;
snd_ctl_elem_value_t *val;
int err;
snd_ctl_elem_value_alloca (&val);
snd_ctl_elem_value_set_interface (val, SND_CTL_ELEM_IFACE_MIXER);
if (idx >= 8) {
snd_ctl_elem_value_set_name (val, SPDIF_PLAYBACK_ROUTE_NAME);
snd_ctl_elem_value_set_index (val, idx - 8);
} else {
snd_ctl_elem_value_set_name (val, ANALOG_PLAYBACK_ROUTE_NAME);
snd_ctl_elem_value_set_index (val, idx);
}
if (onoff) {
snd_ctl_elem_value_set_enumerated (val, 0, idx + 1);
} else {
snd_ctl_elem_value_set_enumerated (val, 0, 0);
}
if ((err = snd_ctl_elem_write (h->driver->ctl_handle, val)) != 0) {
jack_error ("ALSA/ICE1712: (%d) cannot set input monitoring (%s)",
idx,snd_strerror (err));
return -1;
}

return 0;
}

static int
ice1712_set_input_monitor_mask (jack_hardware_t *hw, unsigned long mask)
{
int idx;
ice1712_t *h = (ice1712_t *) hw->private;
for (idx = 0; idx < 10; idx++) {
if (h->active_channels & (1<<idx)) {
ice1712_hw_monitor_toggle (hw, idx, mask & (1<<idx) ? 1 : 0);
}
}
hw->input_monitor_mask = mask;
return 0;
}

static int
ice1712_change_sample_clock (jack_hardware_t *hw, SampleClockMode mode)
{
return -1;
}

static void
ice1712_release (jack_hardware_t *hw)

{
return;
}




jack_hardware_t *
jack_alsa_ice1712_hw_new (alsa_driver_t *driver)

{
jack_hardware_t *hw;
ice1712_t *h;
snd_ctl_elem_value_t *val;
int err;

hw = (jack_hardware_t *) malloc (sizeof (jack_hardware_t));

hw->capabilities = Cap_HardwareMonitoring;
hw->input_monitor_mask = 0;
hw->private = 0;

hw->set_input_monitor_mask = ice1712_set_input_monitor_mask;
hw->change_sample_clock = ice1712_change_sample_clock;
hw->release = ice1712_release;

h = (ice1712_t *) malloc (sizeof (ice1712_t));

h->driver = driver;

/* Get the EEPROM (adopted from envy24control) */
h->eeprom = (ice1712_eeprom_t *) malloc (sizeof (ice1712_eeprom_t));
snd_ctl_elem_value_alloca (&val);
snd_ctl_elem_value_set_interface (val, SND_CTL_ELEM_IFACE_CARD);
snd_ctl_elem_value_set_name (val, "ICE1712 EEPROM");
if ((err = snd_ctl_elem_read (driver->ctl_handle, val)) < 0) {
jack_error( "ALSA/ICE1712: Unable to read EEPROM contents (%s)\n", snd_strerror (err));
/* Recover? */
}
memcpy(h->eeprom, snd_ctl_elem_value_get_bytes(val), 32);

/* determine number of pro ADC's. We're asumming that there is at least one stereo pair.
Should check this first, but how? */
switch((h->eeprom->codec & 0xCU) >> 2) {
case 0:
h->active_channels = 0x3U;
break;
case 1:
h->active_channels = 0xfU;
break;
case 2:
h->active_channels = 0x3fU;
break;
case 3:
h->active_channels = 0xffU;
break;
}
/* check for SPDIF In's */
if (h->eeprom->spdif & 0x1U) {
h->active_channels |= 0x300U;
}
hw->private = h;

return hw;
}

+ 1
- 1
jackd/Makefile.am View File

@@ -6,7 +6,7 @@ else
bin_PROGRAMS = jackd
endif

AM_CFLAGS = -I.. $(JACK_CFLAGS) -DADDON_DIR=\"$(ADDON_DIR)\" $(GLIB_CFLAGS)
AM_CFLAGS = $(JACK_CFLAGS) -DADDON_DIR=\"$(ADDON_DIR)\" $(GLIB_CFLAGS)

jackd_SOURCES = jackd.c engine.c
jackd_LDADD = ../libjack/libjack.la


Loading…
Cancel
Save